Ad

Struct Ad 

Source
pub struct Ad<const N: usize> { /* private fields */ }
Expand description

Automatic differentiation value tracking first and second derivatives

§Value getters:

  • value() -> f64: Returns the current numerical value
  • grad() -> SVector<f64, N>: Returns the gradient vector
  • hess() -> SMatrix<f64, N, N>: Returns the Hessian matrix

§Type Parameters

  • N - The dimension of the input space (number of variables)

§Fields (private)

  • value - The current value of the function
  • grad - The gradient (first derivatives) as a vector
  • hess - The Hessian matrix (second derivatives)

Implementations§

Source§

impl<const N: usize> Ad<N>

Source

pub fn neg(&self) -> Self

Source

pub fn sqrt(&self) -> Self

Source

pub fn square(&self) -> Self

Source

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

Examples found in repository?
src/examples/mass_spring.rs (line 20)
14    fn eval(&self, variables: &raddy::types::advec<4, 4>, _: &()) -> raddy::Ad<4> {
15        let p1 = advec::<4, 2>::new(variables[0].clone(), variables[1].clone());
16        let p2 = advec::<4, 2>::new(variables[2].clone(), variables[3].clone());
17
18        let len = (p2 - p1).norm();
19        // Hooke's law
20        let potential = val::scalar(0.5 * self.k) * (len - val::scalar(self.restlen)).powi(2);
21
22        potential
23    }
Source

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

Source

pub fn abs(&self) -> Self

Source

pub fn exp(&self) -> Self

Source

pub fn ln(&self) -> Self

Examples found in repository?
src/examples/basic.rs (line 17)
9fn main() {
10    // 1.
11    // ################ scalar ################
12    let mut rng = thread_rng();
13    let val = rng.gen_range(0.0..10.0);
14
15    let var = var::scalar(val);
16    let var = &var;
17    let y = var.sin() * var + var.ln();
18    let g = val * val.cos() + val.sin() + val.recip();
19    let h = -val * val.sin() + 2.0 * val.cos() - val.powi(-2);
20
21    assert_abs_diff_eq!(y.grad()[(0, 0)], g, epsilon = EPS);
22    assert_abs_diff_eq!(y.hess()[(0, 0)], h, epsilon = EPS);
23
24    // 2.
25    // ############################# Matrix #############################
26
27    const N_TEST_MAT_4: usize = 4;
28    type NaConst = Const<N_TEST_MAT_4>;
29    const N_VEC_4: usize = N_TEST_MAT_4 * N_TEST_MAT_4;
30
31    let vals: &[f64] = &(0..N_VEC_4)
32        .map(|_| rng.gen_range(-4.0..4.0))
33        .collect::<Vec<_>>();
34
35    let s: SVector<Ad<N_VEC_4>, N_VEC_4> = var::vector_from_slice(vals);
36    let z = s
37        .clone()
38        // This reshape is COL MAJOR!!!!!!!!!!!!!
39        .reshape_generic(NaConst {}, NaConst {})
40        .transpose();
41
42    let det = z.determinant();
43    let _grad = det.grad();
44    let _hess = det.hess();
45    // core logic ends ####################################################
46
47    // correctness
48    // let expected_grad = grad_det4(
49    //     vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], vals[8], vals[9],
50    //     vals[10], vals[11], vals[12], vals[13], vals[14], vals[15],
51    // );
52    // let g_diff = (expected_grad - det.grad()).norm_squared();
53    // assert_abs_diff_eq!(g_diff, 0.0, epsilon = EPS);
54
55    // let expected_hess = hess_det4(
56    //     vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], vals[8], vals[9],
57    //     vals[10], vals[11], vals[12], vals[13], vals[14], vals[15],
58    // );
59    // let h_diff = (det.hess() - expected_hess).norm_squared();
60    // assert_abs_diff_eq!(h_diff, 0.0, epsilon = EPS);
61}
Source

pub fn log(&self, base: f64) -> Self

Source

pub fn log2(&self) -> Self

Source

pub fn log10(&self) -> Self

Source

pub fn sin(&self) -> Self

