+#' \cr
+#' The main argument -- \code{getSeries} -- has a quite misleading name, since it can be
+#' either a [big.]matrix, a CSV file, a connection or a user function to retrieve
+#' series; the name was chosen because all types of arguments are converted to a function.
+#' When \code{getSeries} is given as a function, it must take a single argument,
+#' 'indices', integer vector equal to the indices of the curves to retrieve;
+#' see SQLite example. The nature and role of other arguments should be clear
+#' \cr
+#' Note: Since we don't make assumptions on initial data, there is a possibility that
+#' even when serialized, contributions or synchrones do not fit in RAM. For example,
+#' 30e6 series of length 100,000 would lead to a +4Go contribution matrix. Therefore,
+#' it's safer to place these in (binary) files; that's what we do.
+#'
+#' @param getSeries Access to the (time-)series, which can be of one of the three
+#' following types:
+#' \itemize{
+#' \item [big.]matrix: each column contains the (time-ordered) values of one time-serie
+#' \item connection: any R connection object providing lines as described above
+#' \item character: name of a CSV file containing series in rows (no header)
+#' \item function: a custom way to retrieve the curves; it has only one argument:
+#' the indices of the series to be retrieved. See SQLite example
+#' }
+#' @param K1 Number of clusters to be found after stage 1 (K1 << N [number of series])
+#' @param K2 Number of clusters to be found after stage 2 (K2 << K1)
+#' @param nb_series_per_chunk (Maximum) number of series to retrieve in one batch
+#' @param algoClust1 Clustering algorithm for stage 1. A function which takes (data, K)
+#' as argument where data is a matrix in columns and K the desired number of clusters,
+#' and outputs K medoids ranks. Default: PAM. In our method, this function is called
+#' on iterated medoids during stage 1
+#' @param algoClust2 Clustering algorithm for stage 2. A function which takes (dists, K)
+#' as argument where dists is a matrix of distances and K the desired number of clusters,
+#' and outputs K medoids ranks. Default: PAM. In our method, this function is called
+#' on a matrix of K1 x K1 (WER) distances computed between synchrones
+#' @param nb_items_clust1 (~Maximum) number of items in input of the clustering algorithm
+#' for stage 1. At worst, a clustering algorithm might be called with ~2*nb_items_clust1
+#' items; but this could only happen at the last few iterations.
+#' @param wav_filt Wavelet transform filter; see ?wavelets::wt.filter
+#' @param contrib_type Type of contribution: "relative", "logit" or "absolute" (any prefix)
+#' @param WER "end" to apply stage 2 after stage 1 has fully iterated, or "mix" to apply
+#' stage 2 at the end of each task
+#' @param random TRUE (default) for random chunks repartition
+#' @param ntasks Number of tasks (parallel iterations to obtain K1 [if WER=="end"]
+#' or K2 [if WER=="mix"] medoids); default: 1.
+#' Note: ntasks << N (number of series), so that N is "roughly divisible" by ntasks
+#' @param ncores_tasks Number of parallel tasks (1 to disable: sequential tasks)
+#' @param ncores_clust Number of parallel clusterings in one task (4 should be a minimum)
+#' @param sep Separator in CSV input file (if any provided)
+#' @param nbytes Number of bytes to serialize a floating-point number; 4 or 8
+#' @param endian Endianness for (de)serialization ("little" or "big")
+#' @param verbose Level of verbosity (0/FALSE for nothing or 1/TRUE for all; devel stage)
+#' @param parll TRUE to fully parallelize; otherwise run sequentially (debug, comparison)
+#'
+#' @return A matrix of the final K2 medoids curves, in columns
+#'
+#' @references Clustering functional data using Wavelets [2013];
+#' A. Antoniadis, X. Brossat, J. Cugliari & J.-M. Poggi.
+#' Inter. J. of Wavelets, Multiresolution and Information Procesing,
+#' vol. 11, No 1, pp.1-30. doi:10.1142/S0219691313500033
+#'
+#' @examples
+#' \dontrun{
+#' # WER distances computations are too long for CRAN (for now)
+#'
+#' # Random series around cos(x,2x,3x)/sin(x,2x,3x)
+#' x = seq(0,500,0.05)
+#' L = length(x) #10001
+#' ref_series = matrix( c(cos(x),cos(2*x),cos(3*x),sin(x),sin(2*x),sin(3*x)), ncol=6 )
+#' library(wmtsa)
+#' series = do.call( cbind, lapply( 1:6, function(i)
+#' do.call(cbind, wmtsa::wavBootstrap(ref_series[i,], n.realization=400)) ) )
+#' #dim(series) #c(2400,10001)
+#' medoids_ascii = claws(series, K1=60, K2=6, 200, verbose=TRUE)