qalgebra package¶
Main QAlgebra package
The qalgebra
package exposes all of QAlgebra’s functionality for easy
interactive or programmative use.
For interactive usage, the package should be initialized as follows:
>>> import qalgebra
>>> qalgebra.init_printing()
QNET provides a “flat” API. That is, after
>>> import qalgebra
all submodules are directly accessible, e.g.
>>> qalgebra.core.operator_algebra.OperatorSymbol
<class 'qalgebra.core.operator_algebra.OperatorSymbol'>
Furthermore, every package exports the “public” symbols of any of its submodules/subpackages (public symbols are those listed in __all__)
>>> (qalgebra.core.operator_algebra.OperatorSymbol is
... qalgebra.core.OperatorSymbol is qalgebra.OperatorSymbol is
... qalgebra.OperatorSymbol)
True
In an interactive context (and only there!), a star import such as
from qalgebra import *
may be useful.
Submodules:
Subpackages:
Summary¶
__all__
Exceptions:
Base class for all algebraic errors. |
|
Base class for all algebraic exceptions. |
|
Raised if the basis or a Hilbert space dimension is unavailable. |
|
Raised when a rule cannot further simplify an expression. |
|
Matrix cannot be diagonalized analytically. |
|
Raised when expanding a sum into an infinite number of terms. |
|
Raised when entries of |
|
Raised when a |
|
Raised when objects fail to be in separate Hilbert spaces. |
|
Raised when objects fail to be have overlapping Hilbert spaces. |
|
Raised when objects fail to be in the same Hilbert space. |
__all__
Classes:
Symbolic Adjoint of an operator |
|
Local basis state, identified by index or label |
|
The associated dual/adjoint state for any ket |
|
The symbolic inner product between two states |
|
Local coherent state, labeled by a complex amplitude \(\alpha\). |
|
Commutator of two operators |
|
Bosonic creation operator |
|
Bosonic annihilation operator |
|
Unitary coherent displacement operator. |
|
Base class for all QAlgebra Expressions. |
|
Symbolic index labeling a basis state in a |
|
Symbolic label that evaluates to the label of a basis state |
|
Base class for Hilbert spaces |
|
Index symbol in an indexed sum or product. |
|
Index range over the integer indices of a |
|
Index over a list of explicit values |
|
Index over the inclusive range between two integers |
|
Base class for indexed sums. |
|
A symbolic label that evaluates to an integer. |
|
Lowering operator on a spin space |
|
Raising operator of a spin space |
|
Spin (angular momentum) operator in z-direction |
|
Outer product of two states |
|
Indexed sum over Kets. |
|
Sum of states. |
|
Symbolic state. |
|
A state on a |
|
Base class for “known” operators on a |
|
Level flip operator between two levels of a |
|
Hilbert space for a single degree of freedom. |
|
Result of a |
|
Matrix of Expressions. |
|
Projection operator onto the nullspace of its operand. |
|
Base class for “operations” |
|
Base class for all quantum operators. |
|
Symbolic partial derivative of an operator |
|
Indexed sum over operators |
|
Sum of Operators |
|
An operator plus or minus its complex conjugate. |
|
Symbolic operator |
|
Product of operators |
|
Product of an operator and a state. |
|
(Partial) trace of an operator |
|
Pattern for matching an expression. |
|
Unitary “phase” operator |
|
Tensor product of local Hilbert spaces. |
|
Unevaluated pseudo-inverse \(\Op{X}^+\) of an operator \(\Op{X}\). |
|
Base class for adjoints of quantum expressions |
|
Symbolic partial derivative. |
|
Base class for expressions associated with a Hilbert space |
|
Base class for indexed sums of quantum expressions. |
|
Base class for operations on quantum expression |
|
General implementation of addition of quantum expressions |
|
Symbolic element of an algebra. |
|
General implementation of product of quantum expressions |
|
Linear post-multiplication operator. |
|
Linear pre-multiplication operator |
|
Base class for Scalars |
|
Symbolic partial derivative of a scalar |
|
Base class for scalars with non-scalar arguments |
|
Indexed sum over scalars. |
|
Sum of scalars |
|
A scalar raised to a power. |
|
Product of scalars |
|
Product of a |
|
Product of a |
|
Product of a |
|
Wrapper around a numeric or symbolic value |
|
Base class for operations on a single quantum expression |
|
Metaclass for singletons. |
|
Symbolic label for a spin degree of freedom |
|
Base class for operators in a spin space |
|
A Hilbert space for an integer or half-integer spin system. |
|
Unitary squeezing operator. |
|
Base class for states in a Hilbert space |
|
Symbolic partial derivative of a state |
|
Symbolic label that evaluates to a string |
|
Adjoint of a super-operator. |
|
Base class for super-operators |
|
Symbolic partial derivative of a super-operator |
|
A sum of super-operators |
|
Symbolic super-operator |
|
Product of super-operators |
|
Application of a super-operator to an operator. |
|
A tensor product of kets. |
__all__
Functions:
Kronecker delta symbol. |
|
A projector onto a specific level of a |
|
Pauli-type X-operator. |
|
Pauli-type Y-operator |
|
Pauli-type Z-operator |
|
Instantiator for an arbitrary indexed sum. |
|
Return the adjoint of an obj. |
|
If |
|
Return an ASCII representation of the given object / expression |
|
Generate the operator matrix with quadrants |
|
Commutator of A and B |
|
Context manager for temporarily changing the printing system. |
|
Convert a QAlgebra expression to a qutip object |
|
Convert a QAlgebra expression to an explicit |
|
Simplifies OperatorTrace expressions over tensor-product spaces by turning it into iterated partial traces. |
|
Generalizes the diagonal matrix creation capabilities of numpy.diag to |
|
Return the DOT (graph) description of an Expression tree as a string. |
|
Recursively expand commutators in expr according to the Leibniz rule. |
|
Factor out coefficients of all factors. |
|
Factor ls out of op for easy tracing. |
|
Create a dictionary with all Operator terms of the expression (understood as a sum) as keys and their coefficients as values. |
|
Generalizes numpy.hstack to |
|
Generate the N-dimensional identity matrix. |
|
Initialize the printing system. |
|
Return a LaTeX representation of the given object / expression |
|
Return the super-operator Lindblad term of the Lindblad operator C |
|
Return the Liouvillian super-operator associated with H and Ls |
|
Recursively match expr with the given expr_or_pattern. |
|
Temporarily disable instance caching in |
|
‘Flat’ constructor for |
|
Print a tree representation of the structure of expr |
|
Try to rewrite expr using |
|
Class decorator that transforms (and replaces) a class definition (which must have a Singleton metaclass) with the actual singleton object. |
|
Square root of a |
|
Render the given expression into a string that can be evaluated in an appropriate context to re-instantiate an identical expression. |
|
Substitute symbols or (sub-)expressions with the given replacements. |
|
The |
|
Use a temporary cache for instances in |
|
Allow temporary modification of rules for |
|
Alias for |
|
Instantiate while applying automatic simplifications. |
|
Give the output of tree as a multiline string, using line drawings to visualize the hierarchy of expressions (similar to the |
|
Return a unicode representation of the given object / expression |
|
Generalizes numpy.vstack to |
|
Constructor for a wildcard- |
|
Generalizes |
__all__
Data:
The ‘full space’, i.e. |
|
|
|
|
|
Neutral element for product of super-operators |
|
The neutral element with respect to scalar multiplication |
|
A dummy type that for checking whether an object is a Singleton. |
|
TrivialKet constant (singleton) object. |
|
The ‘nullspace’, i.e. |
|
The neutral element with respect to scalar addition |
|
ZeroKet constant (singleton) object for the null-state. |
|
|
|
Neutral element for sum of super-operators |
Reference¶
-
qalgebra.
init_algebra
(*, default_hs_cls='LocalSpace')[source]¶ Initialize the algebra system.
- Parameters
default_hs_cls (str) – The name of the
LocalSpace
subclass that should be used when implicitly creating Hilbert spaces, e.g. inOperatorSymbol