8 return ScalarInteger(X.ndeme());
13 return ScalarInteger(X.nsample());
18 return ScalarReal(X.timezero());
23 return ScalarReal(X.time());
30 PROTECT(out = NEW_RAW(X.bytesize()));
38 SEXP
yaml (
const TYPE& X) {
39 return mkString(X.yaml().c_str());
45 return mkString(X.describe().c_str());
57 return mkString(X.newick().c_str());
63 return G.lineage_count();
74 SEXP
make (SEXP Params, SEXP IVPs, SEXP T0) {
76 PROTECT(Params = AS_NUMERIC(Params));
77 PROTECT(IVPs = AS_NUMERIC(IVPs));
78 PROTECT(T0 = AS_NUMERIC(T0));
81 X.update_params(REAL(Params),LENGTH(Params));
82 X.update_IVPs(REAL(IVPs),LENGTH(IVPs));
93 SEXP
revive (SEXP State, SEXP Params) {
96 PROTECT(Params = AS_NUMERIC(Params));
97 X.update_params(REAL(Params),LENGTH(Params));
105 SEXP
run (SEXP State, SEXP Tout) {
108 PROTECT(Tout = AS_NUMERIC(Tout));
119 template <
class TYPE>
123 PROTECT(out =
serial(A.geneal));
124 SET_ATTR(out,install(
"class"),mkString(
"gpgen"));
129 #define MAKEFN(X,TYPE) SEXP make ## X (SEXP Params, SEXP IVPs, SEXP T0) { \
130 return make<TYPE>(Params,IVPs,T0); \
133 #define REVIVEFN(X,TYPE) SEXP revive ## X (SEXP State, SEXP Params) { \
134 return revive<TYPE>(State,Params); \
137 #define RUNFN(X,TYPE) SEXP run ## X (SEXP State, SEXP Times) { \
138 return run<TYPE>(State,Times); \
141 #define GENEALFN(X,TYPE) SEXP geneal ## X (SEXP State) { \
142 return genealogy<TYPE>(State); \
145 #define YAMLFN(X,TYPE) SEXP yaml ## X (SEXP State) { \
146 return yaml<TYPE>(State); \
149 #define GENERICS(X,TYPE) \
SEXP run(SEXP State, SEXP Tout)
run simulations
SEXP revive(SEXP State, SEXP Params)
refresh parameters
SEXP describe(const TYPE &X)
human readable output
SEXP structure(const TYPE &X)
structure in R list format
SEXP newick(const TYPE &X)
tree in newick format
SEXP serial(const TYPE &X)
binary serialization
SEXP genealogy(SEXP State)
extract the bare genealogy
SEXP gendat(const TYPE &G)
data-frame format
SEXP yaml(const TYPE &X)
human/machine readable output
SEXP lineage_count(const TYPE &G)
number of lineages through time
SEXP make(SEXP Params, SEXP IVPs, SEXP T0)
initialization