cuquantum.densitymat.OperatorTerm

class cuquantum.densitymat.OperatorTerm(dtype: Optional[str] = None)[source]

Operator term consisting of tensor products of elementary operators.

An OperatorTerm containing a tensor product of elementary operators can be obtained from the free function tensor_product(). Sums of more than a single product are obtained by in-place (+=) or out-of-place addition (+) of OperatorTerm objects.

Parameters

dtype – Numeric data type of the underlying elementary operators’ data. Defaults to None and will be inferred from the appended tensor products of elementary operators.

Note

  • Scalar operators, for which no product is appended, require specification of dtype at construction.

Methods

__add__(other: OperatorTerm) OperatorTerm[source]

Return a new OperatorTerm equal to the sum of this OperatorTerm and another OperatorTerm.

__iadd__(other: OperatorTerm) OperatorTerm[source]

Inplace add another OperatorTerm into this OperatorTerm.

__init__(dtype: Optional[str] = None)[source]

Initialize an operator term consisting of tensor products of elementary operators.

__mul__(other: Union[numbers.Number, Callable, OperatorTerm]) OperatorTerm[source]

Multiply this OperatorTerm with a number, callable or another OperatorTerm on the left.

__rmul__(other: Union[numbers.Number, Callable, OperatorTerm]) OperatorTerm[source]

Multiply this OperatorTerm with a number, callable or another OperatorTerm on the right.

dag() OperatorTerm[source]

Return a new OperatorTerm equal to the complex conjugate of this OperatorTerm.

Warning

A error will be raised if the OperatorTerm contains tensor products of elementary operators acting on both bra and ket modes at the same time.

dual() OperatorTerm[source]

Return a new OperatorTerm with duality reversed.

Attributes

dtype

Data type of this OperatorTerm.

hilbert_space_dims

Hilbert space dimensions of this OperatorTerm.