X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=epclust%2FR%2FcomputeWerDists.R;h=f47cd238767cbab18eca0ccec1b8121eec96404f;hb=57f337af19cd6251815bb1ff2d62f4c58e8b6078;hp=c6fa6338384cbbd7eb87e48753af5e90cbe4fa33;hpb=c25d83a0ea7435d3c72ed74738be86ddcccd7e66;p=epclust.git diff --git a/epclust/R/computeWerDists.R b/epclust/R/computeWerDists.R index c6fa633..f47cd23 100644 --- a/epclust/R/computeWerDists.R +++ b/epclust/R/computeWerDists.R @@ -3,8 +3,8 @@ #' Compute the WER distances between the series at specified indices, which are #' obtaind by \code{getSeries(indices)} #' -#' @param indices Range of series indices to cluster -#' @param getSeries Function to retrieve series (argument: 'indices', integer vector), +#' @param indices Indices of the series to consider +#' @param getSeries Function to retrieve series (argument: 'inds', integer vector), #' as columns of a matrix #' @param ncores Number of cores for parallel runs #' @inheritParams claws @@ -12,8 +12,8 @@ #' @return A distances matrix of size K x K where K == length(indices) #' #' @export -computeWerDists <- function(indices, getSeries, nb_series_per_chunk, smooth_lvl=3, nvoice=4, - nbytes=4, endian=.Platform$endian, ncores=3, verbose=FALSE, parll=TRUE) +computeWerDists <- function(indices, getSeries, nb_series_per_chunk, smooth_lvl=3, + nvoice=4, nbytes=4, endian=.Platform$endian, ncores=3, verbose=FALSE) { n <- length(indices) L <- length(getSeries(1)) #TODO: not very neat way to get L @@ -97,6 +97,7 @@ computeWerDists <- function(indices, getSeries, nb_series_per_chunk, smooth_lvl= for (inds in indices_cwt) computeSaveCWT(inds) + parll <- (ncores > 1) if (parll) { # outfile=="" to see stderr/stdout on terminal @@ -115,7 +116,7 @@ computeWerDists <- function(indices, getSeries, nb_series_per_chunk, smooth_lvl= ignored <- if (parll) - parallel::parLapply(cl, seq_len(n-1), computeDistances) + parallel::parLapplyLB(cl, seq_len(n-1), computeDistances) else lapply(seq_len(n-1), computeDistances) Xwer_dist[n,n] <- 0.