Closed billdenney closed 1 year ago
This is the underlying code, first in the "classic" rxode2 code and then the underlying C-code
library(rxode2)
#> Warning: package 'rxode2' was built under R version 4.2.3
#> rxode2 2.0.13 using 4 threads (see ?getRxThreads)
#> no cache: create with `rxCreateCache()`
one.compartment <- function() {
ini({
tka <- log(1.57); label("Ka")
tcl <- log(2.72); label("Cl")
tv <- log(31.5); label("V")
eta.ka ~ 0.6
eta.cl ~ 0.3
eta.v ~ 0.1
add.sd <- 0.7
})
model({
ka <- exp(tka + eta.ka)
cl <- clAgain <- exp(tcl + eta.cl)
v <- exp(tv + eta.v)
d/dt(depot) <- -ka * depot
d/dt(center) <- ka * depot - cl / v * center
cp <- center / v
cp ~ add(add.sd)
})
}
f <- one.compartment()
summary(f$simulationModel)
#> rxode2 2.0.13 model named rx_fdd0eee5f8bc2e66eb76d658118301a5_x6 model (✔ ready).
#> DLL: C:\Users\fidlema3\AppData\Local\Temp\1\RTMPKZ~1\rxode2\rx_fdd0eee5f8bc2e66eb76d658118301a5_x64_.rxd/rx_fdd0eee5f8bc2e66eb76d658118301a5_x64.dll
#> NULL
#>
#> Calculated Variables:
#> [1] "ka" "cl" "v" "cp" "ipredSim" "sim"
#> ── rxode2 Model Syntax ──
#> rxode2({
#> param(tka, tcl, tv, add.sd, eta.ka, eta.cl, eta.v, clAgain)
#> ka = exp(tka + eta.ka)
#> cl = clAgain <- exp(tcl + eta.cl)
#> v = exp(tv + eta.v)
#> d/dt(depot) = -ka * depot
#> d/dt(center) = ka * depot - cl/v * center
#> cp = center/v
#> rx_yj_ ~ 2
#> rx_lambda_ ~ 1
#> rx_low_ ~ 0
#> rx_hi_ ~ 1
#> rx_pred_f_ ~ cp
#> rx_pred_ ~ rx_pred_f_
#> rx_r_ ~ (add.sd)^2
#> ipredSim = rxTBSi(rx_pred_, rx_lambda_, rx_yj_, rx_low_,
#> rx_hi_)
#> sim = rxTBSi(rx_pred_ + sqrt(rx_r_) * err.cp, rx_lambda_,
#> rx_yj_, rx_low_, rx_hi_)
#> cmt(cp)
#> dvid(3)
#> })
summary(rxC(f$simulationModel))
#> //C file: C:\Users\fidlema3\AppData\Local\Temp\1\RTMPKZ~1\rxode2\rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_.rxd/rx_a4f3cc8eeae0cfe5347447762c52fafa_x64.c
#> //
#> #define _getRxSolve_ _rxa9ba5d6403908518e87161f0a11b27ea114
#> #define _solveData _rxa9ba5d6403908518e87161f0a11b27ea115
#> #define _assign_ptr _rxa9ba5d6403908518e87161f0a11b27ea116
#> #define _rxRmModelLib _rxa9ba5d6403908518e87161f0a11b27ea117
#> #define _rxGetModelLib _rxa9ba5d6403908518e87161f0a11b27ea118
#> #define _old_c _rxa9ba5d6403908518e87161f0a11b27ea119
#> #define _ptrid _rxa9ba5d6403908518e87161f0a11b27ea120
#> #define _rxIsCurrentC _rxa9ba5d6403908518e87161f0a11b27ea121
#> #define _sumPS _rxa9ba5d6403908518e87161f0a11b27ea122
#> #define _prodPS _rxa9ba5d6403908518e87161f0a11b27ea123
#> #define _prodType _rxa9ba5d6403908518e87161f0a11b27ea124
#> #define _sumType _rxa9ba5d6403908518e87161f0a11b27ea125
#> #define _update_par_ptr _rxa9ba5d6403908518e87161f0a11b27ea126
#> #define _getParCov _rxa9ba5d6403908518e87161f0a11b27ea127
#> #define _rxode2_rxAssignPtr _rxa9ba5d6403908518e87161f0a11b27ea128
#> #define _rxQr _rxa9ba5d6403908518e87161f0a11b27ea129
#> #define _compareFactorVal _rxa9ba5d6403908518e87161f0a11b27ea130
#> #define _sum _rxa9ba5d6403908518e87161f0a11b27ea131
#> #define _sign _rxa9ba5d6403908518e87161f0a11b27ea132
#> #define _prod _rxa9ba5d6403908518e87161f0a11b27ea133
#> #define _max _rxa9ba5d6403908518e87161f0a11b27ea134
#> #define _min _rxa9ba5d6403908518e87161f0a11b27ea135
#> #define _transit4P _rxa9ba5d6403908518e87161f0a11b27ea136
#> #define _transit3P _rxa9ba5d6403908518e87161f0a11b27ea137
#> #define _assignFuns0 _rxa9ba5d6403908518e87161f0a11b27ea138
#> #define _assignFuns _rxa9ba5d6403908518e87161f0a11b27ea139
#> #define _rxord _rxa9ba5d6403908518e87161f0a11b27ea140
#> #define __assignFuns2 _rxa9ba5d6403908518e87161f0a11b27ea141
#> #define _llikCauchyDscale _rxa9ba5d6403908518e87161f0a11b27ea142
#> #define _llikCauchyDlocation _rxa9ba5d6403908518e87161f0a11b27ea143
#> #define _llikCauchy _rxa9ba5d6403908518e87161f0a11b27ea144
#> #define _llikGammaDrate _rxa9ba5d6403908518e87161f0a11b27ea145
#> #define _llikGammaDshape _rxa9ba5d6403908518e87161f0a11b27ea146
#> #define _llikGamma _rxa9ba5d6403908518e87161f0a11b27ea147
#> #define _llikWeibullDscale _rxa9ba5d6403908518e87161f0a11b27ea148
#> #define _llikWeibullDshape _rxa9ba5d6403908518e87161f0a11b27ea149
#> #define _llikWeibull _rxa9ba5d6403908518e87161f0a11b27ea150
#> #define _llikUnifDbeta _rxa9ba5d6403908518e87161f0a11b27ea151
#> #define _llikUnifDalpha _rxa9ba5d6403908518e87161f0a11b27ea152
#> #define _llikUnif _rxa9ba5d6403908518e87161f0a11b27ea153
#> #define _llikGeomDp _rxa9ba5d6403908518e87161f0a11b27ea154
#> #define _llikGeom _rxa9ba5d6403908518e87161f0a11b27ea155
#> #define _llikFDdf2 _rxa9ba5d6403908518e87161f0a11b27ea156
#> #define _llikFDdf1 _rxa9ba5d6403908518e87161f0a11b27ea157
#> #define _llikF _rxa9ba5d6403908518e87161f0a11b27ea158
#> #define _llikExpDrate _rxa9ba5d6403908518e87161f0a11b27ea159
#> #define _llikExp _rxa9ba5d6403908518e87161f0a11b27ea160
#> #define _llikChisqDdf _rxa9ba5d6403908518e87161f0a11b27ea161
#> #define _llikChisq _rxa9ba5d6403908518e87161f0a11b27ea162
#> #define _llikTDsd _rxa9ba5d6403908518e87161f0a11b27ea163
#> #define _llikTDmean _rxa9ba5d6403908518e87161f0a11b27ea164
#> #define _llikTDdf _rxa9ba5d6403908518e87161f0a11b27ea165
#> #define _llikT _rxa9ba5d6403908518e87161f0a11b27ea166
#> #define _llikBetaDshape2 _rxa9ba5d6403908518e87161f0a11b27ea167
#> #define _llikBetaDshape1 _rxa9ba5d6403908518e87161f0a11b27ea168
#> #define _llikBeta _rxa9ba5d6403908518e87161f0a11b27ea169
#> #define _llikNbinomMuDmu _rxa9ba5d6403908518e87161f0a11b27ea170
#> #define _llikNbinomMu _rxa9ba5d6403908518e87161f0a11b27ea171
#> #define _llikNbinomDprob _rxa9ba5d6403908518e87161f0a11b27ea172
#> #define _llikNbinom _rxa9ba5d6403908518e87161f0a11b27ea173
#> #define _llikBinomDprob _rxa9ba5d6403908518e87161f0a11b27ea174
#> #define _llikBinom _rxa9ba5d6403908518e87161f0a11b27ea175
#> #define _llikPoisDlambda _rxa9ba5d6403908518e87161f0a11b27ea176
#> #define _llikPois _rxa9ba5d6403908518e87161f0a11b27ea177
#> #define _llikNormDsd _rxa9ba5d6403908518e87161f0a11b27ea178
#> #define _llikNormDmean _rxa9ba5d6403908518e87161f0a11b27ea179
#> #define _llikNorm _rxa9ba5d6403908518e87161f0a11b27ea180
#> #define simeps _rxa9ba5d6403908518e87161f0a11b27ea181
#> #define simeta _rxa9ba5d6403908518e87161f0a11b27ea182
#> #define expit _rxa9ba5d6403908518e87161f0a11b27ea183
#> #define logit _rxa9ba5d6403908518e87161f0a11b27ea184
#> #define gammapDer _rxa9ba5d6403908518e87161f0a11b27ea185
#> #define lowergamma _rxa9ba5d6403908518e87161f0a11b27ea186
#> #define uppergamma _rxa9ba5d6403908518e87161f0a11b27ea187
#> #define gammaqInva _rxa9ba5d6403908518e87161f0a11b27ea188
#> #define gammaqInv _rxa9ba5d6403908518e87161f0a11b27ea189
#> #define gammapInva _rxa9ba5d6403908518e87161f0a11b27ea190
#> #define gammapInv _rxa9ba5d6403908518e87161f0a11b27ea191
#> #define gammaq _rxa9ba5d6403908518e87161f0a11b27ea192
#> #define gammap _rxa9ba5d6403908518e87161f0a11b27ea193
#> #define phi _rxa9ba5d6403908518e87161f0a11b27ea194
#> #define riweibull _rxa9ba5d6403908518e87161f0a11b27ea195
#> #define riunif _rxa9ba5d6403908518e87161f0a11b27ea196
#> #define rit_ _rxa9ba5d6403908518e87161f0a11b27ea197
#> #define ripois _rxa9ba5d6403908518e87161f0a11b27ea198
#> #define ribeta _rxa9ba5d6403908518e87161f0a11b27ea199
#> #define rigamma _rxa9ba5d6403908518e87161f0a11b27ea200
#> #define rigeom _rxa9ba5d6403908518e87161f0a11b27ea201
#> #define rif _rxa9ba5d6403908518e87161f0a11b27ea202
#> #define riexp _rxa9ba5d6403908518e87161f0a11b27ea203
#> #define richisq _rxa9ba5d6403908518e87161f0a11b27ea204
#> #define ricauchy _rxa9ba5d6403908518e87161f0a11b27ea205
#> #define rinbinomMu _rxa9ba5d6403908518e87161f0a11b27ea206
#> #define rinbinom _rxa9ba5d6403908518e87161f0a11b27ea207
#> #define ribinom _rxa9ba5d6403908518e87161f0a11b27ea208
#> #define rinorm _rxa9ba5d6403908518e87161f0a11b27ea209
#> #define rxweibull _rxa9ba5d6403908518e87161f0a11b27ea210
#> #define rxunif _rxa9ba5d6403908518e87161f0a11b27ea211
#> #define rxt_ _rxa9ba5d6403908518e87161f0a11b27ea212
#> #define rxpois _rxa9ba5d6403908518e87161f0a11b27ea213
#> #define rxbeta _rxa9ba5d6403908518e87161f0a11b27ea214
#> #define rxgamma _rxa9ba5d6403908518e87161f0a11b27ea215
#> #define rxgeom _rxa9ba5d6403908518e87161f0a11b27ea216
#> #define rxf _rxa9ba5d6403908518e87161f0a11b27ea217
#> #define rxexp _rxa9ba5d6403908518e87161f0a11b27ea218
#> #define rxchisq _rxa9ba5d6403908518e87161f0a11b27ea219
#> #define rxcauchy _rxa9ba5d6403908518e87161f0a11b27ea220
#> #define rxnbinomMu _rxa9ba5d6403908518e87161f0a11b27ea221
#> #define rxnbinom _rxa9ba5d6403908518e87161f0a11b27ea222
#> #define rxbinom _rxa9ba5d6403908518e87161f0a11b27ea223
#> #define rxnorm _rxa9ba5d6403908518e87161f0a11b27ea224
#> #define linCmtC _rxa9ba5d6403908518e87161f0a11b27ea225
#> #define linCmtB _rxa9ba5d6403908518e87161f0a11b27ea226
#> #define linCmtA _rxa9ba5d6403908518e87161f0a11b27ea227
#> #include <rxode2_model_shared.h>
#> #define __MAX_PROD__ 0
#> #define _CMT CMT
#> #define _SYNC_simeps_ for (int _svari=_solveData->neps; _svari--;){ if (_solveData->svar[_svari] == 0) {tka = _PP[0];}; if (_solveData->svar[_svari] == 1) {tcl = _PP[1];}; if (_solveData->svar[_svari] == 2) {tv = _PP[2];}; if (_solveData->svar[_svari] == 3) {add_DoT_sd = _PP[3];}; if (_solveData->svar[_svari] == 4) {eta_DoT_ka = _PP[4];}; if (_solveData->svar[_svari] == 5) {eta_DoT_cl = _PP[5];}; if (_solveData->svar[_svari] == 6) {eta_DoT_v = _PP[6];}; if (_solveData->svar[_svari] == 7) {clAgain = _PP[7];}; if (_solveData->svar[_svari] == 8) {err_DoT_cp = _PP[8];}; }
#> #define _SYNC_simeta_ for (int _ovari=_solveData->neta; _ovari--;){ if (_solveData->ovar[_ovari] == 0) {tka = _PP[0];}; if (_solveData->ovar[_ovari] == 1) {tcl = _PP[1];}; if (_solveData->ovar[_ovari] == 2) {tv = _PP[2];}; if (_solveData->ovar[_ovari] == 3) {add_DoT_sd = _PP[3];}; if (_solveData->ovar[_ovari] == 4) {eta_DoT_ka = _PP[4];}; if (_solveData->ovar[_ovari] == 5) {eta_DoT_cl = _PP[5];}; if (_solveData->ovar[_ovari] == 6) {eta_DoT_v = _PP[6];}; if (_solveData->ovar[_ovari] == 7) {clAgain = _PP[7];}; if (_solveData->ovar[_ovari] == 8) {err_DoT_cp = _PP[8];}; }
#> #include "extraC.h"
#> _getRxSolve_t _getRxSolve_;
#> _simfun simeps;
#> _simfun simeta;
#> rx_solve *_solveData=NULL;
#> rxode2_assign_ptr _assign_ptr=NULL;
#> _rxRmModelLibType _rxRmModelLib=NULL;
#> _rxGetModelLibType _rxGetModelLib=NULL;
#> rxode2_ode_solver_old_c _old_c=NULL;
#> rxode2_fn0i _ptrid=NULL;
#> _rxIsCurrentC_type _rxIsCurrentC=NULL;
#> _rxSumType _sumPS=NULL;
#> _rxProdType _prodPS=NULL;
#> rxode2_fn0i _prodType=NULL;
#> rxode2_fn0i _sumType=NULL;
#> _update_par_ptr_p _update_par_ptr=NULL;
#> _getParCov_p _getParCov=NULL;
#> linCmtA_p linCmtA;
#> linCmtA_p linCmtC;
#> linCmtB_p linCmtB;
#> _rx_asgn _rxode2_rxAssignPtr=NULL;
#> _rx_asgn _rxQr=NULL;
#> rxode2_fn phi;
#> rxode2_fn3 logit;
#> rxode2_fn3 expit;
#> rxode2_fn2 gammap;
#> rxode2_fn2 gammaq;
#> rxode2_fn2 lowergamma;
#> rxode2_fn2 uppergamma;
#> rxode2_fn2 gammapInv;
#> rxode2_fn2 gammapDer;
#> rxode2_fn2 gammapInva;
#> rxode2_fn2 gammaqInv;
#> rxode2_fn2 gammaqInva;
#> rxode2i_fn2 rxnorm;
#> rxode2i_rxbinom rxbinom;
#> rxode2i_rxbinom rxnbinom;
#> rxode2i_rxbinom rxnbinomMu;
#> rxode2i_fn2 rxcauchy;
#> rxode2i_fn rxchisq;
#> rxode2i_fn rxexp;
#> rxode2i_fn2 rxf;
#> rxode2i_ifn rxgeom;
#> rxode2i_fn2 rxgamma;
#> rxode2i_fn2 rxbeta;
#> rxode2i_ifn rxpois;
#> rxode2i_fn rxt_;
#> rxode2i_fn2 rxunif;
#> rxode2i_fn2 rxweibull;
#> rxode2i2_fn2 rinorm;
#> rxode2i2_ribinom ribinom;
#> rxode2i2_ribinom rinbinom;
#> rxode2i2_ribinom rinbinomMu;
#> rxode2i2_fn2 ricauchy;
#> rxode2i2_fn richisq;
#> rxode2i2_fn riexp;
#> rxode2i2_fn2 rif;
#> rxode2i2_ifn rigeom;
#> rxode2i2_fn2 rigamma;
#> rxode2i2_fn2 ribeta;
#> rxode2i2_ifn ripois;
#> rxode2i2_fn rit_;
#> rxode2i2_fn2 riunif;
#> rxode2i2_fn2 riweibull;
#> rxode2_llikNormFun _llikNorm;
#> rxode2_llikNormFun _llikNormDmean;
#> rxode2_llikNormFun _llikNormDsd;
#> rxode2_llikPoisFun _llikPois;
#> rxode2_llikPoisFun _llikPoisDlambda;
#> rxode2_llikBinomFun _llikBinom;
#> rxode2_llikBinomFun _llikBinomDprob;
#> rxode2_llikBinomFun _llikNbinom;
#> rxode2_llikBinomFun _llikNbinomDprob;
#> rxode2_llikBinomFun _llikNbinomMu;
#> rxode2_llikBinomFun _llikNbinomMuDmu;
#> rxode2_llikBetaFun _llikBeta;
#> rxode2_llikBetaFun _llikBetaDshape1;
#> rxode2_llikBetaFun _llikBetaDshape2;
#> rxode2_llikTFun _llikT;
#> rxode2_llikTFun _llikTDdf;
#> rxode2_llikTFun _llikTDmean;
#> rxode2_llikTFun _llikTDsd;
#> rxode2_llikChisqFun _llikChisq;
#> rxode2_llikChisqFun _llikChisqDdf;
#> rxode2_llikExpFun _llikExp;
#> rxode2_llikExpFun _llikExpDrate;
#> rxode2_llikFFun _llikF;
#> rxode2_llikFFun _llikFDdf1;
#> rxode2_llikFFun _llikFDdf2;
#> rxode2_llikGeomFun _llikGeom;
#> rxode2_llikGeomFun _llikGeomDp;
#> rxode2_llikUnifFun _llikUnif;
#> rxode2_llikUnifFun _llikUnifDalpha;
#> rxode2_llikUnifFun _llikUnifDbeta;
#> rxode2_llikWeibullFun _llikWeibull;
#> rxode2_llikWeibullFun _llikWeibullDshape;
#> rxode2_llikWeibullFun _llikWeibullDscale;
#> rxode2_llikGammaFun _llikGamma;
#> rxode2_llikGammaFun _llikGammaDshape;
#> rxode2_llikGammaFun _llikGammaDrate;
#> rxode2_llikCauchyFun _llikCauchy;
#> rxode2_llikCauchyFun _llikCauchyDlocation;
#> rxode2_llikCauchyFun _llikCauchyDscale;
#> rxode2_compareFactorVal_fn _compareFactorVal;
#> double _prod(double *input, double *p, int type, int n, ...){
#> va_list valist;
#> va_start(valist, n);
#> for (unsigned int i = 0; i < n; i++){
#> input[i] = va_arg(valist, double);
#> }
#> va_end(valist);
#> return _prodPS(input, p, n, type);
#> }
#> double _sum(double *input, double *pld, int m, int type, int n, ...){
#> va_list valist;
#> va_start(valist, n);
#> for (unsigned int i = 0; i < n; i++){
#> input[i] = va_arg(valist, double);
#> }
#> va_end(valist);
#> double ret = _sumPS(input, n, pld, m, type);
#> if (type == 2 && m < 0){
#> for (int i = -m; i--;){
#> pld[i] = 0.0;
#> }
#> }
#> return ret;
#> }
#> double _sign(unsigned int n, ...) {
#> va_list valist;
#> va_start(valist, n);
#> double s = 1;
#> for (unsigned int i = 0; i < n; i++) {
#> s = sign(va_arg(valist, double))*s;
#> if (s == 0){
#> break;
#> }
#> }
#> va_end(valist);
#> return s;
#> }
#> double _rxord(int _cSub, unsigned int n, ...) {
#> rx_solving_options_ind* ind = &(_solveData->subjects[_cSub]);
#> if (!ind->inLhs) {
#> return 1.0;
#> }
#> va_list valist;
#> va_start(valist, n);
#> double ret = 1.0;
#> double p = 0.0;
#> double u = rxunif(ind, 0.0, 1.0);
#> int found = 0;
#> for (unsigned int i = 0; i < n; i++) {
#> p += va_arg(valist, double);
#> if (!found) {
#> if (u < p) {
#> ret = (double)(i+1);
#> found = 1;
#> }
#> }
#> }
#> if (!found) ret =(double)(n+1);
#> va_end(valist);
#> return ret;
#> }
#> double _max(unsigned int n, ...) {
#> va_list valist;
#> va_start(valist, n);
#> double mx = NA_REAL;
#> double tmp = 0;
#> if (n >= 1){
#> mx = va_arg(valist, double);
#> for (unsigned int i = 1; i < n; i++) {
#> tmp = va_arg(valist, double);
#> if (tmp>mx) mx=tmp;
#> }
#> va_end(valist);
#> }
#> return mx;
#> }
#> double _min(unsigned int n, ...){
#> va_list valist;
#> va_start(valist, n);
#> double mn = NA_REAL;
#> double tmp = 0;
#> if (n >= 1){
#> mn = va_arg(valist, double);
#> for (unsigned int i = 1; i < n; i++){
#> tmp = va_arg(valist, double);
#> if (tmp<mn) mn=tmp;
#> }
#> va_end(valist);
#> }
#> return mn;
#> }
#> double _transit4P(int cmt, double t, unsigned int id, double n, double mtt, double bio){
#> double nd = (double) n;
#> double ktr = (nd+1)/mtt;
#> double lktr = _safe_log(nd+1)-_safe_log(mtt);
#> double tlast = _solveData->subjects[id].tlastS[cmt];
#> double dose = _solveData->subjects[id].curDoseS[cmt];
#> if (ISNA(dose)) dose = 0.0;
#> if (ISNA(tlast)) tlast = 0.0;
#> double tad = (t-tlast);
#> return exp(_safe_log(bio*dose)+lktr+n*(lktr+_safe_log(tad))-ktr*(tad)-lgamma1p(nd));
#> }
#> double _transit3P(int cmt, double t, unsigned int id, double n, double mtt){
#> double nd = (double) n;
#> double ktr = (nd+1)/mtt;
#> double lktr = _safe_log(nd+1)-_safe_log(mtt);
#> double tlast = _solveData->subjects[id].tlastS[cmt];
#> if (ISNA(tlast)) tlast = 0.0;
#> double tad = t-tlast;
#> double podo = _solveData->subjects[id].curDoseS[cmt];
#> if (ISNA(podo)) podo = 0.0;
#> return exp(_safe_log(podo)+lktr+n*(lktr+_safe_log(tad))-ktr*(tad)-lgamma1p(nd));
#> }
#> void _assignFuns0(void) {
#> _getRxSolve_ = (_getRxSolve_t) R_GetCCallable("rxode2","getRxSolve_");
#> _assign_ptr=(rxode2_assign_ptr) R_GetCCallable("rxode2","rxode2_assign_fn_pointers");
#> _rxRmModelLib=(_rxRmModelLibType) R_GetCCallable("rxode2","rxRmModelLib");
#> _rxGetModelLib=(_rxGetModelLibType) R_GetCCallable("rxode2","rxGetModelLib");
#> _rxode2_rxAssignPtr=(_rx_asgn)R_GetCCallable("rxode2","_rxode2_rxAssignPtr");
#> _rxQr=(_rx_asgn)R_GetCCallable("rxode2parse","_rxode2parse_rxQr");
#> _rxIsCurrentC = (_rxIsCurrentC_type)R_GetCCallable("rxode2","rxIsCurrentC");
#> _sumPS = (_rxSumType) R_GetCCallable("PreciseSums","PreciseSums_sum_r");
#> _prodPS = (_rxProdType) R_GetCCallable("PreciseSums","PreciseSums_prod_r");
#> _prodType=(rxode2_fn0i)R_GetCCallable("PreciseSums", "PreciseSums_prod_get");
#> _sumType=(rxode2_fn0i)R_GetCCallable("PreciseSums", "PreciseSums_sum_get");
#> _ptrid=(rxode2_fn0i)R_GetCCallable("rxode2", "rxode2_current_fn_pointer_id");
#> _compareFactorVal=(rxode2_compareFactorVal_fn) R_GetCCallable("rxode2", "compareFactorVal");
#> _update_par_ptr = (_update_par_ptr_p) R_GetCCallable("rxode2","_update_par_ptr");
#> _getParCov = (_getParCov_p) R_GetCCallable("rxode2","_getParCov");
#> // dynamic start
#> _llikCauchyDscale = (rxode2_llikCauchyFun) R_GetCCallable("rxode2ll", "rxLlikCauchyDscale");
#> _llikCauchyDlocation = (rxode2_llikCauchyFun) R_GetCCallable("rxode2ll", "rxLlikCauchyDlocation");
#> _llikCauchy = (rxode2_llikCauchyFun) R_GetCCallable("rxode2ll", "rxLlikCauchy");
#> _llikGammaDrate = (rxode2_llikGammaFun) R_GetCCallable("rxode2ll", "rxLlikGammaDrate");
#> _llikGammaDshape = (rxode2_llikGammaFun) R_GetCCallable("rxode2ll", "rxLlikGammaDshape");
#> _llikGamma = (rxode2_llikGammaFun) R_GetCCallable("rxode2ll", "rxLlikGamma");
#> _llikWeibullDscale = (rxode2_llikWeibullFun) R_GetCCallable("rxode2ll", "rxLlikWeibullDscale");
#> _llikWeibullDshape = (rxode2_llikWeibullFun) R_GetCCallable("rxode2ll", "rxLlikWeibullDshape");
#> _llikWeibull = (rxode2_llikWeibullFun) R_GetCCallable("rxode2ll", "rxLlikWeibull");
#> _llikUnifDbeta = (rxode2_llikUnifFun) R_GetCCallable("rxode2ll", "rxLlikUnifDbeta");
#> _llikUnifDalpha = (rxode2_llikUnifFun) R_GetCCallable("rxode2ll", "rxLlikUnifDalpha");
#> _llikUnif = (rxode2_llikUnifFun) R_GetCCallable("rxode2ll", "rxLlikUnif");
#> _llikGeomDp = (rxode2_llikGeomFun) R_GetCCallable("rxode2ll", "rxLlikGeomDp");
#> _llikGeom = (rxode2_llikGeomFun) R_GetCCallable("rxode2ll", "rxLlikGeom");
#> _llikFDdf2 = (rxode2_llikFFun) R_GetCCallable("rxode2ll", "rxLlikFDdf2");
#> _llikFDdf1 = (rxode2_llikFFun) R_GetCCallable("rxode2ll", "rxLlikFDdf1");
#> _llikF = (rxode2_llikFFun) R_GetCCallable("rxode2ll", "rxLlikF");
#> _llikExpDrate = (rxode2_llikExpFun) R_GetCCallable("rxode2ll", "rxLlikExpDrate");
#> _llikExp = (rxode2_llikExpFun) R_GetCCallable("rxode2ll", "rxLlikExp");
#> _llikChisqDdf = (rxode2_llikChisqFun) R_GetCCallable("rxode2ll", "rxLlikChisqDdf");
#> _llikChisq = (rxode2_llikChisqFun) R_GetCCallable("rxode2ll", "rxLlikChisq");
#> _llikTDsd = (rxode2_llikTFun) R_GetCCallable("rxode2ll", "rxLlikTDsd");
#> _llikTDmean = (rxode2_llikTFun) R_GetCCallable("rxode2ll", "rxLlikTDmean");
#> _llikTDdf = (rxode2_llikTFun) R_GetCCallable("rxode2ll", "rxLlikTDdf");
#> _llikT = (rxode2_llikTFun) R_GetCCallable("rxode2ll", "rxLlikT");
#> _llikBetaDshape2 = (rxode2_llikBetaFun) R_GetCCallable("rxode2ll", "rxLlikBetaDshape2");
#> _llikBetaDshape1 = (rxode2_llikBetaFun) R_GetCCallable("rxode2ll", "rxLlikBetaDshape1");
#> _llikBeta = (rxode2_llikBetaFun) R_GetCCallable("rxode2ll", "rxLlikBeta");
#> _llikNbinomMuDmu = (rxode2_llikBinomFun) R_GetCCallable("rxode2ll", "rxLlikNbinomMuDmu");
#> _llikNbinomMu = (rxode2_llikBinomFun) R_GetCCallable("rxode2ll", "rxLlikNbinomMu");
#> _llikNbinomDprob = (rxode2_llikBinomFun) R_GetCCallable("rxode2ll", "rxLlikNbinomDprob");
#> _llikNbinom = (rxode2_llikBinomFun) R_GetCCallable("rxode2ll", "rxLlikNbinom");
#> _llikBinomDprob = (rxode2_llikBinomFun) R_GetCCallable("rxode2ll", "rxLlikBinomDprob");
#> _llikBinom = (rxode2_llikBinomFun) R_GetCCallable("rxode2ll", "rxLlikBinom");
#> _llikPoisDlambda = (rxode2_llikPoisFun) R_GetCCallable("rxode2ll", "rxLlikPoisDlambda");
#> _llikPois = (rxode2_llikPoisFun) R_GetCCallable("rxode2ll", "rxLlikPois");
#> _llikNormDsd = (rxode2_llikNormFun) R_GetCCallable("rxode2ll", "rxLlikNormDsd");
#> _llikNormDmean = (rxode2_llikNormFun) R_GetCCallable("rxode2ll", "rxLlikNormDmean");
#> _llikNorm = (rxode2_llikNormFun) R_GetCCallable("rxode2ll", "rxLlikNorm");
#> simeps = (_simfun) R_GetCCallable("rxode2random", "simeps");
#> simeta = (_simfun) R_GetCCallable("rxode2random", "simeta");
#> expit = (rxode2_fn3) R_GetCCallable("rxode2", "expit");
#> logit = (rxode2_fn3) R_GetCCallable("rxode2", "logit");
#> gammapDer = (rxode2_fn2) R_GetCCallable("rxode2", "gammapDer");
#> lowergamma = (rxode2_fn2) R_GetCCallable("rxode2", "lowergamma");
#> uppergamma = (rxode2_fn2) R_GetCCallable("rxode2", "uppergamma");
#> gammaqInva = (rxode2_fn2) R_GetCCallable("rxode2", "gammaqInva");
#> gammaqInv = (rxode2_fn2) R_GetCCallable("rxode2", "gammaqInv");
#> gammapInva = (rxode2_fn2) R_GetCCallable("rxode2", "gammapInva");
#> gammapInv = (rxode2_fn2) R_GetCCallable("rxode2", "gammapInv");
#> gammaq = (rxode2_fn2) R_GetCCallable("rxode2", "gammaq");
#> gammap = (rxode2_fn2) R_GetCCallable("rxode2", "gammap");
#> phi = (rxode2_fn) R_GetCCallable("rxode2random", "phi");
#> riweibull = (rxode2i2_fn2) R_GetCCallable("rxode2random", "riweibull");
#> riunif = (rxode2i2_fn2) R_GetCCallable("rxode2random", "riunif");
#> rit_ = (rxode2i2_fn) R_GetCCallable("rxode2random", "rit_");
#> ripois = (rxode2i2_ifn) R_GetCCallable("rxode2random", "ripois");
#> ribeta = (rxode2i2_fn2) R_GetCCallable("rxode2random", "ribeta");
#> rigamma = (rxode2i2_fn2) R_GetCCallable("rxode2random", "rigamma");
#> rigeom = (rxode2i2_ifn) R_GetCCallable("rxode2random", "rigeom");
#> rif = (rxode2i2_fn2) R_GetCCallable("rxode2random", "rif");
#> riexp = (rxode2i2_fn) R_GetCCallable("rxode2random", "riexp");
#> richisq = (rxode2i2_fn) R_GetCCallable("rxode2random", "richisq");
#> ricauchy = (rxode2i2_fn2) R_GetCCallable("rxode2random", "ricauchy");
#> rinbinomMu = (rxode2i2_ribinom) R_GetCCallable("rxode2random", "rinbinomMu");
#> rinbinom = (rxode2i2_ribinom) R_GetCCallable("rxode2random", "rinbinom");
#> ribinom = (rxode2i2_ribinom) R_GetCCallable("rxode2random", "ribinom");
#> rinorm = (rxode2i2_fn2) R_GetCCallable("rxode2random", "rinorm");
#> rxweibull = (rxode2i_fn2) R_GetCCallable("rxode2random", "rxweibull");
#> rxunif = (rxode2i_fn2) R_GetCCallable("rxode2random", "rxunif");
#> rxt_ = (rxode2i_fn) R_GetCCallable("rxode2random", "rxt_");
#> rxpois = (rxode2i_ifn) R_GetCCallable("rxode2random", "rxpois");
#> rxbeta = (rxode2i_fn2) R_GetCCallable("rxode2random", "rxbeta");
#> rxgamma = (rxode2i_fn2) R_GetCCallable("rxode2random", "rxgamma");
#> rxgeom = (rxode2i_ifn) R_GetCCallable("rxode2random", "rxgeom");
#> rxf = (rxode2i_fn2) R_GetCCallable("rxode2random", "rxf");
#> rxexp = (rxode2i_fn) R_GetCCallable("rxode2random", "rxexp");
#> rxchisq = (rxode2i_fn) R_GetCCallable("rxode2random", "rxchisq");
#> rxcauchy = (rxode2i_fn2) R_GetCCallable("rxode2random", "rxcauchy");
#> rxnbinomMu = (rxode2i_rxbinom) R_GetCCallable("rxode2random", "rxnbinomMu");
#> rxnbinom = (rxode2i_rxbinom) R_GetCCallable("rxode2random", "rxnbinom");
#> rxbinom = (rxode2i_rxbinom) R_GetCCallable("rxode2random", "rxbinom");
#> rxnorm = (rxode2i_fn2) R_GetCCallable("rxode2random", "rxnorm");
#> linCmtC = (linCmtA_p) R_GetCCallable("rxode2parse", "linCmtC");
#> linCmtB = (linCmtB_p) R_GetCCallable("rxode2parse", "linCmtB");
#> linCmtA = (linCmtA_p) R_GetCCallable("rxode2parse", "linCmtA");
#> // dynamic stop
#> _solveData = _getRxSolve_();
#> }
#> void _assignFuns(void) {
#> if (_assign_ptr == NULL){
#> _assignFuns0();
#> }
#> }
#> void __assignFuns2(rx_solve rx,
#> rx_solving_options op,
#> t_F f,
#> t_LAG lag,
#> t_RATE rate,
#> t_DUR dur,
#> t_calc_mtime mtime,
#> t_ME me,
#> t_IndF indf,
#> t_getTime gettime,
#> t_locateTimeIndex timeindex,
#> t_handle_evidL handleEvid,
#> t_getDur getdur) {
#> // 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);
#> // assign stop
#> }
#> extern void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_ode_solver_solvedata (rx_solve *solve){
#> _solveData = solve;
#> }
#> extern rx_solve *rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_ode_solver_get_solvedata(void){
#> return _solveData;
#> }
#> SEXP rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_model_vars(void);
#>
#>
#> // prj-specific differential eqns
#> void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt(int *_neq, double __t, double *__zzStateVar__, double *__DDtStateVar__)
#> {
#> int _itwhile = 0;
#> (void)_itwhile;
#> int _cSub = _neq[1];
#> double t = __t + _solveData->subjects[_neq[1]].curShift;
#> (void)t;
#> (&_solveData->subjects[_cSub])->_rxFlag=1;
#> double tka;
#> double tcl;
#> double tv;
#> double add_DoT_sd;
#> double eta_DoT_ka;
#> double eta_DoT_cl;
#> double eta_DoT_v;
#> double clAgain;
#> double ka;
#> double cl;
#> double v;
#> double depot;
#> double center;
#> double cp;
#> double rx_yj___;
#> double rx_lambda___;
#> double rx_low___;
#> double rx_hi___;
#> double rx_pred_f_;
#> double rx_pred_;
#> double rx_r_;
#> double ipredSim;
#> double sim;
#> double err_DoT_cp;
#>
#> (void)t;
#> (void)tka;
#> (void)tcl;
#> (void)tv;
#> (void)add_DoT_sd;
#> (void)eta_DoT_ka;
#> (void)eta_DoT_cl;
#> (void)eta_DoT_v;
#> (void)clAgain;
#> (void)ka;
#> (void)cl;
#> (void)v;
#> (void)depot;
#> (void)center;
#> (void)cp;
#> (void)rx_yj___;
#> (void)rx_lambda___;
#> (void)rx_low___;
#> (void)rx_hi___;
#> (void)rx_pred_f_;
#> (void)rx_pred_;
#> (void)rx_r_;
#> (void)ipredSim;
#> (void)sim;
#> (void)err_DoT_cp;
#>
#> ka = _PL[0];
#> cl = _PL[1];
#> v = _PL[2];
#> cp = _PL[3];
#> ipredSim = _PL[4];
#> sim = _PL[5];
#>
#> _update_par_ptr(__t, _cSub, _solveData, _idx);
#> tka = _PP[0];
#> tcl = _PP[1];
#> tv = _PP[2];
#> add_DoT_sd = _PP[3];
#> eta_DoT_ka = _PP[4];
#> eta_DoT_cl = _PP[5];
#> eta_DoT_v = _PP[6];
#> clAgain = _PP[7];
#> err_DoT_cp = _PP[8];
#>
#> depot = __zzStateVar__[0]*((double)(_ON[0]));
#> center = __zzStateVar__[1]*((double)(_ON[1]));
#>
#> ka =exp(tka+eta_DoT_ka);
#> cl =clAgain<-exp(tcl+eta_DoT_cl);
#> v =exp(tv+eta_DoT_v);
#> __DDtStateVar__[0] = ((double)(_ON[0]))*(_IR[0] -ka*depot);
#> __DDtStateVar__[1] = ((double)(_ON[1]))*(_IR[1] + ka*depot-cl/safe_zero(v)*center);
#> cp =center/safe_zero(v);
#> rx_yj_ =2;
#> rx_lambda_ =1;
#> rx_low_ =0;
#> rx_hi_ =1;
#> rx_pred_f_ =cp;
#> rx_pred_ =rx_pred_f_;
#> rx_r_ =Rx_pow(_as_dbleps((add_DoT_sd)),2);
#> ipredSim =rxTBSi(rx_pred_,rx_lambda_,rx_yj_,rx_low_,rx_hi_);
#> sim =rxTBSi(rx_pred_+sqrt(rx_r_)*err_DoT_cp,rx_lambda_,rx_yj_,rx_low_,rx_hi_);
#> (&_solveData->subjects[_cSub])->dadt_counter[0]++;
#> }
#>
#> // Jacobian derived vars
#> void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_calc_jac(int *_neq, double __t, double *__zzStateVar__, double *__PDStateVar__, unsigned int __NROWPD__) {
#> int _itwhile = 0;
#> (void)_itwhile;
#> int _cSub=_neq[1];
#> double t = __t + _solveData->subjects[_neq[1]].curShift;
#> (void)t;
#> (&_solveData->subjects[_cSub])->_rxFlag=2;
#> (&_solveData->subjects[_cSub])->jac_counter[0]++;
#> }
#> // Functional based initial conditions.
#> void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_inis(int _cSub, double *__zzStateVar__){
#> int _itwhile = 0;
#> (void)_itwhile;
#>
#> (&_solveData->subjects[_cSub])->_rxFlag=3;
#> }
#> // prj-specific derived vars
#> void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_calc_lhs(int _cSub, double __t, double *__zzStateVar__, double *_lhs) {
#> int _itwhile = 0;
#> (void)_itwhile;
#> double t = __t + _solveData->subjects[_cSub].curShift;
#> (void)t;
#> (&_solveData->subjects[_cSub])->_rxFlag=11;
#> double __DDtStateVar_0__;
#> double __DDtStateVar_1__;
#> double __DDtStateVar_2__;
#> double tka;
#> double tcl;
#> double tv;
#> double add_DoT_sd;
#> double eta_DoT_ka;
#> double eta_DoT_cl;
#> double eta_DoT_v;
#> double clAgain;
#> double ka;
#> double cl;
#> double v;
#> double depot;
#> double center;
#> double cp;
#> double rx_yj___;
#> double rx_lambda___;
#> double rx_low___;
#> double rx_hi___;
#> double rx_pred_f_;
#> double rx_pred_;
#> double rx_r_;
#> double ipredSim;
#> double sim;
#> double err_DoT_cp;
#>
#> (void)t;
#> (void)__DDtStateVar_0__;
#> (void)__DDtStateVar_1__;
#> (void)__DDtStateVar_2__;
#> (void)tka;
#> (void)tcl;
#> (void)tv;
#> (void)add_DoT_sd;
#> (void)eta_DoT_ka;
#> (void)eta_DoT_cl;
#> (void)eta_DoT_v;
#> (void)clAgain;
#> (void)ka;
#> (void)cl;
#> (void)v;
#> (void)depot;
#> (void)center;
#> (void)cp;
#> (void)rx_yj___;
#> (void)rx_lambda___;
#> (void)rx_low___;
#> (void)rx_hi___;
#> (void)rx_pred_f_;
#> (void)rx_pred_;
#> (void)rx_r_;
#> (void)ipredSim;
#> (void)sim;
#> (void)err_DoT_cp;
#>
#> ka = _PL[0];
#> cl = _PL[1];
#> v = _PL[2];
#> cp = _PL[3];
#> ipredSim = _PL[4];
#> sim = _PL[5];
#>
#> _update_par_ptr(__t, _cSub, _solveData, _idx);
#> tka = _PP[0];
#> tcl = _PP[1];
#> tv = _PP[2];
#> add_DoT_sd = _PP[3];
#> eta_DoT_ka = _PP[4];
#> eta_DoT_cl = _PP[5];
#> eta_DoT_v = _PP[6];
#> clAgain = _PP[7];
#> err_DoT_cp = _PP[8];
#>
#> depot = __zzStateVar__[0]*((double)(_ON[0]));
#> center = __zzStateVar__[1]*((double)(_ON[1]));
#>
#> ka =exp(tka+eta_DoT_ka);
#> cl =clAgain<-exp(tcl+eta_DoT_cl);
#> v =exp(tv+eta_DoT_v);
#> __DDtStateVar_0__ = ((double)(_ON[0]))*(_IR[0] -ka*depot);
#> __DDtStateVar_1__ = ((double)(_ON[1]))*(_IR[1] + ka*depot-cl/safe_zero(v)*center);
#> cp =center/safe_zero(v);
#> rx_yj_ =2;
#> rx_lambda_ =1;
#> rx_low_ =0;
#> rx_hi_ =1;
#> rx_pred_f_ =cp;
#> rx_pred_ =rx_pred_f_;
#> rx_r_ =Rx_pow(_as_dbleps((add_DoT_sd)),2);
#> ipredSim =rxTBSi(rx_pred_,rx_lambda_,rx_yj_,rx_low_,rx_hi_);
#> sim =rxTBSi(rx_pred_+sqrt(rx_r_)*err_DoT_cp,rx_lambda_,rx_yj_,rx_low_,rx_hi_);
#>
#> _lhs[0]=ka;
#> _lhs[1]=cl;
#> _lhs[2]=v;
#> _lhs[3]=cp;
#> _lhs[4]=ipredSim;
#> _lhs[5]=sim;
#> }
#> // Functional based bioavailability
#> double rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_F(int _cSub, int _cmt, double _amt, double __t, double *__zzStateVar__){
#> return _amt;
#> }
#> // Functional based absorption lag
#> double rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_Lag(int _cSub, int _cmt, double __t, double *__zzStateVar__){
#> return __t;
#> }
#> // Modeled zero-order rate
#> double rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_Rate(int _cSub, int _cmt, double _amt, double __t, double *__zzStateVar__){
#> return 0.0;
#> }
#> // Modeled zero-order duration
#> double rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_Dur(int _cSub, int _cmt, double _amt, double __t){
#> return 0.0;
#> }
#> // Model Times
#> void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_mtime(int _cSub, double *_mtime){
#> }
#> // Matrix Exponential (0)
#> void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_ME(int _cSub, double _t, double __t, double *_mat, const double *__zzStateVar__){
#> int _itwhile = 0;
#> (void)_itwhile;
#> double t = __t + _solveData->subjects[_cSub].curShift;
#> (void)t;
#> (&_solveData->subjects[_cSub])->_rxFlag=9;
#> }
#> // Inductive linearization Matf
#> void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_IndF(int _cSub, double _t, double __t, double *_matf){
#> int _itwhile = 0;
#> (void)_itwhile;
#> double t = __t + _solveData->subjects[_cSub].curShift;
#> (void)t;
#> (&_solveData->subjects[_cSub])->_rxFlag=10;
#> }
#> extern SEXP rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_model_vars(void){
#> int pro=0;
#> SEXP _mv = PROTECT(_rxGetModelLib("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_model_vars"));pro++;
#> if (!_rxIsCurrentC(_mv)){
#> SEXP hash = PROTECT(allocVector(STRSXP, 1));pro++;
#> #define __doBuf__ snprintf(buf, __doBufN__, "un]\"BAAA@QRtHACAAAAAAAjn#AAAv7#aT)OwQ$PA)Ylei\"P*7t1)9rm+)cfvu{YD+2.*iYXQy85c{c|X+M_C)fvZ#!MyP&~\?u!v>WYVVMs/l8slad,}nyHHA{fj4SA@AzD>mT)8yd=y`u#9#~6RDYM$7mmTe2]SLwa~[=N5<qHTUtUn3CEh:AO]/f*I.2q^5tgs^\?&zPb0{}\?s%%%%.^WE/HAR,dX~_Zx}ZSO#\".@{\"@)M{C&~j~yl}Jj0(*E;x=/DH/P8}nRXLt_rmW[a|T*@=9c8dS)U6Ll<+~x`>9(#Ia$HW~j3_Fzk\?c&=rB^R^\?i+w[gvVtgU@$R@$7!;RUZV@hjP$J_yRmu.gS2+I^jjHE\?sg<]!Q]f#J.kzg<F[l3nd)\"M^#X=];i#>mW%%k9j\?!_Is3%%.F.7<n9f}uODAQG{M5.rI<rmB]aT37FzBnzpYCTl),X)llfbsZfy%%cLjVs;MCs(@a)X]Nx/iN_\?unE){8~s~{|&%%t={G\"!wkZ8g@:J9Q\"q^%%~y!@Ntjtc\"XO51/gZPmCy0cUADUPwE_4Qv\?F/J!E8L4EY;V93DdZ$TSf$$*=C5dF1\?g\?.*D.9xR_Tu&8{y=(wu`kgpf\"Pu@}2jVGDiP{+JBS+vK1z4mgO\"$oGyw9t:Ccc3LeaxwX8<mGw!j*/F[j*>8C+&l+bV1h&$JWWnTZ%%T;JF#fd5%%\?DH|,1Sf\?D\?|B4Wf}G0yFp4{=\"c]GCpU8Al>m;c\?Mv^KDV>r>0C^<(i6[1!N.V#]HF)`P<*4VHu75~O_uC:;3!7={Ub0v\?F3]IOQyVrPg6frZc+5`N=g0Q=yJ\?1DkU1+BlH1Pk/=^nu]LhM$<rCwntH+w;V~0r1Q{IFiP!{M99H(BzB)@}<VGP;]<VG<KBP_;W_J]D\"`XnS\?aORkz!B)y/BUvxA.ACdD2kKU\"7PQ,`J#Wyu$WDz2K*M:`.E#Lbt}*=_\?n_E\"_1w8Xvp5$Y5Dl4{UfEsq*+%%*~N;qY[z[PTI/HUfk#5/y/1sGVf7iW5wJh8_wG7`V2a:|J)Q^3Qv#DJ~#kTcmSlUlWqVU57l]vr:7:fV<gaUYx6QS:8bHoAe{VivfC;\?t`^%%6v|m=vm[nF9|Cr4B.Kevo$[Ob[i!/E=e4]wfncM=p^v`&MQw.[Kl>8b;5CGLfcMdoe&Xiwqu{daG3p7tkJD@!c8;b*&bF!]ES^fX{$w.cwmT.p_@aM6&lCEeMZ,8Eld!T!9j;p{hSH~a@(heBnXrU9rX/G5HC64wA`m.4BPvDlQHfTald77|~yh]%%:2{Mg");
#> char buf[1293];
#> #define __doBufN__ 1293
#> __doBuf__
#> #undef __doBuf__
#> #undef __doBufN__
#> SET_STRING_ELT(hash, 0, mkChar(buf));
#> SEXP lst = PROTECT(_rxQr(hash));pro++;
#> _assign_ptr(lst);
#> UNPROTECT(pro);
#> return lst;
#> } else {
#> UNPROTECT(pro);
#> return _mv;
#> }
#> }
#> extern void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt_lsoda(int *neq, double *t, double *A, double *DADT)
#> {
#> rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt(neq, *t, A, DADT);
#> }
#> extern int rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt_liblsoda(double __t, double *y, double *ydot, void *data)
#> {
#> int *neq = (int*)(data);
#> rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt(neq, __t, y, ydot);
#> return(0);
#> }
#> extern void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_calc_jac_lsoda(int *neq, double *t, double *A,int *ml, int *mu, double *JAC, int *nrowpd){
#> // Update all covariate parameters
#> rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_calc_jac(neq, *t, A, JAC, *nrowpd);
#> }
#>
#> //Create function to call from R's main thread that assigns the required functions. Sometimes they don't get assigned.
#> extern void rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_assignFuns(void){
#> _assignFuns();
#> }
#>
#> //Initialize the dll to match rxode2's calls
#> void R_init0_rx_a4f3cc8eeae0cfe5347447762c52fafa_x64(void){
#> // Get C callables on load; Otherwise it isn't thread safe
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_assignFuns2", (DL_FUNC) __assignFuns2);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_assignFuns", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_assignFuns);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_inis",(DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_inis);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt",(DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_calc_lhs",(DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_calc_lhs);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_calc_jac",(DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_calc_jac);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt_lsoda", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt_lsoda);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_calc_jac_lsoda", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_calc_jac_lsoda);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_ode_solver_solvedata", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_ode_solver_solvedata);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_ode_solver_get_solvedata", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_ode_solver_get_solvedata);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_F", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_F);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_Lag", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_Lag);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_Rate", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_Rate);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_Dur", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_Dur);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_mtime", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_mtime);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_ME", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_ME);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_IndF", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_IndF);
#> R_RegisterCCallable("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64","rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt_liblsoda", (DL_FUNC) rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_dydt_liblsoda);
#> }
#> //Initialize the dll to match rxode2's calls
#> void R_init_rx_a4f3cc8eeae0cfe5347447762c52fafa_x64(DllInfo *info){
#> // Get C callables on load; Otherwise it isn't thread safe
#> R_init0_rx_a4f3cc8eeae0cfe5347447762c52fafa_x64();
#> static const R_CallMethodDef callMethods[] = {
#> {"rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_model_vars", (DL_FUNC) &rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_model_vars, 0},
#> {NULL, NULL, 0}
#> };
#>
#> R_registerRoutines(info, NULL, callMethods, NULL, NULL);
#> R_useDynamicSymbols(info,FALSE);
#> _assignFuns0();
#>
#> }
#>
#> void R_unload_rx_a4f3cc8eeae0cfe5347447762c52fafa_x64 (DllInfo *info){
#> // Free resources required for single subject solve.
#> SEXP _mv = PROTECT(_rxGetModelLib("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_model_vars"));
#> if (!isNull(_mv)){
#> _rxRmModelLib("rx_a4f3cc8eeae0cfe5347447762c52fafa_x64_model_vars");
#> }
#> UNPROTECT(1);
#> }
Created on 2023-04-29 with reprex v2.0.2
The line in C becomes:
cl =clAgain<-exp(tcl+eta_DoT_cl);
I'm unsure how this even works.
Ah, this is interpreted as a logical in C. To make it clearer you can see:
cl = clAgain< (-exp(tcl+eta_DoT_cl));
This is a bit of a parsing problem, though because whitespace is conserved and < -
is legal as less than a negative, it may be difficult to throw an error for this particular expression without causing the language to be un-parsible.
Note that with 2 =
signs this gives the expected error
library(rxode2)
#> Warning: package 'rxode2' was built under R version 4.2.3
#> rxode2 2.0.13 using 4 threads (see ?getRxThreads)
#> no cache: create with `rxCreateCache()`
one.compartment <- function() {
ini({
tka <- log(1.57); label("Ka")
tcl <- log(2.72); label("Cl")
tv <- log(31.5); label("V")
eta.ka ~ 0.6
eta.cl ~ 0.3
eta.v ~ 0.1
add.sd <- 0.7
})
model({
ka <- exp(tka + eta.ka)
cl = clAgain = exp(tcl + eta.cl)
v <- exp(tv + eta.v)
d/dt(depot) <- -ka * depot
d/dt(center) <- ka * depot - cl / v * center
cp <- center / v
cp ~ add(add.sd)
})
}
f <- one.compartment()
#> rxode2 model syntax error:
#> ================================================================================
#> :001: ka <- exp(tka + eta.ka)
#>
#> rxode2 syntax error:
#> :002: cl = clAgain = exp(tcl + eta.cl)
#> ^
#> :002: v <- exp(tv + eta.v)
#> :003: d/dt(depot) <- -ka * depot
#> :004: d/dt(center) <- ka * depot - cl/v * center
#> :005: cp <- center/v
#> ================================================================================
#> Error: rxode2 syntax error:
#> :002: cl = clAgain = exp(tcl + eta.cl)
#> ^
#> more errors could be listed above
summary(f$simulationModel)
#> Error in summary(f$simulationModel): object 'f' not found
Created on 2023-04-29 with reprex v2.0.2
The double =
and double <-
should match behaviors.
Should be fixed, haven't tested higher level functions yet.
In the example below,
cl <- clAgain <- exp(tcl + eta.cl)
should probably give a parsing error due to repeated assignment (thecl <- clAgain <-
part). If it shouldn't give an error, then it should probably work as in R where bothcl
andclAgain
get the same value rather than being detected as a covariate (covariate detection is why I putdsim$clAgain <- 1
in the reprex).Created on 2023-04-28 with reprex v2.0.2