Skip to main content

Scalar

Trait Scalar 

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

Source

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

Source

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

Required Methods§

Source

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

Create a new real number

Source

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

Create a new complex number

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Real part

Source

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

Imaginary part

Source

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

As a complex number

Source

fn conj(&self) -> Self

Complex conjugate

Source

fn abs(self) -> Self::Real

Absolute value

Source

fn square(self) -> Self::Real

Sqaure of absolute value

Source

fn sqrt(self) -> Self

Source

fn exp(self) -> Self

Source

fn ln(self) -> Self

Source

fn sin(self) -> Self

Source

fn cos(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 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".

Implementations on Foreign Types§

Source§

impl Scalar for Complex<f32>

Source§

type Real = f32

Source§

type Complex = Complex<f32>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn sqrt(self) -> Complex<f32>

Source§

fn exp(self) -> Complex<f32>

Source§

fn ln(self) -> Complex<f32>

Source§

fn sin(self) -> Complex<f32>

Source§

fn cos(self) -> Complex<f32>

Source§

fn tan(self) -> Complex<f32>

Source§

fn sinh(self) -> Complex<f32>

Source§

fn cosh(self) -> Complex<f32>

Source§

fn tanh(self) -> Complex<f32>

Source§

fn asin(self) -> Complex<f32>

Source§

fn acos(self) -> Complex<f32>

Source§

fn atan(self) -> Complex<f32>

Source§

fn asinh(self) -> Complex<f32>

Source§

fn acosh(self) -> Complex<f32>

Source§

fn atanh(self) -> Complex<f32>

Source§

impl Scalar for Complex<f64>

Source§

type Real = f64

Source§

type Complex = Complex<f64>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn sqrt(self) -> Complex<f64>

Source§

fn exp(self) -> Complex<f64>

Source§

fn ln(self) -> Complex<f64>

Source§

fn sin(self) -> Complex<f64>

Source§

fn cos(self) -> Complex<f64>

Source§

fn tan(self) -> Complex<f64>

Source§

fn sinh(self) -> Complex<f64>

Source§

fn cosh(self) -> Complex<f64>

Source§

fn tanh(self) -> Complex<f64>

Source§

fn asin(self) -> Complex<f64>

Source§

fn acos(self) -> Complex<f64>

Source§

fn atan(self) -> Complex<f64>

Source§

fn asinh(self) -> Complex<f64>

Source§

fn acosh(self) -> Complex<f64>

Source§

fn atanh(self) -> Complex<f64>

Source§

impl Scalar for f32

Source§

type Real = f32

Source§

type Complex = Complex<f32>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn conj(&self) -> f32

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn sqrt(self) -> f32

Source§

fn abs(self) -> f32

Source§

fn exp(self) -> f32

Source§

fn ln(self) -> f32

Source§

fn sin(self) -> f32

Source§

fn cos(self) -> f32

Source§

fn tan(self) -> f32

Source§

fn sinh(self) -> f32

Source§

fn cosh(self) -> f32

Source§

fn tanh(self) -> f32

Source§

fn asin(self) -> f32

Source§

fn acos(self) -> f32

Source§

fn atan(self) -> f32

Source§

fn asinh(self) -> f32

Source§

fn acosh(self) -> f32

Source§

fn atanh(self) -> f32

Source§

impl Scalar for f64

Source§

type Real = f64

Source§

type Complex = Complex<f64>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn conj(&self) -> f64

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn sqrt(self) -> f64

Source§

fn abs(self) -> f64

Source§

fn exp(self) -> f64

Source§

fn ln(self) -> f64

Source§

fn sin(self) -> f64

Source§

fn cos(self) -> f64

Source§

fn tan(self) -> f64

Source§

fn sinh(self) -> f64

Source§

fn cosh(self) -> f64

Source§

fn tanh(self) -> f64

Source§

fn asin(self) -> f64

Source§

fn acos(self) -> f64

Source§

fn atan(self) -> f64

Source§

fn asinh(self) -> f64

Source§

fn acosh(self) -> f64

Source§

fn atanh(self) -> f64

Implementors§