[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: simple matrix problem
From: |
taltman |
Subject: |
Re: simple matrix problem |
Date: |
Wed, 5 Nov 2003 18:53:08 +0000 (UTC) |
On Nov 5, 2003 at 2:47pm, Geraint Paul Bevan wrote:
g.beva >data = [ data ( : , 1 ) , detrend ( data ( : , 2 ) ) ]
Not to knit-pick, but an in-place assignment is faster than
re-allocating memory via the [...] operator:
---
octave> version
ans = 2.1.50
octave> A = rand(50,50);
octave> tic;A(:,1) = rand(50,1);toc
ans = 0.0013770
octave> tic;A = [ rand(50,1), A(:,2:50)];toc
ans = 0.0026010
---
It's almost exactly twice as fast. Sorry Geraint, this is just my
curiosity running amok! :-)
~Tomer
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------