pub struct DualVec<T, F, const N: usize> {
pub re: T,
pub eps: StaticVec<T, N>,
// some fields omitted
}Expand description
A dual number for the calculations of gradients or Jacobians.
Real part of the dual number
Derivative part of the dual number
Create a new dual number from its fields.
Create a new scalar dual number from its fields.
Create a new dual number from the real part.
Derive a scalar dual number, i.e. set the derivative part to 1.
let x = Dual64::from_re(5.0).derive().powi(2);
assert_eq!(x.re, 25.0);
assert_eq!(x.eps[0], 10.0);
The resulting type after applying the + operator.
The resulting type after applying the + operator.
The resulting type after applying the + operator.
The resulting type after applying the + operator.
The resulting type after applying the + operator.
fn add(self, other: F) -> Self
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The resulting type after applying the / operator.
The resulting type after applying the / operator.
The resulting type after applying the / operator.
The resulting type after applying the / operator.
The resulting type after applying the / operator.
fn div(self, other: F) -> Self
Highest derivative that can be calculated with this struct
Real part (0th derivative) of the number
fn scale(&mut self, f: F)
Multiply the number with the scalar f inplace.
Reciprocal (inverse) of a number 1/x.
Power with integer exponent x^n
fn powf(&self, n: F) -> Self
Power with real exponent x^n
Exponential with base 2 2^x
Exponential minus 1 e^x-1
fn log(&self, base: F) -> Self
Logarithm with arbitrary base
Logarithm on x plus one ln(1+x)
Calculate sine and cosine simultaneously
0th order spherical bessel function of the first kind
1st order spherical bessel function of the first kind
2nd order spherical bessel function of the first kind
fn mul_add(&self, a: Self, b: Self) -> Self
fn powd(&self, exp: &Self) -> Self
Power with dual exponent x^n
Return Archimedes’ constant π.
fn TAU() -> Self where
Self: Add<Self, Output = Self>,
Return the full circle constant τ.
fn LOG10_2() -> Self where
Self: Div<Self, Output = Self>,
fn LOG2_10() -> Self where
Self: Div<Self, Output = Self>,
fn from(float: F) -> Self
Converts an isize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts an i8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts an i16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts an i32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts an i64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts an i128 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts a usize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts an u8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts an u16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts an u32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts an u64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts an u128 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts a f32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
Converts a f64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read more
The result after applying the operator.
Returns the multiplicative inverse of self. Read more
The resulting type after applying the * operator.
The resulting type after applying the * operator.
The resulting type after applying the * operator.
The resulting type after applying the * operator.
The resulting type after applying the * operator.
fn mul(self, other: F) -> Self
The resulting type after applying the - operator.
The resulting type after applying the - operator.
Convert from a string and radix (typically 2..=36). Read more
Returns the multiplicative identity element of Self, 1. Read more
Returns true if self is equal to the multiplicative identity. Read more
Sets self to the multiplicative identity element of Self, 1.
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
Method which takes an iterator and generates Self from the elements by
multiplying the items. Read more
Method which takes an iterator and generates Self from the elements by
multiplying the items. Read more
The resulting type after applying the % operator.
The resulting type after applying the % operator.
The resulting type after applying the % operator.
The resulting type after applying the % operator.
The resulting type after applying the % operator.
fn rem(self, _other: F) -> Self
The positive difference of two numbers. Read more
Returns true if the number is positive and false if the number is zero or negative.
Returns true if the number is negative and false if the number is zero or positive.
The resulting type after applying the - operator.
The resulting type after applying the - operator.
The resulting type after applying the - operator.
The resulting type after applying the - operator.
The resulting type after applying the - operator.
fn sub(self, other: F) -> Self
Method which takes an iterator and generates Self from the elements by
“summing up” the items. Read more
fn sum<I>(iter: I) -> Self where
I: Iterator<Item = Self>,
Method which takes an iterator and generates Self from the elements by
“summing up” the items. Read more
Returns the additive identity element of Self, 0. Read more
Returns true if self is equal to the additive identity.
Sets self to the additive identity element of Self, 0.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,