broadcast function

Matrix broadcast(
  1. Matrix input,
  2. int numberOfRows
)

Implementation

Matrix broadcast(Matrix input, int numberOfRows) {
  assert(numberOfRows > 0, 'Parameter numberOfRows has to be larger than 0');
  assert(input.columnsNum == 1 || input.rowsNum == 1,
      'At least one dimension has to be larger than 1');

  List<List<double>> output = [];

  for (int i = 0; i < numberOfRows; i++) {
    output.add(input[0].toList());
  }

  return Matrix.fromList(output);
}