236
237
238
239
240
241
|
# File 'lib/narray_ext.rb', line 236
def convol(a1,a2)
n1x,n1y = a1.shape
n2x,n2y = a2.shape
raise "arrays must have same shape" if n1x!=n2x || n1y!=n2y
(FFTW.fftw( FFTW.fftw(a1,-1) * FFTW.fftw(a2,-1), 1).real) / (n1x*n1y)
end
|