pomp
Inference for partially observed Markov processes
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
transformations.c File Reference
#include <R.h>
#include <Rmath.h>
#include <Rdefines.h>
#include "internal.h"
Include dependency graph for transformations.c:

Go to the source code of this file.

Functions

SEXP LogitTransform (SEXP P)
 
SEXP ExpitTransform (SEXP X)
 
SEXP LogBarycentricTransform (SEXP X)
 
SEXP InverseLogBarycentricTransform (SEXP Y)
 

Function Documentation

◆ ExpitTransform()

SEXP ExpitTransform ( SEXP  X)

Definition at line 26 of file transformations.c.

26 {
27 double *x;
28 int k, n;
29 PROTECT(X = duplicate(AS_NUMERIC(X)));
30 x = REAL(X);
31 n = LENGTH(X);
32 for (k = 0; k < n; k++, x++)
33 *x = 1.0/(1.0+exp(-(*x)));
34 UNPROTECT(1);
35 return X;
36}
#define X
Definition gompertz.c:14

◆ InverseLogBarycentricTransform()

SEXP InverseLogBarycentricTransform ( SEXP  Y)

Definition at line 47 of file transformations.c.

47 {
48 SEXP X;
49 PROTECT(Y = AS_NUMERIC(Y));
50 PROTECT(X = NEW_NUMERIC(LENGTH(Y)));
51 from_log_barycentric(REAL(X),REAL(Y),LENGTH(Y));
52 UNPROTECT(2);
53 return X;
54}
#define Y
Definition gompertz.c:13
static R_INLINE void from_log_barycentric(double *xt, const double *x, int n)
Definition pomp.h:288
Here is the call graph for this function:

◆ LogBarycentricTransform()

SEXP LogBarycentricTransform ( SEXP  X)

Definition at line 38 of file transformations.c.

38 {
39 SEXP Y;
40 PROTECT(X = AS_NUMERIC(X));
41 PROTECT(Y = NEW_NUMERIC(LENGTH(X)));
42 to_log_barycentric(REAL(Y),REAL(X),LENGTH(X));
43 UNPROTECT(2);
44 return Y;
45}
static R_INLINE void to_log_barycentric(double *xt, const double *x, int n)
Definition pomp.h:278
Here is the call graph for this function:

◆ LogitTransform()

SEXP LogitTransform ( SEXP  P)

Definition at line 14 of file transformations.c.

14 {
15 double *p;
16 int k, n;
17 PROTECT(P = duplicate(AS_NUMERIC(P)));
18 p = REAL(P);
19 n = LENGTH(P);
20 for (k = 0; k < n; k++, p++)
21 *p = logit(*p);
22 UNPROTECT(1);
23 return P;
24}
static R_INLINE double logit(double p)
Definition pomp.h:118
Here is the call graph for this function: