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:
- P. Migdał, K. Jankiewicz, P. Grabarz, et al., Visualizing quantum mechanics in an interactive simulation - Virtual Lab by Quantum Flytrap, arXiv:2203.13300
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:
- C. Zendejas-Morales, P. Migdał, Quantum logic gates for a single qubit, interactively
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ł.
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
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ł.
- Create TSDoc for each new function, class, and method
- Setup ESLint configured as in this
.eslintrc.js
- Try to adhere to Angular-like commit style
- P. Migdał, K. Jankiewicz, P. Grabarz, et al., Visualizing quantum mechanics in an interactive simulation - Virtual Lab by Quantum Flytrap, arXiv:2203.13300
@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}
}