Displaying 1 result from an estimated 1 matches for "tmp_m".
Did you mean:
tmp__
2012 Oct 08
1
Any better way of optimizing time for calculating distances in the mentioned scenario??
...d[1,1:10])
time taken for running the code is :
real 1m33.088s
user 1m32.287s
sys 0m0.036s
2) scenario2:
> x<-read.table("query.vec")
> v<-read.table("query.vec2")
> v<-as.matrix(v)
> d<-matrix(nrow=nrow(v),ncol=nrow(x))
> for (i in 1:nrow(v)){
+ tmp_m<-matrix(rep(v[i,],nrow(x)),nrow=nrow(x),byrow=T)
+ d[i,]<- rowSums(abs(tmp_m - x))
+ }
> print(d[1,1:10])
time taken for running the code is:
real 0m0.882s
user 0m0.854s
sys 0m0.025s
3) scenario3:
> x<-read.table("query.vec")
> v<-read.table("query.vec2&...