Module: FFTW

Defined in:
lib/narray_ext.rb

Class Method Summary collapse

Class Method Details

.convol(a1, a2) ⇒ Object



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