Examples found in repository?
src/examples/basic.rs (line 17)
9fn main() {
10    // 1.
11    // ################ scalar ################
12    let mut rng = thread_rng();
13    let val = rng.gen_range(0.0..10.0);
14
15    let var = var::scalar(val);
16    let var = &var;
17    let y = var.sin() * var + var.ln();
18    let g = val * val.cos() + val.sin() + val.recip();
19    let h = -val * val.sin() + 2.0 * val.cos() - val.powi(-2);
20
21    assert_abs_diff_eq!(y.grad()[(0, 0)], g, epsilon = EPS);
22    assert_abs_diff_eq!(y.hess()[(0, 0)], h, epsilon = EPS);
23
24    // 2.
25    // ############################# Matrix #############################
26
27    const N_TEST_MAT_4: usize = 4;
28    type NaConst = Const<N_TEST_MAT_4>;
29    const N_VEC_4: usize = N_TEST_MAT_4 * N_TEST_MAT_4;
30
31    let vals: &[f64] = &(0..N_VEC_4)
32        .map(|_| rng.gen_range(-4.0..4.0))
33        .collect::<Vec<_>>();
34
35    let s: SVector<Ad<N_VEC_4>, N_VEC_4> = var::vector_from_slice(vals);
36    let z = s
37        .clone()
38        // This reshape is COL MAJOR!!!!!!!!!!!!!
39        .reshape_generic(NaConst {}, NaConst {})
40        .transpose();
41
42    let det = z.determinant();
43    let _grad = det.grad();
44    let _hess = det.hess();
45    // core logic ends ####################################################
46
47    // correctness
48    // let expected_grad = grad_det4(
49    //     vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], vals[8], vals[9],
50    //     vals[10], vals[11], vals[12], vals[13], vals[14], vals[15],
51    // );
52    // let g_diff = (expected_grad - det.grad()).norm_squared();
53    // assert_abs_diff_eq!(g_diff, 0.0, epsilon = EPS);
54
55    // let expected_hess = hess_det4(
56    //     vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], vals[8], vals[9],
57    //     vals[10], vals[11], vals[12], vals[13], vals[14], vals[15],
58    // );
59    // let h_diff = (det.hess() - expected_hess).norm_squared();
60    // assert_abs_diff_eq!(h_diff, 0.0, epsilon = EPS);
61}
Source

pub fn cos(&self) -> Self

Source

pub fn tan(&self) -> Self

Source

pub fn asin(&self) -> Self

Source

pub fn acos(&self) -> Self

Source

pub fn atan(&self) -> Self

👎Deprecated: Please use atan2 instead.
Source

pub fn sinh(&self) -> Self

Source

pub fn cosh(&self) -> Self

Source

pub fn tanh(&self) -> Self

Source

pub fn asinh(&self) -> Self

Source

pub fn acosh(&self) -> Self

Source

pub fn atanh(&self) -> Self

Source§

impl<const N: usize> Ad<N>

Source

pub fn add_value(&self, other: f64) -> Self

Source

pub fn sub_value(&self, other: f64) -> Self

Source

pub fn mul_value(&self, other: f64) -> Self

Source

pub fn recip(&self) -> Self

Source

pub fn div_value(&self, other: f64) -> Self

Source

pub fn atan2(&self, x: &Self) -> Self

§self is y
Source

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

Source

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

Source

pub fn clamp(&self, low: &Self, high: &Self) -> Self

Source

pub fn hypot(&self, other: &Self) -> Self

Source§

impl<const N: usize> Ad<N>

Source

pub fn value(&self) -> f64

Returns the current value of the AD variable

Source

pub fn grad(&self) -> SVector<f64, L>

Returns the gradient (first derivatives) of the AD variable

§Returns

The gradient (A vector containing the partial derivatives with respect to each input variable).

Examples found in repository?
src/examples/basic.rs (line 21)
9fn main() {
10    // 1.
11    // ################ scalar ################
12    let mut rng = thread_rng();
13    let val = rng.gen_range(0.0..10.0);
14
15    let var = var::scalar(val);
16    let var = &var;
17    let y = var.sin() * var + var.ln();
18    let g = val * val.cos() + val.sin() + val.recip();
19    let h = -val * val.sin() + 2.0 * val.cos() - val.powi(-2);
20
21    assert_abs_diff_eq!(y.grad()[(0, 0)], g, epsilon = EPS);
22    assert_abs_diff_eq!(y.hess()[(0, 0)], h, epsilon = EPS);
23
24    // 2.
25    // ############################# Matrix #############################
26
27    const N_TEST_MAT_4: usize = 4;
28    type NaConst = Const<N_TEST_MAT_4>;
29    const N_VEC_4: usize = N_TEST_MAT_4 * N_TEST_MAT_4;
30
31    let vals: &[f64] = &(0..N_VEC_4)
32        .map(|_| rng.gen_range(-4.0..4.0))
33        .collect::<Vec<_>>();
34
35    let s: SVector<Ad<N_VEC_4>, N_VEC_4> = var::vector_from_slice(vals);
36    let z = s
37        .clone()
38        // This reshape is COL MAJOR!!!!!!!!!!!!!
39        .reshape_generic(NaConst {}, NaConst {})
40        .transpose();
41
42    let det = z.determinant();
43    let _grad = det.grad();
44    let _hess = det.hess();
45    // core logic ends ####################################################
46
47    // correctness
48    // let expected_grad = grad_det4(
49    //     vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], vals[8], vals[9],
50    //     vals[10], vals[11], vals[12], vals[13], vals[14], vals[15],
51    // );
52    // let g_diff = (expected_grad - det.grad()).norm_squared();
53    // assert_abs_diff_eq!(g_diff, 0.0, epsilon = EPS);
54
55    // let expected_hess = hess_det4(
56    //     vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], vals[8], vals[9],
57    //     vals[10], vals[11], vals[12], vals[13], vals[14], vals[15],
58    // );
59    // let h_diff = (det.hess() - expected_hess).norm_squared();
60    // assert_abs_diff_eq!(h_diff, 0.0, epsilon = EPS);
61}
Source

