qalgebra.core package

The fundamental object hiearchies that constitute QNET’s various algebras

Submodules:

Summary

__all__ Exceptions:

AlgebraError

Base class for all algebraic errors.

AlgebraException

Base class for all algebraic exceptions.

BasisNotSetError

Raised if the basis or a Hilbert space dimension is unavailable.

CannotSimplify

Raised when a rule cannot further simplify an expression.

CannotSymbolicallyDiagonalize

Matrix cannot be diagonalized analytically.

InfiniteSumError

Raised when expanding a sum into an infinite number of terms.

NoConjugateMatrix

Raised when entries of Matrix have no defined conjugate.

NonSquareMatrix

Raised when a Matrix fails to be square.

OverlappingSpaces

Raised when objects fail to be in separate Hilbert spaces.

SpaceTooLargeError

Raised when objects fail to be have overlapping Hilbert spaces.

UnequalSpaces

Raised when objects fail to be in the same Hilbert space.

__all__ Classes:

Adjoint

Symbolic Adjoint of an operator

BasisKet

Local basis state, identified by index or label

Bra

The associated dual/adjoint state for any ket

BraKet

The symbolic inner product between two states

CoherentStateKet

Local coherent state, labeled by a complex amplitude \(\alpha\).

Commutator

Commutator of two operators

Expression

Base class for all QAlgebra Expressions.

HilbertSpace

Base class for Hilbert spaces

IndexedSum

Base class for indexed sums.

KetBra

Outer product of two states

KetIndexedSum

Indexed sum over Kets.

KetPlus

Sum of states.

KetSymbol

Symbolic state.

LocalKet

A state on a LocalSpace.

LocalOperator

Base class for “known” operators on a LocalSpace.

LocalSigma

Level flip operator between two levels of a LocalSpace.

LocalSpace

Hilbert space for a single degree of freedom.

Matrix

Matrix of Expressions.

NullSpaceProjector

Projection operator onto the nullspace of its operand.

Operation

Base class for “operations”

Operator

Base class for all quantum operators.

OperatorDerivative

Symbolic partial derivative of an operator

OperatorIndexedSum

Indexed sum over operators

OperatorPlus

Sum of Operators

OperatorPlusMinusCC

An operator plus or minus its complex conjugate.

OperatorSymbol

Symbolic operator

OperatorTimes

Product of operators

OperatorTimesKet

Product of an operator and a state.

OperatorTrace

(Partial) trace of an operator

ProductSpace

Tensor product of local Hilbert spaces.

PseudoInverse

Unevaluated pseudo-inverse \(\Op{X}^+\) of an operator \(\Op{X}\).

QuantumAdjoint

Base class for adjoints of quantum expressions

QuantumDerivative

Symbolic partial derivative.

QuantumExpression

Base class for expressions associated with a Hilbert space

QuantumIndexedSum

Base class for indexed sums of quantum expressions.

QuantumOperation

Base class for operations on quantum expression

QuantumPlus

General implementation of addition of quantum expressions

QuantumSymbol

Symbolic element of an algebra.

QuantumTimes

General implementation of product of quantum expressions

SPost

Linear post-multiplication operator.

SPre

Linear pre-multiplication operator

Scalar

Base class for Scalars

ScalarDerivative

Symbolic partial derivative of a scalar

ScalarExpression

Base class for scalars with non-scalar arguments

ScalarIndexedSum

Indexed sum over scalars.

ScalarPlus

Sum of scalars

ScalarPower

A scalar raised to a power.

ScalarTimes

Product of scalars

ScalarTimesKet

Product of a Scalar coefficient and a ket

ScalarTimesOperator

Product of a Scalar coefficient and an Operator.

ScalarTimesQuantumExpression

Product of a Scalar and a QuantumExpression

ScalarTimesSuperOperator

Product of a Scalar coefficient and a SuperOperator.

ScalarValue

Wrapper around a numeric or symbolic value

SingleQuantumOperation

Base class for operations on a single quantum expression

State

Base class for states in a Hilbert space

StateDerivative

Symbolic partial derivative of a state

SuperAdjoint

Adjoint of a super-operator.

SuperOperator

Base class for super-operators

SuperOperatorDerivative

Symbolic partial derivative of a super-operator

SuperOperatorPlus

A sum of super-operators

SuperOperatorSymbol

Symbolic super-operator

SuperOperatorTimes

Product of super-operators

SuperOperatorTimesOperator

Application of a super-operator to an operator.

TensorKet

A tensor product of kets.

__all__ Functions:

KroneckerDelta

Kronecker delta symbol.

LocalProjector

A projector onto a specific level of a LocalSpace

Sum

Instantiator for an arbitrary indexed sum.

adjoint

Return the adjoint of an obj.

anti_commutator

If B != None, return the anti-commutator \(\{A,B\}\), otherwise return the super-operator \(\{A,\cdot\}\).

block_matrix

Generate the operator matrix with quadrants

commutator

Commutator of A and B

decompose_space

Simplifies OperatorTrace expressions over tensor-product spaces by turning it into iterated partial traces.

diagm

Generalizes the diagonal matrix creation capabilities of numpy.diag to Matrix objects.

factor_coeff

Factor out coefficients of all factors.

factor_for_trace

Factor ls out of op for easy tracing.

get_coeffs

Create a dictionary with all Operator terms of the expression (understood as a sum) as keys and their coefficients as values.

hstackm

Generalizes numpy.hstack to Matrix objects.

identity_matrix

Generate the N-dimensional identity matrix.

lindblad

Return the super-operator Lindblad term of the Lindblad operator C

liouvillian

Return the Liouvillian super-operator associated with H and Ls

rewrite_with_operator_pm_cc

Try to rewrite expr using OperatorPlusMinusCC.

sqrt

Square root of a Scalar or scalar value.

substitute

Substitute symbols or (sub-)expressions with the given replacements.

tr

Instantiate while applying automatic simplifications.

vstackm

Generalizes numpy.vstack to Matrix objects.

zerosm

Generalizes numpy.zeros to Matrix objects.

__all__ Data:

FullSpace

The ‘full space’, i.e.

II

IdentityOperator constant (singleton) object.

IdentityOperator

IdentityOperator constant (singleton) object.

IdentitySuperOperator

Neutral element for product of super-operators

One

The neutral element with respect to scalar multiplication

TrivialKet

TrivialKet constant (singleton) object.

TrivialSpace

The ‘nullspace’, i.e.

Zero

The neutral element with respect to scalar addition

ZeroKet

ZeroKet constant (singleton) object for the null-state.

ZeroOperator

ZeroOperator constant (singleton) object.

ZeroSuperOperator

Neutral element for sum of super-operators