An implementation of traditional (i.e. not utilising FFTs) convolution with
ndarray. Designed to match numpy
's convolve
with mode='same'
.
The code could be made to work for multi-dimensional arrays, but at present, I have not investigated how.
numpy example of convolve with mode='same':
>>> np.convolve([1,2,3],[0,1,0.5], 'same')
array([1. , 2.5, 4. ])
ndarray code follows:
data: [1.0, 2.0, 3.0], shape=[3], strides=[1], layout=C | F (0x3), const ndim=1
window: [0.0, 1.0, 0.5], shape=[3], strides=[1], layout=C | F (0x3), const ndim=1
convolution: [1.0, 2.5, 4.0], shape=[3], strides=[1], layout=C | F (0x3), const ndim=1