help-octave
[Top][All Lists]
Advanced

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

Re: Speedup/Refaktoring loop? Extended...


From: Andreas Romeyke
Subject: Re: Speedup/Refaktoring loop? Extended...
Date: Tue, 19 Aug 2008 12:47:57 +0200

Hello,

Am Tue, 19 Aug 2008 11:53:13 +0200
schrieb Andreas Romeyke <address@hidden>:

> 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

This was only the minor part of the algorithm. Because Jaroslav and me
does not detect further optimizations, here the whole algorithm (which
makes it clear, that your hint, Thomas, does not work...) to compute
NMF (Lee & Seung):

for iteration = 1:maxit
    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
    for i=1:n
        tmpV=V*transpose(V);
        a=X*transpose(V);
        for k=1:rows
            b=U*tmpV;
            U(k,i)=U(k,i)*a(k,i)/b(k,i);
        end
    end
end

Do you see any chance to optimize this code for octave?

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]