help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Odd behavior of time-domain convolutions


From: Fredrik Lingvall
Subject: Odd behavior of time-domain convolutions
Date: Wed, 05 Sep 2007 14:21:17 +0000
User-agent: Thunderbird 2.0.0.6 (X11/20070804)

Perhaps slightly OT, but anyway, as a part of a toolbox for modeling acoustic waves
(http://www.signal.uu.se/Toolbox/dream) I have a few functions for computing (large)
convolutions (the routines are threaded and can handle matrix inputs) both in the time
and the frequency domains (using fftw). The freq. domain algorithm is expected to be much
faster than the time-domain version for long convolutions. The algorithms is implemented
as C mex-files for  Matlab and C++ oct-files for Octave.  The odd thing is that the  Matlab
time-domain version is much faster than the time-domain Octave version even though
the CFLAGS and the CXXFLAGS are identical (gcc 4.1.2 was  used). See the (embedded) plots below:


Matlab:


Octave:



Note: The red lines is without a pre-computed fftw plan and the green with a pre-computed plan, and
the blue lines is for the time-domain version. The test was done on a 2GHz Dell M90 laptop using both
cores (two treads) for 50 convolutions.

The time-domain convolution algorithm look  like this:

  for(i=0; i<nx; i++) {
    for(j=0; j<ny; j++) {
      zr[i+j] += xr[i] * yr[j];
    }
  }


/Fredrik

reply via email to

[Prev in Thread] Current Thread [Next in Thread]