Matrix<T>.fromPackedRows constructor
Matrix<T>.fromPackedRows (
- DataType<
T> dataType, - int rowCount,
- int columnCount,
- List<
T> source, { - MatrixFormat? format,
Constructs a matrix from a packed list of rows.
If format
is specified, source
is copied into a mutable matrix of the
selected format; otherwise a view onto the possibly mutable source
is
provided.
Implementation
factory Matrix.fromPackedRows(
DataType<T> dataType, int rowCount, int columnCount, List<T> source,
{MatrixFormat? format}) {
if (rowCount * columnCount != source.length) {
throw ArgumentError.value(
source, 'source', 'Row and column count do not match.');
}
final result =
RowMajorMatrix.fromList(dataType, rowCount, columnCount, source);
return format == null ? result : result.toMatrix(format: format);
}