help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Skip one output value


From: Jaroslav Hajek
Subject: Re: Skip one output value
Date: Wed, 10 Dec 2008 21:15:19 +0100

On Tue, Dec 9, 2008 at 11:54 PM, Jakob Malm <address@hidden> wrote:
> Hi,
>
> I am doing the following with a large (256^2 x 300, sometimes sparse)
> matrix, X:
>
> [ U, S, P ] = svd ( X, 0 );
>
> I am only interested in S and P. Can I skip the U somehow, so that it
> does not get assigned, something like
>
> [ ..., S, P ] = svd ( X, 0 );
>
> The reason for wanting to do this is because U becomes the same size as
> X, and takes up memory.
>

If it's absolutely necessary, you can do
Y = X'*X; [S, P] = eig (Y); S ^= 0.5;
but the accuracy may suffer.
Otherwise, it's probably impossible to avoid allocating of at least
one matrix of the same size as X. The reason is that Octave functions
never operate on arguments in place, so whatever operations you
perform on the matrix, it needs to be copied first.


regards


-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]