Skip to main content

MultiDual

Struct MultiDual 

Source
pub struct MultiDual<const N: usize> {
    pub real: f64,
    pub dual: [f64; N],
}
Expand description

A real value carrying N simultaneous derivative lanes.

See the module docs for why the lanes are bit-identical to N separate tang::Dual evaluations.

Fields§

§real: f64

The value.

§dual: [f64; N]

The derivative in each seeded direction.

Implementations§

Source§

impl<const N: usize> MultiDual<N>

Source

pub fn constant(real: f64) -> Self

A constant: value with every derivative zero.

Source

pub fn var(real: f64, k: usize) -> Self

A variable seeded in lane k: ∂self/∂(lane k) = 1, all others zero.

Panics if k >= N, which is a programming error rather than a runtime condition — a lane index out of range means the chunking is wrong.

Source

pub fn new(real: f64, dual: [f64; N]) -> Self

Construct with explicit derivatives.

Trait Implementations§

Source§

impl<const N: usize> Add for MultiDual<N>

Source§

type Output = MultiDual<N>

The resulting type after applying the + operator.
Source§

fn add(self, o: Self) -> Self

Performs the + operation. Read more
Source§

impl<const N: usize> AddAssign for MultiDual<N>

Source§

fn add_assign(&mut self, o: Self)

Performs the += operation. Read more
Source§

impl<const N: usize> Clone for MultiDual<N>

Source§

fn clone(&self) -> MultiDual<N>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const N: usize> Copy for MultiDual<N>

Source§

impl<const N: usize> Debug for MultiDual<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Default for MultiDual<N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const N: usize> Display for MultiDual<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Div for MultiDual<N>

Source§

type Output = MultiDual<N>

The resulting type after applying the / operator.
Source§

fn div(self, o: Self) -> Self

Performs the / operation. Read more
Source§

impl<const N: usize> DivAssign for MultiDual<N>

Source§

fn div_assign(&mut self, o: Self)

Performs the /= operation. Read more
Source§

impl<const N: usize> Mul for MultiDual<N>

Source§

type Output = MultiDual<N>

The resulting type after applying the * operator.
Source§

fn mul(self, o: Self) -> Self

Performs the * operation. Read more
Source§

impl<const N: usize> MulAssign for MultiDual<N>

Source§

fn mul_assign(&mut self, o: Self)

Performs the *= operation. Read more
Source§

impl<const N: usize> Neg for MultiDual<N>

Source§

type Output = MultiDual<N>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<const N: usize> PartialEq for MultiDual<N>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<const N: usize> PartialOrd for MultiDual<N>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<const N: usize> Scalar for MultiDual<N>

Source§

const ZERO: Self

Source§

const ONE: Self

Source§

const TWO: Self

Source§

const HALF: Self

Source§

const PI: Self

Source§

const TAU: Self

Source§

const FRAC_PI_2: Self

Source§

const EPSILON: Self

Source§

const INFINITY: Self

Source§

const NEG_INFINITY: Self

Source§

fn sqrt(self) -> Self

Source§

fn abs(self) -> Self

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn acos(self) -> Self

Source§

fn atan2(self, other: Self) -> Self

Source§

fn sin_cos(self) -> (Self, Self)

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, lo: Self, hi: Self) -> Self

Source§

fn recip(self) -> Self

Source§

fn powi(self, n: i32) -> Self

Source§

fn copysign(self, sign: Self) -> Self

Source§

fn signum(self) -> Self

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn exp(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn powf(self, p: Self) -> Self

Source§

fn tanh(self) -> Self

Source§

fn sinh(self) -> Self

Source§

fn cosh(self) -> Self

Source§

fn acosh(self) -> Self

Source§

fn asinh(self) -> Self

Source§

fn atanh(self) -> Self

Source§

fn from_f64(v: f64) -> Self

Source§

fn to_f64(self) -> f64

Source§

fn from_i32(v: i32) -> Self

Source§

fn select(cond: Self, a: Self, b: Self) -> Self

Branchless select: returns a if cond > 0, else b.
Source§

fn alg_add(self, other: Self) -> Self

Reassociable add: with the algebraic feature on f32/f64 the compiler may reorder/vectorize chains of these (result varies by ~1 ulp per element vs strict order). Defaults to strict + so Dual, Interval, and non-feature builds are bit-identical to today.
Source§

fn alg_sub(self, other: Self) -> Self

Reassociable sub — see Scalar::alg_add.
Source§

fn alg_mul(self, other: Self) -> Self

Reassociable mul — see Scalar::alg_add.
Source§

impl<const N: usize> Sub for MultiDual<N>

Source§

type Output = MultiDual<N>

The resulting type after applying the - operator.
Source§

fn sub(self, o: Self) -> Self

Performs the - operation. Read more
Source§

impl<const N: usize> SubAssign for MultiDual<N>

Source§

fn sub_assign(&mut self, o: Self)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<const N: usize> Freeze for MultiDual<N>
where [f64; N]: Freeze,

§

impl<const N: usize> RefUnwindSafe for MultiDual<N>
where [f64; N]: RefUnwindSafe,

§

impl<const N: usize> Send for MultiDual<N>
where [f64; N]: Send,

§

impl<const N: usize> Sync for MultiDual<N>
where [f64; N]: Sync,

§

impl<const N: usize> Unpin for MultiDual<N>
where [f64; N]: Unpin,

§

impl<const N: usize> UnsafeUnpin for MultiDual<N>
where [f64; N]: UnsafeUnpin,

§

impl<const N: usize> UnwindSafe for MultiDual<N>
where [f64; N]: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.