Skip to content

Latest commit

 

History

History
196 lines (134 loc) · 5.72 KB

README.rst

File metadata and controls

196 lines (134 loc) · 5.72 KB

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. 2022. Published in Quantum.

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.