ndarray_linalg::types

Trait Scalar

pub trait Scalar:
    NumAssign
    + FromPrimitive
    + NumCast
    + Neg<Output = Self>
    + Copy
    + Clone
    + Display
    + Debug
    + LowerExp
    + UpperExp
    + Sum
    + Product
    + Serialize
    + for<'de> Deserialize<'de>
    + 'static {
    type Real: Scalar<Real = Self::Real, Complex = Self::Complex> + NumOps + Float;
    type Complex: Scalar<Real = Self::Real, Complex = Self::Complex> + NumOps<Self::Real> + NumOps;

Show 37 methods // Required methods fn real<T>(re: T) -> Self::Real where T: ToPrimitive; fn complex<T>(re: T, im: T) -> Self::Complex where T: ToPrimitive; fn from_real(re: Self::Real) -> Self; fn add_real(self, re: Self::Real) -> Self; fn sub_real(self, re: Self::Real) -> Self; fn mul_real(self, re: Self::Real) -> Self; fn div_real(self, re: Self::Real) -> Self; fn add_complex(self, im: Self::Complex) -> Self::Complex; fn sub_complex(self, im: Self::Complex) -> Self::Complex; fn mul_complex(self, im: Self::Complex) -> Self::Complex; fn div_complex(self, im: Self::Complex) -> Self::Complex; fn pow(self, n: Self) -> Self; fn powi(self, n: i32) -> Self; fn powf(self, n: Self::Real) -> Self; fn powc(self, n: Self::Complex) -> Self::Complex; fn re(&self) -> Self::Real; fn im(&self) -> Self::Real; fn as_c(&self) -> Self::Complex; fn conj(&self) -> Self; fn abs(self) -> Self::Real; fn square(self) -> Self::Real; fn sqrt(self) -> Self; fn exp(self) -> Self; fn ln(self) -> 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 rand(rng: &mut impl Rng) -> Self;
}

Required Associated Types§

type Real: Scalar<Real = Self::Real, Complex = Self::Complex> + NumOps + Float

type Complex: Scalar<Real = Self::Real, Complex = Self::Complex> + NumOps<Self::Real> + NumOps

Required Methods§

fn real<T>(re: T) -> Self::Real
where T: ToPrimitive,

Create a new real number

fn complex<T>(re: T, im: T) -> Self::Complex
where T: ToPrimitive,

Create a new complex number

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

fn add_real(self, re: Self::Real) -> Self

fn sub_real(self, re: Self::Real) -> Self

fn mul_real(self, re: Self::Real) -> Self

fn div_real(self, re: Self::Real) -> Self

fn add_complex(self, im: Self::Complex) -> Self::Complex

fn sub_complex(self, im: Self::Complex) -> Self::Complex

fn mul_complex(self, im: Self::Complex) -> Self::Complex

fn div_complex(self, im: Self::Complex) -> Self::Complex

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

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

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

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

fn re(&self) -> Self::Real

Real part

fn im(&self) -> Self::Real

Imaginary part

fn as_c(&self) -> Self::Complex

As a complex number

fn conj(&self) -> Self

Complex conjugate

fn abs(self) -> Self::Real

Absolute value

fn square(self) -> Self::Real

Sqaure of absolute value

fn sqrt(self) -> Self

fn exp(self) -> Self

fn ln(self) -> 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 rand(rng: &mut impl Rng) -> Self

Generate an random number from rand::distributions::Standard

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl Scalar for f32

§

type Real = f32

§

type Complex = Complex<f32>

§

fn re(&self) -> <f32 as Scalar>::Real

§

fn im(&self) -> <f32 as Scalar>::Real

§

fn from_real(re: <f32 as Scalar>::Real) -> f32

§

fn pow(self, n: f32) -> f32

§

fn powi(self, n: i32) -> f32

§

fn powf(self, n: <f32 as Scalar>::Real) -> f32

§

fn powc(self, n: <f32 as Scalar>::Complex) -> <f32 as Scalar>::Complex

§

fn real<T>(re: T) -> <f32 as Scalar>::Real
where T: ToPrimitive,

§

fn complex<T>(re: T, im: T) -> <f32 as Scalar>::Complex
where T: ToPrimitive,

§

fn as_c(&self) -> <f32 as Scalar>::Complex

§

fn conj(&self) -> f32

§

fn square(self) -> <f32 as Scalar>::Real

§

fn rand(rng: &mut impl Rng) -> f32

§

fn add_real(self, re: <f32 as Scalar>::Real) -> f32

§

fn sub_real(self, re: <f32 as Scalar>::Real) -> f32

§

fn mul_real(self, re: <f32 as Scalar>::Real) -> f32

§

fn div_real(self, re: <f32 as Scalar>::Real) -> f32

