pub trait MatrixFrom<T> {
    // Required method
    fn matrix_from(input: T) -> Self;
}
Expand description

Sister trait of MatrixInto. Basically does the same thing, just with a different syntax.

Required Methods§

source

fn matrix_from(input: T) -> Self

Method for getting a matrix from another matrix of type Matrix<T>.

Example
use matrix_basic::Matrix;
use matrix_basic::MatrixFrom;

let a = Matrix::from(vec![vec![1, 2, 3], vec![0, 1, 2]]).unwrap();
let b = Matrix::from(vec![vec![1.0, 2.0, 3.0], vec![0.0, 1.0, 2.0]]).unwrap();
let c = Matrix::<f64>::matrix_from(a); // Type annotation is needed here

assert_eq!(c, b);

Implementors§

source§

impl<T: MatrixInto<S>, S: ToMatrix> MatrixFrom<T> for Matrix<S>

Blanket implementation of MatrixFrom for Matrix<S> whenever T (which is actually some)Matrix<U> implements MatrixInto<S>.