1 #ifndef STAN_LANG_AST_SIGS_FUNCTION_SIGNATURES_HPP 2 #define STAN_LANG_AST_SIGS_FUNCTION_SIGNATURES_HPP 51 bool is_user_defined(
const std::pair<std::string, function_signature_t>&
62 void add(
const std::string& name,
64 const std::vector<expr_type>& arg_types);
73 void add(
const std::string& name,
84 void add(
const std::string& name,
96 void add(
const std::string& name,
111 void add(
const std::string& name,
128 void add(
const std::string& name,
147 void add(
const std::string& name,
168 void add(
const std::string& name,
191 void add(
const std::string& name,
215 void add_unary(const::std::string& name);
260 const std::vector<expr_type>& sig_args);
277 const std::vector<expr_type>& args,
278 std::ostream& error_msgs,
279 bool sampling_error_style =
false);
291 const std::vector<expr_type>& args,
320 std::set<std::string>
key_set()
const;
329 bool has_key(
const std::string& key)
const;
357 std::map<std::string, std::vector<function_signature_t> > sigs_map_;
362 std::set<std::pair<std::string, function_signature_t> > user_defined_set_;
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 argum...
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.
Probability, optimization and sampling library.
static function_signatures & instance()
Return the instance of this singleton.
This class is a singleton used to store the available functions in the Stan object language and their...
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 t...
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...
Structure of the type of an expression, which consists of a base type and a number of dimensions...
void add_binary(const ::std::string &name)
Add a built-in function with the specified name, a real return type, and two real arguments...
bool has_user_defined_key(const std::string &name) const
Return true if the specified name is the name of a user-defined function.
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...
static void reset_sigs()
Reset the signature singleton to contain no instances.
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...
void add_nullary(const ::std::string &name)
Add a built-in function with the specified name, a real return type, and no arguments.
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.
void add_quaternary(const ::std::string &name)
Add a built-in function with the specified name, a real return type, and four real arguments...
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.
std::pair< expr_type, std::vector< expr_type > > function_signature_t
The type of a function signature, mapping a vector of argument expression types to a result expressio...
void add_ternary(const ::std::string &name)
Add a built-in function with the specified name, a real return type, and three real arguments...
std::set< std::string > key_set() const
Return the set of function names defined.
bool has_key(const std::string &key) const
Return true if specified key is the name of a declared function.
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.
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 ...