Skip to main content

AReal

Struct AReal 

pub struct AReal<T: TapeStorage> {
    value: T,
    pub(crate) slot: u32,
}

Fields§

§value: T§slot: u32

Implementations§

§

impl<T: TapeStorage> AReal<T>

pub fn new(value: T) -> Self

pub fn value(&self) -> T

pub fn set_value(&mut self, v: T)

pub fn slot(&self) -> u32

pub fn should_record(&self) -> bool

pub fn adjoint(&self, tape: &Tape<T>) -> T

pub fn set_adjoint(&self, tape: &mut Tape<T>, value: T)

pub fn input(value: T, tape: &mut Tape<T>) -> AReal<T>

pub fn register(&mut self, tape: &mut Tape<T>)

pub fn register_input(vars: &mut [AReal<T>], tape: &mut Tape<T>)

pub fn register_output(vars: &mut [AReal<T>], tape: &mut Tape<T>)

Trait Implementations§

§

impl<T: TapeStorage> Add for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the + operator.
§

fn add(self, rhs: AReal<T>) -> AReal<T>

Performs the + operation. Read more
§

impl<T: TapeStorage> Add<&AReal<T>> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the + operator.
§

fn add(self, rhs: &AReal<T>) -> AReal<T>

Performs the + operation. Read more
§

impl<T: TapeStorage> Add<&AReal<T>> for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the + operator.
§

fn add(self, rhs: &AReal<T>) -> AReal<T>

Performs the + operation. Read more
§

impl Add<&AReal<f64>> for f64

§

type Output = AReal<f64>

The resulting type after applying the + operator.
§

fn add(self, rhs: &AReal<f64>) -> AReal<f64>

Performs the + operation. Read more
§

impl<T: TapeStorage> Add<AReal<T>> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the + operator.
§

fn add(self, rhs: AReal<T>) -> AReal<T>

Performs the + operation. Read more
§

impl Add<AReal<f64>> for f64

§

type Output = AReal<f64>

The resulting type after applying the + operator.
§

fn add(self, rhs: AReal<f64>) -> AReal<f64>

Performs the + operation. Read more
§

impl<T: TapeStorage> Add<T> for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the + operator.
§

fn add(self, rhs: T) -> AReal<T>

Performs the + operation. Read more
§

impl<T: TapeStorage> Add<T> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the + operator.
§

fn add(self, rhs: T) -> AReal<T>

Performs the + operation. Read more
§

impl<T: TapeStorage> AddAssign for AReal<T>

§

fn add_assign(&mut self, rhs: AReal<T>)

Performs the += operation. Read more
§

impl<T: TapeStorage> AddAssign<&AReal<T>> for AReal<T>

§

fn add_assign(&mut self, rhs: &AReal<T>)

Performs the += operation. Read more
§

impl<T: TapeStorage> AddAssign<T> for AReal<T>

§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
§

impl<T: Clone + TapeStorage> Clone for AReal<T>

§

fn clone(&self) -> AReal<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T: Copy + TapeStorage> Copy for AReal<T>

§

impl<T: TapeStorage> Debug for AReal<T>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl<T: TapeStorage> Default for AReal<T>

§

fn default() -> Self

Returns the “default value” for a type. Read more
§

impl<T: TapeStorage> Display for AReal<T>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl<T: TapeStorage> Div for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the / operator.
§

fn div(self, rhs: AReal<T>) -> AReal<T>

Performs the / operation. Read more
§

impl<T: TapeStorage> Div<&AReal<T>> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the / operator.
§

fn div(self, rhs: &AReal<T>) -> AReal<T>

Performs the / operation. Read more
§

impl<T: TapeStorage> Div<&AReal<T>> for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the / operator.
§

fn div(self, rhs: &AReal<T>) -> AReal<T>

Performs the / operation. Read more
§

impl Div<&AReal<f64>> for f64

§

type Output = AReal<f64>

The resulting type after applying the / operator.
§

fn div(self, rhs: &AReal<f64>) -> AReal<f64>

Performs the / operation. Read more
§

impl<T: TapeStorage> Div<AReal<T>> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the / operator.
§

fn div(self, rhs: AReal<T>) -> AReal<T>

Performs the / operation. Read more
§

impl Div<AReal<f64>> for f64

§

type Output = AReal<f64>

The resulting type after applying the / operator.
§

fn div(self, rhs: AReal<f64>) -> AReal<f64>

Performs the / operation. Read more
§

impl<T: TapeStorage> Div<T> for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the / operator.
§

fn div(self, rhs: T) -> AReal<T>

Performs the / operation. Read more
§

impl<T: TapeStorage> Div<T> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the / operator.
§

fn div(self, rhs: T) -> AReal<T>

Performs the / operation. Read more
§

impl<T: TapeStorage> DivAssign for AReal<T>

