check_simplex
makes sure the elements of a vector sum to 1. When constructing a vector, I get a value that slightly off from 1 – not quite sury why.
double p1_init = 0.65;
Eigen::VectorXd rho(n_states);
rho << p1_init, 1 - p1_init;
and later using this as an argument
density = hmm_marginal_lpdf(log_omegas, Gamma, rho);
Produces the following error message
C++ exception with description "hmm_marginal_lpdf: rho is not a valid simplex. sum(rho) = 1.000001, but should be 1" thrown in the test body.
By construction, however rho
should be a simplex. Is arithmetic error introduced by a simple subtraction?