diff options
Diffstat (limited to 'src/parent_solutions.c')
-rw-r--r-- | src/parent_solutions.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/parent_solutions.c b/src/parent_solutions.c new file mode 100644 index 00000000..4881d708 --- /dev/null +++ b/src/parent_solutions.c @@ -0,0 +1,25 @@ +#include <R.h> +#include <Rinternals.h> + +SEXP SFO_solution(SEXP t, SEXP parent_0_, SEXP k_) { + + int n = length(t); + + double parent_0 = asReal(parent_0_); + double k = asReal(k_); + + double *pt, *pout; + + SEXP out = PROTECT(allocVector(REALSXP, n)); + + pt = REAL(t); + pout = REAL(out); + + for (int i = 0; i < n; i++) { + pout[i] = parent_0 * exp(- k * pt[i]); + } + + UNPROTECT(1); + + return out; +} |