Trait easy_ml::differentiation::record_operations::SwappedOperations[][src]

pub trait SwappedOperations<Lhs = Self> {
    type Output;
    fn sub_swapped(self, lhs: Lhs) -> Self::Output;
fn div_swapped(self, lhs: Lhs) -> Self::Output; }

A trait which defines subtraction and division with the arguments swapped around, ie 5.sub_swapped(7) would equal 2. This trait is only implemented for Records and constant operations.

Addition and Multiplication are not included because argument order doesn’t matter for those operations, so you can just swap the left and right and get the same result.

Implementations for Trace are not included because you can just lift a constant to a Trace with ease. While you can lift constants to Records with ease too, these operations allow for the avoidance of storing the constant on the WengertList which saves memory.

Associated Types

Loading content...

Required methods

fn sub_swapped(self, lhs: Lhs) -> Self::Output[src]

fn div_swapped(self, lhs: Lhs) -> Self::Output[src]

Loading content...

Implementors

impl<'a, T: Numeric + Primitive> SwappedOperations<&'_ T> for &Record<'a, T> where
    &'t T: NumericRef<T>, 
[src]

fn sub_swapped(self, lhs: &T) -> Self::Output[src]

Subtraction for a record and a constant, where the constant is the left hand side, ie C - record.

fn div_swapped(self, lhs: &T) -> Self::Output[src]

Division for a record and a constant, where the constant is the left hand side, ie C / record.

type Output = Record<'a, T>

impl<'a, T: Numeric + Primitive> SwappedOperations<&'_ T> for Record<'a, T> where
    &'t T: NumericRef<T>, 
[src]

fn sub_swapped(self, lhs: &T) -> Self::Output[src]

Subtraction for a record and a constant, where the constant is the left hand side, ie C - record.

fn div_swapped(self, lhs: &T) -> Self::Output[src]

Division for a record and a constant, where the constant is the left hand side, ie C / record.

type Output = Record<'a, T>

impl<'a, T: Numeric + Primitive> SwappedOperations<T> for &Record<'a, T> where
    &'t T: NumericRef<T>, 
[src]

fn sub_swapped(self, lhs: T) -> Self::Output[src]

Subtraction for a record and a constant, where the constant is the left hand side, ie C - record.

fn div_swapped(self, lhs: T) -> Self::Output[src]

Division for a record and a constant, where the constant is the left hand side, ie C / record.

type Output = Record<'a, T>

impl<'a, T: Numeric + Primitive> SwappedOperations<T> for Record<'a, T> where
    &'t T: NumericRef<T>, 
[src]

fn sub_swapped(self, lhs: T) -> Self::Output[src]

Subtraction for a record and a constant, where the constant is the left hand side, ie C - record.

fn div_swapped(self, lhs: T) -> Self::Output[src]

Division for a record and a constant, where the constant is the left hand side, ie C / record.

type Output = Record<'a, T>

Loading content...