1 #ifndef STAN_LANG_AST_DEF_CPP
2 #define STAN_LANG_AST_DEF_CPP
4 #include <boost/variant/apply_visitor.hpp>
5 #include <boost/variant/recursive_variant.hpp>
60 : base_type_(base_type),
65 : base_type_(base_type),
73 return !(*
this == et);
125 for (
size_t i = 1; i < et.
num_dims(); ++i)
146 if (sigs_ == 0)
return;
158 std::pair<std::string,
161 user_defined_set_.insert(name_sig);
167 return user_defined_set_.find(name_sig) != user_defined_set_.end();
172 if (sigs_map_.find(name) == sigs_map_.end())
174 const std::vector<function_signature_t> sigs = sigs_map_[name];
175 for (
size_t i = 0; i < sigs.size(); ++i)
176 if (sig.second == sigs[i].second)
182 const std::vector<expr_type>& arg_types) {
187 std::vector<expr_type> arg_types;
188 add(name, result_type, arg_types);
193 std::vector<expr_type> arg_types;
194 arg_types.push_back(arg_type);
195 add(name, result_type, arg_types);
201 std::vector<expr_type> arg_types;
202 arg_types.push_back(arg_type1);
203 arg_types.push_back(arg_type2);
204 add(name, result_type, arg_types);
211 std::vector<expr_type> arg_types;
212 arg_types.push_back(arg_type1);
213 arg_types.push_back(arg_type2);
214 arg_types.push_back(arg_type3);
215 add(name, result_type, arg_types);
223 std::vector<expr_type> arg_types;
224 arg_types.push_back(arg_type1);
225 arg_types.push_back(arg_type2);
226 arg_types.push_back(arg_type3);
227 arg_types.push_back(arg_type4);
228 add(name, result_type, arg_types);
237 std::vector<expr_type> arg_types;
238 arg_types.push_back(arg_type1);
239 arg_types.push_back(arg_type2);
240 arg_types.push_back(arg_type3);
241 arg_types.push_back(arg_type4);
242 arg_types.push_back(arg_type5);
243 add(name, result_type, arg_types);
253 std::vector<expr_type> arg_types;
254 arg_types.push_back(arg_type1);
255 arg_types.push_back(arg_type2);
256 arg_types.push_back(arg_type3);
257 arg_types.push_back(arg_type4);
258 arg_types.push_back(arg_type5);
259 arg_types.push_back(arg_type6);
260 add(name, result_type, arg_types);
271 std::vector<expr_type> arg_types;
272 arg_types.push_back(arg_type1);
273 arg_types.push_back(arg_type2);
274 arg_types.push_back(arg_type3);
275 arg_types.push_back(arg_type4);
276 arg_types.push_back(arg_type5);
277 arg_types.push_back(arg_type6);
278 arg_types.push_back(arg_type7);
279 add(name, result_type, arg_types);
297 const std::vector<expr_type>& call_args,
298 const std::vector<expr_type>& sig_args) {
299 if (call_args.size() != sig_args.size()) {
303 for (
size_t i = 0; i < call_args.size(); ++i) {
304 if (call_args[i] == sig_args[i]) {
306 }
else if (call_args[i].is_primitive_int()
307 && sig_args[i].is_primitive_double()) {
316 const std::vector<expr_type>& args,
319 std::vector<function_signature_t> signatures = sigs_map_[name];
320 size_t min_promotions = std::numeric_limits<size_t>::max();
321 size_t num_matches = 0;
322 for (
size_t i = 0; i < signatures.size(); ++i) {
323 signature = signatures[i];
325 if (promotions < 0)
continue;
326 size_t promotions_ui =
static_cast<size_t>(promotions);
327 if (promotions_ui < min_promotions) {
328 min_promotions = promotions_ui;
330 }
else if (promotions_ui == min_promotions) {
339 || name ==
"subtract"
340 || name ==
"multiply"
343 || name ==
"mdivide_left"
344 || name ==
"mdivide_right"
345 || name ==
"elt_multiply"
346 || name ==
"elt_divide";
350 return name ==
"minus"
351 || name ==
"logical_negation";
355 return name ==
"transpose";
366 if (name ==
"add")
return "+";
367 if (name ==
"subtract")
return "-";
368 if (name ==
"multiply")
return "*";
369 if (name ==
"divide")
return "/";
370 if (name ==
"modulus")
return "%";
371 if (name ==
"mdivide_left")
return "\\";
372 if (name ==
"mdivide_right")
return "/";
373 if (name ==
"elt_multiply")
return ".*";
374 if (name ==
"elt_divide")
return "./";
377 if (name ==
"minus")
return "-";
378 if (name ==
"logical_negation")
return "!";
381 if (name ==
"transpose")
return "'";
388 const std::vector<expr_type>& arg_types,
389 bool sampling_error_style,
390 std::ostream& msgs) {
391 static size_t OP_SIZE = std::string(
"operator").size();
393 if (name.size() > OP_SIZE && name.substr(0, OP_SIZE) ==
"operator") {
394 std::string operator_name = name.substr(OP_SIZE);
395 if (arg_types.size() == 2) {
396 msgs << arg_types[0] <<
" " << operator_name <<
" " << arg_types[1]
399 }
else if (arg_types.size() == 1) {
400 if (operator_name ==
"'")
401 msgs << arg_types[0] << operator_name << std::endl;
403 msgs << operator_name << arg_types[0] << std::endl;
408 msgs <<
"Operators must have 1 or 2 arguments." << std::endl;
411 if (sampling_error_style && arg_types.size() > 0)
412 msgs << arg_types[0] <<
" ~ ";
414 size_t start = sampling_error_style ? 1 : 0;
415 for (
size_t j = start; j < arg_types.size(); ++j) {
416 if (j > start) msgs <<
", ";
417 msgs << arg_types[j];
419 msgs <<
")" << std::endl;
423 const std::vector<expr_type>& args,
424 std::ostream& error_msgs,
425 bool sampling_error_style) {
426 std::vector<function_signature_t> signatures = sigs_map_[name];
427 size_t match_index = 0;
428 size_t min_promotions = std::numeric_limits<size_t>::max();
429 size_t num_matches = 0;
431 std::string display_name;
434 }
else if (sampling_error_style &&
ends_with(
"_log", name)) {
435 display_name = name.substr(0, name.size() - 4);
436 }
else if (sampling_error_style
438 display_name = name.substr(0, name.size() - 5);
443 for (
size_t i = 0; i < signatures.size(); ++i) {
445 if (promotions < 0)
continue;
446 size_t promotions_ui =
static_cast<size_t>(promotions);
447 if (promotions_ui < min_promotions) {
448 min_promotions = promotions_ui;
451 }
else if (promotions_ui == min_promotions) {
456 if (num_matches == 1)
457 return signatures[match_index].first;
461 if (num_matches == 0) {
462 error_msgs <<
"No matches for: "
463 << std::endl << std::endl;
465 error_msgs <<
"Ambiguous: "
466 << num_matches <<
" matches with "
467 << min_promotions <<
" integer promotions for: "
472 if (signatures.size() == 0) {
473 error_msgs << std::endl
474 << (sampling_error_style ?
"Distribution " :
"Function ")
475 << display_name <<
" not found.";
476 if (sampling_error_style)
477 error_msgs <<
" Require function with _lpdf or _lpmf or _log suffix";
478 error_msgs << std::endl;
480 error_msgs << std::endl
481 <<
"Available argument signatures for "
482 << display_name <<
":" << std::endl << std::endl;
484 for (
size_t i = 0; i < signatures.size(); ++i) {
486 sampling_error_style, error_msgs);
488 error_msgs << std::endl;
494 function_signatures::function_signatures() {
495 #include <stan/lang/function_signatures.h>
498 std::set<std::string>
504 set<std::string> result;
505 for (map<
string, vector<function_signature_t> >::const_iterator
506 it = sigs_map_.begin();
507 it != sigs_map_.end();
509 result.insert(it->first);
514 return sigs_map_.find(key) != sigs_map_.end();
521 const std::string& name)
522 : arg_type_(arg_type),
526 std::vector<expression> dims;
534 const std::string& name,
535 const std::vector<arg_decl>& arg_decls,
538 : return_type_(return_type),
540 arg_decls_(arg_decls),
547 : decl_defs_(decl_defs) {
551 std::ostream& error_msgs)
552 : return_type_(return_type),
553 error_msgs_(error_msgs) {
556 error_msgs_ <<
"Expecting return, found nil statement."
561 error_msgs_ <<
"Expecting return, found assignment statement."
566 error_msgs_ <<
"Expecting return, found assignment statement."
571 error_msgs_ <<
"Expecting return, found sampling statement."
577 error_msgs_ <<
"Expecting return, found increment_log_prob statement."
582 error_msgs_ <<
"Expecting return, found increment_log_prob statement."
587 error_msgs_ <<
"Expecting return, found print statement."
592 error_msgs_ <<
"Expecting return, found reject statement."
597 error_msgs_ <<
"Expecting return, found no_op statement."
606 " statement sequence with empty body.")
624 error_msgs_ << (
"Expecting return, found conditional"
625 " without final else.")
629 for (
size_t i = 0; i < st.
bodies_.size(); ++i)
638 "Returned expression does not match return type",
644 std::ostream& error_msgs) {
645 if (return_type ==
VOID_T)
648 return boost::apply_visitor(vis, statement.
statement_);
655 const std::vector<statement>& stmts)
656 : local_decl_(local_decl),
709 return boost::apply_visitor(vis,
expr_);
742 : printable_(printable) { }
744 : printable_(printable.printable_) { }
747 : var_map_(var_map) {
759 for (
size_t i = 0; i < e.
args_.size(); ++i)
760 if (boost::apply_visitor(*
this, e.
args_[i].expr_))
771 for (
size_t i = 0; i < e.
args_.size(); ++i)
772 if (boost::apply_visitor(*
this, e.
args_[i].expr_))
778 return boost::apply_visitor(*
this, e.
y0_.
expr_)
783 return boost::apply_visitor(*
this, e.
y0_.
expr_)
787 return boost::apply_visitor(*
this, e.
expr_.
expr_);
790 return boost::apply_visitor(*
this, e.
expr_.
expr_);
793 return boost::apply_visitor(*
this, e.
cond_.
expr_)
798 return boost::apply_visitor(*
this, e.
left.
expr_)
799 || boost::apply_visitor(*
this, e.
right.
expr_);
808 || name ==
"append_col"
811 || name ==
"diagonal"
814 || name ==
"negative_infinity"
815 || name ==
"not_a_number"
816 || name ==
"append_row"
817 || name ==
"rep_matrix"
818 || name ==
"rep_row_vector"
819 || name ==
"rep_vector"
822 || name ==
"positive_infinity"
824 || name ==
"subtract"
827 || name ==
"to_vector"
828 || name ==
"to_row_vector"
829 || name ==
"to_matrix"
830 || name ==
"to_array_1d"
831 || name ==
"to_array_2d"
832 || name ==
"transpose";
838 return boost::apply_visitor(vis, e.
expr_);
842 : var_map_(var_map) {
854 for (
size_t i = 0; i < e.
args_.size(); ++i)
855 if (boost::apply_visitor(*
this, e.
args_[i].expr_))
866 return boost::apply_visitor(*
this, e.
y0_.
expr_)
872 return boost::apply_visitor(*
this, e.
y0_.
expr_)
877 for (
size_t i = 0; i < e.
args_.size(); ++i)
878 if (boost::apply_visitor(*
this, e.
args_[i].expr_))
882 for (
size_t i = 0; i < e.
args_.size(); ++i)
889 return boost::apply_visitor(*
this, e.
expr_.
expr_);
892 return boost::apply_visitor(*
this, e.
expr_.
expr_);
916 if (e.
op ==
"*" || e.
op ==
"/")
928 return boost::apply_visitor(vis, e.
expr_);
937 const {
return false; }
957 return boost::apply_visitor(ino, e.
expr_);
962 std::vector<expression>
const& dims)
1023 const std::string& system_function_name,
1030 : integration_function_name_(integration_function_name),
1031 system_function_name_(system_function_name),
1042 const std::string& integration_function_name,
1043 const std::string& system_function_name,
1053 : integration_function_name_(integration_function_name),
1054 system_function_name_(system_function_name),
1063 max_num_steps_(max_num_steps) {
1068 std::vector<expression>
const& args)
1073 size_t total_dims(
const std::vector<std::vector<expression> >& dimss) {
1075 for (
size_t i = 0; i < dimss.size(); ++i)
1076 total += dimss[i].size();
1081 size_t num_expr_dims,
1082 size_t num_index_dims) {
1083 if (num_index_dims <= num_expr_dims)
1084 return expr_type(expr_base_type, num_expr_dims - num_index_dims);
1085 if (num_index_dims == (num_expr_dims + 1)) {
1091 if (num_index_dims == (num_expr_dims + 2))
1100 size_t num_index_dims) {
1109 const std::vector<std::vector<expression> >& dimss)
1120 const std::vector<idx>& idxs)
1121 : expr_(expr), idxs_(idxs), type_(
indexed_type(expr_, idxs_)) { }
1131 true_val_(true_val),
1132 false_val_(false_val),
1134 false_val.expression_type())) {
1139 const std::string& op,
1145 right.expression_type())) {
1185 : lb_(lb), ub_(ub) {
1220 return boost::apply_visitor(v, idx.
idx_);
1233 o <<
"transformed data";
1237 o <<
"transformed parameter";
1239 o <<
"generated quantities";
1243 o <<
"function argument";
1245 o <<
"function argument '_lp' suffixed";
1247 o <<
"function argument '_rng' suffixed";
1249 o <<
"void function argument";
1251 o <<
"void function argument '_lp' suffixed";
1253 o <<
"void function argument '_rng' suffixed";
1255 o <<
"UNKNOWN ORIGIN=" << vo;
1261 : base_type_(base_type) {
1264 const std::vector<expression>& dims,
1266 : name_(name), dims_(dims), base_type_(base_type) { }
1269 return map_.find(name) !=
map_.end();
1273 throw std::invalid_argument(
"variable does not exist");
1274 return map_.find(name)->second.first;
1277 return get(name).base_type_;
1280 return get(name).dims_.size();
1284 throw std::invalid_argument(
"variable does not exist");
1285 return map_.find(name)->second.second;
1301 std::string
const& name,
1302 std::vector<expression>
const& dims)
1314 std::string
const& name,
1315 std::vector<expression>
const& dims)
1325 std::string
const& name,
1326 std::vector<expression>
const& dims)
1336 std::string
const& name,
1337 std::vector<expression>
const& dims)
1347 std::string
const& name,
1348 std::vector<expression>
const& dims)
1358 std::string
const& name,
1359 std::vector<expression>
const& dims)
1368 std::string
const& name,
1369 std::vector<expression>
const& dims)
1378 std::string
const& name,
1379 std::vector<expression>
const& dims)
1389 std::string
const& name,
1390 std::vector<expression>
const& dims)
1403 std::string
const& name,
1404 std::vector<expression>
const& dims)
1414 std::string
const& name,
1415 std::vector<expression>
const& dims)
1423 std::string
const& name,
1424 std::vector<expression>
const& dims)
1431 std::string
const& name,
1432 std::vector<expression>
const& dims)
1639 return boost::apply_visitor(vis,
statement_);
1646 : log_prob_(log_prob) {
1654 : variable_(variable),
1663 : condition_(condition),
1669 conditional_statement
1670 ::conditional_statement(
const std::vector<expression>& conditions,
1671 const std::vector<statement>& bodies)
1672 : conditions_(conditions),
1678 : return_value_(expr) {
1684 : printables_(printables) {
1690 : printables_(printables) {
1695 const std::vector<var_decl>& data_decl,
1696 const std::pair<std::vector<var_decl>,
1697 std::vector<statement> >& derived_data_decl,
1698 const std::vector<var_decl>& parameter_decl,
1699 const std::pair<std::vector<var_decl>,
1700 std::vector<statement> >& derived_decl,
1702 const std::pair<std::vector<var_decl>,
1703 std::vector<statement> >& generated_decl)
1704 : function_decl_defs_(function_decl_defs),
1705 data_decl_(data_decl),
1706 derived_data_decl_(derived_data_decl),
1707 parameter_decl_(parameter_decl),
1708 derived_decl_(derived_decl),
1710 generated_decl_(generated_decl) {
1733 : var_dims_(var_dims),
1738 : var_name_(e.name_) {
1757 for (
size_t i = 0; i < e.
args_.size(); ++i)
1758 if (boost::apply_visitor(*
this, e.
args_[i].expr_))
1770 return boost::apply_visitor(*
this, e.
expr_.
expr_);
1773 return boost::apply_visitor(*
this, e.
expr_.
expr_);
1776 return boost::apply_visitor(*
this, e.
cond_.
expr_)
1781 return boost::apply_visitor(*
this, e.
left.
expr_)
1782 || boost::apply_visitor(*
this, e.
right.
expr_);
1791 : lhs_var_(lhs_var), idxs_(idxs), rhs_(rhs) { }
1795 return boost::apply_visitor(vis,
rhs_.
expr_);
1809 const std::vector<idx>& idxs) {
1814 size_t unindexed_dims = base_dims;
1815 size_t out_dims = 0U;
1817 for ( ; unindexed_dims > 0 && i < idxs.size(); ++i, --unindexed_dims)
1820 if (idxs.size() - i == 0) {
1821 return expr_type(base_type, out_dims + unindexed_dims);
1822 }
else if (idxs.size() - i == 1) {
1828 }
else if (base_type ==
VECTOR_T) {
1841 }
else if (idxs.size() - i == 2) {
1898 const std::vector<expression>& args) {
1899 std::vector<expr_type> arg_types;
1900 for (
size_t i = 0; i < args.size(); ++i)
1901 arg_types.push_back(args[i].expression_type());
1908 std::pair<std::string, function_signature_t>
1909 name_sig(name, sig);
1915 const std::vector<expression>& params) {
1916 std::vector<expression> variate_params;
1917 variate_params.push_back(variate);
1918 for (
size_t i = 0; i < params.size(); ++i)
1919 variate_params.push_back(params[i]);
1929 const std::string& failure_message,
1930 std::ostream& error_msgs) {
1931 bool assignable =
true;
1934 error_msgs <<
"Mismatched array dimensions.";
1940 error_msgs <<
"Base type mismatch. ";
1943 error_msgs << failure_message
1945 <<
" LHS type = " << l_type
1946 <<
"; RHS type = " << r_type
1952 const std::string& s) {
1953 size_t idx = s.rfind(suffix);
1954 return idx != std::string::npos
1955 && idx == (s.size() - suffix.size());
1958 std::string
get_cdf(
const std::string& dist_name) {
1960 return dist_name +
"_cdf_log";
1962 return dist_name +
"_lcdf";
1969 return dist_name +
"_ccdf_log";
1971 return dist_name +
"_lccdf";
1978 return dist_name +
"_log";
1980 return dist_name +
"_lpdf";
1982 return dist_name +
"_lpmf";
1994 return fname.substr(0, fname.size() - 5);
1996 return fname.substr(0, fname.size() - 5);
1998 return fname.substr(0, fname.size() - 4);
2009 return fname.substr(0, fname.size() - 5);
2011 return fname.substr(0, fname.size() - 8);
2022 return fname.substr(0, fname.size() - 6);
2024 return fname.substr(0, fname.size() - 9);
expr_type get_result_type(const std::string &name, const std::vector< expr_type > &args, std::ostream &error_msgs, bool sampling_error_style=false)
var_occurs_vis(const variable &e)
increment_log_prob_statement()
std::string strip_ccdf_suffix(const std::string &dist_fun)
base_var_decl base_decl() const
bool lhs_var_occurs_on_rhs() const
void add(const std::string &name, const expr_type &result_type, const std::vector< expr_type > &arg_types)
const int function_argument_origin
const variable_map & var_map_
bool is_operator(const std::string &name)
bool has_lp_suffix(const std::string &s)
std::vector< statement > statements_
contains_var(const variable_map &var_map)
expression & operator-=(const expression &rhs)
std::string strip_cdf_suffix(const std::string &dist_fun)
const int parameter_origin
bool has_cdf_suffix(const std::string &name)
const int function_argument_origin_rng
Probability, optimization and sampling library.
size_t total_dims(const std::vector< std::vector< expression > > &dimss)
bool operator()(const nil &e) const
bool operator<=(const expr_type &et) const
std::string get_prob_fun(const std::string &dist_name)
static function_signatures & instance()
bool is_multi_index(const idx &idx)
bool is_unary_postfix_operator(const std::string &name)
std::pair< base_var_decl, var_origin > range_t
std::vector< expression > args_
void add(const std::string &name, const base_var_decl &base_decl, const var_origin &vo)
bool has_prob_fun_suffix(const std::string &name)
std::string get_cdf(const std::string &dist_name)
bool exists(const std::string &name) const
bool operator!=(const expr_type &et) const
std::vector< statement > bodies_
bool is_ill_formed() const
bool is_assignable(const expr_type &l_type, const expr_type &r_type, const std::string &failure_message, std::ostream &error_msgs)
bool has_rng_suffix(const std::string &s)
int num_promotions(const std::vector< expr_type > &call_args, const std::vector< expr_type > &sig_args)
bool is_primitive_int() const
base_var_decl operator()(const nil &x) const
int get_signature_matches(const std::string &name, const std::vector< expr_type > &args, function_signature_t &signature)
const int transformed_parameter_origin
positive_ordered_var_decl()
base_var_decl get(const std::string &name) const
bool is_no_op_statement() const
void add_binary(const ::std::string &name)
void set_type(const base_expr_type &base_type, size_t num_dims)
var_origin get_origin(const std::string &name) const
contains_nonparam_var(const variable_map &var_map)
std::string get_ccdf(const std::string &dist_name)
const int function_argument_origin_lp
boost::variant< boost::recursive_wrapper< nil >, boost::recursive_wrapper< int_var_decl >, boost::recursive_wrapper< double_var_decl >, boost::recursive_wrapper< vector_var_decl >, boost::recursive_wrapper< row_vector_var_decl >, boost::recursive_wrapper< matrix_var_decl >, boost::recursive_wrapper< simplex_var_decl >, boost::recursive_wrapper< unit_vector_var_decl >, boost::recursive_wrapper< ordered_var_decl >, boost::recursive_wrapper< positive_ordered_var_decl >, boost::recursive_wrapper< cholesky_factor_var_decl >, boost::recursive_wrapper< cholesky_corr_var_decl >, boost::recursive_wrapper< cov_matrix_var_decl >, boost::recursive_wrapper< corr_matrix_var_decl > > var_decl_t
bool is_unary_operator(const std::string &name)
expr_type expression_type() const
const variable_map & var_map_
void print_var_origin(std::ostream &o, const var_origin &vo)
void add_unary(const ::std::string &name)
expression & operator*=(const expression &rhs)
bool is_nil(const expression &e)
array_literal & operator=(const array_literal &al)
bool operator()(const nil &e) const
void remove(const std::string &name)
const int void_function_argument_origin_rng
void add_nullary(const ::std::string &name)
bool fun_name_exists(const std::string &name)
const int model_name_origin
bool is_primitive() const
bool has_key(const std::string &key) const
bool ends_with(const std::string &suffix, const std::string &s)
bool returns_type(const expr_type &return_type, const statement &statement, std::ostream &error_msgs)
expression & operator+=(const expression &rhs)
bool is_user_defined_prob_function(const std::string &name, const expression &variate, const std::vector< expression > ¶ms)
bool is_defined(const std::string &name, const function_signature_t &sig)
void add_quaternary(const ::std::string &name)
bool operator<(const expr_type &et) const
bool is_ill_formed() const
bool operator()(const uni_idx &i) const
base_expr_type type() const
expr_type indexed_type(const expression &e, const std::vector< idx > &idxs)
Return the type of the expression indexed by the generalized index sequence.
bool is_user_defined(const std::pair< std::string, function_signature_t > &name_sig)
bool operator()(const nil &e) const
expr_type promote_primitive(const expr_type &et)
const int void_function_argument_origin
base_expr_type base_type_
size_t get_num_dims(const std::string &name) const
void print_signature(const std::string &name, const std::vector< expr_type > &arg_types, bool sampling_error_style, std::ostream &msgs)
boost::variant< boost::recursive_wrapper< nil >, boost::recursive_wrapper< assignment >, boost::recursive_wrapper< assgn >, boost::recursive_wrapper< sample >, boost::recursive_wrapper< increment_log_prob_statement >, boost::recursive_wrapper< expression >, boost::recursive_wrapper< statements >, boost::recursive_wrapper< for_statement >, boost::recursive_wrapper< conditional_statement >, boost::recursive_wrapper< while_statement >, boost::recursive_wrapper< print_statement >, boost::recursive_wrapper< reject_statement >, boost::recursive_wrapper< return_statement >, boost::recursive_wrapper< no_op_statement > > statement_t
std::ostream & operator<<(std::ostream &o, const expr_type &et)
std::pair< expr_type, std::vector< expr_type > > function_signature_t
std::string operator()(const nil &x) const
boost::variant< boost::recursive_wrapper< std::string >, boost::recursive_wrapper< expression > > printable_t
bool has_non_param_var(const expression &e, const variable_map &var_map)
const int void_function_argument_origin_lp
base_expr_type base_type_
bool is_binary_operator(const std::string &name)
bool is_data_origin(const var_origin &vo)
expr_type infer_type_indexing(const base_expr_type &expr_base_type, size_t num_expr_dims, size_t num_index_dims)
bool operator()(const nil &st) const
std::vector< expression > conditions_
std::set< std::string > key_set() const
bool has_var(const expression &e, const variable_map &var_map)
bool is_linear_function(const std::string &name)
int_literal & operator=(const int_literal &il)
const std::string var_name_
bool operator==(const expr_type &et) const
bool operator>=(const expr_type &et) const
bool has_ccdf_suffix(const std::string &name)
base_var_decl base_variable_declaration()
expr_type operator()(const nil &e) const
bool operator>(const expr_type &et) const
void add_ternary(const ::std::string &name)
double_literal & operator=(const double_literal &dl)
std::string strip_prob_fun_suffix(const std::string &dist_fun)
std::vector< expression > args_
boost::variant< boost::recursive_wrapper< nil >, boost::recursive_wrapper< int_literal >, boost::recursive_wrapper< double_literal >, boost::recursive_wrapper< array_literal >, boost::recursive_wrapper< variable >, boost::recursive_wrapper< integrate_ode >, boost::recursive_wrapper< integrate_ode_control >, boost::recursive_wrapper< fun >, boost::recursive_wrapper< index_op >, boost::recursive_wrapper< index_op_sliced >, boost::recursive_wrapper< conditional_op >, boost::recursive_wrapper< binary_op >, boost::recursive_wrapper< unary_op > > expression_t
std::ostream & write_base_expr_type(std::ostream &o, base_expr_type type)
bool operator()(const nil &st) const
void set_user_defined(const std::pair< std::string, function_signature_t > &name_sig)
cholesky_factor_var_decl()
bool is_user_defined(const std::string &name, const std::vector< expression > &args)
returns_type_vis(const expr_type &return_type, std::ostream &error_msgs)
bool is_primitive_double() const
std::vector< std::vector< expression > > dimss_
base_expr_type get_base_type(const std::string &name) const
std::string fun_name_to_operator(const std::string &name)
Placeholder struct for boost::variant default ctors.
std::map< std::string, range_t > map_
expression & operator/=(const expression &rhs)
unary_op(char op, expression const &subject)
const int transformed_data_origin
bool operator()(const nil &x) const
std::ostream & error_msgs_