pub struct HyperDual<T: Numeric> {
pub real: T,
pub eps1: T,
pub eps2: T,
pub eps1eps2: T,
}Expand description
A hyper-dual number real + eps1·ε₁ + eps2·ε₂ + eps1eps2·ε₁ε₂, where ε₁² = ε₂² = 0.
After evaluating a function, real holds the value, eps1/eps2 hold the first
derivatives along each seeded direction, and eps1eps2 holds the second (mixed) derivative.
Fields§
§real: TThe value, f.
eps1: TFirst derivative along direction 1.
eps2: TFirst derivative along direction 2.
eps1eps2: TSecond derivative across the two directions.
Implementations§
Trait Implementations§
Source§impl<T: Numeric> AddAssign for HyperDual<T>
impl<T: Numeric> AddAssign for HyperDual<T>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreimpl<T: Copy + Numeric> Copy for HyperDual<T>
Source§impl<T: Numeric> DivAssign for HyperDual<T>
impl<T: Numeric> DivAssign for HyperDual<T>
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moreSource§impl<T: Numeric> MulAssign for HyperDual<T>
impl<T: Numeric> MulAssign for HyperDual<T>
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl<T: Numeric> Numeric for HyperDual<T>
impl<T: Numeric> Numeric for HyperDual<T>
Source§fn abs(self) -> Self
fn abs(self) -> Self
Derivative of |x| is its sign (the subgradient at zero is +1); its second derivative
is zero.
Source§fn ln(self) -> Self
fn ln(self) -> Self
Defined for real > 0; at 0 the value is -inf and the derivatives unbounded.
Source§fn atan2(self, other: Self) -> Self
fn atan2(self, other: Self) -> Self
Four-quadrant arctangent carried to second order. With Y = self.real,
X = other.real, r² = X² + Y², the partials are f_Y = X/r², f_X = −Y/r²,
f_YY = −2XY/r⁴, f_XX = 2XY/r⁴, f_XY = (Y² − X²)/r⁴. The r² denominator is
nonzero off the origin, so the x = 0 axis is handled; only X = Y = 0 degenerates,
as for float atan2.
Source§fn copysign(self, sign: Self) -> Self
fn copysign(self, sign: Self) -> Self
Magnitude of self with the sign of sign: a linear scaling by ±1, so it rides the
univariate chain helper with slope s and zero curvature.
Source§fn is_finite(self) -> bool
fn is_finite(self) -> bool
Reflects the real part only; a finite value can still carry a non-finite derivative
(e.g. from sqrt(0) or ln(0)).
Source§const NEG_INFINITY: Self
const NEG_INFINITY: Self
Source§const MIN_POSITIVE: Self
const MIN_POSITIVE: Self
Source§fn from_f64(value: f64) -> Self
fn from_f64(value: f64) -> Self
f64, narrowing if necessary. Used for table values and literals.Source§fn from_usize(value: usize) -> Self
fn from_usize(value: usize) -> Self
usize, e.g. a point or variable count.Source§fn hypot(self, other: Self) -> Self
fn hypot(self, other: Self) -> Self
√(self² + other²), scaled to avoid overflow and underflow.Source§fn powf(self, n: Self) -> Self
fn powf(self, n: Self) -> Self
self raised to a floating-point power, via exp(n · ln self). Defined for
self > 0; the f32/f64 impls override for negative bases and edge cases.