help-octave
[Top][All Lists]
Advanced

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

Speedup/Refaktoring loop?


From: Andreas Romeyke
Subject: Speedup/Refaktoring loop?
Date: Tue, 19 Aug 2008 11:53:13 +0200

Hi,

There are any tricks to speedup the following piece of code?

    for i=1:n
        a=transpose(U) * X;
        tmpU = transpose(U)*U;
        for j=1:columns
            b=tmpU*V;
            V(i,j)=V(i,j)* a(i,j)/b(i,j);
        end
    end

U and V are rectangular matrices, X is a squared matrix.

The variant to replace line "V(i,j)=V(i,j)* a(i,j)/b(i,j);" with

"V = V .* a ./ b" is much slower.

I used Octave 2.9.9 to time the code.

Any hints?

Bye Andreas



-- 
Software Developer / Dipl. Inform. (FH)
Max Planck Institute for Human Cognitive and Brain Sciences
Department of Psychology
Stephanstr. 1a, 04103 Leipzig, Germany

Attachment: signature.asc
Description: PGP signature


reply via email to

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