mematrica/
cmatrix_trait.rs1pub mod cmatrix_trait {
2    extern crate num;
3    
4    use crate::{matrix::matrix::Error, Matrix2, Matrix3};
5    use self::num::Num;
6
7    pub trait CMatrixTrait<T: Num + Default + Clone + std::str::FromStr + std::cmp::PartialOrd + std::fmt::Debug + std::convert::Into<f64> + std::marker::Copy> {
8        fn zero(rows: usize, columns: usize) -> Self;
10        fn one(rows: usize, columns: usize) -> Self;
12        fn identity(rows: usize, columns: usize) -> Self;
14        fn from_file(filename: String, delimiter: char, rows: usize, columns: usize) -> Self
16        where <T as std::str::FromStr>::Err: std::fmt::Debug;
17        fn try_from_file(filename: String, delimiter: char, rows: usize, columns: usize) -> Result<Self, Error>
19        where <T as std::str::FromStr>::Err: std::fmt::Debug, Self : Sized;
20        fn from_element(rows: usize, columns: usize, e: T) -> Self;
22        fn from_vec_as_columns(columns: usize, v: Vec<T>) -> Self;
24        fn from_vec_as_rows(rows: usize, v: Vec<T>) -> Self;
26        fn from_diagonal(rows: usize, columns: usize, element: T) -> Self;
28        fn to_matrix2(self) -> Matrix2<T>;
30        fn to_matrix3(self) -> Matrix3<T>;
32        fn push(&mut self, v: Vec<T>);
34        fn pop(&mut self);
36    }
37
38}