metrumresearchgroup / Torsten

library of C++ functions that support applications of Stan in Pharmacometrics
BSD 3-Clause "New" or "Revised" License
52 stars 11 forks source link

[BUG] failure to build example models #48

Closed yizhang-yiz closed 8 months ago

yizhang-yiz commented 8 months ago

From https://discourse.mc-stan.org/t/problem-installing-torsten-0-90/27585/5?u=yizhang by Casey Davis.

Description

On new macbook pro with M3 chip:

48 warnings and 14 errors generated.
make: *** [src/cmdstan/main.o] Error 1

Is this something going on with a Torsten incompatibility with the M3 chip?

Expected Output

Build success.

Current Version:

v0.90.0

Full error msg

cbdavis33 commented 8 months ago

Thanks for working on it, Yi. I don't have any compilation issues, now. But now I'm running into some bugs, but they're on the Torsten side rather than the Stan side, so I'm going to move the thread here.

In example-models.pk2cpt/pk2cpt.stan, when compiling it as is, I get the error

Compiling Stan program...
Syntax error in '/var/folders/cq/ymsm1rv904b6mwygsq0z0z4w0000gn/T/RtmpYy3ugG/model-1132070f5fc31.stan', line 54, column 17 to column 18, parsing error:
   -------------------------------------------------
    52:  
    53:    cHat = x[2, :] ./ V1; // we're interested in the amount in the second compartment
    54:    cHatObs = cHat'[iObs]; // predictions for observed data recors
                          ^
    55:  
    56:  }
   -------------------------------------------------

Ill-formed phrase. Found L-value "=" expression. There are many ways in which this can be completed to a valid phrase.

This is no big deal, since changing to either cHatObs = cHat[iObs]'; // predictions for observed data recors or

for(i in 1:nObs){
    cHatObs[i] = cHat[iObs[i]];  // predictions for observed data records
  }

as in pk2cpt_linode.stan fixes it.

pk2cpt_linode works with no issues. However, in both pk2cpt and pk2cpt_ode, there is an error evaluating the log probability. I looked into it, and cHat is a zero row vector.

To do some further checking. I fit a couple models I've written, and the analytical solution runs into the same errors as your examples. The linear ODE solutions and the general ODE solutions are fine, though.

I don't have too much time over the next couple of weeks, but I'll look into all this some more (and also to make sure there's nothing wrong with my code).

yizhang-yiz commented 8 months ago

This has been fixed in the latest develop branch. Thanks for reporting still.