Skip to content

Instantly share code, notes, and snippets.

@SteveBronder
Created July 9, 2020 17:18
Show Gist options
  • Select an option

  • Save SteveBronder/551977811427282006595ea8efde9def to your computer and use it in GitHub Desktop.

Select an option

Save SteveBronder/551977811427282006595ea8efde9def to your computer and use it in GitHub Desktop.
// Fails with examples/bernoulli/bernoulli.hpp:25001: error: stray ‘\’ in program
// Code generated by stanc 458a7933
#include <stan/model/model_header.hpp>
namespace bernoulli_model_namespace {
inline void validate_positive_index(const char* var_name, const char* expr,
int val) {
if (val < 1) {
std::stringstream msg;
msg << "Found dimension size less than one in simplex declaration"
<< "; variable=" << var_name << "; dimension size expression=" << expr
<< "; expression value=" << val;
std::string msg_str(msg.str());
throw std::invalid_argument(msg_str.c_str());
}
}
inline void validate_unit_vector_index(const char* var_name, const char* expr,
int val) {
if (val <= 1) {
std::stringstream msg;
if (val == 1) {
msg << "Found dimension size one in unit vector declaration."
<< " One-dimensional unit vector is discrete"
<< " but the target distribution must be continuous."
<< " variable=" << var_name << "; dimension size expression=" << expr;
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment