convolve method

Matrix<T> convolve(
  1. Matrix<T> kernel, {
  2. DataType<T>? dataType,
  3. ConvolutionMode mode = ConvolutionMode.full,
})

Returns a view of the convolution between this matrix and the given kernel. The solution is obtained lazily by straightforward computation, not by using a FFT.

See http://en.wikipedia.org/wiki/Convolution.

Implementation

Matrix<T> convolve(
  Matrix<T> kernel, {
  DataType<T>? dataType,
  ConvolutionMode mode = ConvolutionMode.full,
}) {
  switch (mode) {
    case ConvolutionMode.full:
      return FullConvolutionMatrix<T>(
          dataType ?? this.dataType, this, kernel);
    case ConvolutionMode.valid:
      return ValidConvolutionMatrix<T>(
          dataType ?? this.dataType, this, kernel);
    case ConvolutionMode.same:
      return SameConvolutionMatrix<T>(
          dataType ?? this.dataType, this, kernel);
  }
}