Trait QuantumComplexExt

Source
pub trait QuantumComplexExt {
    // Required methods
    fn probability(&self) -> f64;
    fn normalize(&self) -> Complex64;
    fn approx_eq(&self, other: &Complex64, tolerance: f64) -> bool;
    fn fidelity(&self, other: &Complex64) -> f64;
}
Expand description

Extension trait for Complex64 that adds quantum-specific operations

Required Methods§

Source

fn probability(&self) -> f64

Calculate the probability (squared magnitude) of a quantum amplitude

Source

fn normalize(&self) -> Complex64

Normalize the complex number to have unit magnitude

Source

fn approx_eq(&self, other: &Complex64, tolerance: f64) -> bool

Check if two complex numbers are approximately equal within tolerance

Source

fn fidelity(&self, other: &Complex64) -> f64

Calculate the fidelity between two quantum amplitudes

Implementations on Foreign Types§

Source§

impl QuantumComplexExt for Complex64

Source§

fn probability(&self) -> f64

Source§

fn normalize(&self) -> Complex64

Source§

fn approx_eq(&self, other: &Complex64, tolerance: f64) -> bool

Source§

fn fidelity(&self, other: &Complex64) -> f64

Implementors§