§

fn div_assign(&mut self, rhs: AReal<T>)

Performs the /= operation. Read more
§

impl<T: TapeStorage> DivAssign<&AReal<T>> for AReal<T>

§

fn div_assign(&mut self, rhs: &AReal<T>)

Performs the /= operation. Read more
§

impl<T: TapeStorage> DivAssign<T> for AReal<T>

§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
§

impl<T: TapeStorage> From<T> for AReal<T>

§

fn from(value: T) -> Self

Converts to this type from the input type.
§

impl From<i32> for AReal<f64>

§

fn from(value: i32) -> Self

Converts to this type from the input type.
§

impl LiftParams for AReal<f64>

§

fn lift(stored: &[f64]) -> Cow<'_, [Self]>

This mode’s view of stored. Read more
§

impl<T: TapeStorage> Mul for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: AReal<T>) -> AReal<T>

Performs the * operation. Read more
§

impl<T: TapeStorage> Mul<&AReal<T>> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: &AReal<T>) -> AReal<T>

Performs the * operation. Read more
§

impl<T: TapeStorage> Mul<&AReal<T>> for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: &AReal<T>) -> AReal<T>

Performs the * operation. Read more
§

impl Mul<&AReal<f64>> for f64

§

type Output = AReal<f64>

The resulting type after applying the * operator.
§

fn mul(self, rhs: &AReal<f64>) -> AReal<f64>

Performs the * operation. Read more
§

impl<T: TapeStorage> Mul<AReal<T>> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: AReal<T>) -> AReal<T>

Performs the * operation. Read more
§

impl Mul<AReal<f64>> for f64

§

type Output = AReal<f64>

The resulting type after applying the * operator.
§

fn mul(self, rhs: AReal<f64>) -> AReal<f64>

Performs the * operation. Read more
§

impl<T: TapeStorage> Mul<T> for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: T) -> AReal<T>

Performs the * operation. Read more
§

impl<T: TapeStorage> Mul<T> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: T) -> AReal<T>

Performs the * operation. Read more
§

impl<T: TapeStorage> MulAssign for AReal<T>

§

fn mul_assign(&mut self, rhs: AReal<T>)

Performs the *= operation. Read more
§

impl<T: TapeStorage> MulAssign<&AReal<T>> for AReal<T>

§

fn mul_assign(&mut self, rhs: &AReal<T>)

Performs the *= operation. Read more
§

impl<T: TapeStorage> MulAssign<T> for AReal<T>

§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
§

impl<T: TapeStorage> Neg for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the - operator.
§

fn neg(self) -> AReal<T>

Performs the unary - operation. Read more
§

impl<T: TapeStorage> Neg for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the - operator.
§

fn neg(self) -> AReal<T>

Performs the unary - operation. Read more
§

impl<T: TapeStorage> PartialEq for AReal<T>

§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T: TapeStorage> PartialEq<T> for AReal<T>

§

fn eq(&self, other: &T) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T: TapeStorage> PartialOrd for AReal<T>

§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<T: TapeStorage> PartialOrd<T> for AReal<T>

§

fn partial_cmp(&self, other: &T) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl Real for AReal<f64>

§

type Passive = f64

§

fn value(&self) -> f64

§

fn zero() -> Self

§

fn one() -> Self

§

fn powf(&self, exponent: Self) -> Self

§

fn powi(&self, exponent: i32) -> Self

§

fn sum(xs: &[Self]) -> Self

§

fn dot(xs: &[Self], ys: &[Self]) -> Self

§

fn weighted_sum(ws: &[Self::Passive], xs: &[Self]) -> Self

§

fn weighted_dot(ws: &[Self::Passive], xs: &[Self], ys: &[Self]) -> Self

§

fn max(&self, other: &Self) -> Self

§

fn min(&self, other: &Self) -> Self

§

fn sin(&self) -> Self

Sine.
§

fn cos(&self) -> Self

Cosine.
§

fn tan(&self) -> Self

Tangent. f' = 1 + tan², f'' = 2·tan·f'.
§

fn asin(&self) -> Self

Inverse sine. f' = 1/√(1-x²), f'' = x·f'³.
§

fn acos(&self) -> Self

Inverse cosine. f' = -1/√(1-x²), f'' = x·f'³.
§

fn atan(&self) -> Self

Inverse tangent. f' = 1/(1+x²), f'' = -2x·f'².
§

fn sinh(&self) -> Self

Hyperbolic sine.
§

fn cosh(&self) -> Self

Hyperbolic cosine.
§

fn tanh(&self) -> Self

Hyperbolic tangent. f' = 1 - tanh², f'' = -2·tanh·f'.
§

fn asinh(&self) -> Self

Inverse hyperbolic sine. f' = 1/√(x²+1), f'' = -x·f'³.
§

