komm.convolve
Convolves two signals. This is like numpy.convolve, but one of the inputs may be multidimensional (the other input must still be $1$-dimensional). The convolution is applied independently to each array along a specified axis.
Note
This is a simple wrapper around numpy.convolve.
Parameters:
-
input1(ArrayLike) –The first input array.
-
input2(ArrayLike) –The second input array.
-
axis(int) –The axis along which the convolution is applied in the multidimensional input. Default is the last axis.
-
mode(Literal['full', 'valid', 'same']) –Convolution mode (same as
numpy.convolve).
Examples:
>>> komm.convolve([1, 1], [1, 1])
array([1, 2, 1])
>>> komm.convolve([1, 1], [[1, 1, 0], [0, 1, 1]])
array([[1, 2, 1, 0],
[0, 1, 2, 1]])
>>> komm.convolve([[1, 1, 0], [0, 1, 1]], [1, 1])
array([[1, 2, 1, 0],
[0, 1, 2, 1]])
>>> komm.convolve([1, 1], [[1, 1, 0], [0, 1, 1]], axis=0)
array([[1, 1, 0],
[1, 2, 1],
[0, 1, 1]])
>>> komm.convolve([[1, 1]], [[1, 1]])
Traceback (most recent call last):
...
ValueError: at least one of the inputs must be 1-dimensional