search for: scenario4

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

Did you mean: scenario
2012 Oct 08
1
Any better way of optimizing time for calculating distances in the mentioned scenario??
...v<-as.matrix(v) > d<-matrix(nrow=nrow(v),ncol=nrow(x)) > for (i in 1:nrow(v)){ + d[i,]<-sapply(1:nrow(x),function(z){dist(rbind(v[i,],x[z,]),method="manhattan")}) + } > print(d[1,1:10]) time taken for running the code is: real 1m3.817s user 1m3.543s sys 0m0.031s 4) scenario4: > x<-read.table("query.vec") > v<-read.table("query.vec2") > v<-as.matrix(v) > d<-dist(rbind(v,x),method="manhattan") > m<-as.matrix(d) > m2<-m[1:nrow(v),(nrow(v)+1):nrow(x)] > print(m2[1,1:10]) time taken for running the code:...