pub fn hess(&self) -> SMatrix<f64, RC, RC>

Returns the Hessian matrix (second derivatives) of the AD variable

§Returns

The hessian.

Examples found in repository?
src/examples/basic.rs (line 22)
9fn main() {
10    // 1.
11    // ################ scalar ################
12    let mut rng = thread_rng();
13    let val = rng.gen_range(0.0..10.0);
14
15    let var = var::scalar(val);
16    let var = &var;
17    let y = var.sin() * var + var.ln();
18    let g = val * val.cos() + val.sin() + val.recip();
19    let h = -val * val.sin() + 2.0 * val.cos() - val.powi(-2);
20
21    assert_abs_diff_eq!(y.grad()[(0, 0)], g, epsilon = EPS);
22    assert_abs_diff_eq!(y.hess()[(0, 0)], h, epsilon = EPS);
23
24    // 2.
25    // ############################# Matrix #############################
26
27    const N_TEST_MAT_4: usize = 4;
28    type NaConst = Const<N_TEST_MAT_4>;
29    const N_VEC_4: usize = N_TEST_MAT_4 * N_TEST_MAT_4;
30
31    let vals: &[f64] = &(0..N_VEC_4)
32        .map(|_| rng.gen_range(-4.0..4.0))
33        .collect::<Vec<_>>();
34
35    let s: SVector<Ad<N_VEC_4>, N_VEC_4> = var::vector_from_slice(vals);
36    let z = s
37        .clone()
38        // This reshape is COL MAJOR!!!!!!!!!!!!!
39        .reshape_generic(NaConst {}, NaConst {})
40        .transpose();
41
42    let det = z.determinant();
43    let _grad = det.grad();
44    let _hess = det.hess();
45    // core logic ends ####################################################
46
47    // correctness
48    // let expected_grad = grad_det4(
49    //     vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], vals[8], vals[9],
50    //     vals[10], vals[11], vals[12], vals[13], vals[14], vals[15],
51    // );
52    // let g_diff = (expected_grad - det.grad()).norm_squared();
53    // assert_abs_diff_eq!(g_diff, 0.0, epsilon = EPS);
54
55    // let expected_hess = hess_det4(
56    //     vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], vals[8], vals[9],
57    //     vals[10], vals[11], vals[12], vals[13], vals[14], vals[15],
58    // );
59    // let h_diff = (det.hess() - expected_hess).norm_squared();
60    // assert_abs_diff_eq!(h_diff, 0.0, epsilon = EPS);
61}
Source§

impl Ad<1>

Source

pub fn given_scalar(value: f64, grad: f64, hess: f64) -> Self

Creates an AD scalar with explicitly specified value, gradient and Hessian

§Arguments
  • value - The scalar value
  • grad - The gradient (first derivative)
  • hess - The Hessian (second derivative)
§Returns

A new Ad<1> instance with the specified properties

Source

pub fn active_scalar(value: f64) -> Self

Creates an active scalar AD value with unit gradient

§Arguments
  • value - The scalar value
§Returns

A new Ad<1> instance that is active (gradient = 1.0)

Source§

impl<const N: usize> Ad<N>

Source

pub fn inactive_scalar(value: f64) -> Self

Creates an inactive scalar AD value with zero gradient and Hessian

§Arguments
  • value - The scalar value
§Returns

A new Ad<N> instance that is inactive (gradient = 0)

Source

pub fn inactive_vector<const L: usize>( values: &SVector<f64, N>, ) -> SVector<Self, L>

Creates a vector of inactive AD values from a vector of f64 values

§Arguments
  • values - Input vector of numerical values
§Type Parameters
  • L - Length of the output vector
§Returns

A vector of inactive AD values

Source

pub fn inactive_from_slice<const L: usize>(values: &[f64]) -> SVector<Self, L>

Creates a vector of inactive AD values from a slice of f64 values

§Arguments
  • values - Slice of numerical values
§Type Parameters
  • L - Length of the output vector
§Returns

A vector of inactive AD values

§Panics

If the slice length doesn’t match the input dimension N

