diff --git a/inst/include/internal/helpers.h b/inst/include/internal/helpers.h index c0210e1..4266c1e 100644 --- a/inst/include/internal/helpers.h +++ b/inst/include/internal/helpers.h @@ -4,6 +4,8 @@ #include using namespace arma; +typedef double (*Unary_Function)(double); // unary function + template using Mfunction = RET (*)(Args...); @@ -52,4 +54,11 @@ colvec elems(colvec x, colvec y) inline bool check_if_is_finite(double x) { return x > 0 and !R_IsNA(x); +} + +template +void fill_with(T1 start,T1 end,T2 startf){ + for(;start!=end;++start,++startf){ + *startf=F(*start); + } } \ No newline at end of file