pub struct DensityMatrix {
pub rho: Vec<Complex<f32>>,
pub dim: usize,
}Expand description
Density matrix ρ stored as a row-major dim×dim complex matrix.
Fields§
§rho: Vec<Complex<f32>>§dim: usizeImplementations§
Source§impl DensityMatrix
impl DensityMatrix
Sourcepub fn from_pure_state(sv: &StateVector) -> Self
pub fn from_pure_state(sv: &StateVector) -> Self
Construct ρ = |ψ⟩⟨ψ| from a pure state vector.
Sourcepub fn apply_unitary(
&mut self,
u: &[Complex<f32>],
dim: usize,
) -> QuantumResult<()>
pub fn apply_unitary( &mut self, u: &[Complex<f32>], dim: usize, ) -> QuantumResult<()>
Apply a unitary U: ρ’ = U ρ U†.
Trait Implementations§
Source§impl Clone for DensityMatrix
impl Clone for DensityMatrix
Source§fn clone(&self) -> DensityMatrix
fn clone(&self) -> DensityMatrix
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DensityMatrix
impl RefUnwindSafe for DensityMatrix
impl Send for DensityMatrix
impl Sync for DensityMatrix
impl Unpin for DensityMatrix
impl UnsafeUnpin for DensityMatrix
impl UnwindSafe for DensityMatrix
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more