Trait NumKernel

Source
pub trait NumKernel: RawKernel + Sized {
    type RealPolicy: ValidationPolicyReal<Value = Self::RawReal, Error = <Self::RawReal as RawScalarTrait>::ValidationErrors>;
    type ComplexPolicy: ValidationPolicyComplex<Value = Self::RawComplex, Error = <Self::RawComplex as RawScalarTrait>::ValidationErrors>;
    type Real: RealScalar<RawReal = Self::RawReal>;
    type Complex: ComplexScalar<RealType = Self::Real>;

    const PRECISION: u32;
}
Expand description

Defines a complete numerical kernel, acting as the central configuration point.

This trait is the primary bound for generic functions that need to operate across different numerical backends. It bundles together:

  1. The raw underlying types (e.g., f64) via the RawKernel supertrait.
  2. The specific validation logic for those types.
  3. The precision of the kernel in bits.
  4. The final, high-level Real and Complex validated types.

Required Associated Constants§

Source

const PRECISION: u32

The precision of the kernel in bits (e.g., 53 for f64).

Required Associated Types§

Source

type RealPolicy: ValidationPolicyReal<Value = Self::RawReal, Error = <Self::RawReal as RawScalarTrait>::ValidationErrors>

The validation policy for real numbers.

§Note

The bound on ValidationPolicyReal::Error is a critical architectural choice. It enforces that the error type defined by a policy (RealPolicy::Error) MUST be the same as the canonical validation error type associated with its value (RealPolicy::Value::ValidationErrors). This prevents mismatches and simplifies error handling throughout the library.

Source

type ComplexPolicy: ValidationPolicyComplex<Value = Self::RawComplex, Error = <Self::RawComplex as RawScalarTrait>::ValidationErrors>

The validation policy for complex numbers.

§Note

The bound on ValidationPolicyComplex::Error is a critical architectural choice. It enforces that the error type defined by a policy (ComplexPolicy::Error) MUST be the same as the canonical validation error type associated with its value (ComplexPolicy::Value::ValidationErrors). This prevents mismatches and simplifies error handling throughout the library.

Source

type Real: RealScalar<RawReal = Self::RawReal>

The final, high-level, validated real scalar type for this kernel. This is typically an alias for RealValidated<Self>.

Source

type Complex: ComplexScalar<RealType = Self::Real>

The final, high-level, validated complex scalar type for this kernel. This is typically an alias for ComplexValidated<Self>. The RealType = Self::Real bound ensures the complex type is composed of the corresponding validated real type from the same kernel.

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.

Implementors§

Source§

impl<RawReal: RawRealTrait, const PRECISION: u32> NumKernel for NumKernelStrictFinite<RawReal, PRECISION>
where StrictFinitePolicy<RawReal, PRECISION>: ValidationPolicyReal<Value = RawReal>, StrictFinitePolicy<RawReal::RawComplex, PRECISION>: ValidationPolicyComplex<Value = RawReal::RawComplex>,

Source§

const PRECISION: u32 = PRECISION

Source§

type RealPolicy = StrictFinitePolicy<RawReal, PRECISION>

Source§

type ComplexPolicy = StrictFinitePolicy<<RawReal as RawRealTrait>::RawComplex, PRECISION>

Source§

type Real = RealValidated<NumKernelStrictFinite<RawReal, PRECISION>>

Source§

type Complex = ComplexValidated<NumKernelStrictFinite<RawReal, PRECISION>>

Source§

impl<RawReal: RawRealTrait, const PRECISION: u32> NumKernel for NumKernelStrictFiniteInDebug<RawReal, PRECISION>
where StrictFinitePolicy<RawReal, PRECISION>: ValidationPolicyReal<Value = RawReal>, StrictFinitePolicy<RawReal::RawComplex, PRECISION>: ValidationPolicyComplex<Value = RawReal::RawComplex>,