Skip to main content

MatrixSolveScalar

Trait MatrixSolveScalar 

Source
pub trait MatrixSolveScalar: BackendLinalgScalar + MatrixScalar { }
Expand description

Scalar types supported by solve_matrix.

f64 and Complex64 are solved directly. f32 and Complex32 are promoted to the corresponding 64-bit dtype for the backend solve and then converted back, because the current tenferro CPU LU solve is double precision only.

§Examples

use tensor4all_tensorbackend::{from_vec2d, solve_matrix};

let a = from_vec2d(vec![vec![2.0_f32, 1.0], vec![1.0, 2.0]]);
let b = from_vec2d(vec![vec![1.0_f32], vec![0.0]]);
let x = solve_matrix(&a, &b).unwrap();
assert!((x[[0, 0]] - 2.0 / 3.0).abs() < 1.0e-6);

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§

Source§

impl MatrixSolveScalar for f32

Source§

impl MatrixSolveScalar for f64

Source§

impl MatrixSolveScalar for Complex32

Source§

impl MatrixSolveScalar for Complex64

Implementors§