pub trait LinalgScalar:
Scalar
+ Sub<Output = Self>
+ Neg<Output = Self>
+ Div<Output = Self>
+ NumCast
+ Debug
+ 'static {
type Real: LinalgScalar<Real = Self::Real, Complex = Self::Complex> + Float;
type Complex: LinalgScalar<Real = Self::Real, Complex = Self::Complex>;
// Required methods
fn abs_real(&self) -> Self::Real;
fn real_epsilon() -> Self::Real;
fn conj(&self) -> Self;
fn from_parts(real: Self::Real, imag: Self::Real) -> Self;
fn real_part(&self) -> Self::Real;
fn imag_part(&self) -> Self::Real;
// Provided method
fn from_real(real: Self::Real) -> Self { ... }
}Expand description
Scalar types supported by linalg kernel contracts.
§Examples
use tenferro_linalg_prims::LinalgScalar;
fn needs_linalg_scalar<T: LinalgScalar>(x: T) -> T { x }
assert_eq!(needs_linalg_scalar(1.0_f64), 1.0);Required Associated Types§
type Real: LinalgScalar<Real = Self::Real, Complex = Self::Complex> + Float
type Complex: LinalgScalar<Real = Self::Real, Complex = Self::Complex>
Required Methods§
Sourcefn real_epsilon() -> Self::Real
fn real_epsilon() -> Self::Real
Return a reasonable machine epsilon for the associated real field.
Sourcefn from_parts(real: Self::Real, imag: Self::Real) -> Self
fn from_parts(real: Self::Real, imag: Self::Real) -> Self
Build a scalar from explicit real/imaginary parts.
Provided Methods§
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.