Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning with solve #780

Merged
merged 3 commits into from
Sep 2, 2024
Merged

Warning with solve #780

merged 3 commits into from
Sep 2, 2024

Conversation

mattfidler
Copy link
Member

library(rxode2)
m <- rxode2({
        param(Kpm_pop, V_pop, k_pop, k12_pop, k21_pop, ka_pop,
            km_pop, a1_Cp, b1_Cp, a2_Cm, b2_Cm, omega_Kpm, omega_V,
            omega_k, omega_k12, omega_k21, omega_ka, omega_km)
        cmt(depot)
        cmt(central)
        cmt(cmt2)
        cmt(cmt3)
        Kpm = exp(Kpm_pop + omega_Kpm)
        V = exp(V_pop + omega_V)
        k = exp(k_pop + omega_k)
        k12 = exp(k12_pop + omega_k12)
        k21 = exp(k21_pop + omega_k21)
        ka = exp(ka_pop + omega_ka)
        km = exp(km_pop + omega_km)
        d/dt(depot) = -ka * depot
        d/dt(central) = -k12 * central + k21 * cmt2 + ka * depot -
            k * central - Kpm * central
        Cp = central/V
        d/dt(cmt2) = +k12 * central - k21 * cmt2
        d/dt(cmt3) = +Kpm * central - km * cmt3
        Cm = cmt3/V
        y1_Cp = Cp
        if (CMT == 5) {
            rx_yj_ ~ 2
            rx_lambda_ ~ 1
            rx_low_ ~ 0
            rx_hi_ ~ 1
            rx_pred_f_ ~ y1_Cp
            rx_pred_ ~ rx_pred_f_
            rx_r_ ~ ((a1_Cp) + (rx_pred_f_) * (b1_Cp))^2
            ipredSim = rxTBSi(rx_pred_, rx_lambda_, rx_yj_, rx_low_,
                rx_hi_)
            sim = rxTBSi(rx_pred_ + sqrt(rx_r_) * rxerr.y1_Cp,
                rx_lambda_, rx_yj_, rx_low_, rx_hi_)
        }
        y2_Cm = Cm
        if (CMT == 6) {
            rx_yj_ ~ 2
            rx_lambda_ ~ 1
            rx_low_ ~ 0
            rx_hi_ ~ 1
            rx_pred_f_ ~ y2_Cm
            rx_pred_ ~ rx_pred_f_
            rx_r_ ~ ((a2_Cm) + (rx_pred_f_) * (b2_Cm))^2
            ipredSim = rxTBSi(rx_pred_, rx_lambda_, rx_yj_, rx_low_,
                rx_hi_)
            sim = rxTBSi(rx_pred_ + sqrt(rx_r_) * rxerr.y2_Cm,
                rx_lambda_, rx_yj_, rx_low_, rx_hi_)
        }
        iwres = (DV - rx_pred_)/sqrt(rx_r_)
        ires = DV - rx_pred_
        cmt(y1_Cp)
        cmt(y2_Cm)
        dvid(5, 6)
    })

do.call(rxSolve, lst)

@mattfidler
Copy link
Member Author

Backtrace:

Thread 1 "R" hit Breakpoint 1, 0x00007ffff7b28d70 in Rf_warning () from /usr/lib/R/lib/libR.so
(gdb) bt
#0  0x00007ffff7b28d70 in Rf_warning () from /usr/lib/R/lib/libR.so
#1  0x00007fffeb5d984e in Rcpp::warning<long&, long const&> (
    fmt=0x7fffeb9a8b50 "subscript out of bounds (index %s >= vector size %s)")
    at /usr/lib/R/site-library/Rcpp/include/Rcpp/exceptions/cpp11/exceptions.h:47
#2  0x00007fffeb605fe9 in Rcpp::traits::r_vector_cache<13, Rcpp::PreserveStorage>::check_index (
    this=0x7fffffffb950, i=16) at /usr/lib/R/site-library/Rcpp/include/Rcpp/vector/traits.h:59
#3  0x00007fffeb5fea5b in Rcpp::traits::r_vector_cache<13, Rcpp::PreserveStorage>::ref (this=0x7fffffffb950, i=16)
    at /usr/lib/R/site-library/Rcpp/include/Rcpp/vector/traits.h:49
#4  0x00007fffeb5faf79 in Rcpp::Vector<13, Rcpp::PreserveStorage>::operator[] (this=0x7fffffffb940, i=16)
    at /usr/lib/R/site-library/Rcpp/include/Rcpp/vector/Vector.h:340
#5  0x00007fffeb69d8b8 in etTrans (inData=..., obj=..., addCmt=false, dropUnits=false, allTimeVar=false,
    keepDosingOnly=false, combineDvid=..., keep=..., addlKeepsCov=false, addlDropSs=true, ssAtDoseTime=true,
    iCov=...) at etTran.cpp:1245
#6  0x00007fffeb58bb6e in _rxode2_etTrans (inDataSEXP=0x55555f8763c8, objSEXP=0x55555c41f388,
    addCmtSEXP=0x55555b7cb8b0, dropUnitsSEXP=0x55555b7cb8e8, allTimeVarSEXP=0x55555b7cb920,
    keepDosingOnlySEXP=0x55555b7cb958, combineDvidSEXP=0x555555580c10, keepSEXP=0x55555f631d28,
    addlKeepsCovSEXP=0x55555b7cb9c8, addlDropSsSEXP=0x55555b7cba00, ssAtDoseTimeSEXP=0x55555b7cba38,
    iCovSEXP=0x555555580c10) at RcppExports.cpp:305

@mattfidler mattfidler merged commit b190a50 into main Sep 2, 2024
5 of 7 checks passed
@mattfidler mattfidler deleted the 780-warning-solve branch September 2, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant