Options
All
  • Public
  • Public/Protected
  • All
Menu

quantum-tensors

Quantum Tensors

npm version License Build Docs Coverage Status Twitter @QuantumFlytrap

A TypeScript package for sparse tensor operations on complex numbers in your browser - for quantum computing, quantum information, and interactive visualizations of quantum physics. For more details, see our preprint:

Quantum Tensors are developed by Quantum Flytrap and were supported by the Centre of Quantum Technologies, National University of Singapore. They are a part of the Quantum Game 2 project, are used in BraKetVue quantum state visualizer, and serve as a prototype for numerics for Virtual Lab by Quantum Flytrap, and in an interactive blog post:

Documentation: quantum-flytrap.github.io/quantum-tensors (generated by TypeDoc). Some examples of its usage are demos, tests folders.

We base the philosophy of this package on:

  • Sparse operations (both for vectors and matrices)
  • Complex numbers
  • Tensor structure
  • Named tensor dimensions (vide Tensors considered harmful): there is a difference between a 2x2 operator on spin and polarization. It helps with catching errors.

A few insights on contributing, and starting your projects, are in How I Learned to Stop Worrying and Love the Types & Tests: the Zen of Python for TypeScript by Piotr Migdał.

Quantum Tensors logo

Installation

The easiest way is to install from the NPM repository:

npm install quantum-tensors

Or, if you use yarn package manager,

yarn add quantum-tensors

If you want to install a development version, you can get this package directly from this GitHub repository. In this case, the commands are:

npm install Quantum-Flytrap/quantum-tensors#master

Or if you use yarn:

yarn add Quantum-Flytrap/quantum-tensors#master

Usage

And then in your project write:

import * as qt from 'quantum-tensors'

Also, https://github.com/stared/thinking-in-tensors-writing-in-pytorch by Piotr Migdał.

Contributing

Citing

@article{migdal_visualizing_2022,
title = {Visualizing quantum mechanics in an interactive simulation -- {Virtual} {Lab} by {Quantum} {Flytrap}},
url = {http://arxiv.org/abs/2203.13300},
journal = {arXiv:2203.13300 [quant-ph]},
author = {Migdał, Piotr and Jankiewicz, Klementyna and Grabarz, Paweł and Decaroli, Chiara and Cochin, Philippe},
month = mar,
year = {2022},
note = {arXiv: 2203.13300}
}

Generated using TypeDoc