help-octave
[Top][All Lists]
Advanced

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

Re: Speedup/Refaktoring loop? Extended...


From: Jaroslav Hajek
Subject: Re: Speedup/Refaktoring loop? Extended...
Date: Tue, 19 Aug 2008 13:20:42 +0200

> 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?
>


try:

for iteration = 1:maxit
   a=transpose(U) * X;
   tmpU = transpose(U)*U;
   for i=1:n
       bi=tmpU(i,:)*V;
       V(i,:) = V(i,:) .* a(i,:) / b;
   end

   .. and analogously for the second loop
end


> Bye Andreas
>
>
>
> --
> Software Developer / Dipl. Inform. (FH)
> Max Planck Institute for Human Cognitive and Brain Sciences
> Department of Psychology
> Stephanstr. 1a, 04103 Leipzig, Germany
>
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
>



-- 
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]