From af3ea94782db30c2fc1bd796d788dab5e1fb79ed Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 8 Mar 2017 02:34:24 +0100
Subject: [PATCH] forgot to pass parll arg

---
 epclust/R/clustering.R | 11 +++++------
 epclust/R/main.R       |  6 +++---
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/epclust/R/clustering.R b/epclust/R/clustering.R
index 74d009e..14e1f83 100644
--- a/epclust/R/clustering.R
+++ b/epclust/R/clustering.R
@@ -121,10 +121,7 @@ computeSynchrones = function(medoids, getRefSeries,
 	for (inds in indices_workers)
 	{
 		if (verbose)
-		{
-			cat(paste("--- Compute synchrones for indices range ",
-				min(inds)," -> ",max(inds),"\n", sep=""))
-		}
+			cat(paste("--- Compute synchrones for ",length(inds)," lines\n", sep=""))
 		if (parll)
 			ignored <- parallel::mcparallel(computeSynchronesChunk(inds))
 		else
@@ -184,14 +181,16 @@ computeWerDists = function(synchrones, ncores_clust=1,verbose=FALSE,parll=TRUE)
 		ts.cwt = totts.cwt[,s0log:(s0log+noctave*nvoice)]
 		#Normalization
 		sqs <- sqrt(2^(0:(noctave*nvoice)/nvoice)*s0)
-		sqres <- sweep(ts.cwt,MARGIN=2,sqs,'*')
+		sqres <- sweep(ts.cwt,2,sqs,'*')
 		sqres / max(Mod(sqres))
 	}
 
 	if (parll)
 	{
 		cl = parallel::makeCluster(ncores_clust)
-		parallel::clusterExport(cl, varlist=c("getContribs","K1","verbose"), envir=environment())
+		parallel::clusterExport(cl,
+			varlist=c("synchrones","totnoct","nvoice","w0","s0log","noctave","s0","verbose"),
+			envir=environment())
 	}
 
 	# (normalized) observations node with CWT
diff --git a/epclust/R/main.R b/epclust/R/main.R
index 9064dfa..bf31c87 100644
--- a/epclust/R/main.R
+++ b/epclust/R/main.R
@@ -222,9 +222,9 @@ claws = function(getSeries, K1, K2,
 	if (verbose)
 		cat("...Run final // stage 1 + stage 2\n")
 	indices_medoids = clusteringTask1(
-		indices, getContribs, K1, nb_series_per_chunk, ncores_tasks*ncores_clust, verbose)
-	medoids = computeClusters2(getSeries(indices_medoids),
-		K2, getRefSeries, nb_curves, nb_series_per_chunk, ncores_tasks*ncores_clust, verbose)
+		indices, getContribs, K1, nb_series_per_chunk, ncores_tasks*ncores_clust, verbose, parll)
+	medoids = computeClusters2(getSeries(indices_medoids), K2,
+		getRefSeries, nb_curves, nb_series_per_chunk, ncores_tasks*ncores_clust, verbose, parll)
 
 	# Cleanup
 	unlink(bin_dir, recursive=TRUE)
-- 
2.44.0