![]() |
Stan
2.14.0
probability, sampling & optimization
|
This class is a singleton used to store the available functions in the Stan object language and their signatures. More...
#include <function_signatures.hpp>
Public Member Functions | |
void | set_user_defined (const std::pair< std::string, function_signature_t > &name_sig) |
Set the specified name and signature to be a user-defined function. More... | |
bool | is_user_defined (const std::pair< std::string, function_signature_t > &name_sig) |
Return true if the specified name and signature have been added as user-defined functions. More... | |
void | add (const std::string &name, const expr_type &result_type, const std::vector< expr_type > &arg_types) |
Add a built-in function with the specified name, result, type and arguments. More... | |
void | add (const std::string &name, const expr_type &result_type) |
Add a built-in function with the specifed name and result type, with no arguments. More... | |
void | add (const std::string &name, const expr_type &result_type, const expr_type &arg_type1) |
Add a built-in function with the specifed name, result type, and argument types. More... | |
void | add (const std::string &name, const expr_type &result_type, const expr_type &arg_type1, const expr_type &arg_type2) |
Add a built-in function with the specifed name, result type, and argument types. More... | |
void | add (const std::string &name, const expr_type &result_type, const expr_type &arg_type1, const expr_type &arg_type2, const expr_type &arg_type3) |
Add a built-in function with the specifed name, result type, and argument types. More... | |
void | add (const std::string &name, const expr_type &result_type, const expr_type &arg_type1, const expr_type &arg_type2, const expr_type &arg_type3, const expr_type &arg_type4) |
Add a built-in function with the specifed name, result type, and argument types. More... | |
void | add (const std::string &name, const expr_type &result_type, const expr_type &arg_type1, const expr_type &arg_type2, const expr_type &arg_type3, const expr_type &arg_type4, const expr_type &arg_type5) |
Add a built-in function with the specifed name, result type, and argument types. More... | |
void | add (const std::string &name, const expr_type &result_type, const expr_type &arg_type1, const expr_type &arg_type2, const expr_type &arg_type3, const expr_type &arg_type4, const expr_type &arg_type5, const expr_type &arg_type6) |
Add a built-in function with the specifed name, result type, and argument types. More... | |
void | add (const std::string &name, const expr_type &result_type, const expr_type &arg_type1, const expr_type &arg_type2, const expr_type &arg_type3, const expr_type &arg_type4, const expr_type &arg_type5, const expr_type &arg_type6, const expr_type &arg_type7) |
Add a built-in function with the specifed name, result type, and argument types. More... | |
void | add_nullary (const ::std::string &name) |
Add a built-in function with the specified name, a real return type, and no arguments. More... | |
void | add_unary (const ::std::string &name) |
Add a built-in function with the specified name, a real return type, and a single real argument. More... | |
void | add_unary_vectorized (const ::std::string &name) |
Add built-in functions for all the vectorized form of a unary function with the speicifed name and a single real argument. More... | |
void | add_binary (const ::std::string &name) |
Add a built-in function with the specified name, a real return type, and two real arguments. More... | |
void | add_ternary (const ::std::string &name) |
Add a built-in function with the specified name, a real return type, and three real arguments. More... | |
void | add_quaternary (const ::std::string &name) |
Add a built-in function with the specified name, a real return type, and four real arguments. More... | |
int | num_promotions (const std::vector< expr_type > &call_args, const std::vector< expr_type > &sig_args) |
Return the number of integer to real promotions required to convert the specified call arguments to the specified signature arguments. More... | |
expr_type | get_result_type (const std::string &name, const std::vector< expr_type > &args, std::ostream &error_msgs, bool sampling_error_style=false) |
Return the result expression type resulting from applying a function of the speicified name and argument types, with errors going to the specified error message string and a flag to control error output. More... | |
int | get_signature_matches (const std::string &name, const std::vector< expr_type > &args, function_signature_t &signature) |
Return the number of declared function signatures match for the specified name, argument types, and signature. More... | |
bool | is_defined (const std::string &name, const function_signature_t &sig) |
Return true if the specified function name is defined for the specified signature. More... | |
bool | has_user_defined_key (const std::string &name) const |
Return true if the specified name is the name of a user-defined function. More... | |
std::set< std::string > | key_set () const |
Return the set of function names defined. More... | |
bool | has_key (const std::string &key) const |
Return true if specified key is the name of a declared function. More... | |
bool | discrete_first_arg (const std::string &name) const |
Return true if all of the function signatures for functions with the specified name have integer base types. More... | |
Static Public Member Functions | |
static function_signatures & | instance () |
Return the instance of this singleton. More... | |
static void | reset_sigs () |
Reset the signature singleton to contain no instances. More... | |
This class is a singleton used to store the available functions in the Stan object language and their signatures.
Use instance()
to retrieve the single instance.
Definition at line 22 of file function_signatures.hpp.
void stan::lang::function_signatures::add | ( | const std::string & | name, |
const expr_type & | result_type, | ||
const std::vector< expr_type > & | arg_types | ||
) |
Add a built-in function with the specified name, result, type and arguments.
name | function name |
result_type | function return type |
arg_types | sequence of argument types |
Definition at line 67 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add | ( | const std::string & | name, |
const expr_type & | result_type | ||
) |
Add a built-in function with the specifed name and result type, with no arguments.
name | function name |
result_type | function return type |
Definition at line 73 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add | ( | const std::string & | name, |
const expr_type & | result_type, | ||
const expr_type & | arg_type1 | ||
) |
Add a built-in function with the specifed name, result type, and argument types.
name | function name |
result_type | function return type |
arg_type1 | type of first argument |
Definition at line 79 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add | ( | const std::string & | name, |
const expr_type & | result_type, | ||
const expr_type & | arg_type1, | ||
const expr_type & | arg_type2 | ||
) |
Add a built-in function with the specifed name, result type, and argument types.
name | function name |
result_type | function return type |
arg_type1 | type of first argument |
arg_type2 | type of second argument |
Definition at line 87 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add | ( | const std::string & | name, |
const expr_type & | result_type, | ||
const expr_type & | arg_type1, | ||
const expr_type & | arg_type2, | ||
const expr_type & | arg_type3 | ||
) |
Add a built-in function with the specifed name, result type, and argument types.
name | function name |
result_type | function return type |
arg_type1 | type of first argument |
arg_type2 | type of second argument |
arg_type3 | type of third argument |
Definition at line 97 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add | ( | const std::string & | name, |
const expr_type & | result_type, | ||
const expr_type & | arg_type1, | ||
const expr_type & | arg_type2, | ||
const expr_type & | arg_type3, | ||
const expr_type & | arg_type4 | ||
) |
Add a built-in function with the specifed name, result type, and argument types.
name | function name |
result_type | function return type |
arg_type1 | type of first argument |
arg_type2 | type of second argument |
arg_type3 | type of third argument |
arg_type4 | type of fourth argument |
Definition at line 109 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add | ( | const std::string & | name, |
const expr_type & | result_type, | ||
const expr_type & | arg_type1, | ||
const expr_type & | arg_type2, | ||
const expr_type & | arg_type3, | ||
const expr_type & | arg_type4, | ||
const expr_type & | arg_type5 | ||
) |
Add a built-in function with the specifed name, result type, and argument types.
name | function name |
result_type | function return type |
arg_type1 | type of first argument |
arg_type2 | type of second argument |
arg_type3 | type of third argument |
arg_type4 | type of fourth argument |
arg_type5 | type of fifth argument |
Definition at line 123 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add | ( | const std::string & | name, |
const expr_type & | result_type, | ||
const expr_type & | arg_type1, | ||
const expr_type & | arg_type2, | ||
const expr_type & | arg_type3, | ||
const expr_type & | arg_type4, | ||
const expr_type & | arg_type5, | ||
const expr_type & | arg_type6 | ||
) |
Add a built-in function with the specifed name, result type, and argument types.
name | function name |
result_type | function return type |
arg_type1 | type of first argument |
arg_type2 | type of second argument |
arg_type3 | type of third argument |
arg_type4 | type of fourth argument |
arg_type5 | type of fifth argument |
arg_type6 | type of sixth argument |
Definition at line 139 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add | ( | const std::string & | name, |
const expr_type & | result_type, | ||
const expr_type & | arg_type1, | ||
const expr_type & | arg_type2, | ||
const expr_type & | arg_type3, | ||
const expr_type & | arg_type4, | ||
const expr_type & | arg_type5, | ||
const expr_type & | arg_type6, | ||
const expr_type & | arg_type7 | ||
) |
Add a built-in function with the specifed name, result type, and argument types.
name | function name |
result_type | function return type |
arg_type1 | type of first argument |
arg_type2 | type of second argument |
arg_type3 | type of third argument |
arg_type4 | type of fourth argument |
arg_type5 | type of fifth argument |
arg_type6 | type of sixth argument |
arg_type7 | type of seventh argument |
Definition at line 157 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add_binary | ( | const ::std::string & | name | ) |
Add a built-in function with the specified name, a real return type, and two real arguments.
name | function name |
Definition at line 196 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add_nullary | ( | const ::std::string & | name | ) |
Add a built-in function with the specified name, a real return type, and no arguments.
name | function name |
Definition at line 177 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add_quaternary | ( | const ::std::string & | name | ) |
Add a built-in function with the specified name, a real return type, and four real arguments.
name | function name |
Definition at line 204 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add_ternary | ( | const ::std::string & | name | ) |
Add a built-in function with the specified name, a real return type, and three real arguments.
name | function name |
Definition at line 200 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add_unary | ( | const ::std::string & | name | ) |
Add a built-in function with the specified name, a real return type, and a single real argument.
name | function name |
Definition at line 181 of file function_signatures_def.hpp.
void stan::lang::function_signatures::add_unary_vectorized | ( | const ::std::string & | name | ) |
Add built-in functions for all the vectorized form of a unary function with the speicifed name and a single real argument.
name | function name |
Definition at line 185 of file function_signatures_def.hpp.
bool stan::lang::function_signatures::discrete_first_arg | ( | const std::string & | name | ) | const |
Return true if all of the function signatures for functions with the specified name have integer base types.
name | function name |
Definition at line 49 of file function_signatures_def.hpp.
expr_type stan::lang::function_signatures::get_result_type | ( | const std::string & | name, |
const std::vector< expr_type > & | args, | ||
std::ostream & | error_msgs, | ||
bool | sampling_error_style = false |
||
) |
Return the result expression type resulting from applying a function of the speicified name and argument types, with errors going to the specified error message string and a flag to control error output.
name | function name |
args | sequence of argument types it is called with |
error_msgs | stream to which error messages are written |
sampling_error_style | type of error message, with true value indicating that it was called in a sampling statement |
Definition at line 340 of file function_signatures_def.hpp.
int stan::lang::function_signatures::get_signature_matches | ( | const std::string & | name, |
const std::vector< expr_type > & | args, | ||
function_signature_t & | signature | ||
) |
Return the number of declared function signatures match for the specified name, argument types, and signature.
name | function name |
args | argument types with which function is called |
signature | signature to match |
Definition at line 228 of file function_signatures_def.hpp.
bool stan::lang::function_signatures::has_key | ( | const std::string & | key | ) | const |
Return true if specified key is the name of a declared function.
key | function name |
Definition at line 444 of file function_signatures_def.hpp.
bool stan::lang::function_signatures::has_user_defined_key | ( | const std::string & | name | ) | const |
Return true if the specified name is the name of a user-defined function.
name | function name |
Definition at line 415 of file function_signatures_def.hpp.
|
static |
Return the instance of this singleton.
Definition at line 21 of file function_signatures_def.hpp.
bool stan::lang::function_signatures::is_defined | ( | const std::string & | name, |
const function_signature_t & | sig | ||
) |
Return true if the specified function name is defined for the specified signature.
name | function name |
sig | signature |
Definition at line 38 of file function_signatures_def.hpp.
bool stan::lang::function_signatures::is_user_defined | ( | const std::pair< std::string, function_signature_t > & | name_sig | ) |
Return true if the specified name and signature have been added as user-defined functions.
name_sig | name and signature of function |
Definition at line 33 of file function_signatures_def.hpp.
std::set< std::string > stan::lang::function_signatures::key_set | ( | ) | const |
Return the set of function names defined.
Definition at line 430 of file function_signatures_def.hpp.
int stan::lang::function_signatures::num_promotions | ( | const std::vector< expr_type > & | call_args, |
const std::vector< expr_type > & | sig_args | ||
) |
Return the number of integer to real promotions required to convert the specified call arguments to the specified signature arguments.
call_args | argument types in function call |
sig_args | argument types in function signature |
Definition at line 208 of file function_signatures_def.hpp.
|
static |
Reset the signature singleton to contain no instances.
Definition at line 15 of file function_signatures_def.hpp.
void stan::lang::function_signatures::set_user_defined | ( | const std::pair< std::string, function_signature_t > & | name_sig | ) |
Set the specified name and signature to be a user-defined function.
name_sig | name and signature of user-defined function |
Definition at line 28 of file function_signatures_def.hpp.