§

fn add_complex(self, im: <f32 as Scalar>::Complex) -> <f32 as Scalar>::Complex

§

fn sub_complex(self, im: <f32 as Scalar>::Complex) -> <f32 as Scalar>::Complex

§

fn mul_complex(self, im: <f32 as Scalar>::Complex) -> <f32 as Scalar>::Complex

§

fn div_complex(self, im: <f32 as Scalar>::Complex) -> <f32 as Scalar>::Complex

§

fn sqrt(self) -> f32

§

fn abs(self) -> f32

§

fn exp(self) -> f32

§

fn ln(self) -> f32

§

fn sin(self) -> f32

§

fn cos(self) -> f32

§

fn tan(self) -> f32

§

fn sinh(self) -> f32

§

fn cosh(self) -> f32

§

fn tanh(self) -> f32

§

fn asin(self) -> f32

§

fn acos(self) -> f32

§

fn atan(self) -> f32

§

fn asinh(self) -> f32

§

fn acosh(self) -> f32

§

fn atanh(self) -> f32

§

impl Scalar for f64

§

type Real = f64

§

type Complex = Complex<f64>

§

fn re(&self) -> <f64 as Scalar>::Real

§

fn im(&self) -> <f64 as Scalar>::Real

§

fn from_real(re: <f64 as Scalar>::Real) -> f64

§

fn pow(self, n: f64) -> f64

§

fn powi(self, n: i32) -> f64

§

fn powf(self, n: <f64 as Scalar>::Real) -> f64

§

fn powc(self, n: <f64 as Scalar>::Complex) -> <f64 as Scalar>::Complex

§

fn real<T>(re: T) -> <f64 as Scalar>::Real
where T: ToPrimitive,

§

fn complex<T>(re: T, im: T) -> <f64 as Scalar>::Complex
where T: ToPrimitive,

§

fn as_c(&self) -> <f64 as Scalar>::Complex

§

fn conj(&self) -> f64

§

fn square(self) -> <f64 as Scalar>::Real

§

fn rand(rng: &mut impl Rng) -> f64

§

fn add_real(self, re: <f64 as Scalar>::Real) -> f64

§

fn sub_real(self, re: <f64 as Scalar>::Real) -> f64

§

fn mul_real(self, re: <f64 as Scalar>::Real) -> f64

§

fn div_real(self, re: <f64 as Scalar>::Real) -> f64

§

fn add_complex(self, im: <f64 as Scalar>::Complex) -> <f64 as Scalar>::Complex

§

fn sub_complex(self, im: <f64 as Scalar>::Complex) -> <f64 as Scalar>::Complex

§

fn mul_complex(self, im: <f64 as Scalar>::Complex) -> <f64 as Scalar>::Complex

§

fn div_complex(self, im: <f64 as Scalar>::Complex) -> <f64 as Scalar>::Complex

§

fn sqrt(self) -> f64

§

fn abs(self) -> f64

§

fn exp(self) -> f64

§

fn ln(self) -> f64

§

fn sin(self) -> f64

§

fn cos(self) -> f64

§

fn tan(self) -> f64

§

fn sinh(self) -> f64

§

fn cosh(self) -> f64

§

fn tanh(self) -> f64

§

fn asin(self) -> f64

§

fn acos(self) -> f64

§

fn atan(self) -> f64

§

fn asinh(self) -> f64

§

fn acosh(self) -> f64

§

fn atanh(self) -> f64

§

impl Scalar for Complex<f32>

§

type Real = f32

§

type Complex = Complex<f32>

§

fn re(&self) -> <Complex<f32> as Scalar>::Real

§

fn im(&self) -> <Complex<f32> as Scalar>::Real

§

fn from_real(re: <Complex<f32> as Scalar>::Real) -> Complex<f32>

§

fn pow(self, n: Complex<f32>) -> Complex<f32>

§

fn powi(self, n: i32) -> Complex<f32>

§

fn powf(self, n: <Complex<f32> as Scalar>::Real) -> Complex<f32>

§

fn powc( self, n: <Complex<f32> as Scalar>::Complex, ) -> <Complex<f32> as Scalar>::Complex

§

fn real<T>(re: T) -> <Complex<f32> as Scalar>::Real
where T: ToPrimitive,

§

fn complex<T>(re: T, im: T) -> <Complex<f32> as Scalar>::Complex
where T: ToPrimitive,

§

fn as_c(&self) -> <Complex<f32> as Scalar>::Complex

§

fn conj(&self) -> Complex<f32>

§

fn square(self) -> <Complex<f32> as Scalar>::Real

§

fn abs(self) -> <Complex<f32> as Scalar>::Real

§

fn rand(rng: &mut impl Rng) -> Complex<f32>

