Table Of Contents

Previous topic

Utilities (qit.utils)

Next topic

Quantum states (qit.state)

This Page

Linear maps (qit.lmap)

Bounded finite-dimensional linear maps are represented using lmap class instances. In addition to the matrix representing the map, they contain the dimension vectors of the domain and codomain vector spaces. All the usual scalar-map and map-map arithmetic operators are provided, including the exponentiation of maps by integers.

Utilities

remove_singletons() Eliminate unnecessary singleton dimensions.
is_compatible(t) True iff the lmaps have equal dimensions and can thus be added.
is_ket() True if the lmap is a ket.

Linear algebra

conj() Complex conjugate.
transpose() Transpose.
ctranspose() Hermitian conjugate.
trace() Trace of the lmap.
norm() Matrix norm of the lmap.
reorder(perm[, inplace]) Change the relative order of the input and/or output subsystems.

Non-member functions:

tensor(*arg) Tensor product of lmaps.
qit.lmap.numstr_to_array(s)

Utility, converts a numeric string to the corresponding array.

qit.lmap.array_to_numstr(s)

Utility, converts an integer array to the corresponding numeric string.

class qit.lmap.lmap(s, dim=None)

Bounded linear maps between tensor products of finite-dimensional Hilbert spaces.

Contains both the order-2 tensor and the dimensional information.

TODO Another possible interpretation of lmap would be to treat each subsystem as an index, with the subsystems within dim{1} and dim{2} corresponding to contravariant and covariant indices, respectively?

Variables: data: ndarray of tensor data dim: tuple of input and output dimension tuples, big-endian: ((out), (in))

Base class of state.

conj()

Complex conjugate.

ctranspose()

Hermitian conjugate.

is_compatible(t)

True iff the lmaps have equal dimensions and can thus be added.

is_ket()

True if the lmap is a ket.

norm()

Matrix norm of the lmap.

remove_singletons()

Eliminate unnecessary singleton dimensions.

NOTE: changes the object itself!

reorder(perm, inplace=False)

Change the relative order of the input and/or output subsystems.

Returns a copy of the lmap with permuted subsystem order.

A permutation can be either None (do nothing), a pair (a, b) of subsystems to be swapped, or a tuple containing a full permutation of the subsystems. Two subsystems to be swapped must be in decreasing order so as not to mistake the full identity permutation (0, 1) for a swap.

reorder((None, (2, 1, 0))) ignore first index, reverse the order of subsystems in the second reorder(((5, 2), None)) swap the subsystems 2 and 5 in the first index, ignore the second

NOTE: The full permutations are interpreted in the same sense as numpy.transpose() understands them, i.e. the permutation tuple is the new ordering of the old subsystem indices. This is the inverse of the mathematically more common “one-line” notation.

trace()

Trace of the lmap.

The trace is only properly defined if self.dim[0] == self.dim[1].

transpose()

Transpose.

qit.lmap.tensor(*arg)

Tensor product of lmaps.