pub(crate) fn matrix_to_array<'a, T, U>(buf: &mut String, name: &str, matrix: &'a T)
where
    T: AsMatrix<'a, U>,
    U: 'a + std::fmt::Display,
{
    write!(buf, "{}=np.array([", name).unwrap();
    let (m, n) = matrix.mat_size();
    for i in 0..m {
        write!(buf, "[").unwrap();
        for j in 0..n {
            write!(buf, "{},", matrix.mat_at(i, j)).unwrap();
        }
        write!(buf, "],").unwrap();
    }
    write!(buf, "],dtype=float)\n").unwrap();
}
/// Converts a matrix to a 2D NumPy array
Converts a matrix to a 2D NumPy array
Converts a matrix to a 2D NumPy array
pub(crate) fn matrix_to_array<'a, T, U>(buf: &mut String, name: &str, matrix: &'a T)
where
    T: AsMatrix<'a, U>,
    U: 'a + std::fmt::Display,
{
    write!(buf, "{}=np.array([", name).unwrap();
    let (m, n) = matrix.mat_size();
    for i in 0..m {
        write!(buf, "[").unwrap();
        for j in 0..n {
            write!(buf, "{},", matrix.mat_at(i, j)).unwrap();
        }
        write!(buf, "],").unwrap();
    }
    write!(buf, "],dtype=float)\n").unwrap();
}
pub ( crate ) fn matrix_to_array < ' a , T , U > ( buf : & mut String , name : & str , matrix : & ' a T ) where T : AsMatrix < ' a , U > , U : ' a + std :: fmt :: Display , { write ! ( buf " " name ) . unwrap ( ) ; let ( m , n ) = matrix . mat_size ( ) ; for i in 0 .. m { write ! ( buf " " ) . unwrap ( ) ; for j in 0 .. n { write ! ( buf " " matrix mat_at ( i j ) ) . unwrap ( ) ; } write ! ( buf " " ) . unwrap ( ) ; } write ! ( buf " \n " ) . unwrap ( ) ; }
Converts a matrix to a 2D NumPy array
Converts a matrix to a 2D NumPy array
buf
&mut String
name
&str
matrix
&'a T
buf
&mut String
name
&str
matrix
&'a T