-# Cluster one full task (nb_curves / ntasks series); only step 1
-clusteringTask = function(indices, getCoefs, K1, nb_series_per_chunk, ncores)
+#' @name clustering
+#' @rdname clustering
+#' @aliases clusteringTask1 clusteringTask2 computeClusters1 computeClusters2
+#'
+#' @title Two-stage clustering, withing one task (see \code{claws()})
+#'
+#' @description \code{clusteringTask1()} runs one full stage-1 task, which consists in
+#' iterated stage 1 clustering on nb_curves / ntasks energy contributions, computed
+#' through discrete wavelets coefficients.
+#' \code{clusteringTask2()} runs a full stage-2 task, which consists in
+#' WER distances computations between medoids indices output from stage 1,
+#' before applying the second clustering algorithm, on the distances matrix.
+#'
+#' @param indices Range of series indices to cluster
+#' @param getContribs Function to retrieve contributions from initial series indices:
+#' \code{getContribs(indices)} outputs a contributions matrix
+#' @inheritParams claws
+#' @inheritParams computeSynchrones
+#'
+#' @return For \code{clusteringTask1()}, the indices of the computed (K1) medoids.
+#' Indices are irrelevant for stage 2 clustering, thus \code{clusteringTask2()}
+#' outputs a big.matrix of medoids (of size LxK2, K2 = final number of clusters)
+NULL
+
+#' @rdname clustering
+#' @export
+clusteringTask1 = function(indices, getContribs, K1, algoClust1, nb_series_per_chunk,
+ ncores_clust=1, verbose=FALSE, parll=TRUE)