convolve method

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

Returns a view of the convolution between this vector 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

Vector<T> convolve(
  Vector<T> kernel, {
  DataType<T>? dataType,
  ConvolutionMode mode = ConvolutionMode.full,
}) {
  switch (mode) {
    case ConvolutionMode.full:
      return FullConvolutionVector<T>(
          dataType ?? this.dataType, this, kernel);
    case ConvolutionMode.valid:
      return ValidConvolutionVector<T>(
          dataType ?? this.dataType, this, kernel);
    case ConvolutionMode.same:
      return SameConvolutionVector<T>(
          dataType ?? this.dataType, this, kernel);
  }
}