§

fn add_real(self, re: <Complex<f32> as Scalar>::Real) -> Complex<f32>

§

fn sub_real(self, re: <Complex<f32> as Scalar>::Real) -> Complex<f32>

§

fn mul_real(self, re: <Complex<f32> as Scalar>::Real) -> Complex<f32>

§

fn div_real(self, re: <Complex<f32> as Scalar>::Real) -> Complex<f32>

§

fn add_complex( self, im: <Complex<f32> as Scalar>::Complex, ) -> <Complex<f32> as Scalar>::Complex

§

fn sub_complex( self, im: <Complex<f32> as Scalar>::Complex, ) -> <Complex<f32> as Scalar>::Complex

§

fn mul_complex( self, im: <Complex<f32> as Scalar>::Complex, ) -> <Complex<f32> as Scalar>::Complex

§

fn div_complex( self, im: <Complex<f32> as Scalar>::Complex, ) -> <Complex<f32> as Scalar>::Complex

§

fn sqrt(self) -> Complex<f32>

§

fn exp(self) -> Complex<f32>

§

fn ln(self) -> Complex<f32>

§

fn sin(self) -> Complex<f32>

§

fn cos(self) -> Complex<f32>

§

fn tan(self) -> Complex<f32>

§

fn sinh(self) -> Complex<f32>

§

fn cosh(self) -> Complex<f32>

§

fn tanh(self) -> Complex<f32>

§

fn asin(self) -> Complex<f32>

§

fn acos(self) -> Complex<f32>

§

fn atan(self) -> Complex<f32>

§

fn asinh(self) -> Complex<f32>

§

fn acosh(self) -> Complex<f32>

§

fn atanh(self) -> Complex<f32>

§

impl Scalar for Complex<f64>

§

type Real = f64

§

type Complex = Complex<f64>

§

fn re(&self) -> <Complex<f64> as Scalar>::Real

§

fn im(&self) -> <Complex<f64> as Scalar>::Real

§

fn from_real(re: <Complex<f64> as Scalar>::Real) -> Complex<f64>

§

fn pow(self, n: Complex<f64>) -> Complex<f64>

§

fn powi(self, n: i32) -> Complex<f64>

§

fn powf(self, n: <Complex<f64> as Scalar>::Real) -> Complex<f64>

§

fn powc( self, n: <Complex<f64> as Scalar>::Complex, ) -> <Complex<f64> as Scalar>::Complex

§

fn real<T>(re: T) -> <Complex<f64> as Scalar>::Real
where T: ToPrimitive,

§

fn complex<T>(re: T, im: T) -> <Complex<f64> as Scalar>::Complex
where T: ToPrimitive,

§

fn as_c(&self) -> <Complex<f64> as Scalar>::Complex

§

fn conj(&self) -> Complex<f64>

§

fn square(self) -> <Complex<f64> as Scalar>::Real

§

fn abs(self) -> <Complex<f64> as Scalar>::Real

§

fn rand(rng: &mut impl Rng) -> Complex<f64>

§

fn add_real(self, re: <Complex<f64> as Scalar>::Real) -> Complex<f64>

§

fn sub_real(self, re: <Complex<f64> as Scalar>::Real) -> Complex<f64>

§

fn mul_real(self, re: <Complex<f64> as Scalar>::Real) -> Complex<f64>

§

fn div_real(self, re: <Complex<f64> as Scalar>::Real) -> Complex<f64>

§

fn add_complex( self, im: <Complex<f64> as Scalar>::Complex, ) -> <Complex<f64> as Scalar>::Complex

§

fn sub_complex( self, im: <Complex<f64> as Scalar>::Complex, ) -> <Complex<f64> as Scalar>::Complex

§

fn mul_complex( self, im: <Complex<f64> as Scalar>::Complex, ) -> <Complex<f64> as Scalar>::Complex

§

fn div_complex( self, im: <Complex<f64> as Scalar>::Complex, ) -> <Complex<f64> as Scalar>::Complex

§

fn sqrt(self) -> Complex<f64>

§

fn exp(self) -> Complex<f64>

§

fn ln(self) -> Complex<f64>

§

fn sin(self) -> Complex<f64>

§

fn cos(self) -> Complex<f64>

§

fn tan(self) -> Complex<f64>

§

fn sinh(self) -> Complex<f64>

§

fn cosh(self) -> Complex<f64>

§

fn tanh(self) -> Complex<f64>

§

fn asin(self) -> Complex<f64>

§

fn acos(self) -> Complex<f64>

§

fn atan(self) -> Complex<f64>

§

fn asinh(self) -> Complex<f64>

§

fn acosh(self) -> Complex<f64>

§

fn atanh(self) -> Complex<f64>

Implementors§