use crate::Matrix;
use core::marker::Sized;
use core::result::Result;
#[allow(dead_code)]
pub trait MatrixTrait<const ROWS: usize, const COLS: usize> {
type TransposeType: MatrixTrait<COLS, ROWS>;
fn new() -> Result<Self, &'static str>
where
Self: Sized;
fn eye() -> Result<Self, &'static str>
where
Self: Sized;
fn from_vector(data: [[f64; COLS]; ROWS]) -> Result<Self, &'static str>
where
Self: Sized;
fn transpose(&self) -> Self::TransposeType;
fn to_double(&self) -> Result<f64, &'static str>;
fn swap_rows(&mut self, row1: usize, row2: usize) -> Result<(), &'static str>;
fn swap_cols(&mut self, col1: usize, col2: usize) -> Result<(), &'static str>;
fn sub_matrix<const NEW_ROWS: usize, const NEW_COLS: usize>(
&self,
row_start: usize,
col_start: usize,
) -> Result<Matrix<NEW_ROWS, NEW_COLS>, &'static str>;
fn vector_to_row(elems: [f64; ROWS]) -> Result<Matrix<ROWS, 1>, &'static str>;
fn pinv<const DOUBLE: usize>(&self) -> Result<Matrix<COLS, ROWS>, &'static str>;
}
pub trait MatrixConcat<const ROWS: usize, const COLS: usize> {
fn x_concat<const RHS_COLS: usize, const NEW_COLS: usize>(
self,
rhs: Matrix<ROWS, RHS_COLS>,
) -> Result<Matrix<ROWS, NEW_COLS>, &'static str>;
fn y_concat<const RHS_ROWS: usize, const NEW_ROWS: usize>(
self,
rhs: Matrix<RHS_ROWS, COLS>,
) -> Result<Matrix<NEW_ROWS, COLS>, &'static str>;
}
pub trait SquareMatrix<const N: usize> {
fn det(&self) -> f64;
fn inv<const DOUBLE_COLS: usize>(&self) -> Result<Matrix<N, N>, &'static str>;
fn pow(&self, n: usize) -> Matrix<N, N>;
fn diag(elems: [f64; N]) -> Result<Matrix<N, N>, &'static str>;
}
pub trait VectorCol<const ROWS: usize> {
fn shift_data(&mut self, data: f64);
}
pub trait IsSquareMatrix {}
pub trait IsVectorCol {}