Skip to main content

LinalgScalar

Trait LinalgScalar 

Source
pub trait LinalgScalar: TensorScalar + Sealed {
    type Complex: TensorScalar + PoolScalar + Default;
    type RealScalar: TensorScalar + PoolScalar + Default;
}
Expand description

Scalar types supported by statically typed linear algebra methods: f32, f64, Complex32 and Complex64.

The trait is sealed: its supertrait lives in a private module, so no other type can implement it. It names the two output scalars a factorization of Self can return.

SelfRealScalarComplex
f32f32Complex32
f64f64Complex64
Complex32f32Complex32
Complex64f64Complex64

§Examples

use num_complex::Complex64;
use tenferro_linalg::LinalgScalar;

fn accepts_linalg_scalar<T: LinalgScalar>() {}
accepts_linalg_scalar::<f64>();

fn spectrum_scalar<T: LinalgScalar>() -> &'static str {
    std::any::type_name::<T::RealScalar>()
}
assert_eq!(spectrum_scalar::<Complex64>(), "f64");

Required Associated Types§

Source

type Complex: TensorScalar + PoolScalar + Default

Complex counterpart used by general eigendecomposition.

Source

type RealScalar: TensorScalar + PoolScalar + Default

Real scalar of singular values and Hermitian eigenvalues.

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 Complex32

Source§

impl LinalgScalar for Complex64

Source§

impl LinalgScalar for f32

Source§

impl LinalgScalar for f64

Implementors§