- if (!sync_mean)
- return (synchrones)
-
- #TODO: can we avoid this loop? ( synchrones = sweep(synchrones, 2, counts, '/') )
- for (i in seq_len(K))
- synchrones[,i] = synchrones[,i] / counts[i]
- #NOTE: odds for some clusters to be empty? (when series already come from stage 2)
- # ...maybe; but let's hope resulting K1' be still quite bigger than K2
- noNA_rows = sapply(seq_len(K), function(i) all(!is.nan(synchrones[,i])))
- if (all(noNA_rows))
- return (synchrones)
- # Else: some clusters are empty, need to slice synchrones
- bigmemory::as.big.matrix(synchrones[,noNA_rows])