Skip to main content

LinalgScalar

Trait LinalgScalar 

Source
pub trait LinalgScalar:
    Element<Real = Self::LinalgReal>
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + Neg<Output = Self>
    + PartialEq
    + Sealed {
    type LinalgReal: LinalgFloat;

    const IS_COMPLEX: bool;
    const ZERO: Self;
    const ONE: Self;
    const NAN: Self;

    // Required methods
    fn conj(self) -> Self;
    fn abs(self) -> Self::LinalgReal;
    fn abs1(self) -> Self::LinalgReal;
    fn abs2(self) -> Self::LinalgReal;
    fn scale(self, r: Self::LinalgReal) -> Self;
    fn is_finite(self) -> bool;
    fn csqrt(self) -> Self;

    // Provided method
    fn from_real(r: Self::LinalgReal) -> Self { ... }
}
Expand description

The element types of linear algebra: f32, f64, c64, and c128.

Required Associated Constants§

Source

const IS_COMPLEX: bool

Whether the type is complex.

Source

const ZERO: Self

Zero.

Source

const ONE: Self

One.

Source

const NAN: Self

NaN (in both parts for complex types).

Required Associated Types§

Source

type LinalgReal: LinalgFloat

The real type of the absolute values (Self for real types; the element type’s Real, whose re, im, and from_parts the algorithms use).

Required Methods§

Source

fn conj(self) -> Self

The complex conjugate (the value itself for real types).

Source

fn abs(self) -> Self::LinalgReal

The absolute value (the modulus for complex types).

Source

fn abs1(self) -> Self::LinalgReal

|re| + |im|, by which BLAS’s izamax compares complex values (the absolute value for real types).

Source

fn abs2(self) -> Self::LinalgReal

|x|^2.

Source

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

self * r for a real r.

Source

fn is_finite(self) -> bool

Whether the value is finite (in both parts).

Source

fn csqrt(self) -> Self

The principal square root (NaN for negative real numbers).

Provided Methods§

Source

fn from_real(r: Self::LinalgReal) -> Self

The value of a real number.

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 LinalgScalar for f32

Source§

const IS_COMPLEX: bool = false

Source§

const ZERO: Self = 0.0

Source§

const ONE: Self = 1.0

Source§

const NAN: Self = f32::NAN

Source§

type LinalgReal = f32

Source§

fn conj(self) -> Self

Source§

fn abs(self) -> Self

Source§

fn abs1(self) -> Self

Source§

fn abs2(self) -> Self

Source§

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

Source§

fn is_finite(self) -> bool

Source§

fn csqrt(self) -> Self

Source§

fn from_real(r: Self) -> Self

Source§

impl LinalgScalar for f64

Source§

const IS_COMPLEX: bool = false

Source§

const ZERO: Self = 0.0

Source§

const ONE: Self = 1.0

Source§

const NAN: Self = f64::NAN

Source§

type LinalgReal = f64

Source§

fn conj(self) -> Self

Source§

fn abs(self) -> Self

Source§

fn abs1(self) -> Self

Source§

fn abs2(self) -> Self

Source§

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

Source§

fn is_finite(self) -> bool

Source§

fn csqrt(self) -> Self

Source§

fn from_real(r: Self) -> Self

Implementors§