help-octave
[Top][All Lists]
Advanced

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

Re: Speedup/Refaktoring loop?


From: Thomas Weber
Subject: Re: Speedup/Refaktoring loop?
Date: Tue, 19 Aug 2008 12:27:45 +0200

Am Dienstag, den 19.08.2008, 11:53 +0200 schrieb Andreas Romeyke:
> Hi,
> 
> There are any tricks to speedup the following piece of code?
> 
>     for i=1:n
>         a=transpose(U) * X;
>         tmpU = transpose(U)*U;
These two lines shouldn't be in the for loop at all.

>         for j=1:columns
>             b=tmpU*V;
This line should be taken out of both loops.

>             V(i,j)=V(i,j)* a(i,j)/b(i,j);
>         end
>     end

With the above changes, it should be possible to eliminate the loop over
'i'. Use row vectors in the 'j' loop to achieve a similar effect that
the loop over 'i' currently has.

        Thomas




reply via email to

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