Dear Carlos,
thanks for your support. Patrick Burns gave me a hint, which is in the
end very similar to your proposal. Now the script is roughly 25 times
faster.
Here is the code (I implemented as well an in size not increasing
vector 'summ.dist<-rep(0,val.x.c.n)'):
KEN.STO<-function(val.n
Dear Patrick,
thanks for the very helpful response. I can calculate now 25 times
faster.
I use the 'k' from the outer-most loop only indirectly. It gives a
maximal number of repetitions of the whole script until following
command applies
'if(length(val.x.c)>=val.x.c.n)break'.
The reason w
Hello,
I believe that your bottleneck lies at this piece of code:
sum<-c();
for(j in 1:length(val)){
sum[j]<-euc[rownames(start.b)[i],val[j]]
}
In order to speed up your code, there are two alternatives:
1) Try to reorder the euc matrix so that the sum vector corresponds to
(part of) a
You are definitely in Circle 2 of the R Inferno.
Growing objects is suboptimal, although your
objects are small so this probably isn't taking
too much time.
There is no need for the inner-most loop:
sum.dist[i] <- min(euc[rownames(start.b)[i],val] )
Maybe I'm blind, but I don't see where 'k' c
Dear R-programmer,
I wrote an adapted implementation of the Kennard-Stone algorithm for
sample selection of multivariate data (R 2.7.1 under MacBook Pro,
Processor 2.2 GHz Intel Core 2 Duo, Memory 2 GB 667 MHZ DDR2 SDRAM).
I used for the heart of the script three embedded loops. This makes it
5 matches
Mail list logo