[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: row vectors changed to column vectors?
From: |
Christoph Dalitz |
Subject: |
Re: row vectors changed to column vectors? |
Date: |
Tue, 10 Feb 2004 20:07:08 +0100 |
On Tue, 10 Feb 2004 17:46:55 +0100
"Christian T. Steigies" <address@hidden> wrote:
>
> > >BTW, if you are creating vectors by doing things like
> > >
> > > clear a;
> > > for i = 1:N
> > > a(i) = something();
> > > end
> > >
> > >then you should probably rethink your method, because this type of
> > >loop the vector A to be resized N times, which will be slow.
>
> Yes, it is slow, what do you suggest? Should I create a matrix with
> zero(N,1) first? Looks as if it is just a few ms difference.
>
If your matrix entries can be computed in some way, might look for a way
to create your matrix with builtin vector/matrix operations, eg.
[1^2,2^2,3^2,...,n^2]
could be created with (1:n).^2.
You can find more suggestions in
http://lionel.kr.hs-niederrhein.de/~dalitz/data/lehre/CBM/vektorisierung-4up.ps.gz
(it is in German, but the formula are understandable supralingual)
Hope this helps,
Christoph
-------------------------------------------------------------
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
-------------------------------------------------------------