GithubHelp home page GithubHelp logo

stoianmihail / netzwerk Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 4.31 MB

A collection of state-of-the-art contraction ordering algorithms. https://arxiv.org/abs/2209.12332

License: MIT License

Jupyter Notebook 33.57% Shell 0.11% Python 50.76% CMake 0.18% C++ 15.37%
contraction-order dynamic-programming join-ordering tensornetwork einsum opt-einsum optimal-algorithm cotengra

netzwerk's Introduction

Netzwerk

A collection of state-of-the-art contraction ordering algorithms. Plug-in for opt_einsum and cotengra.

  • Optimal and near-optimal algorithms for several classes of tensor networks
  • Based on the latest research in contraction ordering and database join ordering
  • Careful C++ implementations

Description

$\large \textcolor{#0065bd}{\texttt{Netzwerk}}$ hosts optimal and near-optimal algorithms for tensor network contraction ordering:

  • $\large \texttt{TensorIKKBZ}$: Optimal linear contraction orders for tree tensor networks
  • $\large \texttt{LinDP}$: Optimal general contraction trees given the linear contraction orders of $\large \texttt{TensorIKKBZ}$
  • Coming soon..

Setup

Build the shared library, which requires CMake.

cd src/netzwerk
mkdir -p build
cd build
cmake ..
make

The following initializes the package, assuming you are still in build:

cd ../../
versioneer install
pip3 install -e .

Usage

Make sure that opt_einsum and cotengra are imported before netzwerk, as follows:

import opt_einsum as oe
import cotengra as ctg
import netzwerk

Data Generation

Example: generate FTPS of up to 100 tensors.

python3 gen.py -t ftps -s 100

The files will be stored in data/ftps.

Run

The script bench.sh runs the experiments. For instance, if you want to benchmark on the networks you have just generated:

./bench.sh opt_einsum ftps 100

The results will be stored in results. For the Sycamore circuit, simply run

./bench.sh cotengra sycamore

Plot

Use the following notebooks to plot the results:

  • bench-plot.ipynb: for networks generated via gen.py
  • circuit-plot.ipynb: for quantum circuits, e.g., Sycamore.

netzwerk's People

Contributors

ihorvalds avatar stoianmihail avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ihorvalds

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.