add comments, fix some things. TODO: comment tests, finish computeWerDists, test it
[epclust.git] / epclust / tests / testthat / helper.computeMedoidsIndices.R
1 # R-equivalent of computeMedoidsIndices, requiring a matrix
2 # (thus potentially breaking "fit-in-memory" hope)
3 R_computeMedoidsIndices <- function(medoids, series)
4 {
5 nb_series = ncol(series) #series in columns
6
7 mi = rep(NA,nb_series)
8 for (i in 1:nb_series)
9 mi[i] <- which.min( colSums( sweep(medoids, 1, series[,i], '-')^2 ) )
10
11 mi
12 }