Same times ago I suggested this solution for the Optimization
problem....what do you think?
> one <- rep(c(1),100)
> Z <- z %o% one # what you need
> Y <- t(y %o% one) #
> x2 <- colSums(1*(Z<Y)) #
It seems to me quite simple and natural.
bye
Roberto.
----- Original Message -----
From: "Roberto Matterazzo" <roberto.matterazzo@prometeia.it>
To: <cyril.caillault@laposte.net>
Sent: Thursday, February 06, 2003 11:24 AM
Subject: Re: [S] About Optimization
> Try this one
>
> one <- rep(c(1),100)
> Z <- z %o% one # what you need
> Y <- t(y %o% one) #
> x2 <- colSums(1*(Z<Y)) #
>
> It seems to work quite well...but I'm using R.
> Look at the whole example.
>
> bye
> Roberto.
>
>
>
>
>
> Roberto Matterazzo
> PROMETEIA
> Financial Planning & Risk Management
>
>
>
> ----- Original Message -----
> From: <cyril.caillault@laposte.net>
> To: "s news" <s-news@lists.biostat.wustl.edu>
> Sent: Thursday, February 06, 2003 10:20 AM
> Subject: [S] About Optimization
>
>
> Hello,
>
>
>
> is it possible to optimize the following program:
>
>
>
> x<-rep(0,100)
>
> y<-rnorm(100)
>
> z<-rnorm(100)
>
> for(i in 1:100){
>
>
>
> x[i]<-length(z[z<y[i]])
>
>
>
> }
>
>
>
> I would like to delete the "for".
>
>
>
> Cyril
>
> Accédez au courrier électronique de La Poste : www.laposte.net ;
> 3615 LAPOSTENET (0,13 ?/mn) ; tél : 08 92 68 13 50 (0,34?/mn)"
>
>
>
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu. To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message: unsubscribe s-news
>
>
>
Prova_R.DEFANGED-28
Description: application/defanged-28
|