Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
_getDur no longer comes from rxode2
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Sep 26, 2023
1 parent 5697852 commit fa0038b
Show file tree
Hide file tree
Showing 10 changed files with 973 additions and 956 deletions.
15 changes: 7 additions & 8 deletions inst/include/rxode2_model_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void _assignFuns0(void) {
linCmtA=(linCmtA_p)R_GetCCallable("rxode2parse", "linCmtA");
linCmtB=(linCmtB_p)R_GetCCallable("rxode2parse", "linCmtB");
linCmtC=(linCmtA_p)R_GetCCallable("rxode2parse", "linCmtC");

rxnorm = (rxode2i_fn2)R_GetCCallable("rxode2random", "rxnorm");
rxbinom = (rxode2i_rxbinom)R_GetCCallable("rxode2random","rxbinom");
rxnbinom = (rxode2i_rxbinom)R_GetCCallable("rxode2random","rxnbinom");
Expand Down Expand Up @@ -298,7 +298,7 @@ void _assignFuns0(void) {
riunif = (rxode2i2_fn2)R_GetCCallable("rxode2random","riunif");
riweibull = (rxode2i2_fn2)R_GetCCallable("rxode2random","riweibull");
phi = (rxode2_fn)R_GetCCallable("rxode2random","phi");

gammap = (rxode2_fn2) R_GetCCallable("rxode2","gammap");
gammaq = (rxode2_fn2) R_GetCCallable("rxode2","gammaq");
gammapInv = (rxode2_fn2) R_GetCCallable("rxode2","gammapInv");
Expand All @@ -312,11 +312,11 @@ void _assignFuns0(void) {
expit = (rxode2_fn3) R_GetCCallable("rxode2", "expit");
simeta =(_simfun) R_GetCCallable("rxode2random", "simeta");
simeps =(_simfun) R_GetCCallable("rxode2random", "simeps");

_llikNorm=(rxode2_llikNormFun) R_GetCCallable("rxode2ll","rxLlikNorm");
_llikNormDmean=(rxode2_llikNormFun) R_GetCCallable("rxode2ll","rxLlikNormDmean");
_llikNormDsd=(rxode2_llikNormFun) R_GetCCallable("rxode2ll","rxLlikNormDsd");

_llikPois = (rxode2_llikPoisFun) R_GetCCallable("rxode2ll","rxLlikPois");
_llikPoisDlambda = (rxode2_llikPoisFun) R_GetCCallable("rxode2ll","rxLlikPoisDlambda");

Expand All @@ -325,7 +325,7 @@ void _assignFuns0(void) {

_llikNbinom = (rxode2_llikBinomFun) R_GetCCallable("rxode2ll", "rxLlikNbinom");
_llikNbinomDprob = (rxode2_llikBinomFun) R_GetCCallable("rxode2ll", "rxLlikNbinomDprob");

_llikNbinomMu = (rxode2_llikBinomFun) R_GetCCallable("rxode2ll", "rxLlikNbinomMu");
_llikNbinomMuDmu = (rxode2_llikBinomFun) R_GetCCallable("rxode2ll", "rxLlikNbinomMuDmu");

Expand Down Expand Up @@ -386,11 +386,10 @@ void __assignFuns2(rx_solve rx,
t_IndF indf,
t_getTime gettime,
t_locateTimeIndex timeindex,
t_handle_evidL handleEvid,
t_getDur getdur) {
t_handle_evidL handleEvid) {
// assign start
static rxode2_assignFuns2 rxode2parse_assignFuns2 = NULL;
if (rxode2parse_assignFuns2 == NULL) rxode2parse_assignFuns2 = (rxode2_assignFuns2)(R_GetCCallable("rxode2parse", "_rxode2parse_assignFuns2"));
rxode2parse_assignFuns2(rx, op, f, lag, rate, dur, mtime, me, indf, gettime, timeindex, handleEvid, getdur);
rxode2parse_assignFuns2(rx, op, f, lag, rate, dur, mtime, me, indf, gettime, timeindex, handleEvid);
// assign stop
}
40 changes: 20 additions & 20 deletions inst/include/rxode2_model_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#define rxTBSd(x, lm, yj, hi, low) _powerDD(x, lm, (int)(yj), hi, low)
#define rxTBSd2(x, lm, yj, hi, low) _powerDDD(x, lm, (int)(yj), hi, low)
#define normcdf(x) phi(x)
#define _getIndSim(id, val) (_solveData->subjects[_cSub].isIni == 1 ? \
#define _getIndSim(id, val) (_solveData->subjects[_cSub].isIni == 1 ? \
(_solveData->subjects[_cSub].simIni[id] = (val)) : \
_solveData->subjects[_cSub].simIni[id])
#undef rbeta
Expand All @@ -55,8 +55,8 @@
// FIXME: need to use same scheme here
#define rnormV(ind, x,y) rxnormV(ind,x,y)
#define rnormV1(ind, id, x) rxnormV(ind, id, x, 1.0)
#undef rcauchy

#undef rcauchy
#define rcauchy(ind, x, y) rxcauchy(ind,x,y)
#define rxcauchy1(x) rxcauchy(&_solveData->subjects[_cSub],x, 1.0)
#define ricauchy1(id, x) ricauchy(&_solveData->subjects[_cSub], id, x, 1.0)
Expand Down Expand Up @@ -247,24 +247,24 @@ typedef double(*_rxProdType)(double*, double*, int, int);


typedef double (*linCmtA_p) (rx_solve *rx, unsigned int id, double t, int linCmt,
int ncmt, int trans, double d_ka,
double p1, double v1,
double p2, double p3,
double p4, double p5,
double d_tlag, double d_tlag2, double d_F, double d_F2,
double d_rate, double d_dur,
double d_rate2, double d_dur2);
int ncmt, int trans, double d_ka,
double p1, double v1,
double p2, double p3,
double p4, double p5,
double d_tlag, double d_tlag2, double d_F, double d_F2,
double d_rate, double d_dur,
double d_rate2, double d_dur2);

typedef double (*linCmtB_p) (rx_solve *rx, unsigned int id, double t, int linCmt,
int i_cmt, int trans, int val,
double dd_p1, double dd_v1,
double dd_p2, double dd_p3,
double dd_p4, double dd_p5,
double dd_ka,
double dd_tlag, double dd_tlag2,
double dd_F, double dd_F2,
double dd_rate, double dd_dur,
double dd_rate2, double dd_dur2);
int i_cmt, int trans, int val,
double dd_p1, double dd_v1,
double dd_p2, double dd_p3,
double dd_p4, double dd_p5,
double dd_ka,
double dd_tlag, double dd_tlag2,
double dd_F, double dd_F2,
double dd_rate, double dd_dur,
double dd_rate2, double dd_dur2);


typedef void (*_update_par_ptr_p)(double t, unsigned int id, rx_solve *rx, int idx);
Expand Down Expand Up @@ -292,6 +292,6 @@ typedef double (*rxode2_llikGammaFun) (double *in, double x, double shape, doubl
typedef double (*rxode2_llikCauchyFun) (double *in, double x, double location, double scale);


typedef void (*rxode2_assignFuns2)(rx_solve, rx_solving_options, t_F, t_LAG, t_RATE, t_DUR,t_calc_mtime, t_ME, t_IndF, t_getTime, t_locateTimeIndex, t_handle_evidL,t_getDur);
typedef void (*rxode2_assignFuns2)(rx_solve, rx_solving_options, t_F, t_LAG, t_RATE, t_DUR,t_calc_mtime, t_ME, t_IndF, t_getTime, t_locateTimeIndex, t_handle_evidL);

#endif // __rxode2_model_shared_H__
2 changes: 0 additions & 2 deletions inst/include/rxode2parseHandleEvid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ extern "C" {

int handle_evidL(int evid, double *yp, double xout, rx_solving_options_ind *ind);
void handleTlast(double *time, rx_solving_options_ind *ind);
double _getDur(int l, rx_solving_options_ind *ind, int backward, unsigned int *p);

#else
#define _getDur _rxode2parse_getDur
extern rx_solving_options op_global;
extern rx_solve rx_global;
#endif
Expand Down
Loading

0 comments on commit fa0038b

Please sign in to comment.