pub struct Dual<V, A = V> {
pub value: V,
pub adjoint: A,
}Expand description
Dual variable for forward-mode autodifferentiation over aegir buffers.
This struct can be used as a simple container for a value and its adjoint (as we do within this crate). Alternatively, it can be used as a lightweight implementation of the “augmented algebra” commonly found in autodifferentiation libraries. It is by no means exhaustive, but may come in handy for some applications.
Fields§
§value: VThe value associated with the dual number.
adjoint: AThe gradient/adjoint associated with the dual number.
Implementations§
Trait Implementations§
impl<V: Copy, A: Copy> Copy for Dual<V, A>
impl<V, A> StructuralPartialEq for Dual<V, A>
Auto Trait Implementations§
impl<V, A> Freeze for Dual<V, A>
impl<V, A> RefUnwindSafe for Dual<V, A>where
V: RefUnwindSafe,
A: RefUnwindSafe,
impl<V, A> Send for Dual<V, A>
impl<V, A> Sync for Dual<V, A>
impl<V, A> Unpin for Dual<V, A>
impl<V, A> UnwindSafe for Dual<V, A>where
V: UnwindSafe,
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more