Skip to main content

yarrow diagrams

Project description

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:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yarrow_diagrams-0.0.3.1.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yarrow_diagrams-0.0.3.1-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file yarrow_diagrams-0.0.3.1.tar.gz.

File metadata

  • Download URL: yarrow_diagrams-0.0.3.1.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for yarrow_diagrams-0.0.3.1.tar.gz
Algorithm Hash digest
SHA256 9726e59279ce6c43bdc71db5450dbedb6afc5674b7f1e1c64fbe4aa85dc592cf
MD5 e2abbe8222125d921690d30f7698b02f
BLAKE2b-256 77629527d85d3b41ee49c81802b54ac7d761fa860f1636114a9e8dd73eae54f3

See more details on using hashes here.

File details

Details for the file yarrow_diagrams-0.0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for yarrow_diagrams-0.0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76aec346da8d5bd911d98348954b8925402b1ccdbba003943672db1538e9d391
MD5 67e6ac01369a1cc6324ec1c51a85cb40
BLAKE2b-256 1c7b62777d9f3f4d5acff1e1632f8106515d9aa2aedc83f0edaccb5d5423874a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page