fn acosh(&self) -> Self

Inverse hyperbolic cosine. f' = 1/√(x²-1), f'' = -x·f'³.
§

fn atanh(&self) -> Self

Inverse hyperbolic tangent. f' = 1/(1-x²), f'' = 2x·f'².
§

fn exp(&self) -> Self

Exponential. f = f' = f''.
§

fn exp2(&self) -> Self

Base-2 exponential. f' = f·ln 2, f'' = f·(ln 2)².
§

fn ln(&self) -> Self

Natural logarithm. f' = 1/x, f'' = -1/x².
§

fn log2(&self) -> Self

Base-2 logarithm. f' = 1/(x·ln 2), f'' = -f'/x.
§

fn log10(&self) -> Self

Base-10 logarithm. f' = 1/(x·ln 10), f'' = -f'/x.
§

fn ln_1p(&self) -> Self

ln(1 + x). f' = 1/(1+x), f'' = -f'².
§

fn exp_m1(&self) -> Self

exp(x) - 1. f' = f'' = exp(x) = f + 1.
§

fn sqrt(&self) -> Self

Square root. f' = 1/(2√x), f'' = -1/(4·x·√x).
§

fn cbrt(&self) -> Self

Cube root. f' = 1/(3·f²), f'' = -2/(9·x·f²).
§

fn abs(&self) -> Self

Absolute value. f' = sign(x), f'' = 0 (away from 0). At x = 0 the derivative is not defined; every surface takes the sub-gradient f'(0) = +1 (the x >= 0 branch), matching the winning-branch convention max/min use for payoffs.
§

fn erf(&self) -> Self

Gaussian error function. f' = (2/√π)·e^{-x²}, f'' = -2x·f'.
§

fn erfc(&self) -> Self

Complementary error function 1 - erf(x). f' = -(2/√π)·e^{-x²}.
§

fn norm_cdf(&self) -> Self

Standard normal CDF Φ(x). f' = φ(x), f'' = -x·φ(x).
§

fn norm_pdf(&self) -> Self

Standard normal density φ(x). f' = -x·φ(x), f'' = (x² − 1)·φ(x).
§

fn inv_norm_cdf(&self) -> Self

Inverse standard normal CDF Φ⁻¹(p). f' = 1/φ(f), f'' = f·f'².
§

impl<T: TapeStorage> Sub for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the - operator.
§

fn sub(self, rhs: AReal<T>) -> AReal<T>

Performs the - operation. Read more
§

impl<T: TapeStorage> Sub<&AReal<T>> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the - operator.
§

fn sub(self, rhs: &AReal<T>) -> AReal<T>

Performs the - operation. Read more
§

impl<T: TapeStorage> Sub<&AReal<T>> for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the - operator.
§

fn sub(self, rhs: &AReal<T>) -> AReal<T>

Performs the - operation. Read more
§

impl Sub<&AReal<f64>> for f64

§

type Output = AReal<f64>

The resulting type after applying the - operator.
§

fn sub(self, rhs: &AReal<f64>) -> AReal<f64>

Performs the - operation. Read more
§

impl<T: TapeStorage> Sub<AReal<T>> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the - operator.
§

fn sub(self, rhs: AReal<T>) -> AReal<T>

Performs the - operation. Read more
§

impl Sub<AReal<f64>> for f64

§

type Output = AReal<f64>

The resulting type after applying the - operator.
§

fn sub(self, rhs: AReal<f64>) -> AReal<f64>

Performs the - operation. Read more
§

impl<T: TapeStorage> Sub<T> for AReal<T>

§

type Output = AReal<T>

The resulting type after applying the - operator.
§

fn sub(self, rhs: T) -> AReal<T>

Performs the - operation. Read more
§

impl<T: TapeStorage> Sub<T> for &AReal<T>

§

type Output = AReal<T>

The resulting type after applying the - operator.
§

fn sub(self, rhs: T) -> AReal<T>

Performs the - operation. Read more
§

impl<T: TapeStorage> SubAssign for AReal<T>

§

fn sub_assign(&mut self, rhs: AReal<T>)

Performs the -= operation. Read more
§

impl<T: TapeStorage> SubAssign<&AReal<T>> for AReal<T>

§

fn sub_assign(&mut self, rhs: &AReal<T>)

Performs the -= operation. Read more
§

impl<T: TapeStorage> SubAssign<T> for AReal<T>

§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<T> Freeze for AReal<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for AReal<T>
where T: RefUnwindSafe,

§

impl<T> Send for AReal<T>

§

impl<T> Sync for AReal<T>

§

impl<T> Unpin for AReal<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for AReal<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for AReal<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<R> CopyableReal for R
where R: Real + Copy,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<R> Scalar for R
where R: Real<Passive = f64> + LiftParams + Copy,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.