Skip to main content

Scalar

Trait Scalar 

Source
pub trait Scalar:
    Copy
    + Debug
    + PartialEq
    + Send
    + Sync
    + 'static
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + Neg<Output = Self>
    + AddAssign
    + SubAssign
    + MulAssign
    + DivAssign {
    const IS_COMPLEX: bool;
Show 13 methods // Required methods fn zero() -> Self; fn one() -> Self; fn from_real(re: f64) -> Self; fn conj(self) -> Self; fn re(self) -> f64; fn im(self) -> f64; fn abs(self) -> f64; fn abs_sqr(self) -> f64; fn scale(self, r: f64) -> Self; fn is_finite(self) -> bool; fn to_complex(self) -> Complex<f64>; fn from_complex(z: Complex<f64>) -> Self; unsafe fn gemm_sub( m: usize, k: usize, n: usize, a: *const Self, rsa: isize, csa: isize, b: *const Self, rsb: isize, csb: isize, c: *mut Self, rsc: isize, csc: isize, );
}
Expand description

A real or complex double-precision scalar.

Required Associated Constants§

Source

const IS_COMPLEX: bool

true for complex scalars.

Required Methods§

Source

fn zero() -> Self

Source

fn one() -> Self

Source

fn from_real(re: f64) -> Self

Source

fn conj(self) -> Self

The complex conjugate (the identity for reals).

Source

fn re(self) -> f64

The real part.

Source

fn im(self) -> f64

The imaginary part (zero for reals).

Source

fn abs(self) -> f64

The modulus |z|.

Source

fn abs_sqr(self) -> f64

|z|².

Source

fn scale(self, r: f64) -> Self

z · r for a real r.

Source

fn is_finite(self) -> bool

Source

fn to_complex(self) -> Complex<f64>

As a complex number.

Source

fn from_complex(z: Complex<f64>) -> Self

From a complex number (the real part, for reals).

Source

unsafe fn gemm_sub( m: usize, k: usize, n: usize, a: *const Self, rsa: isize, csa: isize, b: *const Self, rsb: isize, csb: isize, c: *mut Self, rsc: isize, csc: isize, )

C ← C − A B for an m × k matrix A, a k × n matrix B and an m × n matrix C, each given by a pointer to its first element and its row and column strides.

§Safety

The pointers and strides must describe valid matrices, and C must not overlap A or B.

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

Source§

const IS_COMPLEX: bool = true

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

fn from_real(re: f64) -> Self

Source§

fn conj(self) -> Self

Source§

fn re(self) -> f64

Source§

fn im(self) -> f64

Source§

fn abs(self) -> f64

Source§

fn abs_sqr(self) -> f64

Source§

fn scale(self, r: f64) -> Self

Source§

fn is_finite(self) -> bool

Source§

fn to_complex(self) -> Complex<f64>

Source§

fn from_complex(z: Complex<f64>) -> Self

Source§

unsafe fn gemm_sub( m: usize, k: usize, n: usize, a: *const Self, rsa: isize, csa: isize, b: *const Self, rsb: isize, csb: isize, c: *mut Self, rsc: isize, csc: isize, )

Source§

impl Scalar for f64

Source§

const IS_COMPLEX: bool = false

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

fn from_real(re: f64) -> Self

Source§

fn conj(self) -> Self

Source§

fn re(self) -> f64

Source§

fn im(self) -> f64

Source§

fn abs(self) -> f64

Source§

fn abs_sqr(self) -> f64

Source§

fn scale(self, r: f64) -> Self

Source§

fn is_finite(self) -> bool

Source§

fn to_complex(self) -> Complex<f64>

Source§

fn from_complex(z: Complex<f64>) -> Self

Source§

unsafe fn gemm_sub( m: usize, k: usize, n: usize, a: *const Self, rsa: isize, csa: isize, b: *const Self, rsb: isize, csb: isize, c: *mut Self, rsc: isize, csc: isize, )

Implementors§