Matrix.ones constructor

Matrix.ones(
  1. int rows,
  2. int cols, {
  3. bool isDouble = false,
})

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

rows: Number of rows. cols: Number of columns.

Example:

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

Implementation

factory Matrix.ones(int rows, int cols, {bool isDouble = false}) {
  return Matrix.factory
      .create(MatrixType.ones, rows, cols, isDouble: isDouble);
}