3 #include <R.h> // Rprintf()
4 //#include <R_ext/Utils.h> // user interrupts
6 #include <Rinternals.h>
14 //' Filter time-series
16 //' @param cwt Continuous wavelets transform
18 //' @return The filtered CWT
20 RcppExport SEXP
epclustFilter(SEXP cwt_
)
22 int L
= INTEGER(Rf_getAttrib(cwt_
, R_DimSymbol
))[0],
23 D
= INTEGER(Rf_getAttrib(cwt_
, R_DimSymbol
))[1];
24 double *cwt
= REAL(cwt_
);
26 PROTECT(fcwt_
= Rf_allocMatrix(REALSXP
, L
, D
));
27 double* fcwt
= REAL(fcwt_
); //(double*)malloc(L*D*sizeof(double));
29 //TODO: coding style is terrible... no time for now.
30 for (int col
=0; col
<D
; col
++)
33 double ma
= v1
+ cwt
[1] + cwt
[2];
34 for (int i
=1; i
<L
-2; i
++)
37 ma
= ma
- v1
+ cwt
[i
+2];
47 // REAL(fcwt_) = fcwt;