Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

Topic: convn and (i)fftn
Replies: 9   Last Post: Jun 23, 2011 9:00 AM

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 23, 2011 4:32 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> I'm getting a factor of 5 speed-up over FFTN and a factor of 7 speed-up over CONVN
>
> % 3-dimensional filtering with convn
> tic
> filtered = convn ( volume, gauss, 'same' ) ;
> toc;%Elapsed time is 0.308417 seconds.
>
> % 3-dimensional filtering with fftn
> tic;
> gf = fftn ( gauss2, size ( volume ) ) ;
> gv = fftn ( volume, size ( volume ) ) ;
> filtered2 = real ( ifftn ( conj ( gf ) .* gv ) ) ;
> toc;%Elapsed time is 0.192878 seconds.
>
> % 3-dimensional filtering using KronProd to exploit separability
>
> 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.


I'm getting an error on this line in interpMatrix.m:

if ischar(origin)
switch origin
case 'max'
[~,origin]=max(kernel);
^^^^^^^^^^^^^^^^^^^^^
>>Expression or statement is incorrect--possibly unbalanced (, {, or [. <<
case 'ctr'
origin = ceil( (length(kernel)+1)/2 );
otherwise
error 'Unrecognized option for "origin"'
end
end

The line makes no sense to me either. Should the '~,' just go?

thanks
Alle Meije



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.