transform<S> method

Matrix<S> transform<S>(
  1. S read(
    1. int row,
    2. int col,
    3. T value
    ), {
  2. T write(
    1. int row,
    2. int col,
    3. S value
    )?,
  3. DataType<S>? dataType,
})

Returns a view on this Matrix with all its elements lazily converted by calling the provided read transformation. An optionally provided write transformation enables writing to the returned matrix.

Implementation

Matrix<S> transform<S>(S Function(int row, int col, T value) read,
        {T Function(int row, int col, S value)? write,
        DataType<S>? dataType}) =>
    TransformedMatrix<T, S>(
      this,
      read,
      write ?? (r, c, v) => throw UnsupportedError('Matrix is not mutable.'),
      dataType ?? DataType.fromType<S>(),
    );