Struct easy_ml::differentiation::Record [−][src]
A wrapper around a real number which records it going through the computational graph. This is used to perform Reverse Mode Automatic Differentiation.
Panics
Every operation and nearly every method a Record has involves manipulating the record’s history on its referenced WengertList. This WengertList itself maintains a RefCell which tracks borrows at runtime rather than compile time. This is neccessary to maintain the illusion that Records are just ordinary numbers, and the side effects of doing arithmetic with Records are limited to their referenced WengertList. Hence, the Rust compiler infers that it is not safe to share references to WengertLists between threads, nor transfer Records across threads. If you called a method on two Records that both mutably borrowed from the same WengertList at once, which could be trivially done with multiple threads, then the code would panic. Easy ML shouldn’t allow you to do this in safe Rust because each mutable borrow of the WengertList is dropped at the end of each Record method call, and you can’t call two methods simulatenously without threading.
Acknowledgments
A tutorial by Rufflewind and the associated MIT licensed soure code were invaluable in providing understanding on how to implement Reverse Mode Automatic Differentiation.
Fields
number: T
The real number
index: usize
The index of this number in its WengertList. The first entry will be 0, the next 1 and so on.
In normal use cases you should not need to read this field, you can index Derivatives directly with Records.
Implementations
impl<'a, T: Numeric + Primitive> Record<'a, T>
[src]
impl<'a, T: Numeric + Primitive> Record<'a, T>
[src]The main set of methods for using Record types for Reverse Differentiation.
The general steps are
- create a
WengertList
- create variables from this list
- do operations on the variables
- from the output you want to compute derivatives for call
.derivatives()
- index the
Derivatives
object with the index variables to get the derivatives with respect to each input - if you want to make another pass call
clear()
on theWengertList
and then callreset()
on all of the variables to forget the gradients already computed (the order ofclear
thenreset
is very important!).
Constants can be used to save memory if you have numbers that you do not need to compute the gradients with respect to.
pub fn constant(c: T) -> Record<'a, T>
[src]
pub fn constant(c: T) -> Record<'a, T>
[src]Creates an untracked Record which has no backing WengertList.
This is provided for using constants along with Records in operations.
For example with y = x + 4 the computation graph could be conceived as a y node with parent nodes of x and 4 combined with the operation +. However there is no need to record the derivatives of a constant, so instead the computation graph can be conceived as a y node with a single parent node of x and the unary operation of +4.
This is also used for the type level constructors required by Numeric which are also considered constants.
pub fn variable(x: T, history: &'a WengertList<T>) -> Record<'a, T>
[src]
pub fn variable(x: T, history: &'a WengertList<T>) -> Record<'a, T>
[src]Creates a record backed by the provided WengertList.
The record cannot live longer than the WengertList, hence the following example does not compile
use easy_ml::differentiation::Record; use easy_ml::differentiation::WengertList; let record = { let list = WengertList::new(); Record::variable(1.0, &list) }; // list no longer in scope
You can alternatively use the record constructor on the WengertList type.
impl<'a, T: Numeric + Primitive> Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Record<'a, T> where
&'t T: NumericRef<T>,
[src]pub fn derivatives(&self) -> Derivatives<T>
[src]
pub fn derivatives(&self) -> Derivatives<T>
[src]Performs a backward pass up this record’s WengertList from this record as the output, computing all the derivatives for the inputs involving this output.
If you have N inputs x1 to xN, and this output is y, then this computes all the derivatives δy/δxi for i = 1 to N.
Panics
Panics if the Record has no backing WengertList, ie it was created as a constant.
impl<'a, T: Numeric + Primitive> Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Record<'a, T> where
&'t T: NumericRef<T>,
[src]pub fn unary(
&self,
fx: impl Fn(T) -> T,
dfx_dx: impl Fn(T) -> T
) -> Record<'_, T>
[src]
pub fn unary(
&self,
fx: impl Fn(T) -> T,
dfx_dx: impl Fn(T) -> T
) -> Record<'_, T>
[src]Creates a new Record from a reference to an existing Record by applying some unary function to it which operates on the type the Record wraps.
To compute the new record, the unary function of some input x to some output y is needed along with its derivative with respect to its input x.
For example, tanh is a commonly used activation function, but the Real trait does not include this operation and Record has no operations for it specifically. However, you can use this function to compute the tanh of a Record like so:
use easy_ml::differentiation::{Record, WengertList}; let list = WengertList::new(); let x = Record::variable(0.7f32, &list); // the derivative of tanh(x) is sech(x) * sech(x) which is equivalent to // 1 / (cosh(x) * cosh(x)) let y = x.unary(|x| x.tanh(), |x| 1.0 / (x.cosh() * x.cosh())); assert_eq!(y.derivatives()[&x], 1.0f32 / (0.7f32.cosh() * 0.7f32.cosh()));
pub fn binary(
&self,
rhs: &Record<'a, T>,
fxy: impl Fn(T, T) -> T,
dfxy_dx: impl Fn(T, T) -> T,
dfxy_dy: impl Fn(T, T) -> T
) -> Record<'_, T>
[src]
pub fn binary(
&self,
rhs: &Record<'a, T>,
fxy: impl Fn(T, T) -> T,
dfxy_dx: impl Fn(T, T) -> T,
dfxy_dy: impl Fn(T, T) -> T
) -> Record<'_, T>
[src]Creates a new Record from a reference to two existing Records by applying some binary function to them which operates on two arguments of the type the Records wrap.
To compute the new record, the binary function of some inputs x and y to some output z is needed along with its derivative with respect to its first input x and its derivative with respect to its second input y.
For example, atan2 takes two arguments, but the Real trait does not include this operation and Record has no operations for it specifically. However, you can use this function to compute the atan2 of two Records like so:
use easy_ml::differentiation::{Record, WengertList}; let list = WengertList::new(); let x = Record::variable(3.0f32, &list); let y = Record::variable(3.0f32, &list); // the derivative of atan2 with respect to x is y/(x*x + y*y) // https://www.wolframalpha.com/input/?i=d%28atan2%28x%2Cy%29%29%2Fdx // the derivative of atan2 with respect to y is -x/(x*x + y*y) // https://www.wolframalpha.com/input/?i=d%28atan2%28x%2Cy%29%29%2Fdy let z = x.binary(&y, |x, y| x.atan2(y), |x, y| y/((x*x) + (y*y)), |x, y| -x/((x*x) + (y*y)) ); let derivatives = z.derivatives(); let dx = derivatives[&x]; let dy = derivatives[&y];
Trait Implementations
impl<'a, T: Numeric + Primitive> Add<&'_ Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Add<&'_ Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type with the right referenced.
impl<'a, T: Numeric + Primitive> Add<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Add<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Addition for a record and a constant of the same type with both referenced.
impl<'a, T: Numeric + Primitive> Add<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Add<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type with the right referenced.
impl<'a, 'l, 'r, T: Numeric + Primitive> Add<&'r Record<'a, T>> for &'l Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, 'l, 'r, T: Numeric + Primitive> Add<&'r Record<'a, T>> for &'l Record<'a, T> where
&'t T: NumericRef<T>,
[src]Addition for two records of the same type with both referenced and both using the same WengertList.
impl<'a, T: Numeric + Primitive> Add<Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Add<Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type.
impl<'a, T: Numeric + Primitive> Add<Record<'a, T>> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Add<Record<'a, T>> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type with the left referenced.
impl<'a, T: Numeric + Primitive> Add<T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Add<T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type.
impl<'a, T: Numeric + Primitive> Add<T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Add<T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type with the left referenced.
impl<'a, T: Clone + Primitive> Clone for Record<'a, T>
[src]
impl<'a, T: Clone + Primitive> Clone for Record<'a, T>
[src]Any record of a Cloneable type implements clone
impl<'a, T: Numeric + Real + Primitive> Cos for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Cos for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Cosine of a Record by reference.
impl<'a, T: Numeric + Real + Primitive> Cos for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Cos for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a record by value.
impl<'a, T: Display + Primitive> Display for Record<'a, T>
[src]
impl<'a, T: Display + Primitive> Display for Record<'a, T>
[src]A record is displayed by showing its number component.
impl<'a, T: Numeric + Primitive> Div<&'_ Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Div<&'_ Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type with the right referenced.
impl<'a, T: Numeric + Primitive> Div<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Div<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Division for a record and a constant of the same type with both referenced.
impl<'a, T: Numeric + Primitive> Div<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Div<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type with the right referenced.
impl<'a, 'l, 'r, T: Numeric + Primitive> Div<&'r Record<'a, T>> for &'l Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, 'l, 'r, T: Numeric + Primitive> Div<&'r Record<'a, T>> for &'l Record<'a, T> where
&'t T: NumericRef<T>,
[src]Dvision for two records of the same type with both referenced and both using the same WengertList.
impl<'a, T: Numeric + Primitive> Div<Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Div<Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type.
impl<'a, T: Numeric + Primitive> Div<Record<'a, T>> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Div<Record<'a, T>> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type with the left referenced.
impl<'a, T: Numeric + Primitive> Div<T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Div<T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type.
impl<'a, T: Numeric + Primitive> Div<T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Div<T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type with the left referenced.
impl<'a, T: Numeric + Real + Primitive> Exp for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Exp for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Exponential, ie ex of a Record by reference.
impl<'a, T: Numeric + Real + Primitive> Exp for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Exp for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a record by value.
impl<'a, T: Numeric + Primitive> FromUsize for Record<'a, T>
[src]
impl<'a, T: Numeric + Primitive> FromUsize for Record<'a, T>
[src]fn from_usize(n: usize) -> Option<Record<'a, T>>
[src]
impl<'a, T: Primitive> Index<&'_ Record<'a, T>> for Derivatives<T>
[src]
impl<'a, T: Primitive> Index<&'_ Record<'a, T>> for Derivatives<T>
[src]impl<'a, T: Numeric + Real + Primitive> Ln for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Ln for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Natural logarithm, ie ln(x) of a Record by reference.
impl<'a, T: Numeric + Real + Primitive> Ln for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Ln for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a record by value.
impl<'a, T: Numeric + Primitive> Mul<&'_ Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Mul<&'_ Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type with the right referenced.
impl<'a, T: Numeric + Primitive> Mul<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Mul<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Multiplication for a record and a constant of the same type with both referenced.
impl<'a, T: Numeric + Primitive> Mul<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Mul<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type with the right referenced.
impl<'a, 'l, 'r, T: Numeric + Primitive> Mul<&'r Record<'a, T>> for &'l Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, 'l, 'r, T: Numeric + Primitive> Mul<&'r Record<'a, T>> for &'l Record<'a, T> where
&'t T: NumericRef<T>,
[src]Multiplication for two records of the same type with both referenced and both using the same WengertList.
impl<'a, T: Numeric + Primitive> Mul<Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Mul<Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type.
impl<'a, T: Numeric + Primitive> Mul<Record<'a, T>> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Mul<Record<'a, T>> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type with the left referenced.
impl<'a, T: Numeric + Primitive> Mul<T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Mul<T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type.
impl<'a, T: Numeric + Primitive> Mul<T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Mul<T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type with the left referenced.
impl<'a, T: Numeric + Primitive> Neg for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Neg for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Negation of a record by reference.
impl<'a, T: Numeric + Primitive> Neg for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Neg for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Negation of a record by value.
impl<'a, T: PartialEq + Primitive> PartialEq<Record<'a, T>> for Record<'a, T>
[src]
impl<'a, T: PartialEq + Primitive> PartialEq<Record<'a, T>> for Record<'a, T>
[src]Any record of a PartialEq type implements PartialEq
Note that as a Record is intended to be substitutable with its type T only the number parts of the record are compared.
impl<'a, T: PartialOrd + Primitive> PartialOrd<Record<'a, T>> for Record<'a, T>
[src]
impl<'a, T: PartialOrd + Primitive> PartialOrd<Record<'a, T>> for Record<'a, T>
[src]Any record of a PartialOrd type implements PartialOrd
Note that as a Record is intended to be substitutable with its type T only the number parts of the record are compared.
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<'a, T: Numeric + Real + Primitive> Pow<&'_ Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<&'_ Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for two records of the same type with the right referenced.
impl<'a, T: Numeric + Real + Primitive> Pow<&'_ Record<'a, T>> for &T where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<&'_ Record<'a, T>> for &T where
&'t T: NumericRef<T> + RealRef<T>,
[src]Power of a constant to a Record of the same type with both referenced.
impl<'a, T: Numeric + Real + Primitive> Pow<&'_ Record<'a, T>> for T where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<&'_ Record<'a, T>> for T where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a constant and a record of the same type with the right referenced.
impl<'a, T: Numeric + Real + Primitive> Pow<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Power of one Record to a constant of the same type with both referenced.
impl<'a, T: Numeric + Real + Primitive> Pow<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a record and a constant of the same type with the right referenced.
impl<'a, 'l, 'r, T: Numeric + Real + Primitive> Pow<&'r Record<'a, T>> for &'l Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, 'l, 'r, T: Numeric + Real + Primitive> Pow<&'r Record<'a, T>> for &'l Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Power of one Record to another, ie self^rhs for two records of the same type with both referenced and both using the same WengertList.
impl<'a, T: Numeric + Real + Primitive> Pow<Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for two records of the same type.
impl<'a, T: Numeric + Real + Primitive> Pow<Record<'a, T>> for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<Record<'a, T>> for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for two records of the same type with the left referenced.
impl<'a, T: Numeric + Real + Primitive> Pow<Record<'a, T>> for T where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<Record<'a, T>> for T where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a constant and a record of the same type.
impl<'a, T: Numeric + Real + Primitive> Pow<Record<'a, T>> for &T where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<Record<'a, T>> for &T where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a constant and a record of the same type with the left referenced.
impl<'a, T: Numeric + Real + Primitive> Pow<T> for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<T> for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a record and a constant of the same type.
impl<'a, T: Numeric + Real + Primitive> Pow<T> for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Pow<T> for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a record and a constant of the same type with the left referenced.
impl<'a, T: Numeric + Real + Primitive> Sin for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Sin for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Sine of a Record by reference.
impl<'a, T: Numeric + Real + Primitive> Sin for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Sin for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a record by value.
impl<'a, T: Numeric + Real + Primitive> Sqrt for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Sqrt for &Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Square root of a Record by reference.
impl<'a, T: Numeric + Real + Primitive> Sqrt for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]
impl<'a, T: Numeric + Real + Primitive> Sqrt for Record<'a, T> where
&'t T: NumericRef<T> + RealRef<T>,
[src]Operation for a record by value.
impl<'a, T: Numeric + Primitive> Sub<&'_ Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Sub<&'_ Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type with the right referenced.
impl<'a, T: Numeric + Primitive> Sub<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Sub<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Subtraction for a record and a constant of the same type with both referenced.
impl<'a, T: Numeric + Primitive> Sub<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Sub<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type with the right referenced.
impl<'a, 'l, 'r, T: Numeric + Primitive> Sub<&'r Record<'a, T>> for &'l Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, 'l, 'r, T: Numeric + Primitive> Sub<&'r Record<'a, T>> for &'l Record<'a, T> where
&'t T: NumericRef<T>,
[src]Subtraction for two records of the same type with both referenced and both using the same WengertList.
impl<'a, T: Numeric + Primitive> Sub<Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Sub<Record<'a, T>> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type.
impl<'a, T: Numeric + Primitive> Sub<Record<'a, T>> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Sub<Record<'a, T>> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for two records of the same type with the left referenced.
impl<'a, T: Numeric + Primitive> Sub<T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Sub<T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type.
impl<'a, T: Numeric + Primitive> Sub<T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
impl<'a, T: Numeric + Primitive> Sub<T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]Operation for a record and a constant of the same type with the left referenced.
impl<'a, T: Numeric + Primitive> Sum<Record<'a, T>> for Record<'a, T>
[src]
impl<'a, T: Numeric + Primitive> Sum<Record<'a, T>> for Record<'a, T>
[src]Any record of a Numeric type implements Sum, which is the same as adding a bunch of Record types together.
impl<'a, T: Numeric + Primitive> SwappedOperations<&'_ T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
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]
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]
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.
impl<'a, T: Numeric + Primitive> SwappedOperations<&'_ T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
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]
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]
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.
impl<'a, T: Numeric + Primitive> SwappedOperations<T> for &Record<'a, T> where
&'t T: NumericRef<T>,
[src]
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]
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]
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.
impl<'a, T: Numeric + Primitive> SwappedOperations<T> for Record<'a, T> where
&'t T: NumericRef<T>,
[src]
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]
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]
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.
impl<'a, T: Copy + Primitive> Copy for Record<'a, T>
[src]
Any record of a Copy type implements Copy
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for Record<'a, T>
impl<'a, T> !Send for Record<'a, T>
impl<'a, T> !Sync for Record<'a, T>
impl<'a, T> Unpin for Record<'a, T> where
T: Unpin,
T: Unpin,
impl<'a, T> !UnwindSafe for Record<'a, T>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<'a, '_, T> Pow<&'_ Record<'a, T>> for T where
T: Numeric + Real + Primitive,
&'t T: for<'t> NumericRef<T>,
&'t T: for<'t> RealRef<T>,
[src]
impl<'a, '_, T> Pow<&'_ Record<'a, T>> for T where
T: Numeric + Real + Primitive,
&'t T: for<'t> NumericRef<T>,
&'t T: for<'t> RealRef<T>,
[src]impl<'a, '_, T> Pow<&'_ Record<'a, T>> for T where
T: Numeric + Real + Primitive,
&'t T: for<'t> NumericRef<T>,
&'t T: for<'t> RealRef<T>,
[src]
impl<'a, '_, T> Pow<&'_ Record<'a, T>> for T where
T: Numeric + Real + Primitive,
&'t T: for<'t> NumericRef<T>,
&'t T: for<'t> RealRef<T>,
[src]impl<'a, T> Pow<Record<'a, T>> for T where
T: Numeric + Real + Primitive,
&'t T: for<'t> NumericRef<T>,
&'t T: for<'t> RealRef<T>,
[src]
impl<'a, T> Pow<Record<'a, T>> for T where
T: Numeric + Real + Primitive,
&'t T: for<'t> NumericRef<T>,
&'t T: for<'t> RealRef<T>,
[src]impl<'a, T> Pow<Record<'a, T>> for T where
T: Numeric + Real + Primitive,
&'t T: for<'t> NumericRef<T>,
&'t T: for<'t> RealRef<T>,
[src]
impl<'a, T> Pow<Record<'a, T>> for T where
T: Numeric + Real + Primitive,
&'t T: for<'t> NumericRef<T>,
&'t T: for<'t> RealRef<T>,
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> Numeric for T where
T: NumericByValue<T, T> + for<'a> NumericByValue<&'a T, T> + Clone + ZeroOne + FromUsize + Sum<T> + PartialOrd<T>,
[src]
T: NumericByValue<T, T> + for<'a> NumericByValue<&'a T, T> + Clone + ZeroOne + FromUsize + Sum<T> + PartialOrd<T>,
impl<T, Rhs, Output> NumericByValue<Rhs, Output> for T where
T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Neg<Output = Output>,
[src]
T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Neg<Output = Output>,
impl<RefT, T> NumericRef<T> for RefT where
RefT: NumericByValue<T, T> + for<'a> NumericByValue<&'a T, T>,
[src]
RefT: NumericByValue<T, T> + for<'a> NumericByValue<&'a T, T>,
impl<T> Real for T where
T: RealByValue<T, T> + for<'a> RealByValue<&'a T, T> + Pi,
[src]
T: RealByValue<T, T> + for<'a> RealByValue<&'a T, T> + Pi,
impl<T, Rhs, Output> RealByValue<Rhs, Output> for T where
T: Pow<Rhs, Output = Output> + Ln<Output = Output> + Sqrt<Output = Output> + Sin<Output = Output> + Cos<Output = Output> + Exp<Output = Output>,
[src]
T: Pow<Rhs, Output = Output> + Ln<Output = Output> + Sqrt<Output = Output> + Sin<Output = Output> + Cos<Output = Output> + Exp<Output = Output>,
impl<RefT, T> RealRef<T> for RefT where
RefT: RealByValue<T, T> + for<'a> RealByValue<&'a T, T>,
[src]
RefT: RealByValue<T, T> + for<'a> RealByValue<&'a T, T>,