pub trait CustomNumeric:
Sealed
+ Copy
+ Debug
+ PartialOrd
+ Display
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ Div<Output = Self>
+ Neg<Output = Self>
+ Zero
+ ComplexField<RealField = Self> {
// Required methods
fn from_f64_unchecked(x: f64) -> Self;
fn convert_from<U>(value: U) -> Self
where U: CustomNumeric + 'static;
fn to_f64(self) -> f64;
fn epsilon() -> Self;
fn pi() -> Self;
fn max(self, other: Self) -> Self;
fn min(self, other: Self) -> Self;
fn exp_m1(self) -> Self;
}Expand description
Custom numeric trait for high-precision numerical computation
This trait provides the essential numeric operations needed for gauss module and matrix_from_gauss functions. Supports both f64 and Df64 types.
Uses standard traits for common operations:
- num_traits::Zero for zero()
- simba::scalar::ComplexField for mathematical functions (abs, sqrt, cos, sin, exp, etc.)
- ComplexField::is_finite() for is_finite()
It is implemented for f64 and Df64 only (sealed), so that methods can
be added without breaking code that uses it. Both are real:
ComplexField::abs returns Self.
Required Methods§
Sourcefn from_f64_unchecked(x: f64) -> Self
fn from_f64_unchecked(x: f64) -> Self
Convert from f64 to Self (direct conversion, no Option)
This is a static method that can be called as T::from_f64_unchecked(x) Renamed to avoid conflict with num_traits::FromPrimitive::from_f64
Sourcefn convert_from<U>(value: U) -> Selfwhere
U: CustomNumeric + 'static,
fn convert_from<U>(value: U) -> Selfwhere
U: CustomNumeric + 'static,
Convert from any CustomNumeric type to Self (generic conversion)
This allows conversion between different numeric types while preserving precision. Can be called as T::convert_from(other_numeric_value)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl CustomNumeric for Compensated<f64, f64>
Df64 implementation of CustomNumeric
impl CustomNumeric for Compensated<f64, f64>
Df64 implementation of CustomNumeric
fn from_f64_unchecked(x: f64) -> Compensated<f64, f64>
fn convert_from<U>(value: U) -> Compensated<f64, f64>where
U: CustomNumeric + 'static,
fn to_f64(self) -> f64
fn epsilon() -> Compensated<f64, f64>
fn pi() -> Compensated<f64, f64>
fn max(self, other: Compensated<f64, f64>) -> Compensated<f64, f64>
fn min(self, other: Compensated<f64, f64>) -> Compensated<f64, f64>
fn exp_m1(self) -> Compensated<f64, f64>
Source§impl CustomNumeric for f64
f64 implementation of CustomNumeric
impl CustomNumeric for f64
f64 implementation of CustomNumeric