Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Quantum-Flytrap/quantum-tensors

Quantum Tensors - NPM package for sparse matrix operations for quantum information and computing
https://github.com/Quantum-Flytrap/quantum-tensors

complex-numbers matrix quantum-computing quantum-game quantum-information quantum-mechanics quantum-tensors tensor typescript vector

Last synced: 3 days ago
JSON representation

Quantum Tensors - NPM package for sparse matrix operations for quantum information and computing

Awesome Lists containing this project

README

        

# Quantum Tensors

[![npm version](https://badge.fury.io/js/quantum-tensors.svg)](https://badge.fury.io/js/quantum-tensors)
![License](https://img.shields.io/npm/l/quantum-tensors)
![Build](https://github.com/Quantum-Flytrap/quantum-tensors/actions/workflows/build_test.yml/badge.svg)
![Docs](https://github.com/Quantum-Flytrap/quantum-tensors/actions/workflows/publish_docs.yml/badge.svg)
[![Coverage Status](https://codecov.io/gh/Quantum-Flytrap/quantum-tensors/branch/master/graph/badge.svg)](https://codecov.io/gh/Quantum-Flytrap/quantum-tensors/)
[![Twitter @QuantumFlytrap](https://img.shields.io/twitter/follow/QuantumFlytrap)](https://twitter.com/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:

- P. Migdał, K. Jankiewicz, P. Grabarz, et al., [Visualizing quantum mechanics in an interactive simulation - Virtual Lab by Quantum Flytrap](https://arxiv.org/abs/2203.13300), arXiv:2203.13300

Quantum Tensors are developed by [Quantum Flytrap](https://quantumflytrap.com/) and were supported by the [Centre of Quantum Technologies](https://www.quantumlah.org/), National University of Singapore. They are a part of the [Quantum Game 2](https://github.com/Quantum-Game/quantum-game-2) project, are used in [BraKetVue](https://github.com/Quantum-Flytrap/bra-ket-vue) quantum state visualizer, and serve as a prototype for numerics for [Virtual Lab by Quantum Flytrap](https://lab.quantumflytrap.com/), and in an interactive blog post:

- C. Zendejas-Morales, P. Migdał, [Quantum logic gates for a single qubit, interactively](https://quantumflytrap.com/blog/2021/qubit-interactively/)

Documentation: [quantum-flytrap.github.io/quantum-tensors](https://quantum-flytrap.github.io/quantum-tensors/) (generated by [TypeDoc](https://typedoc.org/)). Some examples of its usage are [demos](https://github.com/Quantum-Flytrap/quantum-tensors/tree/master/demos), [tests](https://github.com/Quantum-Flytrap/quantum-tensors/tree/master/demos) 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](http://nlp.seas.harvard.edu/NamedTensor)): 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](https://p.migdal.pl/2020/03/02/types-tests-typescript.html) by Piotr Migdał.

![Quantum Tensors logo](imgs/quantum-tensors-logo.jpg)

## Installation

The easiest way is to install from [the NPM repository](https://www.npmjs.com/package/quantum-tensors):

```
npm install quantum-tensors
```

Or, if you use [yarn](https://yarnpkg.com/) 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:

```{ts}
import * as qt from 'quantum-tensors'
```

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

## Contributing

- Create [TSDoc](https://www.npmjs.com/package/@microsoft/tsdoc) for each new function, class, and method
- Setup [ESLint](https://eslint.org/) configured as in this `.eslintrc.js`
- Try to adhere to [Angular-like commit style](https://github.com/angular/angular/blob/master/CONTRIBUTING.md)

## Citing

- P. Migdał, K. Jankiewicz, P. Grabarz, et al., [Visualizing quantum mechanics in an interactive simulation - Virtual Lab by Quantum Flytrap](https://arxiv.org/abs/2203.13300), 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}
}
```