qnet.algebra.super_operator_algebra module

The specification of a quantum mechanics symbolic super-operator algebra. See Super-Operator Algebra for more details.

Summary

Exceptions:

BadLiouvillianError Raise when a Liouvillian is not of standard Lindblad form.
CannotSymbolicallyDiagonalize

Classes:

SPost Linear post-multiplication operator.
SPre Linear pre-multiplication operator.
ScalarTimesSuperOperator Multiply an operator by a scalar coefficient:
SuperAdjoint The symbolic SuperAdjoint of a super-operator.
SuperCommutativeHSOrder Ordering class that acts like DisjunctCommutativeHSOrder, but also
SuperOperator The super-operator abstract base class.
SuperOperatorOperation Base class for Operations acting only on SuperOperator arguments.
SuperOperatorPlus A sum of super-operators.
SuperOperatorSymbol Super-operator symbol class, parametrized by an identifier string and an associated Hilbert space.
SuperOperatorTimes A product of super-operators that denotes order of application of
SuperOperatorTimesOperator Application of a super-operator to an operator (result is an Operator).

Functions:

anti_commutator If B != None, return the anti-commutator \(\{A,B\}\), otherwise return the super-operator \(\{A,\cdot\}\).
commutator If B != None, return the commutator \([A,B]\), otherwise return the super-operator \([A,\cdot]\).
lindblad Return SPre(C) * SPost(C.adjoint()) - (1/2) * santi_commutator(C.adjoint()*C).
liouvillian Return the Liouvillian super-operator associated with a Hamilton operator H and a set of collapse-operators Ls = [L1, L2, ...].
liouvillian_normal_form Return a Hamilton operator H and a minimal list of collapse operators Ls that generate the liouvillian L.

Data:

IdentitySuperOperator IdentitySuperOperator constant (singleton) object.
ZeroSuperOperator ZeroSuperOperator constant (singleton) object.

__all__: BadLiouvillianError, CannotSymbolicallyDiagonalize, IdentitySuperOperator, SPost, SPre, ScalarTimesSuperOperator, SuperAdjoint, SuperCommutativeHSOrder, SuperOperator, SuperOperatorOperation, SuperOperatorPlus, SuperOperatorSymbol, SuperOperatorTimes, SuperOperatorTimesOperator, ZeroSuperOperator, anti_commutator, commutator, lindblad, liouvillian, liouvillian_normal_form

Reference

exception qnet.algebra.super_operator_algebra.CannotSymbolicallyDiagonalize[source]

Bases: qnet.algebra.abstract_algebra.AlgebraException

exception qnet.algebra.super_operator_algebra.BadLiouvillianError[source]

Bases: qnet.algebra.abstract_algebra.AlgebraError

Raise when a Liouvillian is not of standard Lindblad form.

class qnet.algebra.super_operator_algebra.SuperOperator[source]

Bases: object

The super-operator abstract base class.

Any super-operator contains an associated HilbertSpace object, on which it is taken to act non-trivially.

space

The Hilbert space associated with the operator on which it acts non-trivially

superadjoint()[source]

The super-operator adjoint (w.r.t to the Tr operation). See SuperAdjoint documentation.

Returns:The super-adjoint of the super-operator.
Return type:SuperOperator
expand()[source]

Expand out distributively all products of sums. Note that this does not expand out sums of scalar coefficients.

Returns:A fully expanded sum of superoperators.
Return type:SuperOperator
simplify_scalar()[source]

Simplify all scalar coefficients within the Operator expression.

Returns:The simplified expression.
Return type:Operator
class qnet.algebra.super_operator_algebra.SuperOperatorOperation(*operands)[source]

Bases: qnet.algebra.super_operator_algebra.SuperOperator, qnet.algebra.abstract_algebra.Operation

Base class for Operations acting only on SuperOperator arguments.

space
class qnet.algebra.super_operator_algebra.SuperOperatorSymbol(label, *, hs)[source]

Bases: qnet.algebra.super_operator_algebra.SuperOperator, qnet.algebra.abstract_algebra.Expression

Super-operator symbol class, parametrized by an identifier string and an associated Hilbert space.

Instantiate as:

SuperOperatorSymbol(name, hs)
Parameters:
  • label (str) – Symbol identifier
  • hs (HilbertSpace) – Associated Hilbert space.
