From: Benjamin Auder Date: Fri, 10 Mar 2017 21:55:26 +0000 (+0100) Subject: save state; test clustering not OK, all others OK X-Git-Url: https://git.auder.net/js/img/current/doc/parser.js?a=commitdiff_plain;h=0fe757f750f51e580d2c5a7b7f7df87cc405d12d;p=epclust.git save state; test clustering not OK, all others OK --- diff --git a/epclust/R/clustering.R b/epclust/R/clustering.R index b09c1bc..8662f89 100644 --- a/epclust/R/clustering.R +++ b/epclust/R/clustering.R @@ -318,16 +318,16 @@ computeWerDists = function(synchrones, nbytes,endian,ncores_clust=1,verbose=FALS { L = length(indices) nb_workers = floor( L / nb_per_set ) - rem = L %% max_nb_per_set + rem = L %% nb_per_set if (nb_workers == 0 || (nb_workers==1 && rem==0)) { - # L <= max_nb_per_set, simple case + # L <= nb_per_set, simple case indices_workers = list(indices) } else { indices_workers = lapply( seq_len(nb_workers), function(i) - indices[(nb_per_chunk*(i-1)+1):(nb_per_set*i)] ) + indices[(nb_per_set*(i-1)+1):(nb_per_set*i)] ) # Spread the remaining load among the workers rem = L %% nb_per_set while (rem > 0) diff --git a/epclust/R/main.R b/epclust/R/main.R index 9e9b641..e003933 100644 --- a/epclust/R/main.R +++ b/epclust/R/main.R @@ -348,9 +348,10 @@ claws <- function(getSeries, K1, K2, nb_series_per_chunk, #' @return A [big.]matrix of size log(L) x n containing contributions in columns #' #' @export -curvesToContribs = function(series, wav_filt, contrib_type) +curvesToContribs = function(series, wav_filt, contrib_type, coin=FALSE) { L = nrow(series) + if (coin) browser() D = ceiling( log2(L) ) nb_sample_points = 2^D apply(series, 2, function(x) { diff --git a/epclust/src/computeMedoidsIndices.cpp b/epclust/src/computeMedoidsIndices.cpp index 6934181..f247584 100644 --- a/epclust/src/computeMedoidsIndices.cpp +++ b/epclust/src/computeMedoidsIndices.cpp @@ -21,9 +21,9 @@ IntegerVector computeMedoidsIndices(SEXP pMedoids, NumericMatrix ref_series) { XPtr pMed(pMedoids); MatrixAccessor medoids = MatrixAccessor(*pMed); - int nb_series = ref_series.nrow(), - K = pMed->nrow(), - L = pMed->ncol(); + int nb_series = ref_series.ncol(), + K = pMed->ncol(), + L = pMed->nrow(); IntegerVector mi(nb_series); for (int i=0; i +#include // Rprintf() +//#include // user interrupts +#include +#include + +#include + using namespace Rcpp; //' filter @@ -10,31 +17,35 @@ using namespace Rcpp; //' //' @return The filtered CWT // [[Rcpp::export]] -NumericMatrix epclustFilter(NumericMatrix cwt) +RcppExport SEXP epclustFilter(SEXP cwt_) { - int L = cwt.nrow(), - D = cwt.ncol(); - NumericMatrix fcwt(L, D); //fill with 0... TODO: back to SEXP C-style? - double *cwt_c = cwt.begin(), - *fcwt_c = fcwt.begin(); + int L = INTEGER(Rf_getAttrib(cwt_, R_DimSymbol))[0], + D = INTEGER(Rf_getAttrib(cwt_, R_DimSymbol))[1]; + double *cwt = REAL(cwt_); + SEXP fcwt_; + PROTECT(fcwt_ = Rf_allocMatrix(REALSXP, L, D)); + double* fcwt = REAL(fcwt_); //(double*)malloc(L*D*sizeof(double)); //TODO: coding style is terrible... no time for now. for (int col=0; col