Source

pub fn given_vector( value: f64, grad: &SVector<f64, L>, hess: &SMatrix<f64, RC, RC>, ) -> Self

Creates an AD value with explicitly specified value, gradient and Hessian

§Arguments
  • value - The scalar value
  • grad - The gradient vector
  • hess - The Hessian matrix
§Returns

A new Ad<N> instance with the specified properties

Source

pub fn active_vector(vector: &SVector<f64, N>) -> SVector<Self, N>

Creates a vector of active AD values from a vector of f64 values

§Arguments
  • values - Input vector of numerical values
§Returns

A vector of active AD values where each element has unit gradient in its corresponding dimension

Source

pub fn active_from_slice(values: &[f64]) -> SVector<Self, N>

Creates a vector of active AD values from a slice of f64 values

§Arguments
  • values - Slice of numerical values
§Returns

A vector of active AD values

§Panics

If the slice length doesn’t match the input dimension N

Trait Implementations§

Source§

impl<const N: usize> AbsDiffEq for Ad<N>

Source§

type Epsilon = Ad<N>

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
Source§

impl<const N: usize> Add<&Ad<N>> for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Ad<N>) -> Self::Output

Performs the + operation. Read more
Source§

impl<const N: usize> Add<&Ad<N>> for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Ad<N>) -> Self::Output

Performs the + operation. Read more
Source§

impl<const N: usize> Add<Ad<N>> for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Ad<N>) -> Self::Output

Performs the + operation. Read more
Source§

impl<const N: usize> Add for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Ad<N>) -> Self::Output

Performs the + operation. Read more
Source§

impl<const N: usize> AddAssign<&Ad<N>> for Ad<N>

Source§

fn add_assign(&mut self, rhs: &Ad<N>)

Performs the += operation. Read more
Source§

impl<const N: usize> AddAssign for Ad<N>

Source§

fn add_assign(&mut self, rhs: Ad<N>)

Performs the += operation. Read more
Source§

impl<const N: usize> Clone for Ad<N>

Source§

fn clone(&self) -> Ad<N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const N: usize> ComplexField for Ad<N>

Source§

fn from_real(re: Self::RealField) -> Self

Builds a pure-real complex number from the given value.

Source§

fn real(self) -> Self::RealField

The real part of this complex number.

Source§

fn imaginary(self) -> Self::RealField

The imaginary part of this complex number.

Source§

fn modulus(self) -> Self::RealField

The modulus of this complex number.

Source§

fn modulus_squared(self) -> Self::RealField

The squared modulus of this complex number.

Source§

fn argument(self) -> Self::RealField

The argument of this complex number. This should be zero with no grad w.r.t. self, but the use of this method is itself a bug.

Source§

fn norm1(self) -> Self::RealField

The sum of the absolute value of this complex number’s real and imaginary part.

Source§

fn scale(self, factor: Self::RealField) -> Self

Multiplies this complex number by factor.

Source§

fn unscale(self, factor: Self::RealField) -> Self

Divides this complex number by factor.

Source§

fn abs(self) -> Self::RealField

The absolute value of this complex number: self / self.signum().

This is equivalent to self.modulus().

Source§

fn hypot(self, other: Self) -> Self::RealField

Computes (self.conjugate() * self + other.conjugate() * other).sqrt()

Source§

fn conjugate(self) -> Self

Real number has itself as conjugate

Source§

type RealField = Ad<N>

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn trunc(self) -> Self

Source§

fn fract(self) -> Self

Source§

fn mul_add(self, a: Self, b: Self) -> Self

Source§

fn recip(self) -> Self

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn sin_cos(self) -> (Self, Self)

Source§

fn tan(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn acos(self) -> Self

Source§

fn atan(self) -> Self

Source§

fn sinh(self) -> Self

Source§

fn cosh(self) -> Self

Source§

fn tanh(self) -> Self

Source§

fn asinh(self) -> Self

Source§

fn acosh(self) -> Self

Source§

fn atanh(self) -> Self

Source§

fn log(self, base: Self::RealField) -> Self

Source§

fn log2(self) -> Self

Source§

fn log10(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn ln_1p(self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn exp(self) -> Self

Source§

fn exp2(self) -> Self

Source§

fn exp_m1(self) -> Self

Source§

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

Source§

fn powf(self, n: Self::RealField) -> Self

Source§

fn powc(self, n: Self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn is_finite(&self) -> bool

Source§

fn try_sqrt(self) -> Option<Self>

Source§

fn to_polar(self) -> (Self::RealField, Self::RealField)

The polar form of this complex number: (modulus, arg)
Source§

fn to_exp(self) -> (Self::RealField, Self)

The exponential form of this complex number: (modulus, e^{i arg})
Source§

fn signum(self) -> Self

The exponential part of this complex number: self / self.modulus()
Source§

fn sinh_cosh(self) -> (Self, Self)

Source§

fn sinc(self) -> Self

Cardinal sine
Source§

fn sinhc(self) -> Self

Source§

fn cosc(self) -> Self

Cardinal cos
Source§

fn coshc(self) -> Self

Source§

impl<const N: usize> Debug for Ad<N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Display for Ad<N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Div<&Ad<N>> for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Ad<N>) -> Self::Output

Performs the / operation. Read more
Source§

impl<const N: usize> Div<&Ad<N>> for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Ad<N>) -> Self::Output

Performs the / operation. Read more
Source§

impl<const N: usize> Div<Ad<N>> for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Ad<N>) -> Self::Output

Performs the / operation. Read more
Source§

impl<const N: usize> Div for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Ad<N>) -> Self::Output

Performs the / operation. Read more
Source§

impl<const N: usize> DivAssign<&Ad<N>> for Ad<N>

Source§

fn div_assign(&mut self, rhs: &Ad<N>)

Performs the /= operation. Read more
Source§

impl<const N: usize> DivAssign for Ad<N>

Source§

fn div_assign(&mut self, rhs: Ad<N>)

Performs the /= operation. Read more
Source§

impl<const N: usize> FromPrimitive for Ad<N>

Source§

fn from_i64(n: i64) -> Option<Self>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u64(n: u64) -> Option<Self>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Self>

Converts an i128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Self>

Converts an u128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Source§

fn from_f32(n: f32) -> Option<Self>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Self>

Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Source§

impl<const N: usize> Mul<&Ad<N>> for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Ad<N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<&Ad<N>> for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Ad<N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize, const R: usize, const C: usize> Mul<&Matrix<Ad<N>, Const<R>, Const<C>, ArrayStorage<Ad<N>, R, C>>> for &Ad<N>

Source§

type Output = Matrix<Ad<N>, Const<R>, Const<C>, ArrayStorage<Ad<N>, R, C>>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SMatrix<Ad<N>, R, C>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize, const R: usize, const C: usize> Mul<&Matrix<Ad<N>, Const<R>, Const<C>, ArrayStorage<Ad<N>, R, C>>> for Ad<N>

Source§

type Output = Matrix<Ad<N>, Const<R>, Const<C>, ArrayStorage<Ad<N>, R, C>>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SMatrix<Ad<N>, R, C>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Ad<N>> for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Ad<N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize, const R: usize, const C: usize> Mul<Matrix<Ad<N>, Const<R>, Const<C>, ArrayStorage<Ad<N>, R, C>>> for &Ad<N>

Source§

type Output = Matrix<Ad<N>, Const<R>, Const<C>, ArrayStorage<Ad<N>, R, C>>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SMatrix<Ad<N>, R, C>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize, const R: usize, const C: usize> Mul<Matrix<Ad<N>, Const<R>, Const<C>, ArrayStorage<Ad<N>, R, C>>> for Ad<N>

Source§

type Output = Matrix<Ad<N>, Const<R>, Const<C>, ArrayStorage<Ad<N>, R, C>>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SMatrix<Ad<N>, R, C>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Ad<N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> MulAssign<&Ad<N>> for Ad<N>

Source§

fn mul_assign(&mut self, rhs: &Ad<N>)

Performs the *= operation. Read more
Source§

impl<const N: usize> MulAssign for Ad<N>

Source§

fn mul_assign(&mut self, rhs: Ad<N>)

Performs the *= operation. Read more
Source§

impl<const N: usize> Neg for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Ad<N>

Performs the unary - operation. Read more
Source§

impl<const N: usize> Neg for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Ad<N>

Performs the unary - operation. Read more
Source§

impl<const N: usize> Num for Ad<N>

Source§

type FromStrRadixErr = ()

Source§

fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
Source§

impl<const N: usize> One for Ad<N>

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Source§

impl<const N: usize> PartialEq<Ad<N>> for f64

Source§

fn eq(&self, other: &Ad<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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.
Source§

impl<const N: usize> PartialEq<f64> for Ad<N>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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.
Source§

impl<const N: usize> PartialEq for Ad<N>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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.
Source§

impl<const N: usize> PartialOrd<Ad<N>> for f64

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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
Source§

impl<const N: usize> PartialOrd<f64> for Ad<N>

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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
Source§

impl<const N: usize> PartialOrd for Ad<N>

Source§

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 · 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 · 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 · 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 · 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
Source§

impl<const N: usize> RealField for Ad<N>

Source§

fn is_sign_positive(&self) -> bool

Is the sign of this real number positive?
Source§

fn is_sign_negative(&self) -> bool

Is the sign of this real number negative?
Source§

fn copysign(self, sign: Self) -> Self

Copies the sign of sign to self. Read more
Source§

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

Source§

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

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

fn atan2(self, other: Self) -> Self

Source§

fn min_value() -> Option<Self>

The smallest finite positive value representable using this type.
Source§

fn max_value() -> Option<Self>

The largest finite positive value representable using this type.
Source§

fn pi() -> Self

Source§

fn two_pi() -> Self

Source§

fn frac_pi_2() -> Self

Source§

fn frac_pi_3() -> Self

Source§

fn frac_pi_4() -> Self

Source§

fn frac_pi_6() -> Self

Source§

fn frac_pi_8() -> Self

Source§

fn frac_1_pi() -> Self

Source§

fn frac_2_pi() -> Self

Source§

fn frac_2_sqrt_pi() -> Self

Source§

fn e() -> Self

Source§

fn log2_e() -> Self

Source§

fn log10_e() -> Self

Source§

fn ln_2() -> Self

Source§

fn ln_10() -> Self

Source§

impl<const N: usize> RelativeEq for Ad<N>

Source§

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
Source§

impl<const N: usize> Rem<&Ad<N>> for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &Ad<N>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const N: usize> Rem<&Ad<N>> for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &Ad<N>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const N: usize> Rem<Ad<N>> for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Ad<N>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const N: usize> Rem for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Ad<N>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const N: usize> RemAssign<&Ad<N>> for Ad<N>

Source§

fn rem_assign(&mut self, rhs: &Ad<N>)

Performs the %= operation. Read more
Source§

impl<const N: usize> RemAssign for Ad<N>

Source§

fn rem_assign(&mut self, rhs: Ad<N>)

Performs the %= operation. Read more
Source§

impl<const N: usize> Signed for Ad<N>

Source§

fn abs(&self) -> Self

Computes the absolute value. Read more
Source§

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

The positive difference of two numbers. Read more
Source§

fn signum(&self) -> Self

Returns the sign of the number. Read more
Source§

fn is_positive(&self) -> bool

Returns true if the number is positive and false if the number is zero or negative.
Source§

fn is_negative(&self) -> bool

Returns true if the number is negative and false if the number is zero or positive.
Source§

impl<const N: usize> SimdValue for Ad<N>

Source§

const LANES: usize = 1usize

The number of lanes of this SIMD value.
Source§

type Element = Ad<N>

The type of the elements of each lane of this SIMD value.
Source§

type SimdBool = bool

Type of the result of comparing two SIMD values like self.
Source§

fn splat(val: Self::Element) -> Self

Initializes an SIMD value with each lanes set to val.
Source§

fn extract(&self, i: usize) -> Self::Element

Extracts the i-th lane of self. Read more
Source§

unsafe fn extract_unchecked(&self, i: usize) -> Self::Element

Extracts the i-th lane of self without bound-checking. Read more
Source§

fn replace(&mut self, i: usize, val: Self::Element)

Replaces the i-th lane of self by val. Read more
Source§

unsafe fn replace_unchecked(&mut self, i: usize, val: Self::Element)

Replaces the i-th lane of self by val without bound-checking. Read more
Source§

fn select(self, cond: Self::SimdBool, other: Self) -> Self

Merges self and other depending on the lanes of cond. Read more
Source§

fn map_lanes(self, f: impl Fn(Self::Element) -> Self::Element) -> Self
where Self: Clone,

Applies a function to each lane of self. Read more
Source§

fn zip_map_lanes( self, b: Self, f: impl Fn(Self::Element, Self::Element) -> Self::Element, ) -> Self
where Self: Clone,

Applies a function to each lane of self paired with the corresponding lane of b. Read more
Source§

impl<const N: usize> Sub<&Ad<N>> for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Ad<N>) -> Self::Output

Performs the - operation. Read more
Source§

impl<const N: usize> Sub<&Ad<N>> for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Ad<N>) -> Self::Output

Performs the - operation. Read more
Source§

impl<const N: usize> Sub<Ad<N>> for &Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Ad<N>) -> Self::Output

Performs the - operation. Read more
Source§

impl<const N: usize> Sub for Ad<N>

Source§

type Output = Ad<N>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Ad<N>) -> Self::Output

Performs the - operation. Read more
Source§

impl<const N: usize> SubAssign<&Ad<N>> for Ad<N>

Source§

fn sub_assign(&mut self, rhs: &Ad<N>)

Performs the -= operation. Read more
Source§

impl<const N: usize> SubAssign for Ad<N>

Source§

fn sub_assign(&mut self, rhs: Ad<N>)

Performs the -= operation. Read more
Source§

impl<const N: usize> SubsetOf<Ad<N>> for Ad<N>

Source§

fn to_superset(&self) -> Ad<N>