label
args
kwargs
space
all_symbols()[source]
qnet.algebra.super_operator_algebra.IdentitySuperOperator = IdentitySuperOperator[source]

IdentitySuperOperator constant (singleton) object.

qnet.algebra.super_operator_algebra.ZeroSuperOperator = ZeroSuperOperator[source]

ZeroSuperOperator constant (singleton) object.

class qnet.algebra.super_operator_algebra.SuperOperatorPlus(*operands)[source]

Bases: qnet.algebra.super_operator_algebra.SuperOperatorOperation

A sum of super-operators.

Instantiate as:

OperatorPlus(*summands)
Parameters:summands (SuperOperator) – super-operator summands.
neutral_element = ZeroSuperOperator

ZeroSuperOperator constant (singleton) object.

order_key

alias of FullCommutativeHSOrder

class qnet.algebra.super_operator_algebra.SuperCommutativeHSOrder(op, space_order=None, op_order=None)[source]

Bases: qnet.algebra.ordering.DisjunctCommutativeHSOrder

Ordering class that acts like DisjunctCommutativeHSOrder, but also commutes any SPost and SPre

class qnet.algebra.super_operator_algebra.SuperOperatorTimes(*operands)[source]

Bases: qnet.algebra.super_operator_algebra.SuperOperatorOperation

A product of super-operators that denotes order of application of super-operators (right to left):

SuperOperatorTimes(*factors)
Parameters:factors (SuperOperator) – Super-operator factors.
neutral_element = IdentitySuperOperator

IdentitySuperOperator constant (singleton) object.

order_key

alias of SuperCommutativeHSOrder

classmethod create(*ops)[source]
class qnet.algebra.super_operator_algebra.ScalarTimesSuperOperator(*operands, **kwargs)[source]

Bases: qnet.algebra.super_operator_algebra.SuperOperator, qnet.algebra.abstract_algebra.Operation

Multiply an operator by a scalar coefficient:

ScalarTimesSuperOperator(coeff, term)
Parameters:
space
coeff

The scalar coefficient.

term

The super-operator term.

class qnet.algebra.super_operator_algebra.SuperAdjoint(operand)[source]

Bases: qnet.algebra.super_operator_algebra.SuperOperatorOperation

The symbolic SuperAdjoint of a super-operator.

The math notation for this is typically

\[{\rm SuperAdjoint}(\mathcal{L}) =: \mathcal{L}^*\]

and for any super operator \(\mathcal{L}\), its super-adjoint \(\mathcal{L}^*\) satisfies for any pair of operators \(M,N\):

\[{\rm Tr}[M (\mathcal{L}N)] = Tr[(\mathcal{L}^*M) N]\]
Parameters:L (SuperOperator) – The super-operator to take the adjoint of.
operand
class qnet.algebra.super_operator_algebra.SPre(op)[source]

Bases: qnet.algebra.super_operator_algebra.SuperOperator, qnet.algebra.abstract_algebra.Operation

Linear pre-multiplication operator.

Acting SPre(A) on an operator B just yields the product A * B

space
class qnet.algebra.super_operator_algebra.SPost(op)[source]

Bases: qnet.algebra.super_operator_algebra.SuperOperator, qnet.algebra.abstract_algebra.Operation

Linear post-multiplication operator.

Acting SPost(A) on an operator B just yields the reversed product B * A.

space
class qnet.algebra.super_operator_algebra.SuperOperatorTimesOperator(sop, op)[source]

Bases: qnet.algebra.operator_algebra.Operator, qnet.algebra.abstract_algebra.Operation

Application of a super-operator to an operator (result is an Operator).

Parameters:
space
sop
op
qnet.algebra.super_operator_algebra.commutator(A, B=None)[source]

If B != None, return the commutator \([A,B]\), otherwise return the super-operator \([A,\cdot]\). The super-operator \([A,\cdot]\) maps any other operator B to the commutator \([A, B] = A B - B A\).

