Re: Autocorrelation matrix of a long sequence
- From: Rune Allnor <allnor@xxxxxxxxxxxx>
- Date: Fri, 17 Apr 2009 00:45:36 -0700 (PDT)
On 16 Apr, 23:27, SG <s.gesem...@xxxxxxxxx> wrote:
On 16 Apr., 22:52, Vladimir Vassilevsky <antispam_bo...@xxxxxxxxxxx>
wrote:
sasuke wrote:
Hi
I am using MATLAB to generate close to 10^8 samples
First mistake. Don't use MATLAB for serious computations. A plain C++
program runs ~10 times faster.
This statement is far too general.
Unless you have stripped the operations down to the core
BLAS/LAPACK level, Vladimir is right. There is the interpreter
overhead as well as the call-by-value function call overhead,
which take a lot more time than people realize. More below.
It's not easy to compare the
performances on this level. The programming style is different. If you
want your Matlab code to run fast you usually exploit all the built-in
functions (which map to ATLAS, FFTW, ....) and operate on a matrix/
vector level as opposed to touching every scalar by hand.
And you have to throw every good programming practice
down the drains. One aspect of matlab is that variables
are passed between functions by copy, not by reference,
which means that local copies of variables are found
all over the place.
This first of all consumes memory but also consumes lots
of time copying variables back and forth, where one would
use pointers or references in C or C++.
The solution is to avoid using functions, thus forefeiting
testing habits, code reusability and source code managment.
But this may
also lead to higher memory requirements than what would be necessary
in case of C or C++.
Nope. It *might* not spend more memory. It *certainly* makes
the program blow up and grab all the memory it can get.
Rune
.
- Follow-Ups:
- References:
- Autocorrelation matrix of a long sequence
- From: sasuke
- Re: Autocorrelation matrix of a long sequence
- From: Vladimir Vassilevsky
- Re: Autocorrelation matrix of a long sequence
- From: SG
- Autocorrelation matrix of a long sequence
- Prev by Date: Re: Windowing in the Frequency Domain
- Next by Date: Re: Autocorrelation matrix of a long sequence
- Previous by thread: Re: Autocorrelation matrix of a long sequence
- Next by thread: Re: Autocorrelation matrix of a long sequence
- Index(es):
Relevant Pages
|