-#' curvesToContribs
-#'
-#' Compute the discrete wavelet coefficients for each series, and aggregate them in
-#' energy contribution across scales as described in https://arxiv.org/abs/1101.4744v2
-#'
-#' @param series [big.]matrix of series (in columns), of size L x n
-#' @inheritParams claws
-#'
-#' @return A [big.]matrix of size log(L) x n containing contributions in columns
-#'
-#' @export
-curvesToContribs = function(series, wav_filt, contrib_type, coin=FALSE)
-{
- series = as.matrix(series) #1D serie could occur
- L = nrow(series)
- D = ceiling( log2(L) )
- # Series are interpolated to all have length 2^D
- nb_sample_points = 2^D
- apply(series, 2, function(x) {
- interpolated_curve = spline(1:L, x, n=nb_sample_points)$y
- W = wavelets::dwt(interpolated_curve, filter=wav_filt, D)@W
- # Compute the sum of squared discrete wavelet coefficients, for each scale
- nrj = rev( sapply( W, function(v) ( sqrt( sum(v^2) ) ) ) )
- if (contrib_type!="absolute")
- nrj = nrj / sum(nrj)
- if (contrib_type=="logit")
- nrj = - log(1 - nrj)
- nrj
- })
-}
+ # Compute synchrones, that is to say the cumulated power consumptions for each of the K2
+ # final groups.
+ medoids <- getSeries(indices_medoids)
+ synchrones <- computeSynchrones(medoids, getSeries, nb_curves, nb_series_per_chunk,
+ ncores_last_stage, verbose)