stan-dev / cmdstan

CmdStan, the command line interface to Stan
https://mc-stan.org/users/interfaces/cmdstan
BSD 3-Clause "New" or "Revised" License
210 stars 93 forks source link

pathfinder: disallow models with 0 parameters #1220

Closed WardBrian closed 10 months ago

WardBrian commented 10 months ago

Summary:

Running pathfinder with a model with no parameters triggers undefined behavior, and is a meaningless thing to try to do. We should prevent this.

Reproducible Steps:

Compile an empty model with -fsanitize=undefined and run pathfinder

Current Output:

Path [1] :Initial log joint density = 0.000000
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/MapBase.h:123:26: runtime error: reference binding to null pointer of type 'const Scalar'
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/MapBase.h:123:26: runtime error: reference binding to null pointer of type 'const Scalar'
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/Transpose.h:148:64: runtime error: reference binding to null pointer of type 'const Scalar'
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/CoreEvaluators.h:923:18: runtime error: reference binding to null pointer of type 'Scalar'
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/CoreEvaluators.h:337:39: runtime error: reference binding to null pointer of type 'Scalar'
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/DenseCoeffsBase.h:346:70: runtime error: reference binding to null pointer of type 'Scalar'
...

And a CSV file where all of the lp and lp_approx values are -0

Expected Output:

An error message

Current Version:

v2.33.1