conv1d#

1D convolution

Performs a convolution operation of two inputs. Three convolution modes are available: full, same, and valid. The mode controls how much (if any) of the output is truncated to remove filter ramps. The method parameter allows either direct or FFT-based convolution. Direct performs the typical sliding-window dot product approach, whereas FFT uses the convolution theorem. The FFT method may be faster for large inputs, but both methods should be tested for the target input sizes.

template<typename In1Type, typename In2Type>
__MATX_INLINE__ auto matx::conv1d(const In1Type &i1, const In2Type &i2, matxConvCorrMode_t mode = MATX_C_MODE_FULL, matxConvCorrMethod_t method = MATX_C_METHOD_DIRECT)#

1D convolution

Template Parameters:
  • In1Type – Type of first input

  • In2Type – Type of second input

Parameters:
  • i1 – First input operator

  • i2 – Second input operator

  • mode – Convolution mode (FULL, SAME, or VALID)

  • method – Convolution method (direct or FFT). Only complex inputs are supported for FFT currently

Convolution/Correlation Mode#

The mode parameter specifies how the output size is determined:

  • MATX_C_MODE_FULL: Keep all elements including ramp-up/down (output size = N + M - 1)

  • MATX_C_MODE_SAME: Keep only elements where entire filter was present (output size = max(N, M))

  • MATX_C_MODE_VALID: Keep only elements with full overlap (output size = max(N, M) - min(N, M) + 1)

Convolution/Correlation Method#

The method parameter specifies the algorithm to use:

  • MATX_C_METHOD_DIRECT: Direct convolution using sliding window approach

  • MATX_C_METHOD_FFT: FFT-based convolution using the convolution theorem (may be faster for large inputs)

Examples#

// 1D convolution in FULL mode where every output is stored
(this->cv = conv1d(this->av, this->bv, MATX_C_MODE_FULL)).run(this->exec);
(out2 = conv1d(in1, in2, {2}, MATX_C_MODE_SAME)).run(this->exec);
template<typename In1Type, typename In2Type>
__MATX_INLINE__ auto matx::conv1d(const In1Type &i1, const In2Type &i2, const int32_t (&axis)[1], matxConvCorrMode_t mode = MATX_C_MODE_FULL, matxConvCorrMethod_t method = MATX_C_METHOD_DIRECT)#

1D convolution

Template Parameters:
  • In1Type – Type of first input

  • In2Type – Type of second input

Parameters:
  • i1 – First input operator

  • i2 – Second input operator

  • axis – the axis to perform convolution

  • mode – Convolution mode (FULL, SAME, or VALID)

  • method – Convolution method (direct or FFT). Only complex inputs are supported for FFT currently

Examples#

(out2 = conv1d(in1, in2, {1}, MATX_C_MODE_SAME)).run(this->exec);