Skip to main content

RealValue

Trait RealValue 

Source
pub trait RealValue:
    Copy
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + Neg<Output = Self>
    + MulAddExt<Self, Self, Output = Self> {
    const VAL_ZERO: Self;
    const VAL_ONE: Self;

    // Required method
    fn val_trunc(self) -> Self;
}
Expand description

A value usable as the real/imaginary storage of a Complex.

Implemented for f32/f64 and for every Thermite float Vector. The arithmetic below is written once against it and serves both the element level (Complex<f32>) and the vector level (Complex<Vector<R>>). The math library wants the stronger RealFloatVector.

Required Associated Constants§

Source

const VAL_ZERO: Self

The additive identity in this value type.

Source

const VAL_ONE: Self

The multiplicative identity in this value type.

Required Methods§

Source

fn val_trunc(self) -> Self

Truncate towards zero. Used to give Complex a (componentwise) Rem.

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 RealValue for f32

Source§

const VAL_ZERO: Self = 0.0

Source§

const VAL_ONE: Self = 1.0

Source§

fn val_trunc(self) -> Self

Source§

impl RealValue for f64

Source§

const VAL_ZERO: Self = 0.0

Source§

const VAL_ONE: Self = 1.0

Source§

fn val_trunc(self) -> Self

Source§

impl<R: FloatRegister> RealValue for Vector<R>

Source§

const VAL_ZERO: Self = <Self as thermite::prelude::NumericVector>::ZERO

Source§

const VAL_ONE: Self = <Self as thermite::prelude::NumericVector>::ONE

Source§

fn val_trunc(self) -> Self

Source§

impl<V: DualValue, const N: usize> RealValue for Dual<V, N>

Available on crate feature dual only.

Complex<Dual<V, N>>: a complex number whose parts each carry N derivative components, giving forward-mode AD through the complex functions.

Everything here is written against RealValue, which Dual satisfies, so this impl is all it takes. Seeded along the real axis (dz = 1), the dual parts of f(z) are f'(z) for holomorphic f.

Source§

const VAL_ZERO: Self = Self::ZERO

Source§

const VAL_ONE: Self = Self::ONE

Source§

fn val_trunc(self) -> Self

Source§

impl<V: ScalarValue> RealValue for Compensated<V>

Available on crate feature compensated only.

Complex<Compensated<V>>: a complex number whose parts are each a double-double, roughly doubling the mantissa of the complex arithmetic and of every kernel built on it.

Compensated carries no error term of its own through a complex multiply; the compensation is per component, and the cross terms of (a + bi)(c + di) are summed in double-double, which is where the precision comes from.

Source§

const VAL_ZERO: Self

Source§

const VAL_ONE: Self

Source§

fn val_trunc(self) -> Self

Implementors§