ElementaryOperator#

class cuquantum.densitymat.jax.ElementaryOperator(
data: Array,
diag_offsets: Sequence[int] = (),
)[source]#

PyTree class for cuDensityMat’s elementary operator.

Methods

__add__(
other: ElementaryOperator,
) ElementaryOperator[source]#

Sum of an elementary operator on the left with another elementary operator.

Adding a scalar is not supported: it is ambiguous between elementwise addition and adding scalar * identity, and the two disagree for multidiagonal operators, where only the stored diagonals would be updated.

__init__(
data: Array,
diag_offsets: Sequence[int] = (),
) None[source]#

Initialize an ElementaryOperator object.

Parameters:
  • data – Data buffer of the elementary operator.

  • diag_offsets – Diagonal offsets of the elementary operator.

__matmul__(
other: ElementaryOperator,
) ElementaryOperator[source]#

Matrix multiplication of two elementary operators.

__mul__(
other: Number | Array,
) ElementaryOperator[source]#

Scalar multiplication.

__rmul__(
other: Number | Array,
) ElementaryOperator[source]#

Right scalar multiplication.

__sub__(
other: ElementaryOperator,
) ElementaryOperator[source]#

Difference of an elementary operator on the left with another elementary operator.

Subtracting a scalar is not supported, for the same reason as in __add__.

dag() ElementaryOperator[source]#

Conjugate transpose of an elementary operator.

to_dense() ElementaryOperator[source]#

Return the dense form of an elementary operator.

Attributes

batch_size#
in_axes#

the data leaf always maps its leading batch axis (0), since every operator leaf must carry a batch dimension matching the state’s. A nested vmap peels one leading batch axis per level, so the same spec applies at every level.

Type:

Return the in_axes PyTree spec for vmapping the operator

mode_extents#
num_modes#