X-Git-Url: https://git.auder.net/?p=epclust.git;a=blobdiff_plain;f=epclust%2Fsrc%2Ffilter.cpp;h=cb5a8a0b5d58e553770401accff99438fe0af73f;hp=ee24af604ab2c5cd35a4c754635b7716ca9d477f;hb=0fe757f750f51e580d2c5a7b7f7df87cc405d12d;hpb=0486fbadb122cb4d78c5d9f248c29800a59eb24e diff --git a/epclust/src/filter.cpp b/epclust/src/filter.cpp index ee24af6..cb5a8a0 100644 --- a/epclust/src/filter.cpp +++ b/epclust/src/filter.cpp @@ -1,5 +1,12 @@ #include +#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