pub trait ComplexField:
NumAssign
+ Clone
+ Copy
+ Send
+ Sync
+ Debug
+ Zero
+ One
+ Neg<Output = Self>
+ 'static {
type Real: Float + NumAssign + FromPrimitive + ToPrimitive + Send + Sync + Debug + 'static;
Show 14 methods
// Required methods
fn conj(&self) -> Self;
fn norm_sqr(&self) -> Self::Real;
fn from_real(r: Self::Real) -> Self;
fn from_re_im(re: Self::Real, im: Self::Real) -> Self;
fn re(&self) -> Self::Real;
fn im(&self) -> Self::Real;
fn inv(&self) -> Self;
fn sqrt(&self) -> Self;
// Provided methods
fn norm(&self) -> Self::Real { ... }
fn is_zero_approx(&self, tol: Self::Real) -> bool { ... }
fn vec_dot(x: &Array1<Self>, y: &Array1<Self>) -> Self { ... }
fn vec_norm_sqr(x: &Array1<Self>) -> Self::Real { ... }
fn vec_axpy(alpha: Self, x: &Array1<Self>, y: &mut Array1<Self>) { ... }
fn vec_scale(x: &mut Array1<Self>, alpha: Self) { ... }
}Expand description
Trait for scalar types that can be used in linear algebra operations.
This trait abstracts over real and complex number types, providing a unified interface for operations like conjugation, norm computation, and conversion from real values.
Required Associated Types§
Sourcetype Real: Float + NumAssign + FromPrimitive + ToPrimitive + Send + Sync + Debug + 'static
type Real: Float + NumAssign + FromPrimitive + ToPrimitive + Send + Sync + Debug + 'static
The real number type underlying this field
Required Methods§
Sourcefn from_re_im(re: Self::Real, im: Self::Real) -> Self
fn from_re_im(re: Self::Real, im: Self::Real) -> Self
Create from real and imaginary parts
Provided Methods§
Sourcefn is_zero_approx(&self, tol: Self::Real) -> bool
fn is_zero_approx(&self, tol: Self::Real) -> bool
Check if this is approximately zero
Sourcefn vec_norm_sqr(x: &Array1<Self>) -> Self::Real
fn vec_norm_sqr(x: &Array1<Self>) -> Self::Real
Squared vector norm: Σ |x_i|²
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.