Matrix.fill constructor

Matrix.fill(
  1. int rows,
  2. int cols,
  3. dynamic value
)

Creates a Matrix of the specified dimensions with all elements set to the specified value.

rows: Number of rows. cols: Number of columns. value: Value to fill the matrix with.

Example:

var m = Matrix.fill(2, 3, 7);
print(m);
// Output:
// Matrix: 2x3
// ┌ 7 7 7 ┐
// └ 7 7 7 ┘

Implementation

factory Matrix.fill(int rows, int cols, dynamic value) {
  return Matrix.factory.create(MatrixType.general, rows, cols,
      value: value, isDouble: value is double);
}