Matrix<T>.generate constructor

Matrix<T>.generate(
  1. DataType<T> dataType,
  2. int rowCount,
  3. int columnCount,
  4. MatrixGeneratorCallback<T> callback, {
  5. MatrixFormat? format,
})

Generates a matrix from calling a callback on every value.

If format is specified the resulting matrix is mutable, otherwise this is a read-only view.

Implementation

factory Matrix.generate(DataType<T> dataType, int rowCount, int columnCount,
    MatrixGeneratorCallback<T> callback,
    {MatrixFormat? format}) {
  final result =
      GeneratedMatrix<T>(dataType, rowCount, columnCount, callback);
  return format == null ? result : result.toMatrix(format: format);
}