convolve#
- convolve(a, v)[source]#
Like
numpy.convolve()
, but always returns an array the size of the first array (equivalent to mode=’same’), and solves the boundary problem present innumpy.convolve()
by adjusting the edges by the weight of the convolution kernel.- Parameters:
a (arr) – the input array
v (arr) – the convolution kernel
Example:
a = np.ones(5) v = np.array([0.3, 0.5, 0.2]) c1 = np.convolve(a, v, mode='same') # Returns array([0.8, 1. , 1. , 1. , 0.7]) c2 = sc.convolve(a, v) # Returns array([1., 1., 1., 1., 1.])
New in version 1.3.0.New in version 1.3.1: handling the case where len(a) < len(v)