The conv_spec function does not implement convolution:
def conv_spec(a, b):
out = np.zeros(*a.shape)
len = b.shape[0]
for i in range(a.shape[0]):
out[i] = sum([a[i + j] * b[j] for j in range(len) if i + j < a.shape[0]])
return out
One of the inputs should be index-reversed (see wikipedia)
We can also confirm the error using numpy.convolve
The conv_spec function does not implement convolution:
One of the inputs should be index-reversed (see wikipedia)
We can also confirm the error using numpy.convolve
Test 1 output:
which conflicts with the conv_spec output:
Test 2 output:
which also conflicts with the conv_spec output: