Skip to main content

Yarrow Diagrams

Documentation Status

⚠️ yarrow is still early in development ⚠️: it's missing some features, and not everything is documented. Consider yourself warned!

yarrow is a Python library implementing the datastructures and algorithms for string diagrams described in the paper Data-Parallel Algorithms for String Diagrams.

What is yarrow?

For a programmer's overview of what yarrow is for, see the documentation. In short, the main datastructure of yarrow is the Diagram, which can be thought of a generalisation of syntax trees to syntax graphs.

Here's an example of a string diagram depicted graphically:

You could think of this as representing the syntax of the following python program:

def compute_mean(numbers: List[int]):
    count, sum = summary(numbers)
    return divide(sum, count)

String diagrams are different from directed graphs in two important ways:

  • The boxes (operations) in a string diagram have multiple ordered inputs and outputs in the same way a python function has ordered input arguments.
  • The diagram itself has inputs and outputs depicted as "dangling" wires on the left and right

Other examples of structures which can be represented by string diagrams are electronic circuits, quantum circuits, neural networks, and many more. For a more formal introduction to string diagrams aimed at computer scientists, try this recent paper.

Installation

pip install yarrow-diagrams

Running tests

Install test dependencies

pip install hypothesis

Run test with your test runner, e.g.

pytest

Yarrow as a Reference Implementation

Yarrow is intended as a reference implementation for the paper. It has the following goals:

  • Fast, data-parallel, and runs on the GPU
  • Minimal primitives/dependencies required
  • Simple to implement correctly

The aim is to serve as a general-purpose datastructure in many languages by making it simple to implement fast algorithms while relying on few external dependencies.

To port yarrow to your language, the only things needed are:

Porting Yarrow

If you want to port Yarrow to a different language and you would like help, please reach out. Here are some places you could do that:

Metadata

Release files for yarrow-diagrams 0.0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yarrow-diagrams 0.0.3.1
File Size Uploaded
yarrow_diagrams-0.0.3.1.tar.gz 23.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yarrow-diagrams 0.0.3.1
File Interpreter ABI Platform
yarrow_diagrams-0.0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 55.2 kB

Release files / yarrow_diagrams-0.0.3.1.tar.gz

Download URL yarrow_diagrams-0.0.3.1.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9726e59279ce6c43bdc71db5450dbedb6afc5674b7f1e1c64fbe4aa85dc592cf
BLAKE2b-256 checksum
How to use checksums
77629527d85d3b41ee49c81802b54ac7d761fa860f1636114a9e8dd73eae54f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / yarrow_diagrams-0.0.3.1-py3-none-any.whl

Download URL yarrow_diagrams-0.0.3.1-py3-none-any.whl
Size 31.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76aec346da8d5bd911d98348954b8925402b1ccdbba003943672db1538e9d391
BLAKE2b-256 checksum
How to use checksums
1c7b62777d9f3f4d5acff1e1632f8106515d9aa2aedc83f0edaccb5d5423874a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.0.3.1 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page