Home > Linux > Programming > Libraries

# qitensor 0.9

 User Rating:Rated by: NOT RATED0 user(s)
 Developer: License / Price: Last Updated: Category: Dan Stahlke | More programs BSD License / FREE April 21st, 2012, 01:15 GMT ROOT / Programming / Libraries

 Read user reviews (0)  Refer to a friend  Subscribe

## Quantum Tensors

qitensor is a Python module, 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 and are indexed using any finite sequence (typically a range of integers starting from zero, but any sequence is allowed). 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).
- In Sage, it is possible to create arrays over the Symbolic Ring.
- 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.

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]

Product's homepage

Requirements:

· Python

### TAGS:

quantum tensors | numpy wrapper | quantum mechanics | quantum | tensors | numpy

Go to top