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;
// 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 { ... }
}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.
§Implementations
Provided for:
Complex64(default for most acoustic applications)Complex32(for memory-constrained applications)f64(for real-valued problems)f32(for real-valued, memory-constrained applications)
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
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.