pub struct DualVec<T, F, const N: usize> {
pub re: T,
pub eps: StaticVec<T, N>,
/* private fields */
}
Expand description
A dual number for the calculations of gradients or Jacobians.
Fields
re: T
Real part of the dual number
eps: StaticVec<T, N>
Derivative part of the dual number
Implementations
sourceimpl<T, F> DualVec<T, F, 1_usize>
impl<T, F> DualVec<T, F, 1_usize>
sourcepub fn new_scalar(re: T, eps: T) -> Self
pub fn new_scalar(re: T, eps: T) -> Self
Create a new scalar dual number from its fields.
Trait Implementations
sourceimpl<'a, 'b, T: DualNum<F>, F: Float, const N: usize> Add<&'a DualVec<T, F, N>> for &'b DualVec<T, F, N>
impl<'a, 'b, T: DualNum<F>, F: Float, const N: usize> Add<&'a DualVec<T, F, N>> for &'b DualVec<T, F, N>
sourceimpl<T: Copy + AddAssign, F: Float, const N: usize> AddAssign<DualVec<T, F, N>> for DualVec<T, F, N>
impl<T: Copy + AddAssign, F: Float, const N: usize> AddAssign<DualVec<T, F, N>> for DualVec<T, F, N>
sourcefn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the +=
operation. Read more
sourceimpl<T: AddAssign<F>, F: Float, const N: usize> AddAssign<F> for DualVec<T, F, N>
impl<T: AddAssign<F>, F: Float, const N: usize> AddAssign<F> for DualVec<T, F, N>
sourcefn add_assign(&mut self, other: F)
fn add_assign(&mut self, other: F)
Performs the +=
operation. Read more
sourceimpl<'a, 'b, T: DualNum<F>, F: Float, const N: usize> Div<&'a DualVec<T, F, N>> for &'b DualVec<T, F, N>
impl<'a, 'b, T: DualNum<F>, F: Float, const N: usize> Div<&'a DualVec<T, F, N>> for &'b DualVec<T, F, N>
sourceimpl<T: DualNum<F>, F: Float, const N: usize> DivAssign<DualVec<T, F, N>> for DualVec<T, F, N>
impl<T: DualNum<F>, F: Float, const N: usize> DivAssign<DualVec<T, F, N>> for DualVec<T, F, N>
sourcefn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the /=
operation. Read more
sourceimpl<T: DualNum<F>, F: DualNumFloat, const N: usize> DivAssign<F> for DualVec<T, F, N>
impl<T: DualNum<F>, F: DualNumFloat, const N: usize> DivAssign<F> for DualVec<T, F, N>
sourcefn div_assign(&mut self, other: F)
fn div_assign(&mut self, other: F)
Performs the /=
operation. Read more
sourceimpl<T: DualNum<F>, F: Float + FloatConst, const N: usize> FloatConst for DualVec<T, F, N>
impl<T: DualNum<F>, F: Float + FloatConst, const N: usize> FloatConst for DualVec<T, F, N>
sourcefn FRAC_1_SQRT_2() -> Self
fn FRAC_1_SQRT_2() -> Self
Return 1.0 / sqrt(2.0)
.
sourcefn FRAC_2_SQRT_PI() -> Self
fn FRAC_2_SQRT_PI() -> Self
Return 2.0 / sqrt(π)
.
sourceimpl<T: DualNum<F>, F: Float + FromPrimitive, const N: usize> FromPrimitive for DualVec<T, F, N>
impl<T: DualNum<F>, F: Float + FromPrimitive, const N: usize> FromPrimitive for DualVec<T, F, N>
sourcefn from_isize(n: isize) -> Option<Self>
fn from_isize(n: isize) -> Option<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
sourcefn from_i8(n: i8) -> Option<Self>
fn from_i8(n: i8) -> Option<Self>
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
sourcefn from_i16(n: i16) -> Option<Self>
fn from_i16(n: i16) -> Option<Self>
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
sourcefn from_i32(n: i32) -> Option<Self>
fn from_i32(n: i32) -> Option<Self>
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
sourcefn from_i64(n: i64) -> Option<Self>
fn from_i64(n: i64) -> Option<Self>
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
sourcefn from_i128(n: i128) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
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
sourcefn from_usize(n: usize) -> Option<Self>
fn from_usize(n: usize) -> Option<Self>
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
sourcefn from_u8(n: u8) -> Option<Self>
fn from_u8(n: u8) -> Option<Self>
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
sourcefn from_u16(n: u16) -> Option<Self>
fn from_u16(n: u16) -> Option<Self>
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
sourcefn from_u32(n: u32) -> Option<Self>
fn from_u32(n: u32) -> Option<Self>
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
sourcefn from_u64(n: u64) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
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
sourcefn from_u128(n: u128) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
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
sourceimpl<'a, 'b, T: DualNum<F>, F: Float, const N: usize> Mul<&'a DualVec<T, F, N>> for &'b DualVec<T, F, N>
impl<'a, 'b, T: DualNum<F>, F: Float, const N: usize> Mul<&'a DualVec<T, F, N>> for &'b DualVec<T, F, N>
sourceimpl<T: DualNum<F>, F: Float, const N: usize> MulAssign<DualVec<T, F, N>> for DualVec<T, F, N>
impl<T: DualNum<F>, F: Float, const N: usize> MulAssign<DualVec<T, F, N>> for DualVec<T, F, N>
sourcefn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the *=
operation. Read more
sourceimpl<T: DualNum<F>, F: DualNumFloat, const N: usize> MulAssign<F> for DualVec<T, F, N>
impl<T: DualNum<F>, F: DualNumFloat, const N: usize> MulAssign<F> for DualVec<T, F, N>
sourcefn mul_assign(&mut self, other: F)
fn mul_assign(&mut self, other: F)
Performs the *=
operation. Read more
sourceimpl<T: DualNum<F> + Signed, F: Float, const N: usize> Num for DualVec<T, F, N>
impl<T: DualNum<F> + Signed, F: Float, const N: usize> Num for DualVec<T, F, N>
type FromStrRadixErr = F::FromStrRadixErr
sourcefn from_str_radix(
_str: &str,
_radix: u32
) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix(
_str: &str,
_radix: u32
) -> Result<Self, Self::FromStrRadixErr>
Convert from a string and radix (typically 2..=36
). Read more
sourceimpl<T: PartialEq, F: PartialEq, const N: usize> PartialEq<DualVec<T, F, N>> for DualVec<T, F, N>
impl<T: PartialEq, F: PartialEq, const N: usize> PartialEq<DualVec<T, F, N>> for DualVec<T, F, N>
sourceimpl<'a, T: DualNum<F>, F: Float, const N: usize> Product<&'a DualVec<T, F, N>> for DualVec<T, F, N>
impl<'a, T: DualNum<F>, F: Float, const N: usize> Product<&'a DualVec<T, F, N>> for DualVec<T, F, N>
sourceimpl<T, F: Float, const N: usize> RemAssign<DualVec<T, F, N>> for DualVec<T, F, N>
impl<T, F: Float, const N: usize> RemAssign<DualVec<T, F, N>> for DualVec<T, F, N>
sourcefn rem_assign(&mut self, _other: Self)
fn rem_assign(&mut self, _other: Self)
Performs the %=
operation. Read more
sourceimpl<T, F: Float, const N: usize> RemAssign<F> for DualVec<T, F, N>
impl<T, F: Float, const N: usize> RemAssign<F> for DualVec<T, F, N>
sourcefn rem_assign(&mut self, _other: F)
fn rem_assign(&mut self, _other: F)
Performs the %=
operation. Read more
sourceimpl<T: DualNum<F>, F: DualNumFloat, const N: usize> Signed for DualVec<T, F, N>
impl<T: DualNum<F>, F: DualNumFloat, const N: usize> Signed for DualVec<T, F, N>
sourcefn is_positive(&self) -> bool
fn is_positive(&self) -> bool
Returns true if the number is positive and false if the number is zero or negative.
sourcefn is_negative(&self) -> bool
fn is_negative(&self) -> bool
Returns true if the number is negative and false if the number is zero or positive.
sourceimpl<'a, 'b, T: DualNum<F>, F: Float, const N: usize> Sub<&'a DualVec<T, F, N>> for &'b DualVec<T, F, N>
impl<'a, 'b, T: DualNum<F>, F: Float, const N: usize> Sub<&'a DualVec<T, F, N>> for &'b DualVec<T, F, N>
sourceimpl<T: Copy + SubAssign, F: Float, const N: usize> SubAssign<DualVec<T, F, N>> for DualVec<T, F, N>
impl<T: Copy + SubAssign, F: Float, const N: usize> SubAssign<DualVec<T, F, N>> for DualVec<T, F, N>
sourcefn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the -=
operation. Read more
sourceimpl<T: SubAssign<F>, F: Float, const N: usize> SubAssign<F> for DualVec<T, F, N>
impl<T: SubAssign<F>, F: Float, const N: usize> SubAssign<F> for DualVec<T, F, N>
sourcefn sub_assign(&mut self, other: F)
fn sub_assign(&mut self, other: F)
Performs the -=
operation. Read more
sourceimpl<'a, T: DualNum<F>, F: Float, const N: usize> Sum<&'a DualVec<T, F, N>> for DualVec<T, F, N>
impl<'a, T: DualNum<F>, F: Float, const N: usize> Sum<&'a DualVec<T, F, N>> for DualVec<T, F, N>
impl<T: Copy, F: Copy, const N: usize> Copy for DualVec<T, F, N>
impl<T, F, const N: usize> StructuralPartialEq for DualVec<T, F, N>
Auto Trait Implementations
impl<T, F, const N: usize> RefUnwindSafe for DualVec<T, F, N> where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, F, const N: usize> Send for DualVec<T, F, N> where
F: Send,
T: Send,
impl<T, F, const N: usize> Sync for DualVec<T, F, N> where
F: Sync,
T: Sync,
impl<T, F, const N: usize> Unpin for DualVec<T, F, N> where
F: Unpin,
T: Unpin,
impl<T, F, const N: usize> UnwindSafe for DualVec<T, F, N> where
F: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more