Stan  2.14.0
probability, sampling & optimization
Public Member Functions | Static Public Member Functions | List of all members
stan::lang::function_signatures Class Reference

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_signaturesinstance ()
 Return the instance of this singleton. More...
 
static void reset_sigs ()
 Reset the signature singleton to contain no instances. More...
 

Detailed Description

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.

Member Function Documentation

§ add() [1/9]

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.

Parameters
namefunction name
result_typefunction return type
arg_typessequence of argument types

Definition at line 67 of file function_signatures_def.hpp.

§ add() [2/9]

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.

Parameters
namefunction name
result_typefunction return type

Definition at line 73 of file function_signatures_def.hpp.

§ add() [3/9]

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.

Parameters
namefunction name
result_typefunction return type
arg_type1type of first argument

Definition at line 79 of file function_signatures_def.hpp.

§ add() [4/9]

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.

Parameters
namefunction name
result_typefunction return type
arg_type1type of first argument
arg_type2type of second argument

Definition at line 87 of file function_signatures_def.hpp.

§ add() [5/9]

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.

Parameters
namefunction name
result_typefunction return type
arg_type1type of first argument
arg_type2type of second argument
arg_type3type of third argument

Definition at line 97 of file function_signatures_def.hpp.

§ add() [6/9]

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.

Parameters
namefunction name
result_typefunction return type
arg_type1type of first argument
arg_type2type of second argument
arg_type3type of third argument
arg_type4type of fourth argument

Definition at line 109 of file function_signatures_def.hpp.

§ add() [7/9]

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.

Parameters
namefunction name
result_typefunction return type
arg_type1type of first argument
arg_type2type of second argument
arg_type3type of third argument
arg_type4type of fourth argument
arg_type5type of fifth argument

Definition at line 123 of file function_signatures_def.hpp.

§ add() [8/9]

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.

Parameters
namefunction name
result_typefunction return type
arg_type1type of first argument
arg_type2type of second argument
arg_type3type of third argument
arg_type4type of fourth argument
arg_type5type of fifth argument
arg_type6type of sixth argument

Definition at line 139 of file function_signatures_def.hpp.

§ add() [9/9]

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.

Parameters
namefunction name
result_typefunction return type
arg_type1type of first argument
arg_type2type of second argument
arg_type3type of third argument
arg_type4type of fourth argument
arg_type5type of fifth argument
arg_type6type of sixth argument
arg_type7type of seventh argument

Definition at line 157 of file function_signatures_def.hpp.

§ add_binary()

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.

Parameters
namefunction name

Definition at line 196 of file function_signatures_def.hpp.

§ add_nullary()

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.

Parameters
namefunction name

Definition at line 177 of file function_signatures_def.hpp.

§ add_quaternary()

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.

Parameters
namefunction name

Definition at line 204 of file function_signatures_def.hpp.

§ add_ternary()

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.

Parameters
namefunction name

Definition at line 200 of file function_signatures_def.hpp.

§ add_unary()

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.

Parameters
namefunction name

Definition at line 181 of file function_signatures_def.hpp.

§ add_unary_vectorized()

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.

Parameters
namefunction name

Definition at line 185 of file function_signatures_def.hpp.

§ discrete_first_arg()

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.

Parameters
namefunction name
Returns
true if all first arguments to function with specified name are integers

Definition at line 49 of file function_signatures_def.hpp.

§ get_result_type()

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.

Parameters
namefunction name
argssequence of argument types it is called with
error_msgsstream to which error messages are written
sampling_error_styletype of error message, with true value indicating that it was called in a sampling statement
Returns
expression type resulting from applying function with specified names to arguments of specified type

Definition at line 340 of file function_signatures_def.hpp.

§ get_signature_matches()

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.

Parameters
namefunction name
argsargument types with which function is called
signaturesignature to match
Returns
number of matches

Definition at line 228 of file function_signatures_def.hpp.

§ has_key()

bool stan::lang::function_signatures::has_key ( const std::string &  key) const

Return true if specified key is the name of a declared function.

Parameters
keyfunction name
Returns
true if specified function name has been declared

Definition at line 444 of file function_signatures_def.hpp.

§ has_user_defined_key()

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.

Parameters
namefunction name
Returns
true if function name has been declared as a user-defined function

Definition at line 415 of file function_signatures_def.hpp.

§ instance()

function_signatures & stan::lang::function_signatures::instance ( )
static

Return the instance of this singleton.

Returns
singleton function signatures object

Definition at line 21 of file function_signatures_def.hpp.

§ is_defined()

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.

Parameters
namefunction name
sigsignature
Returns
true if function name is defined for signature

Definition at line 38 of file function_signatures_def.hpp.

§ is_user_defined()

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.

Parameters
name_signame and signature of function

Definition at line 33 of file function_signatures_def.hpp.

§ key_set()

std::set< std::string > stan::lang::function_signatures::key_set ( ) const

Return the set of function names defined.

Returns
set of function names

Definition at line 430 of file function_signatures_def.hpp.

§ num_promotions()

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.

Parameters
call_argsargument types in function call
sig_argsargument types in function signature
Returns
number of promotions required to cast call arguments to the signature arguments

Definition at line 208 of file function_signatures_def.hpp.

§ reset_sigs()

void stan::lang::function_signatures::reset_sigs ( )
static

Reset the signature singleton to contain no instances.

Definition at line 15 of file function_signatures_def.hpp.

§ set_user_defined()

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.

Parameters
name_signame and signature of user-defined function

Definition at line 28 of file function_signatures_def.hpp.


The documentation for this class was generated from the following files:

     [ Stan Home Page ] © 2011–2016, Stan Development Team.