pub struct DensityMatrix5 {
pub entries: [Complex; 25],
}Expand description
5x5 density matrix for the locomotion Hilbert space H_loc = C^5. Basis: |I>=Idle, |M>=Moving, |J>=Jumping, |L>=Landing, |S>=Sprinting.
Hermitian: rho_dag = rho (entries[i][j] = conj(entries[j][i])) Positive semidefinite: all eigenvalues >= 0 Trace 1: sum_k rho_kk = 1
This is the standard density matrix from quantum information theory. Diagonal entries are mode populations. Off-diagonal entries carry coherence.
Fields§
§entries: [Complex; 25]Flat 5x5 complex entries. entries[i*5+j] = rho_{ij}.
Implementations§
Source§impl DensityMatrix5
impl DensityMatrix5
Sourcepub fn pure_state(k: usize) -> Self
pub fn pure_state(k: usize) -> Self
Pure state |k><k| — all population in mode k.
Sourcepub fn from_state_vector(amplitudes: &[Complex; 5]) -> Self
pub fn from_state_vector(amplitudes: &[Complex; 5]) -> Self
Create from a state vector (5 complex amplitudes). rho = |psi><psi| where |psi> = sum alpha_k |k>
Sourcepub fn populations(&self) -> [f32; 5]
pub fn populations(&self) -> [f32; 5]
Diagonal populations (mode probabilities).
Sourcepub fn coherence_magnitude(&self) -> f32
pub fn coherence_magnitude(&self) -> f32
Total off-diagonal coherence magnitude: sum_{i<j} |rho_{ij}|
Sourcepub fn apply_dephasing(&mut self, epsilon: f32)
pub fn apply_dephasing(&mut self, epsilon: f32)
Partial dephasing channel: rho -> (1-eps)rho + eps*Delta(rho). eps in [0,1]. eps=0: no change. eps=1: full dephasing.
Sourcepub fn apply_unitary(&mut self, u: &[Complex; 25])
pub fn apply_unitary(&mut self, u: &[Complex; 25])
Apply unitary evolution: rho -> U * rho * U_dag. U is a 5x5 complex matrix (flat, row-major).