I can't see how to vectorized your code, maybe it's possible.

That leaves you with either using parallel processing (for example using the
foreach package)

Or, If you know C, you could put that calculation into a C code inside the R
code using Rcpp.

There was a recent video on the topic on a google tech talk:
http://www.r-bloggers.com/integrating-r-with-c-rcpp-rinside-and-rprotobuf/

That's all I can think of, sorry...

Tal


----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




2010/10/30 20c <20c@email.it>

> Hi all,
>
> how can i make the following loop faster?
>
> vv[20001,22]=v[20001,22]
> for(k in 21:1) {
>  for(j in 20001:2) {
>   vv[j-1,k+1]=min(xx[j-1]*v[j-1,k+1],vv[j,k+1])
>   v[j,k]=h[1,k]+vv[j-1,k+1]
>  }
> vv[20001,k]=v[20001,k]
> }
>
>
>
> Thanks
>
> Lorenzo
>
>
>
>
>
>  --
>
>  Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
> autenticato? GRATIS solo con Email.it http://www.email.it/f
>
>
>
>  Sponsor:
>
>  Idee Regalo Personalizzate a partire da euro 3.90! Su MisterCupido.com
> alta qualitя a prezzi imbattibili... e questa settimana GRATIS per te, la
> confezione regalo!
>
>  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=11027&d=30-10
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

	[[alternative HTML version deleted]]