The inclusion map: converts self to the equivalent element of its superset.
Source§

fn from_superset_unchecked(element: &Ad<N>) -> Self

Use with care! Same as self.to_superset but without any property checks. Always succeeds.
Source§

fn is_in_subset(element: &Ad<N>) -> bool

Checks if element is actually part of the subset Self (and can be converted to it).
Source§

fn from_superset(element: &T) -> Option<Self>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

impl<const N: usize> SubsetOf<Ad<N>> for f32

Source§

fn to_superset(&self) -> Ad<N>

The inclusion map: converts self to the equivalent element of its superset.
Source§

fn from_superset_unchecked(element: &Ad<N>) -> Self

Use with care! Same as self.to_superset but without any property checks. Always succeeds.
Source§

fn is_in_subset(element: &Ad<N>) -> bool

Checks if element is actually part of the subset Self (and can be converted to it).
Source§

fn from_superset(element: &T) -> Option<Self>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

impl<const N: usize> SubsetOf<Ad<N>> for f64

Source§

fn to_superset(&self) -> Ad<N>

The inclusion map: converts self to the equivalent element of its superset.
Source§

fn from_superset_unchecked(element: &Ad<N>) -> Self

Use with care! Same as self.to_superset but without any property checks. Always succeeds.
Source§

fn is_in_subset(element: &Ad<N>) -> bool

Checks if element is actually part of the subset Self (and can be converted to it).
Source§

fn from_superset(element: &T) -> Option<Self>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

impl<const N: usize> UlpsEq for Ad<N>

Source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
Source§

fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
Source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of UlpsEq::ulps_eq.
Source§

impl<const N: usize> Zero for Ad<N>

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl<const N: usize> Field for Ad<N>

Auto Trait Implementations§

§

impl<const N: usize> Freeze for Ad<N>

§

impl<const N: usize> RefUnwindSafe for Ad<N>

§

impl<const N: usize> Send for Ad<N>

§

impl<const N: usize> Sync for Ad<N>

§

impl<const N: usize> Unpin for Ad<N>

§

impl<const N: usize> UnwindSafe for Ad<N>

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
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.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SimdComplexField for T
where T: ComplexField,

Source§

type SimdRealField = <T as ComplexField>::RealField

Type of the coefficients of a complex number.
Source§

fn from_simd_real(re: <T as SimdComplexField>::SimdRealField) -> T

Builds a pure-real complex number from the given value.
Source§

fn simd_real(self) -> <T as SimdComplexField>::SimdRealField

The real part of this complex number.
Source§

fn simd_imaginary(self) -> <T as SimdComplexField>::SimdRealField

The imaginary part of this complex number.
Source§

fn simd_modulus(self) -> <T as SimdComplexField>::SimdRealField

The modulus of this complex number.
Source§

fn simd_modulus_squared(self) -> <T as SimdComplexField>::SimdRealField

The squared modulus of this complex number.
Source§

fn simd_argument(self) -> <T as SimdComplexField>::SimdRealField

The argument of this complex number.
Source§

fn simd_norm1(self) -> <T as SimdComplexField>::SimdRealField

The sum of the absolute value of this complex number’s real and imaginary part.
Source§

fn simd_scale(self, factor: <T as SimdComplexField>::SimdRealField) -> T

Multiplies this complex number by factor.
Source§

fn simd_unscale(self, factor: <T as SimdComplexField>::SimdRealField) -> T

Divides this complex number by factor.
Source§

fn simd_to_polar( self, ) -> (<T as SimdComplexField>::SimdRealField, <T as SimdComplexField>::SimdRealField)

The polar form of this complex number: (modulus, arg)
Source§

fn simd_to_exp(self) -> (<T as SimdComplexField>::SimdRealField, T)

The exponential form of this complex number: (modulus, e^{i arg})
Source§

fn simd_signum(self) -> T

The exponential part of this complex number: self / self.modulus()
Source§

fn simd_floor(self) -> T

Source§

fn simd_ceil(self) -> T

Source§

fn simd_round(self) -> T

Source§

fn simd_trunc(self) -> T

Source§

fn simd_fract(self) -> T

Source§

fn simd_mul_add(self, a: T, b: T) -> T

Source§

fn simd_abs(self) -> <T as SimdComplexField>::SimdRealField

The absolute value of this complex number: self / self.signum(). Read more
Source§

fn simd_hypot(self, other: T) -> <T as SimdComplexField>::SimdRealField

Computes (self.conjugate() * self + other.conjugate() * other).sqrt()
Source§

fn simd_recip(self) -> T

Source§

fn simd_conjugate(self) -> T

Source§

fn simd_sin(self) -> T

Source§

fn simd_cos(self) -> T

Source§

fn simd_sin_cos(self) -> (T, T)

