Trait Real
pub trait Real:
Clone
+ Debug
+ Display
+ PartialEq
+ PartialOrd
+ From<f64>
+ From<i32>
+ Send
+ Sync
+ 'static
+ Neg<Output = Self>
+ Add<Self, Output = Self>
+ Sub<Self, Output = Self>
+ Mul<Self, Output = Self>
+ Div<Self, Output = Self>
+ Add<Self::Passive, Output = Self>
+ Sub<Self::Passive, Output = Self>
+ Mul<Self::Passive, Output = Self>
+ Div<Self::Passive, Output = Self> {
type Passive: Passive + Add<Self, Output = Self> + Sub<Self, Output = Self> + Mul<Self, Output = Self> + Div<Self, Output = Self>;
Show 38 methods
// Required methods
fn value(&self) -> Self::Passive;
fn zero() -> Self;
fn one() -> Self;
fn powf(&self, exponent: Self) -> Self;
fn powi(&self, exponent: i32) -> Self;
fn sin(&self) -> Self;
fn cos(&self) -> Self;
fn tan(&self) -> Self;
fn asin(&self) -> Self;
fn acos(&self) -> Self;
fn atan(&self) -> Self;
fn sinh(&self) -> Self;
fn cosh(&self) -> Self;
fn tanh(&self) -> Self;
fn asinh(&self) -> Self;
fn acosh(&self) -> Self;
fn atanh(&self) -> Self;
fn exp(&self) -> Self;
fn exp2(&self) -> Self;
fn ln(&self) -> Self;
fn log2(&self) -> Self;
fn log10(&self) -> Self;
fn ln_1p(&self) -> Self;
fn exp_m1(&self) -> Self;
fn sqrt(&self) -> Self;
fn cbrt(&self) -> Self;
fn abs(&self) -> Self;
fn erf(&self) -> Self;
fn erfc(&self) -> Self;
fn norm_cdf(&self) -> Self;
fn norm_pdf(&self) -> Self;
fn inv_norm_cdf(&self) -> 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;
}Required Associated Types§
type Passive: Passive + Add<Self, Output = Self> + Sub<Self, Output = Self> + Mul<Self, Output = Self> + Div<Self, Output = Self>
Required Methods§
fn value(&self) -> Self::Passive
fn zero() -> Self
fn one() -> Self
fn powf(&self, exponent: Self) -> Self
fn powi(&self, exponent: i32) -> Self
fn sin(&self) -> Self
fn sin(&self) -> Self
Sine.
fn cos(&self) -> Self
fn cos(&self) -> Self
Cosine.
fn tan(&self) -> Self
fn tan(&self) -> Self
Tangent. f' = 1 + tan², f'' = 2·tan·f'.
fn asin(&self) -> Self
fn asin(&self) -> Self
Inverse sine. f' = 1/√(1-x²), f'' = x·f'³.
fn acos(&self) -> Self
fn acos(&self) -> Self
Inverse cosine. f' = -1/√(1-x²), f'' = x·f'³.
fn atan(&self) -> Self
fn atan(&self) -> Self
Inverse tangent. f' = 1/(1+x²), f'' = -2x·f'².
fn sinh(&self) -> Self
fn sinh(&self) -> Self
Hyperbolic sine.
fn cosh(&self) -> Self
fn cosh(&self) -> Self
Hyperbolic cosine.
fn tanh(&self) -> Self
fn tanh(&self) -> Self
Hyperbolic tangent. f' = 1 - tanh², f'' = -2·tanh·f'.
fn asinh(&self) -> Self
fn asinh(&self) -> Self
Inverse hyperbolic sine. f' = 1/√(x²+1), f'' = -x·f'³.
fn acosh(&self) -> Self
fn acosh(&self) -> Self
Inverse hyperbolic cosine. f' = 1/√(x²-1), f'' = -x·f'³.
fn atanh(&self) -> Self
fn atanh(&self) -> Self
Inverse hyperbolic tangent. f' = 1/(1-x²), f'' = 2x·f'².
fn exp(&self) -> Self
fn exp(&self) -> Self
Exponential. f = f' = f''.
fn exp2(&self) -> Self
fn exp2(&self) -> Self
Base-2 exponential. f' = f·ln 2, f'' = f·(ln 2)².
fn ln(&self) -> Self
fn ln(&self) -> Self
Natural logarithm. f' = 1/x, f'' = -1/x².
fn log2(&self) -> Self
fn log2(&self) -> Self
Base-2 logarithm. f' = 1/(x·ln 2), f'' = -f'/x.
fn log10(&self) -> Self
fn log10(&self) -> Self
Base-10 logarithm. f' = 1/(x·ln 10), f'' = -f'/x.
fn ln_1p(&self) -> Self
fn ln_1p(&self) -> Self
ln(1 + x). f' = 1/(1+x), f'' = -f'².
fn exp_m1(&self) -> Self
fn exp_m1(&self) -> Self
exp(x) - 1. f' = f'' = exp(x) = f + 1.
fn sqrt(&self) -> Self
fn sqrt(&self) -> Self
Square root. f' = 1/(2√x), f'' = -1/(4·x·√x).
fn cbrt(&self) -> Self
fn cbrt(&self) -> Self
Cube root. f' = 1/(3·f²), f'' = -2/(9·x·f²).
fn abs(&self) -> Self
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
fn erf(&self) -> Self
Gaussian error function. f' = (2/√π)·e^{-x²}, f'' = -2x·f'.
fn erfc(&self) -> Self
fn erfc(&self) -> Self
Complementary error function 1 - erf(x). f' = -(2/√π)·e^{-x²}.
fn norm_cdf(&self) -> Self
fn norm_cdf(&self) -> Self
Standard normal CDF Φ(x). f' = φ(x), f'' = -x·φ(x).
fn norm_pdf(&self) -> Self
fn norm_pdf(&self) -> Self
Standard normal density φ(x). f' = -x·φ(x), f'' = (x² − 1)·φ(x).
fn inv_norm_cdf(&self) -> Self
fn inv_norm_cdf(&self) -> Self
Inverse standard normal CDF Φ⁻¹(p). f' = 1/φ(f), f'' = f·f'².
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".