-# 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 clusteringTask computeClusters1 computeClusters2
+#'
+#' @title Two-stages clustering, withing one task (see \code{claws()})
+#'
+#' @description \code{clusteringTask()} runs one full task, which consists in iterated stage 1
+#' clustering (on nb_curves / ntasks energy contributions, computed through discrete
+#' wavelets coefficients). \code{computeClusters1()} and \code{computeClusters2()}
+#' correspond to the atomic clustering procedures respectively for stage 1 and 2.
+#' The former applies the clustering algorithm (PAM) on a contributions matrix, while
+#' the latter clusters a chunk of series inside one task (~max nb_series_per_chunk)
+#'
+#' @param indices Range of series indices to cluster in parallel (initial data)
+#' @param getContribs Function to retrieve contributions from initial series indices:
+#' \code{getContribs(indices)} outpus a contributions matrix
+#' @param contribs matrix of contributions (e.g. output of \code{curvesToContribs()})
+#' @inheritParams computeSynchrones
+#' @inheritParams claws
+#'
+#' @return For \code{clusteringTask()} and \code{computeClusters1()}, the indices of the
+#' computed (K1) medoids. Indices are irrelevant for stage 2 clustering, thus
+#' \code{computeClusters2()} outputs a matrix of medoids
+#' (of size limited by nb_series_per_chunk)
+NULL
+
+#' @rdname clustering
+#' @export
+clusteringTask = function(indices, getContribs, K1, nb_series_per_chunk, ncores_clust)