![]() |
Stan
1.0
probability, sampling & optimization
|
Directed graphical model compiler. More...
Typedefs | |
| typedef int | base_expr_type |
| typedef std::pair< expr_type, std::vector< expr_type > > | function_signature_t |
| typedef int | var_origin |
| typedef std::istreambuf_iterator< char > | base_iterator_t |
| typedef boost::spirit::multi_pass< base_iterator_t > | forward_iterator_t |
| typedef boost::spirit::classic::position_iterator2< forward_iterator_t > | pos_iterator_t |
Functions | |
| std::ostream & | write_base_expr_type (std::ostream &o, base_expr_type type) |
| std::ostream & | operator<< (std::ostream &o, const expr_type &et) |
| expr_type | promote_primitive (const expr_type &et) |
| expr_type | promote_primitive (const expr_type &et1, const expr_type &et2) |
| bool | is_nil (const expression &e) |
| size_t | total_dims (const std::vector< std::vector< expression > > &dimss) |
| expr_type | infer_type_indexing (const base_expr_type &expr_base_type, size_t num_expr_dims, size_t num_index_dims) |
| expr_type | infer_type_indexing (const expression &expr, size_t num_index_dims) |
| void | print_var_origin (std::ostream &o, const var_origin &vo) |
| void | generate_expression (const expression &e, std::ostream &o) |
| void | print_nuts_help (std::string cmd) |
| bool | do_print (int n, int refresh) |
| template<class Sampler , class Model > | |
| void | sample_from (Sampler &sampler, bool epsilon_adapt, int refresh, int num_iterations, int num_warmup, int num_thin, bool save_warmup, std::ostream &sample_file_stream, std::vector< double > ¶ms_r, std::vector< int > ¶ms_i, Model &model) |
| void | write_comment (std::ostream &o) |
| template<typename M > | |
| void | write_comment (std::ostream &o, const M &msg) |
| template<typename K , typename V > | |
| void | write_comment_property (std::ostream &o, const K &key, const V &val) |
| template<class Model > | |
| int | nuts_command (int argc, const char *argv[]) |
| bool | compile (std::ostream *output_stream, std::istream &stan_gm_in, std::ostream &cpp_out, const std::string &model_name, bool include_main=true, const std::string &in_file_name="input") |
| Read a Stan directed graphical model specification from the specified input, parse it, and write the C++ code for it to the specified output. More... | |
| const std::string | EOL ("\n") |
| const std::string | EOL2 ("\n\n") |
| const std::string | INDENT (" ") |
| const std::string | INDENT2 (" ") |
| const std::string | INDENT3 (" ") |
| template<typename D > | |
| bool | has_lub (const D &x) |
| template<typename D > | |
| bool | has_ub (const D &x) |
| template<typename D > | |
| bool | has_lb (const D &x) |
| template<typename T > | |
| std::string | to_string (T i) |
| void | generate_indent (size_t indent, std::ostream &o) |
| void | generate_start_namespace (std::string name, std::ostream &o) |
| void | generate_end_namespace (std::ostream &o) |
| void | generate_comment (std::string const &msg, int indent, std::ostream &o) |
| void | generate_indexed_expr (const std::string &expr, const std::vector< expression > indexes, base_expr_type base_type, size_t e_num_dims, std::ostream &o) |
| void | generate_type (const std::string &base_type, const std::vector< expression > &dims, size_t end, std::ostream &o) |
| std::string | base_type_to_string (const base_expr_type &bt) |
| void | generate_printable (const printable &p, std::ostream &o) |
| void | generate_using (const std::string &type, std::ostream &o) |
| void | generate_using_namespace (const std::string &ns, std::ostream &o) |
| void | generate_usings (std::ostream &o) |
| void | generate_typedef (const std::string &type, const std::string &abbrev, std::ostream &o) |
| void | generate_typedefs (std::ostream &o) |
| void | generate_include (const std::string &lib_name, std::ostream &o) |
| void | generate_includes (std::ostream &o) |
| void | generate_version_comment (std::ostream &o) |
| void | generate_class_decl (const std::string &model_name, std::ostream &o) |
| void | generate_end_class_decl (std::ostream &o) |
| void | generate_initializer (std::ostream &o, const std::string &base_type, const std::vector< expression > &dims, const expression &type_arg1=expression(), const expression &type_arg2=expression()) |
| void | generate_validate_context_size (std::ostream &o, const std::string &stage, const std::string &var_name, const std::string &base_type, const std::vector< expression > &dims, const expression &type_arg1=expression(), const expression &type_arg2=expression()) |
| void | generate_initialization (std::ostream &o, const std::string &var_name, const std::string &base_type, const std::vector< expression > &dims, const expression &type_arg1=expression(), const expression &type_arg2=expression()) |
| void | generate_var_resizing (const std::vector< var_decl > &vs, std::ostream &o) |
| const std::vector< expression > | EMPTY_EXP_VECTOR (0) |
| void | generate_local_var_inits (std::vector< var_decl > vs, bool is_var, bool declare_vars, std::ostream &o) |
| void | generate_public_decl (std::ostream &o) |
| void | generate_private_decl (std::ostream &o) |
| void | generate_validate_var_decl (const var_decl &decl, int indent, std::ostream &o) |
| void | generate_validate_var_decls (const std::vector< var_decl > decls, int indent, std::ostream &o) |
| void | generate_member_var_decls (const std::vector< var_decl > &vs, int indent, std::ostream &o) |
| void | generate_local_var_decls (const std::vector< var_decl > &vs, int indent, std::ostream &o, bool is_var) |
| void | generate_init_vars (const std::vector< var_decl > &vs, int indent, std::ostream &o) |
| void | generate_validate_transformed_params (const std::vector< var_decl > &vs, int indent, std::ostream &o) |
| void | generate_statement (statement const &s, int indent, std::ostream &o, bool include_sampling, bool is_var) |
| void | generate_statements (const std::vector< statement > &ss, int indent, std::ostream &o, bool include_sampling, bool is_var) |
| void | generate_log_prob (program const &p, std::ostream &o) |
| void | suppress_warning (const std::string &indent, const std::string &var_name, std::ostream &o) |
| void | generate_member_var_inits (const std::vector< var_decl > &vs, std::ostream &o) |
| void | generate_constructor (const program &prog, const std::string &model_name, std::ostream &o) |
| void | generate_init_method (const std::vector< var_decl > &vs, std::ostream &o) |
| void | generate_dims_method (const program &prog, std::ostream &o) |
| void | generate_param_names_method (const program &prog, std::ostream &o) |
| void | generate_write_csv_header_method (const program &prog, std::ostream &o) |
| void | generate_write_csv_method (const program &prog, const std::string &model_name, std::ostream &o) |
| void | generate_write_array_method (const program &prog, const std::string &model_name, std::ostream &o) |
| void | generate_set_param_ranges (const std::vector< var_decl > &var_decls, std::ostream &o) |
| void | generate_main (const std::string &model_name, std::ostream &out) |
| void | generate_cpp (const program &prog, const std::string &model_name, std::ostream &out, bool include_main=true) |
| bool | is_space (char c) |
| bool | is_nonempty (std::string &s) |
| bool | parse (std::ostream *output_stream, std::istream &input, const std::string &filename, program &result) |
Variables | |
| const int | INT_T = 1 |
| const int | DOUBLE_T = 2 |
| const int | VECTOR_T = 3 |
| const int | ROW_VECTOR_T = 4 |
| const int | MATRIX_T = 5 |
| const int | ILL_FORMED_T = 6 |
| const int | data_origin = 1 |
| const int | transformed_data_origin = 2 |
| const int | parameter_origin = 3 |
| const int | transformed_parameter_origin = 4 |
| const int | derived_origin = 5 |
| const int | local_origin = 6 |
| boost::phoenix::function< validate_expr_type2 > | validate_expr_type2_f |
| boost::phoenix::function< set_fun_type2 > | set_fun_type2_f |
| boost::phoenix::function< binary_op_expr > | binary_op_f |
| boost::phoenix::function< addition_expr > | addition |
| boost::phoenix::function< subtraction_expr > | subtraction |
| boost::phoenix::function< add_conditional_condition > | add_conditional_condition_f |
| boost::phoenix::function< add_conditional_body > | add_conditional_body_f |
Directed graphical model compiler.
| typedef int stan::gm::base_expr_type |
| typedef std::istreambuf_iterator<char> stan::gm::base_iterator_t |
Definition at line 10 of file iterator_typedefs.hpp.
| typedef boost::spirit::multi_pass<base_iterator_t> stan::gm::forward_iterator_t |
Definition at line 11 of file iterator_typedefs.hpp.
| typedef std::pair<expr_type, std::vector<expr_type> > stan::gm::function_signature_t |
| typedef boost::spirit::classic::position_iterator2<forward_iterator_t> stan::gm::pos_iterator_t |
Definition at line 12 of file iterator_typedefs.hpp.
| typedef int stan::gm::var_origin |
| std::string stan::gm::base_type_to_string | ( | const base_expr_type & | bt | ) |
Definition at line 125 of file generator.hpp.
| bool stan::gm::compile | ( | std::ostream * | output_stream, |
| std::istream & | stan_gm_in, | ||
| std::ostream & | cpp_out, | ||
| const std::string & | model_name, | ||
| bool | include_main = true, |
||
| const std::string & | in_file_name = "input" |
||
| ) |
Read a Stan directed graphical model specification from the specified input, parse it, and write the C++ code for it to the specified output.
| stan_gm_in | Graphical model specification |
| cpp_out | C++ code output stream |
| model_name | Name of model class |
| include_main | Indicates whether to generate a main function |
| in_file_name | Name of input file to use in error messages; defaults to input. |
false if code could not be generated due to syntax error in the Graphical model; true otherwise. Definition at line 31 of file compiler.hpp.
| bool stan::gm::do_print | ( | int | n, |
| int | refresh | ||
| ) |
Definition at line 152 of file command.hpp.
| const std::vector<expression> stan::gm::EMPTY_EXP_VECTOR | ( | 0 | ) |
| const std::string stan::gm::EOL | ( | "\n" | ) |
| const std::string stan::gm::EOL2 | ( | "\n\n" | ) |
| void stan::gm::generate_class_decl | ( | const std::string & | model_name, |
| std::ostream & | o | ||
| ) |
Definition at line 268 of file generator.hpp.
| void stan::gm::generate_comment | ( | std::string const & | msg, |
| int | indent, | ||
| std::ostream & | o | ||
| ) |
Definition at line 67 of file generator.hpp.
| void stan::gm::generate_constructor | ( | const program & | prog, |
| const std::string & | model_name, | ||
| std::ostream & | o | ||
| ) |
Definition at line 1763 of file generator.hpp.
| void stan::gm::generate_cpp | ( | const program & | prog, |
| const std::string & | model_name, | ||
| std::ostream & | out, | ||
| bool | include_main = true |
||
| ) |
Definition at line 3095 of file generator.hpp.
| void stan::gm::generate_dims_method | ( | const program & | prog, |
| std::ostream & | o | ||
| ) |
Definition at line 2110 of file generator.hpp.
| void stan::gm::generate_end_class_decl | ( | std::ostream & | o | ) |
Definition at line 273 of file generator.hpp.
| void stan::gm::generate_end_namespace | ( | std::ostream & | o | ) |
Definition at line 63 of file generator.hpp.
| void stan::gm::generate_expression | ( | const expression & | e, |
| std::ostream & | o | ||
| ) |
Definition at line 191 of file generator.hpp.
| void stan::gm::generate_include | ( | const std::string & | lib_name, |
| std::ostream & | o | ||
| ) |
Definition at line 254 of file generator.hpp.
| void stan::gm::generate_includes | ( | std::ostream & | o | ) |
Definition at line 258 of file generator.hpp.
| void stan::gm::generate_indent | ( | size_t | indent, |
| std::ostream & | o | ||
| ) |
Definition at line 46 of file generator.hpp.
| void stan::gm::generate_indexed_expr | ( | const std::string & | expr, |
| const std::vector< expression > | indexes, | ||
| base_expr_type | base_type, | ||
| size_t | e_num_dims, | ||
| std::ostream & | o | ||
| ) |
Definition at line 74 of file generator.hpp.
| void stan::gm::generate_init_method | ( | const std::vector< var_decl > & | vs, |
| std::ostream & | o | ||
| ) |
Definition at line 2011 of file generator.hpp.
| void stan::gm::generate_init_vars | ( | const std::vector< var_decl > & | vs, |
| int | indent, | ||
| std::ostream & | o | ||
| ) |
Definition at line 988 of file generator.hpp.
| void stan::gm::generate_initialization | ( | std::ostream & | o, |
| const std::string & | var_name, | ||
| const std::string & | base_type, | ||
| const std::vector< expression > & | dims, | ||
| const expression & | type_arg1 = expression(), |
||
| const expression & | type_arg2 = expression() |
||
| ) |
Definition at line 379 of file generator.hpp.
| void stan::gm::generate_initializer | ( | std::ostream & | o, |
| const std::string & | base_type, | ||
| const std::vector< expression > & | dims, | ||
| const expression & | type_arg1 = expression(), |
||
| const expression & | type_arg2 = expression() |
||
| ) |
Definition at line 277 of file generator.hpp.
| void stan::gm::generate_local_var_decls | ( | const std::vector< var_decl > & | vs, |
| int | indent, | ||
| std::ostream & | o, | ||
| bool | is_var | ||
| ) |
Definition at line 928 of file generator.hpp.
| void stan::gm::generate_local_var_inits | ( | std::vector< var_decl > | vs, |
| bool | is_var, | ||
| bool | declare_vars, | ||
| std::ostream & | o | ||
| ) |
Definition at line 586 of file generator.hpp.
| void stan::gm::generate_log_prob | ( | program const & | p, |
| std::ostream & | o | ||
| ) |
Definition at line 1318 of file generator.hpp.
| void stan::gm::generate_main | ( | const std::string & | model_name, |
| std::ostream & | out | ||
| ) |
Definition at line 3076 of file generator.hpp.
| void stan::gm::generate_member_var_decls | ( | const std::vector< var_decl > & | vs, |
| int | indent, | ||
| std::ostream & | o | ||
| ) |
Definition at line 791 of file generator.hpp.
| void stan::gm::generate_member_var_inits | ( | const std::vector< var_decl > & | vs, |
| std::ostream & | o | ||
| ) |
Definition at line 1756 of file generator.hpp.
| void stan::gm::generate_param_names_method | ( | const program & | prog, |
| std::ostream & | o | ||
| ) |
Definition at line 2182 of file generator.hpp.
| void stan::gm::generate_printable | ( | const printable & | p, |
| std::ostream & | o | ||
| ) |
Definition at line 206 of file generator.hpp.
| void stan::gm::generate_private_decl | ( | std::ostream & | o | ) |
Definition at line 606 of file generator.hpp.
| void stan::gm::generate_public_decl | ( | std::ostream & | o | ) |
Definition at line 602 of file generator.hpp.
| void stan::gm::generate_set_param_ranges | ( | const std::vector< var_decl > & | var_decls, |
| std::ostream & | o | ||
| ) |
Definition at line 3064 of file generator.hpp.
| void stan::gm::generate_start_namespace | ( | std::string | name, |
| std::ostream & | o | ||
| ) |
Definition at line 58 of file generator.hpp.
| void stan::gm::generate_statement | ( | statement const & | s, |
| int | indent, | ||
| std::ostream & | o, | ||
| bool | include_sampling, | ||
| bool | is_var | ||
| ) |
Definition at line 1298 of file generator.hpp.
| void stan::gm::generate_statements | ( | const std::vector< statement > & | ss, |
| int | indent, | ||
| std::ostream & | o, | ||
| bool | include_sampling, | ||
| bool | is_var | ||
| ) |
Definition at line 1307 of file generator.hpp.
| void stan::gm::generate_type | ( | const std::string & | base_type, |
| const std::vector< expression > & | dims, | ||
| size_t | end, | ||
| std::ostream & | o | ||
| ) |
Definition at line 113 of file generator.hpp.
| void stan::gm::generate_typedef | ( | const std::string & | type, |
| const std::string & | abbrev, | ||
| std::ostream & | o | ||
| ) |
Definition at line 236 of file generator.hpp.
| void stan::gm::generate_typedefs | ( | std::ostream & | o | ) |
Definition at line 242 of file generator.hpp.
| void stan::gm::generate_using | ( | const std::string & | type, |
| std::ostream & | o | ||
| ) |
Definition at line 211 of file generator.hpp.
| void stan::gm::generate_using_namespace | ( | const std::string & | ns, |
| std::ostream & | o | ||
| ) |
Definition at line 215 of file generator.hpp.
| void stan::gm::generate_usings | ( | std::ostream & | o | ) |
Definition at line 220 of file generator.hpp.
| void stan::gm::generate_validate_context_size | ( | std::ostream & | o, |
| const std::string & | stage, | ||
| const std::string & | var_name, | ||
| const std::string & | base_type, | ||
| const std::vector< expression > & | dims, | ||
| const expression & | type_arg1 = expression(), |
||
| const expression & | type_arg2 = expression() |
||
| ) |
Definition at line 309 of file generator.hpp.
| void stan::gm::generate_validate_transformed_params | ( | const std::vector< var_decl > & | vs, |
| int | indent, | ||
| std::ostream & | o | ||
| ) |
Definition at line 1108 of file generator.hpp.
| void stan::gm::generate_validate_var_decl | ( | const var_decl & | decl, |
| int | indent, | ||
| std::ostream & | o | ||
| ) |
Definition at line 720 of file generator.hpp.
| void stan::gm::generate_validate_var_decls | ( | const std::vector< var_decl > | decls, |
| int | indent, | ||
| std::ostream & | o | ||
| ) |
Definition at line 727 of file generator.hpp.
| void stan::gm::generate_var_resizing | ( | const std::vector< var_decl > & | vs, |
| std::ostream & | o | ||
| ) |
Definition at line 429 of file generator.hpp.
| void stan::gm::generate_version_comment | ( | std::ostream & | o | ) |
Definition at line 263 of file generator.hpp.
| void stan::gm::generate_write_array_method | ( | const program & | prog, |
| const std::string & | model_name, | ||
| std::ostream & | o | ||
| ) |
Definition at line 2862 of file generator.hpp.
| void stan::gm::generate_write_csv_header_method | ( | const program & | prog, |
| std::ostream & | o | ||
| ) |
Definition at line 2303 of file generator.hpp.
| void stan::gm::generate_write_csv_method | ( | const program & | prog, |
| const std::string & | model_name, | ||
| std::ostream & | o | ||
| ) |
Definition at line 2541 of file generator.hpp.
| bool stan::gm::has_lb | ( | const D & | x | ) |
Definition at line 35 of file generator.hpp.
| bool stan::gm::has_lub | ( | const D & | x | ) |
Definition at line 27 of file generator.hpp.
| bool stan::gm::has_ub | ( | const D & | x | ) |
Definition at line 31 of file generator.hpp.
| const std::string stan::gm::INDENT | ( | " " | ) |
| const std::string stan::gm::INDENT2 | ( | " " | ) |
| const std::string stan::gm::INDENT3 | ( | " " | ) |
| expr_type stan::gm::infer_type_indexing | ( | const base_expr_type & | expr_base_type, |
| size_t | num_expr_dims, | ||
| size_t | num_index_dims | ||
| ) |
Definition at line 479 of file ast_def.cpp.
| expr_type stan::gm::infer_type_indexing | ( | const expression & | expr, |
| size_t | num_index_dims | ||
| ) |
Definition at line 498 of file ast_def.cpp.
| bool stan::gm::is_nil | ( | const expression & | e | ) |
Definition at line 392 of file ast_def.cpp.
| bool stan::gm::is_nonempty | ( | std::string & | s | ) |
Definition at line 50 of file parser.hpp.
| bool stan::gm::is_space | ( | char | c | ) |
Definition at line 46 of file parser.hpp.
| int stan::gm::nuts_command | ( | int | argc, |
| const char * | argv[] | ||
| ) |
Definition at line 241 of file command.hpp.
| std::ostream & stan::gm::operator<< | ( | std::ostream & | o, |
| const expr_type & | et | ||
| ) |
Definition at line 92 of file ast_def.cpp.
|
inline |
Definition at line 62 of file parser.hpp.
| void stan::gm::print_nuts_help | ( | std::string | cmd | ) |
Definition at line 35 of file command.hpp.
| void stan::gm::print_var_origin | ( | std::ostream & | o, |
| const var_origin & | vo | ||
| ) |
Definition at line 550 of file ast_def.cpp.
Definition at line 99 of file ast_def.cpp.
Definition at line 105 of file ast_def.cpp.
| void stan::gm::sample_from | ( | Sampler & | sampler, |
| bool | epsilon_adapt, | ||
| int | refresh, | ||
| int | num_iterations, | ||
| int | num_warmup, | ||
| int | num_thin, | ||
| bool | save_warmup, | ||
| std::ostream & | sample_file_stream, | ||
| std::vector< double > & | params_r, | ||
| std::vector< int > & | params_i, | ||
| Model & | model | ||
| ) |
Definition at line 159 of file command.hpp.
| void stan::gm::suppress_warning | ( | const std::string & | indent, |
| const std::string & | var_name, | ||
| std::ostream & | o | ||
| ) |
Definition at line 1747 of file generator.hpp.
| std::string stan::gm::to_string | ( | T | i | ) |
Definition at line 40 of file generator.hpp.
| size_t stan::gm::total_dims | ( | const std::vector< std::vector< expression > > & | dimss | ) |
Definition at line 471 of file ast_def.cpp.
| std::ostream & stan::gm::write_base_expr_type | ( | std::ostream & | o, |
| base_expr_type | type | ||
| ) |
Definition at line 23 of file ast_def.cpp.
| void stan::gm::write_comment | ( | std::ostream & | o | ) |
Definition at line 225 of file command.hpp.
| void stan::gm::write_comment | ( | std::ostream & | o, |
| const M & | msg | ||
| ) |
Definition at line 229 of file command.hpp.
| void stan::gm::write_comment_property | ( | std::ostream & | o, |
| const K & | key, | ||
| const V & | val | ||
| ) |
Definition at line 234 of file command.hpp.
| boost::phoenix::function<add_conditional_body> stan::gm::add_conditional_body_f |
Definition at line 83 of file statement_2_grammar_def.hpp.
| boost::phoenix::function<add_conditional_condition> stan::gm::add_conditional_condition_f |
Definition at line 73 of file statement_2_grammar_def.hpp.
| boost::phoenix::function<addition_expr> stan::gm::addition |
Definition at line 140 of file expression_grammar_def.hpp.
| boost::phoenix::function<binary_op_expr> stan::gm::binary_op_f |
Definition at line 116 of file expression_grammar_def.hpp.
| boost::phoenix::function<set_fun_type2> stan::gm::set_fun_type2_f |
Definition at line 85 of file expression_grammar_def.hpp.
| boost::phoenix::function<subtraction_expr> stan::gm::subtraction |
Definition at line 163 of file expression_grammar_def.hpp.
| boost::phoenix::function<validate_expr_type2> stan::gm::validate_expr_type2_f |
Definition at line 67 of file expression_grammar_def.hpp.