Operators and States

Python operator and state primitives.

Generated operators use sparse storage internally where that preserves the structure of common open-system models. The public to_numpy and __array__ interfaces still expose dense arrays for convenient inspection and interoperability.

class openquantumsim.operators.Operator(data, space=None, label=None)

Bases: object

Linear operator with an optional Hilbert-space descriptor.

Parameters:
data: Any
space: HilbertSpace | None = None
label: str | None = None
property shape: tuple[int, int]

Matrix shape.

property dim: int

Matrix dimension.

dag()

Return the Hermitian adjoint.

Return type:

Operator

to_numpy()

Return a dense NumPy array representation.

Return type:

ndarray[tuple[Any, …], dtype[complex128]]

openquantumsim.operators.eye(space_or_dim)

Identity operator.

Parameters:

space_or_dim (HilbertSpace | int)

Return type:

Operator

openquantumsim.operators.destroy(space_or_dim)

Bosonic annihilation operator for a finite-dimensional truncation.

Parameters:

space_or_dim (HilbertSpace | int)

Return type:

Operator

openquantumsim.operators.create(space_or_dim)

Bosonic creation operator.

Parameters:

space_or_dim (HilbertSpace | int)

Return type:

Operator

openquantumsim.operators.num(space_or_dim)

Bosonic number operator.

Parameters:

space_or_dim (HilbertSpace | int)

Return type:

Operator

openquantumsim.operators.sigmax(space_or_dim=None)

Pauli sigma-x operator.

Parameters:

space_or_dim (HilbertSpace | int | None)

Return type:

Operator

openquantumsim.operators.sigmay(space_or_dim=None)

Pauli sigma-y operator.

Parameters:

space_or_dim (HilbertSpace | int | None)

Return type:

Operator

openquantumsim.operators.sigmaz(space_or_dim=None)

Pauli sigma-z operator.

Parameters:

space_or_dim (HilbertSpace | int | None)

Return type:

Operator

openquantumsim.operators.sigmam(space_or_dim=None)

Two-level lowering operator |down><up|.

Parameters:

space_or_dim (HilbertSpace | int | None)

Return type:

Operator

openquantumsim.operators.sigmap(space_or_dim=None)

Two-level raising operator |up><down|.

Parameters:

space_or_dim (HilbertSpace | int | None)

Return type:

Operator

openquantumsim.operators.spin_jm(space_or_dim)

Spin-S lowering operator in the Dicke basis ordered by descending m.

Parameters:

space_or_dim (SpinSpace | DickeSpace | int)

Return type:

Operator

openquantumsim.operators.spin_jp(space_or_dim)

Spin-S raising operator.

Parameters:

space_or_dim (SpinSpace | DickeSpace | int)

Return type:

Operator

openquantumsim.operators.spin_jx(space_or_dim)

Spin-S x operator.

Parameters:

space_or_dim (SpinSpace | DickeSpace | int)

Return type:

Operator

openquantumsim.operators.spin_jz(space_or_dim)

Spin-S z operator in the Dicke basis ordered by descending m.

Parameters:

space_or_dim (SpinSpace | DickeSpace | int)

Return type:

Operator

openquantumsim.operators.dicke_jm(space_or_dim)

Collective Dicke lowering operator J_-.

Parameters:

space_or_dim (DickeSpace | int)

Return type:

Operator

openquantumsim.operators.dicke_jp(space_or_dim)

Collective Dicke raising operator J_+.

Parameters:

space_or_dim (DickeSpace | int)

Return type:

Operator

openquantumsim.operators.dicke_jx(space_or_dim)

Collective Dicke drive operator J_x.

Parameters:

space_or_dim (DickeSpace | int)

Return type:

Operator

openquantumsim.operators.dicke_jz(space_or_dim)

Collective Dicke inversion operator J_z.

Parameters:

space_or_dim (DickeSpace | int)

Return type:

Operator

openquantumsim.operators.dicke_excitation(space_or_dim)

Collective excitation-number operator in the symmetric Dicke manifold.

Parameters:

space_or_dim (DickeSpace | int)

Return type:

Operator

openquantumsim.operators.collective_lowering(space_or_dim)

Alias for the Dicke collective lowering operator J_-.

Parameters:

space_or_dim (DickeSpace | int)

Return type:

Operator

openquantumsim.operators.collective_raising(space_or_dim)

Alias for the Dicke collective raising operator J_+.

Parameters:

space_or_dim (DickeSpace | int)

Return type:

Operator

openquantumsim.operators.collective_x(space_or_dim)

Alias for the Dicke collective drive operator J_x.

Parameters:

space_or_dim (DickeSpace | int)

Return type:

Operator

openquantumsim.operators.collective_z(space_or_dim)

Alias for the Dicke collective inversion operator J_z.

Parameters:

space_or_dim (DickeSpace | int)

Return type:

Operator

openquantumsim.operators.collective_excitation(space_or_dim)

Alias for the Dicke collective excitation-number operator.

Parameters:

space_or_dim (DickeSpace | int)

Return type:

Operator

openquantumsim.operators.tensor(*items)

Kronecker product of operators.

Parameters:

items (Operator)

Return type:

Operator

openquantumsim.operators.basis(space_or_dim, index)

Basis ket as a column vector.

Parameters:
Return type:

ndarray[tuple[Any, …], dtype[complex128]]

openquantumsim.operators.fock(space_or_dim, n)

Fock basis state |n>.

Parameters:
Return type:

ndarray[tuple[Any, …], dtype[complex128]]

openquantumsim.operators.dicke_state(space, excitations)

Symmetric Dicke state with a fixed number of excited spins.

Parameters:
Return type:

ndarray[tuple[Any, …], dtype[complex128]]

openquantumsim.operators.ket2dm(ket)

Convert a ket to a density matrix.

Parameters:

ket (ndarray[tuple[Any, ...], dtype[complex128]])

Return type:

ndarray[tuple[Any, …], dtype[complex128]]

openquantumsim.operators.coherent(space_or_dim, alpha)

Truncated coherent state.

Parameters:
  • space_or_dim (FockSpace | int)

  • alpha (complex)

Return type:

ndarray[tuple[Any, …], dtype[complex128]]

openquantumsim.operators.thermal_dm(space_or_dim, nbar)

Truncated thermal density matrix for a bosonic mode.

Parameters:
  • space_or_dim (FockSpace | int)

  • nbar (float)

Return type:

ndarray[tuple[Any, …], dtype[complex128]]