The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: convn and (i)fftn
Replies: 10   Last Post: May 16, 2016 4:51 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Alle Mejie

Posts: 12
Registered: 2/24/11
Re: convn and (i)fftn
Posted: Jun 22, 2011 11:39 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> There's no reason you should be using FFT's with such a small kernel. Also,
> you're not exploiting the separability of the Gaussian. The separability allows you to convolve with a 1D Gaussian first along x, then along y, then along z, which is more efficient than consolidating into a 3D convolution kernel.

Ah, I did forget that indeed. To wrapped up in the frequency domain...

Would like to point out that the FFT version made by 'John' is seriously faster than the original convn() approach!

> Below, I've implemented this using my interpMatrix and KronProd tools.
> I'm getting a factor of 5 speed-up over FFTN and a factor of 7 speed-up over CONVN

I will try it out as well, thanks!

> dist = sqrt ( (-ksize:ksize).^ 2) ;
> gauss = 1 / ( sigma * sqrt ( 2 * pi ) ) * exp ( -0.5 * dist .^ 2 / ( sigma ) ^2 ) ;
> gauss=gauss/sum(gauss(:));
> Hxy=interpMatrix(gauss,'max',144);
> Hz=interpMatrix(gauss,'max',44);
> K=KronProd({Hxy,Hz},[1 1 2]);
> tic;
> filtered3=K*vol;
> toc;%Elapsed time is 0.039550 seconds.

Brilliant. So, what would you (in general, or more specifically for this problem), recommend in terms of speed: do as you've done, combine as many dimensions as possible (Hxy and Hz), or to separate out every dimension (have separate Hx, Hy, and Hz)?

Alle Meije

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.