+ pairs = c(pairs, lapply(V, function(v) c(i,v)))
+ }
+
+ computeSaveCWT = function(index)
+ {
+ ts <- scale(ts(synchrones[index,]), center=TRUE, scale=scaled)
+ totts.cwt = Rwave::cwt(ts, totnoct, nvoice, w0, plot=FALSE)
+ ts.cwt = totts.cwt[,s0log:(s0log+noctave*nvoice)]
+ #Normalization
+ sqs <- sqrt(2^(0:(noctave*nvoice)/nvoice)*s0)
+ sqres <- sweep(ts.cwt,2,sqs,'*')
+ res <- sqres / max(Mod(sqres))
+ #TODO: serializer les CWT, les récupérer via getDataInFile ;
+ #--> OK, faut juste stocker comme séries simples de taille delta*ncol (53*17519)
+ binarize(res, cwt_file, 100, ",", nbytes, endian)
+ }
+
+ if (parll)
+ {
+ cl = parallel::makeCluster(ncores_clust)
+ synchrones_desc <- bigmemory::describe(synchrones)
+ Xwer_dist_desc <- bigmemory::describe(Xwer_dist)
+ parallel::clusterExport(cl, varlist=c("synchrones_desc","Xwer_dist_desc","totnoct",
+ "nvoice","w0","s0log","noctave","s0","verbose","getCWT"), envir=environment())
+ }
+
+ #precompute and serialize all CWT
+ ignored <-
+ if (parll)
+ parallel::parLapply(cl, 1:n, computeSaveCWT)
+ else
+ lapply(1:n, computeSaveCWT)
+
+ getCWT = function(index)
+ {
+ #from cwt_file ...
+ }