GithubHelp home page GithubHelp logo

00mjk / jet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xanaduai/jet

0.0 0.0 0.0 2.16 MB

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

Home Page: https://quantum-jet.readthedocs.io

License: Apache License 2.0

CMake 2.55% Makefile 0.66% Python 27.94% C++ 68.85%

jet's Introduction

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.

jet's People

Contributors

brownj85 avatar mandrenkov avatar mlxd avatar thisac avatar trevor-vincent avatar

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.