Parameters:
  • A (Operator) – The first operator to form the commutator of.
  • or None) B ((Operator) – The second operator to form the commutator of, or None.
Returns:

The linear superoperator \([A,\cdot]\)

Return type:

SuperOperator

qnet.algebra.super_operator_algebra.anti_commutator(A, B=None)[source]

If B != None, return the anti-commutator \(\{A,B\}\), otherwise return the super-operator \(\{A,\cdot\}\). The super-operator \(\{A,\cdot\}\) maps any other operator B to the anti-commutator \(\{A, B\} = A B + B A\).

Parameters:
  • A (Operator) – The first operator to form all anti-commutators of.
  • or None) B ((Operator) – The second operator to form the anti-commutator of, or None.
Returns:

The linear superoperator \([A,\cdot]\)

Return type:

SuperOperator

qnet.algebra.super_operator_algebra.lindblad(C)[source]

Return SPre(C) * SPost(C.adjoint()) - (1/2) * santi_commutator(C.adjoint()*C). These are the super-operators \(\mathcal{D}[C]\) that form the collapse terms of a Master-Equation. Applied to an operator \(X\) they yield

\[\mathcal{D}[C] X = C X C^\dagger - {1\over 2} (C^\dagger C X + X C^\dagger C)\]
Parameters:C (Operator) – The associated collapse operator
Returns:The Lindblad collapse generator.
Return type:SuperOperator
qnet.algebra.super_operator_algebra.liouvillian(H, Ls=[])[source]

Return the Liouvillian super-operator associated with a Hamilton operator H and a set of collapse-operators Ls = [L1, L2, ...].

The Liouvillian \(\mathcal{L}\) generates the Markovian-dynamics of a system via the Master equation:

\[\dot{\rho} = \mathcal{L}\rho = -i[H,\rho] + \sum_{j=1}^n \mathcal{D}[L_j] \rho\]
Parameters:
  • H (Operator) – The associated Hamilton operator
  • Ls (sequence or Matrix) – A sequence of collapse operators.
Returns:

The Liouvillian super-operator.

Return type:

SuperOperator

qnet.algebra.super_operator_algebra.liouvillian_normal_form(L, symbolic=False)[source]

Return a Hamilton operator H and a minimal list of collapse operators Ls that generate the liouvillian L.

A Liouvillian defined by a hermitian Hamilton operator \(H\) and a vector of collapse operators \(\mathbf{L} = (L_1, L_2, \dots L_n)^T\) is invariant under the following two operations:

\[\begin{split}\left(H, \mathbf{L}\right) & \mapsto \left(H + {1\over 2i}\left(\mathbf{w}^\dagger \mathbf{L} - \mathbf{L}^\dagger \mathbf{w}\right), \mathbf{L} + \mathbf{w} \right) \\ \left(H, \mathbf{L}\right) & \mapsto \left(H, \mathbf{U}\mathbf{L}\right)\\\end{split}\]

where \(\mathbf{w}\) is just a vector of complex numbers and \(\mathbf{U}\) is a complex unitary matrix. It turns out that for quantum optical circuit models the set of collapse operators is often linearly dependent. This routine tries to find a representation of the Liouvillian in terms of a Hamilton operator H with as few non-zero collapse operators Ls as possible. Consider the following example, which results from a two-port linear cavity with a coherent input into the first port:

>>> from sympy import symbols
>>> kappa_1, kappa_2 = symbols('kappa_1, kappa_2', positive = True)
>>> Delta = symbols('Delta', real = True)
>>> alpha = symbols('alpha')
>>> H = (Delta * Create(hs=1) * Destroy(hs=1) +
...      (sqrt(kappa_1) / (2 * I)) *
...      (alpha * Create(hs=1) - alpha.conjugate() * Destroy(hs=1)))
>>> Ls = [sqrt(kappa_1) * Destroy(hs=1) + alpha,
...       sqrt(kappa_2) * Destroy(hs=1)]
>>> LL = liouvillian(H, Ls)
>>> Hnf, Lsnf = liouvillian_normal_form(LL)
>>> print(ascii(Hnf))
-I*alpha*sqrt(kappa_1) * a^(1)H + I*sqrt(kappa_1)*conjugate(alpha) * a^(1) + Delta * a^(1)H * a^(1)
>>> len(Lsnf)
1
>>> print(ascii(Lsnf[0]))
sqrt(kappa_1 + kappa_2) * a^(1)

In terms of the ensemble dynamics this final system is equivalent. Note that this function will only work for proper Liouvillians.

Parameters:L (SuperOperator) – The Liouvillian
Returns:(H, Ls)
Return type:tuple
Raises:BadLiouvillianError