/// Create new matrix from vector values. The first value
/// will be assigned to index (0, 0), the second one to index (0, 1),
/// and so on. An error is returned instead if data length does not
/// correspond to the announced size.
Create new matrix from vector values. The first value
will be assigned to index (0, 0), the second one to index (0, 1),
and so on. An error is returned instead if data length does not
correspond to the announced size.
Create new matrix from vector values . The first value will be assigned to index ( 0 0 ) the second one to index ( 0 1 ) and so on . An error is returned instead if data length does not correspond to the announced size .
pub fn from_vec(
        rows: usize,
        columns: usize,
        values: Vec<C>,
    ) -> Result<Self, MatrixFormatError> {
        if rows != 0 && columns == 0 {
            return Err(MatrixFormatError(
                "creating a matrix with empty rows is not allowed".to_owned(),
            ));
        }
        if rows * columns != values.len() {
            return Err(MatrixFormatError ( format!("length of vector does not correspond to announced dimensions ({} instead of {}×{}={})", values.len(), rows, columns, rows*columns)));
        }
        Ok(Self {
            rows,
            columns,
            data: values,
        })
    }
pub fn from_vec ( rows : usize , columns : usize , values : Vec < C > , ) -> Result < Self , MatrixFormatError > { if rows != 0 && columns == 0 { return Err ( MatrixFormatError ( " " . to_owned ( ) , ) ) ; } if rows * columns != values . len ( ) { return Err ( MatrixFormatError ( format ! ( " , alues. en( ) , ows, olumns, ows* olumns) ) ) ; } Ok ( Self { rows , columns , data : values , } ) }
Create new matrix from vector values.
Create new matrix from vector values .
rows
usize
columns
usize
values
Vec<C>