X-Git-Url: https://git.auder.net/?p=epclust.git;a=blobdiff_plain;f=epclust%2Fsrc%2Ffilter.cpp;h=175000032af80c1e7ad30b1ba2d6889f2bbd56a4;hp=5268a5fefbb187070c3072ce16bff9aeddc385fb;hb=a52836b23adb4bfa6722642ec6426fb7b5f39650;hpb=d9bb53c5e1392018bf67f92140edb10137f3423c diff --git a/epclust/src/filter.cpp b/epclust/src/filter.cpp index 5268a5f..1750000 100644 --- a/epclust/src/filter.cpp +++ b/epclust/src/filter.cpp @@ -12,7 +12,7 @@ using namespace Rcpp; //' //' @return The filtered CWT, in a matrix of same size (LxD) // [[Rcpp::export]] -RcppExport SEXP epclustFilter(SEXP cwt_) +RcppExport SEXP filterMA(SEXP cwt_) { // NOTE: C-style for better efficiency (this must be as fast as possible) int L = INTEGER(Rf_getAttrib(cwt_, R_DimSymbol))[0], @@ -24,7 +24,7 @@ RcppExport SEXP epclustFilter(SEXP cwt_) double* fcwt = REAL(fcwt_); //pointer to the encapsulated vector // NOTE: unused loop parameter: shifting at the end of the loop is more efficient - for (int col=D-1; col>=0; col++) + for (int col=D-1; col>=0; col--) { double v1 = cwt[0]; //first value double ms = v1 + cwt[1] + cwt[2]; //moving sum at second value