pub fn col_vec_to_vec<F: Clone>(mat: &Matrix<F>) -> Vec<F> {

    if mat.len() == 1 {
        // TODO: OPTIMIZATION -- find mor efficient way of copying over vector
        let mut res = Vec::with_capacity(mat[0].len());
        for elem in mat[0].iter() {
            res.push(elem.clone());
        }
        res
    }
    else {
        let mut res = Vec::with_capacity(mat.len());
        for i in 0..mat.len() {
            assert_eq!(mat[i].len(), 1);
            res.push(mat[i][0].clone());
        }
        res
    }
}
/// Collapse matrix into a single vector.
Collapse matrix into a single vector.
Collapse matrix into a single vector .
pub fn col_vec_to_vec<F: Clone>(mat: &Matrix<F>) -> Vec<F> {
    if mat.len() == 1 {
        // TODO: OPTIMIZATION -- find mor efficient way of copying over vector
        let mut res = Vec::with_capacity(mat[0].len());
        for elem in mat[0].iter() {
            res.push(elem.clone());
        }
        res
    }
    else {
        let mut res = Vec::with_capacity(mat.len());
        for i in 0..mat.len() {
            assert_eq!(mat[i].len(), 1);
            res.push(mat[i][0].clone());
        }
        res
    }
}
pub fn col_vec_to_vec < F : Clone > ( mat : & Matrix < F > ) -> Vec < F > { if mat . len ( ) == 1 { // TODO: OPTIMIZATION -- find mor efficient way of copying over vector let mut res = Vec :: with_capacity ( mat [ 0 ] . len ( ) ) ; for elem in mat [ 0 ] . iter ( ) { res . push ( elem . clone ( ) ) ; } res } else { let mut res = Vec :: with_capacity ( mat . len ( ) ) ; for i in 0 .. mat . len ( ) { assert_eq ! ( mat [ i ] len ( ) 1 ) ; res . push ( mat [ i ] [ 0 ] . clone ( ) ) ; } res } }
Collapse matrix into a single vector.
Collapse matrix into a single vector .
mat
&Matrix<F>
mat
&Matrix<F>