## qitensor: a python module for quantum information and map-state dualityThis module is essentially a wrapper for numpy that uses semantics useful for finite dimensional quantum mechanics of many particles. In particular, this should be useful for the study of quantum information and quantum computing. Each array is associated with a tensor-product Hilbert space. The underlying spaces can be bra spaces or ket spaces. When arrays are multiplied, a tensor contraction is performed among the bra spaces of the left array and the ket spaces of the right array. Various linear algebra methods are available which are aware of the Hilbert space tensor product structure. - Component Hilbert spaces have string labels
(e.g.
`qubit('a') * qubit('b')`gives`|a,b>`). - Component spaces are finite dimensional and are indexed either by integers or by any sequence (e.g. elements of a group).
- Multiplication of arrays automatically contracts over the intersection of the bra space of the left factor and the ket space of the right factor.
- Linear algebra routines such as SVD are provided which are aware of the Hilbert space labels. These routines can be executed across any bipartite cut, or any combination of bra and ket spaces. For example, SVD can be used to compute the Schmidt decomposition of a pure state or of an operator.
- Modules are available for things like superoperators (with Krauses being computed if the superoperator is completely positive) and operator subspaces.
- In Sage, it is possible to create arrays over the Symbolic Ring. There is preliminary support for sympy.
## Download
Python module: qitensor-0.11.tar.gz
## DocumentationThe documentation contains usage examples and an API reference: qitensor docs## Synopsis```
>>> from qitensor import qubit
>>> ha = qubit('a')
>>> hb = qubit('b')
>>> ha * hb
|a,b>
>>> x = (ha * hb).array()
>>> x
HilbertArray(|a,b>,
array([[ 0.+0.j, 0.+0.j],
[ 0.+0.j, 0.+0.j]]))
``` ```
>>> from qitensor import qudit
>>> hc = qudit('c', 3)
>>> hc.array()
HilbertArray(|c>,
array([ 0.+0.j, 0.+0.j, 0.+0.j]))
``` In Sage the arrays can use the Symbolic Ring. Also, Sage's block_matrix is used to pretty-print the arrays. ```
sage: from qitensor import qubit
sage: ha = qubit('a', dtype=SR)
sage: hb = qubit('b', dtype=SR)
sage: (x, y) = var('x y')
sage: U = (ha * hb).eye()
sage: U[{ ha: 0, ha.H: 0, hb: 0, hb.H: 0 }] = x
sage: U[{ ha: 0, ha.H: 0, hb: 0, hb.H: 1 }] = y
sage: U
|a,b><a,b|
[x y|0 0]
[0 1|0 0]
[---+---]
[0 0|1 0]
[0 0|0 1]
``` ```
sage: U.I
|a,b><a,b|
[ 1/x -y/x| 0 0]
[ 0 1| 0 0]
[---------+---------]
[ 0 0| 1 0]
[ 0 0| 0 1]
``` |