aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-11-03 05:08:25 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2020-11-03 05:08:25 +0100
commit5a986f2064cf0b2fbd94e636cc4fa56d9939ca42 (patch)
tree514eae70fc01dca7e198da475e05221571d382ee /src
parenta5874ab7fce4616e80be69366ff0685332f47bf1 (diff)
C implementation of the SFO function
Only pays off for large time series with length >> 100
Diffstat (limited to 'src')
-rwxr-xr-xsrc/mkin.sobin0 -> 20920 bytes
-rw-r--r--src/parent_solutions.c25
-rw-r--r--src/parent_solutions.obin0 -> 10176 bytes
3 files changed, 25 insertions, 0 deletions
diff --git a/src/mkin.so b/src/mkin.so
new file mode 100755
index 00000000..3d515096
--- /dev/null
+++ b/src/mkin.so
Binary files differ
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;
+}
diff --git a/src/parent_solutions.o b/src/parent_solutions.o
new file mode 100644
index 00000000..9ca88e7d
--- /dev/null
+++ b/src/parent_solutions.o
Binary files differ

Contact - Imprint