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: Computation efficiency: convolution or direct calculation
Replies: 1   Last Post: Dec 5, 2012 6:52 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Matt J

Posts: 4,997
Registered: 11/28/09
Re: Computation efficiency: convolution or direct calculation
Posted: Dec 5, 2012 6:52 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Luca " <l.presottoRE@MOVE.campus.unimib.NOTit> wrote in message <k9ngvn$c9h$>...
> It turns out using tic and toc that the ugly method using the for loops takes 5 ms while the convolution using conv take 220 ms.
> How's that???
> (ok... maybe with the convolution I could go to much wider "time" frames to reduce the dimension of about 10-100 and become as fast or faster...)
> And... which method shall I be using?


It seems pretty clear why implementing as a filter as opposed to a convolution is faster. The filtering operation is very sparse whereas conv(R,S) is very non-sparse. If R and/or S happen to be sparse, you might be able to exploit the sparsity by doing sparse convolution, e.g., using

Otherwise, the filter seems to be the thing to use. You might be able to accelerate the filter implementation somewhat, as compared to the for-loop, using the FILTER command.

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.