Module: FFTW

Defined in:
lib/numru/narray_ext.rb

Class Method Summary collapse

Class Method Details

.convol(a1, a2) ⇒ Object



353
354
355
356
357
358
# File 'lib/numru/narray_ext.rb', line 353

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