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.
- Det1
CpxQuaternion - Represents a 2×2 complex matrix with unit determinant, expressed in the Pauli (complex-quaternion) basis.
- Det1
Real Quaternion - Represents a 2×2 Hermitian matrix with unit determinant, expressed in the Pauli (real-quaternion) basis.
- IdxTo
MixQubits - A separable multi-qubit mixed state, where each qubit is independently in a mixed state.
- IdxTo
Norm - A separable multi-qubit product state defined over an index interval.
- Local
Ops - 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.
- Norm
Pair - Canonical normalized amplitudes representing a single-qubit pure state.
- Norm
Qubit - A normalized single-qubit state in canonical form with orientation.
- RawMat
- Struct representing a raw 2x2 complex matrix.
- Real
Quaternion - Represents a 2×2 Hermitian matrix using the Pauli (complex-quaternion) basis.
- Rk1KB
- A general rank-1 matrix of the form
M = 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.
- Rank
OneTwo - 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 todefaultif the map is empty. - swap_
btree_ entries - Swaps the values at keys
iandjin a BTreeMap if either is present. No effect if both keys are absent.