Crate cpx_mat2by2

Crate cpx_mat2by2 

Source
Expand description

The cpx-mat2by2 library provides structures for representing and manipulating quantum states and operators in a 2-dimensional Hilbert space (qubit). It leverages the cpx-coords crate for complex number arithmetic.

Structs§

CpxQuaternion
Represents a general 2×2 complex matrix using the Pauli (complex-quaternion) basis.
Det1CpxQuaternion
Represents a 2×2 complex matrix with unit determinant, expressed in the Pauli (complex-quaternion) basis.
Det1RealQuaternion
Represents a 2×2 Hermitian matrix with unit determinant, expressed in the Pauli (real-quaternion) basis.
IdxToMixQubits
A separable multi-qubit mixed state, where each qubit is independently in a mixed state.
IdxToNorm
A separable multi-qubit product state defined over an index interval.
LocalOps
Represents a tensor product of local 2×2 complex operators acting on specific qubit indices.
MixPair
A mixed single-qubit state formed by a probabilistic mixture of a normalized state and its orthogonal complement.
MixQubit
A mixed single-qubit state with bra/ket orientation.
NormPair
Canonical normalized amplitudes representing a single-qubit pure state.
NormQubit
A normalized single-qubit state in canonical form with orientation.
RawMat
Struct representing a raw 2x2 complex matrix.
RealQuaternion
Represents a 2×2 Hermitian matrix using the Pauli (complex-quaternion) basis.
Rk1KB
A general rank-1 matrix of the formM = scalar × |ket⟩⟨bra|.
Rk1PN
A rank-1 operator (projector or nilpotent) constructed from a normalized qubit state.
SepQubits
A separable multi-qubit product state with bra/ket orientation.

Enums§

BraKet
Enum representing the side of a state vector.
Det1
Represents a 2×2 complex matrix with unit determinant, expressed in the Pauli basis.
ProNil
Enum representing a type of rank-1 operator: either a projector or a nilpotent.
Rank1
Enum representing a general rank-1 matrix operator.
RankOneTwo
Represents a 2×2 complex matrix of rank 1 or 2, in a compact structured form.

Functions§

key_interval_or
Returns the inclusive interval [min, max] spanned by the keys of a BTreeMap. Falls back to default if the map is empty.
swap_btree_entries
Swaps the values at keys i and j in a BTreeMap if either is present. No effect if both keys are absent.