search for: compd

Displaying 1 result from an estimated 1 matches for "compd".

Did you mean: comp
2010 Dec 26
4
how to replace my double for loop which is little efficient!
Dear all, My double for loop as follows, but it is little efficient, I hope all friends can give me a "vectorized" program to replace my code. thanks x: is a matrix 202*263, that is 202 samples, and 263 independent variables num.compd<-nrow(x); # number of compounds diss.all<-0 for( i in 1:num.compd) for (j in 1:num.compd) if (i!=j) { S1<-sum(x[i,]*x[j,]) S2<-sum(x[i,]^2) S3<-sum(x[j,]^2) sim2<-S1/(S2+S3-S1) diss2<-1-sim2 diss.all<-diss.all+diss2}...