createMatrix method

List<List<double>> createMatrix (int nrows, int ncols, double value)

Returns a new nrows x ncols matrix. All elements are set to value.

Implementation

List<List<double>> createMatrix(int nrows, int ncols, double value) {
  List<List<double>> matrix = List(nrows);
  for (int i = 0; i < nrows; i++) {
    matrix[i] = List<double>(ncols);
    matrix[i].fillRange(0, ncols, value);
  }
  return matrix;
}