Source§

fn simd_sinh_cosh(self) -> (T, T)

Source§

fn simd_tan(self) -> T

Source§

fn simd_asin(self) -> T

Source§

fn simd_acos(self) -> T

Source§

fn simd_atan(self) -> T

Source§

fn simd_sinh(self) -> T

Source§

fn simd_cosh(self) -> T

Source§

fn simd_tanh(self) -> T

Source§

fn simd_asinh(self) -> T

Source§

fn simd_acosh(self) -> T

Source§

fn simd_atanh(self) -> T

Source§

fn simd_sinc(self) -> T

Cardinal sine
Source§

fn simd_sinhc(self) -> T

Source§

fn simd_cosc(self) -> T

Cardinal cos
Source§

fn simd_coshc(self) -> T

Source§

fn simd_log(self, base: <T as SimdComplexField>::SimdRealField) -> T

Source§

fn simd_log2(self) -> T

Source§

fn simd_log10(self) -> T

Source§

fn simd_ln(self) -> T

Source§

fn simd_ln_1p(self) -> T

Source§

fn simd_sqrt(self) -> T

Source§

fn simd_exp(self) -> T

Source§

fn simd_exp2(self) -> T

Source§

fn simd_exp_m1(self) -> T

Source§

fn simd_powi(self, n: i32) -> T

Source§

fn simd_powf(self, n: <T as SimdComplexField>::SimdRealField) -> T

Source§

fn simd_powc(self, n: T) -> T

Source§

fn simd_cbrt(self) -> T

Source§

fn simd_horizontal_sum(self) -> <T as SimdValue>::Element

Computes the sum of all the lanes of self.
Source§

fn simd_horizontal_product(self) -> <T as SimdValue>::Element

Computes the product of all the lanes of self.
Source§

impl<T> SimdPartialOrd for T
where T: SimdValue<Element = T, SimdBool = bool> + PartialOrd,

Source§

fn simd_gt(self, other: T) -> <T as SimdValue>::SimdBool

Lanewise greater than > comparison.
Source§

fn simd_lt(self, other: T) -> <T as SimdValue>::SimdBool

Lanewise less than < comparison.
Source§

fn simd_ge(self, other: T) -> <T as SimdValue>::SimdBool

Lanewise greater or equal >= comparison.
Source§

fn simd_le(self, other: T) -> <T as SimdValue>::SimdBool

Lanewise less or equal <= comparison.
Source§

fn simd_eq(self, other: T) -> <T as SimdValue>::SimdBool

Lanewise equal == comparison.
Source§

fn simd_ne(self, other: T) -> <T as SimdValue>::SimdBool

Lanewise not equal != comparison.
Source§

fn simd_max(self, other: T) -> T

Lanewise max value.
Source§

fn simd_min(self, other: T) -> T

Lanewise min value.
Source§

fn simd_clamp(self, min: T, max: T) -> T

Clamps each lane of self between the corresponding lane of min and max.
Source§

fn simd_horizontal_min(self) -> <T as SimdValue>::Element

The min value among all lanes of self.
Source§

fn simd_horizontal_max(self) -> <T as SimdValue>::Element

The max value among all lanes of self.
Source§

impl<T> SimdRealField for T
where T: RealField,

Source§

impl<T> SimdSigned for T
where T: Signed + SimdValue<SimdBool = bool>,

Source§

fn simd_abs(&self) -> T

The absolute value of each lane of self.
Source§

fn simd_abs_sub(&self, other: &T) -> T

The absolute difference of each lane of self. Read more
Source§

fn simd_signum(&self) -> T

The signum of each lane of Self.
Source§

fn is_simd_positive(&self) -> <T as SimdValue>::SimdBool

Tests which lane is positive.
Source§

fn is_simd_negative(&self) -> <T as SimdValue>::SimdBool

Tests which lane is negative.
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T, Right> ClosedAddAssign<Right> for T
where T: ClosedAdd<Right> + AddAssign<Right>,

Source§

impl<T, Right> ClosedDiv<Right> for T
where T: Div<Right, Output = T> + DivAssign<Right>,

Source§

impl<T, Right> ClosedDivAssign<Right> for T
where T: ClosedDiv<Right> + DivAssign<Right>,

Source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

Source§

impl<T, Right> ClosedMulAssign<Right> for T
where T: ClosedMul<Right> + MulAssign<Right>,

Source§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<T, Right> ClosedSubAssign<Right> for T
where T: ClosedSub<Right> + SubAssign<Right>,

Source§

impl<T> NumAssign for T
where T: Num + NumAssignOps,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T> NumAssignRef for T
where T: NumAssign + for<'r> NumAssignOps<&'r T>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T> NumRef for T
where T: Num + for<'r> NumOps<&'r T>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,