Skip to main content

Jet is an open-source library for quantum circuit simulation using tensor network contractions

Project description

Jet
GitHub Actions Documentation Standard License

Jet is a cross-platform C++ and Python library for simulating quantum circuits using tensor network contractions.

Features

  • Runs on a variety of systems, from single-board machines to massively parallel supercomputers.

  • Accelerates tensor contractions using a novel task-based parallelism approach.

  • Models quantum systems with an arbitrary number of basis states.

To get started with Jet, read one of our tutorial walkthroughs or browse the full API documentation.

Installation

C++

The Jet C++ library requires Taskflow, a BLAS library with a CBLAS interface, and a C++ compiler with C++17 support. To use Jet, add #include <Jet.hpp> to the top of your header file and link your program with the CBLAS library.

For example, assuming that the Taskflow headers can be found in your g++ include path and OpenBLAS is installed on your system, you can compile the hellojet.cpp program below

#include <array>
#include <complex>
#include <iostream>

#include <Jet.hpp>

int main(){
    using Tensor = Jet::Tensor<std::complex<float>>;

    Tensor lhs({"i", "j", "k"}, {2, 2, 2});
    Tensor rhs({"j", "k", "l"}, {2, 2, 2});

    lhs.FillRandom();
    rhs.FillRandom();

    Tensor res = Tensor::ContractTensors(lhs, rhs);

    for (const auto &datum : res.GetData()) {
        std::cout << datum << std::endl;
    }

    std::cout << "You have successfully used Jet version " << Jet::Version() << std::endl;

    return 0;
}

by running

git clone https://github.com/XanaduAI/jet
g++ --std=c++17 -O3 -Ijet/include hellojet.cpp -lopenblas

The output of this program should resemble

$ ./hellojet
(-0.936549,0.0678852)
(-0.0786964,-0.771624)
(2.98721,-0.657124)
(-1.90032,1.58051)
You have successfully used Jet version 0.2.1

For more detailed instructions, see the development guide.

Python

The Jet Python package requires Python version 3.7 and above. Installation of Jet, as well as all dependencies, can be done using pip:

pip install quantum-jet

To build the Jet Python distribution locally, a BLAS library with a CBLAS interface and a C++ compiler with C++17 support is required. Simply run

make dist
pip install dist/*.whl

To verify that Jet is installed, you can run the hellojet.py program below

import jet

lhs = jet.Tensor(["i", "j", "k"], [2, 2, 2])
rhs = jet.Tensor(["j", "k", "l"], [2, 2, 2])

lhs.fill_random()
rhs.fill_random()
res = jet.contract_tensors(lhs, rhs)

for datum in res.data:
    print(f"{datum:.5f}")

print("You have successfully used Jet version", jet.version())

The output of this program should resemble

$ python hellojet.py
1.96289+0.25257j
-0.16588-1.44652j
-1.43005+0.49516j
1.66881-1.67099j
You have successfully used Jet version 0.2.1

Contributing to Jet

We welcome new contributions - simply fork the Jet repository and make a pull request containing your contribution. All contributers to Jet will be listed as authors on the releases. See our changelog for more details.

We also encourage bug reports, suggestions for new features and enhancements, and even links to cool projects or applications built using Jet. Visit the contributions page to learn more about sharing your ideas with the Jet team.

Support

If you are having issues, please let us know by posting the issue on our GitHub issue tracker.

Authors

Jet is the work of many contributors.

If you are doing research using Jet, please cite our paper:

Trevor Vincent, Lee J. O’Riordan, Mikhail Andrenkov, Jack Brown, Nathan Killoran, Haoyu Qi, and Ish Dhand. Jet: Fast quantum circuit simulations with parallel task-based tensor-network contraction. 2021. arxiv:2107.09793

License

Jet is free and open source, released under the Apache License, Version 2.0.

Jet contains a copy of JSON for Modern C++ from Niels Lohmann which is licenced under the MIT License.

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

quantum-jet-0.2.2.tar.gz (223.3 kB view hashes)

Uploaded Source

Built Distributions

quantum_jet-0.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.7 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

quantum_jet-0.2.2-cp39-cp39-macosx_10_14_x86_64.whl (356.7 kB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

quantum_jet-0.2.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.7 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

quantum_jet-0.2.2-cp38-cp38-macosx_10_14_x86_64.whl (356.7 kB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

quantum_jet-0.2.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.7 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

quantum_jet-0.2.2-cp37-cp37m-macosx_10_14_x86_64.whl (350.9 kB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

Supported by

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