Matrix<T>.constant constructor

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

Returns a matrix with a constant value.

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

Implementation

factory Matrix.constant(DataType<T> dataType, int rowCount, int columnCount,
    {T? value, MatrixFormat? format}) {
  final result = ConstantMatrix<T>(
      dataType, rowCount, columnCount, value ?? dataType.defaultValue);
  return format == null ? result : result.toMatrix(format: format);
}