/// Efficiently creates a matrix with the given rows.
///
/// # Safety
///
/// Neither `num_rows` nor `num_cols` may represent `0`.
///
/// The length of each row in the provided iterator must match
/// `num_cols.as_nat()`, and the number of rows in the provided iterator
/// must match `num_rows.as_nat()`.
Efficiently creates a matrix with the given rows.
Efficiently creates a matrix with the given rows .
pub unsafe fn from_rows_unsafe<Rows, Row>(num_rows: N, num_cols: M, rows: Rows) -> Self
        where Rows: IntoIterator<Item = Row>,
              Row: IntoIterator<Item = T>
    {
        // Benchmarks show that repeatedly extending a mutable vector is much
        // faster than using `flat_map` on `rows`, for matrices of all sizes.
        let mut data = Vec::with_capacity(num_rows.as_nat() * num_cols.as_nat());
        for row in rows.into_iter().take(num_rows.as_nat()) {
            data.extend(row.into_iter().take(num_cols.as_nat()));
        }
        Matrix {
            num_rows: num_rows,
            num_cols: num_cols,
            data: data,
        }
    }
pub unsafe fn from_rows_unsafe < Rows , Row > ( num_rows : N , num_cols : M , rows : Rows ) -> Self where Rows : IntoIterator < Item = Row > , Row : IntoIterator < Item = T > { // Benchmarks show that repeatedly extending a mutable vector is much // faster than using `flat_map` on `rows`, for matrices of all sizes. let mut data = Vec :: with_capacity ( num_rows . as_nat ( ) * num_cols . as_nat ( ) ) ; for row in rows . into_iter ( ) . take ( num_rows . as_nat ( ) ) { data . extend ( row . into_iter ( ) . take ( num_cols . as_nat ( ) ) ) ; } Matrix { num_rows : num_rows , num_cols : num_cols , data : data , } }
Efficiently creates a matrix with the given rows.
Efficiently creates a matrix with the given rows .
num_rows
N
num_cols
M
rows
Rows
safety
Neither `num_rows` nor `num_cols` may represent `0`.

The length of each row in the provided iterator must match
`num_cols.as_nat()`, and the number of rows in the provided iterator
must match `num_rows.as_nat()`.
Neither ` num_rows ` nor ` num_cols ` may represent ` 0 ` . The length of each row in the provided iterator must match ` num_cols . as_nat () ` and the number of rows in the provided iterator must match ` num_rows . as_nat () ` .