Stan Math Library  2.20.0
reverse mode automatic differentiation
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
stan::math Namespace Reference

Matrices and templated mathematical functions. More...

Namespaces

 internal
 
 opencl
 
 opencl_kernels
 

Classes

class  accumulator
 Class to accumulate values and eventually return their sum. More...
 
struct  acos_fun
 Structure to wrap acos() so it can be vectorized. More...
 
struct  acosh_fun
 Structure to wrap acosh() so it can be vectorized. More...
 
struct  ad_promotable
 Template traits metaprogram to determine if a variable of one template type can be promoted to a second target template type. More...
 
struct  ad_promotable< bool, double >
 A bool may be promoted to a double. More...
 
struct  ad_promotable< char, double >
 A char may be promoted to a double. More...
 
struct  ad_promotable< double, double >
 A double may be promoted to a double. More...
 
struct  ad_promotable< float, double >
 A float may be promoted to a double. More...
 
struct  ad_promotable< int, double >
 An int may be promoted to a double. More...
 
struct  ad_promotable< long double, double >
 A long double may be promoted to a double. More...
 
struct  ad_promotable< long long, double >
 A long long may be promoted to a double. More...
 
struct  ad_promotable< long, double >
 A long may be promoted to a double. More...
 
struct  ad_promotable< short, double >
 A short may be promoted to a double. More...
 
struct  ad_promotable< T, var >
 Template traits metaprogram to determine if a variable of one template type is promotable to var. More...
 
struct  ad_promotable< typename std::enable_if< std::is_arithmetic< T >::value, T >::type, T >
 Any type may be promoted to itself. More...
 
struct  ad_promotable< unsigned char, double >
 An unsigned char may be promoted to a double. More...
 
struct  ad_promotable< unsigned int, double >
 An unsigned int may be promoted to a double. More...
 
struct  ad_promotable< unsigned long long, double >
 An unsigned long long may be promoted to a double. More...
 
struct  ad_promotable< unsigned long, double >
 An unsigned long may be promoted to a double. More...
 
struct  ad_promotable< unsigned short, double >
 An unsigned short may be promoted to a double. More...
 
struct  ad_promotable< V, fvar< T > >
 Template traits metaprogram to determine if a variable of one template type is promotable to the base type of a second fvar template type. More...
 
struct  ad_promotable< var, var >
 A var type is promotable to itself. More...
 
struct  adj_jac_vari
 adj_jac_vari interfaces a user supplied functor with the reverse mode autodiff. More...
 
struct  algebra_solver_vari
 The vari class for the algebraic solver. More...
 
struct  append_return_type
 This template metaprogram is used to compute the return type for append_array. More...
 
struct  append_return_type< Eigen::Matrix< T1, R, C >, Eigen::Matrix< T2, R, C > >
 This template metaprogram is used to compute the return type for append_array. More...
 
struct  append_return_type< int, int >
 This template metaprogram is used to compute the return type for append_array. More...
 
struct  append_return_type< std::vector< T1 >, std::vector< T2 > >
 This template metaprogram is used to compute the return type for append_array. More...
 
struct  apply_scalar_unary
 Base template class for vectorization of unary scalar functions defined by a template class F to a scalar, standard library vector, or Eigen dense matrix expression template. More...
 
struct  apply_scalar_unary< F, double >
 Template specialization for vectorized functions applying to double arguments. More...
 
struct  apply_scalar_unary< F, fvar< T > >
 Template specialization to fvar for vectorizing a unary scalar function. More...
 
struct  apply_scalar_unary< F, int >
 Template specialization for vectorized functions applying to integer arguments. More...
 
struct  apply_scalar_unary< F, std::vector< T > >
 Template specialization for vectorized functions applying to standard vector containers. More...
 
struct  apply_scalar_unary< F, var >
 Template specialization to var for vectorizing a unary scalar function. More...
 
class  array_builder
 Structure for building up arrays in an expression (rather than in statements) using an argumentchaining add() method and a getter method array() to return the result. More...
 
struct  asin_fun
 Structure to wrap asin() so it can be vectorized. More...
 
struct  asinh_fun
 Structure to wrap asinh() so it can be vectorized. More...
 
struct  atan_fun
 Structure to wrap atan() so it can be vectorized. More...
 
struct  atanh_fun
 Structure to wrap atanh() so it can be vectorized. More...
 
struct  AutodiffStackSingleton
 This struct always provides access to the autodiff stack using the singleton pattern. More...
 
struct  cbrt_fun
 Structure to wrap cbrt() so it can be vectorized. More...
 
struct  ceil_fun
 Structure to wrap ceil() so it can be vectorized. More...
 
class  chainable_alloc
 A chainable_alloc is an object which is constructed and destructed normally but the memory lifespan is managed along with the arena allocator for the gradient calculation. More...
 
struct  child_type
 Primary template class for metaprogram to compute child type of T. More...
 
struct  child_type< T_struct< T_child > >
 Specialization for template classes / structs. More...
 
class  cholesky_block
 
class  cholesky_opencl
 
class  cholesky_scalar
 
struct  common_type
 Struct which calculates type promotion given two types. More...
 
struct  common_type< Eigen::Matrix< T1, R, C >, Eigen::Matrix< T2, R, C > >
 Struct which calculates type promotion over two types. More...
 
struct  common_type< std::vector< T1 >, std::vector< T2 > >
 Struct which calculates type promotion over two types. More...
 
struct  conjunction
 Extends std::true_type when instantiated with zero or more template parameters, all of which extend the std::true_type. More...
 
struct  conjunction< T, Ts... >
 
struct  cos_fun
 Structure to wrap cos() so it can be vectorized. More...
 
struct  cosh_fun
 Structure to wrap cosh() so it can be vectorized. More...
 
struct  coupled_ode_observer
 Observer for the coupled states. More...
 
struct  coupled_ode_system
 The coupled_ode_system represents the coupled ode system, which is the base ode and the sensitivities of the base ode (derivatives with respect to the parameters of the base ode). More...
 
class  coupled_ode_system< F, double, double >
 coupled_ode_system specialization for for known initial values and known parameters. More...
 
struct  coupled_ode_system< F, double, var >
 The coupled_ode_system template specialization for known initial values and unknown parameters. More...
 
struct  coupled_ode_system< F, var, double >
 The coupled_ode_system template specialization for unknown initial values and known parameters. More...
 
struct  coupled_ode_system< F, var, var >
 The coupled_ode_system template specialization for unknown initial values and unknown parameters. More...
 
class  cov_exp_quad_vari
 
class  cov_exp_quad_vari< T_x, double, T_l >
 
class  cvodes_integrator
 Integrator interface for CVODES' ODE solvers (Adams & BDF methods). More...
 
class  cvodes_ode_data
 CVODES ode data holder object which is used during CVODES integration for CVODES callbacks. More...
 
struct  digamma_fun
 Structure to wrap digamma() so it can be vectorized. More...
 
struct  disjunction
 Extends std::false_type when instantiated with zero or more template parameters, all of which extend the std::false_type. More...
 
struct  disjunction< Cond, Conds... >
 
struct  erf_fun
 Structure to wrap erf() so it can be vectorized. More...
 
struct  erfc_fun
 Structure to wrap erfc() so that it can be vectorized. More...
 
struct  exp2_fun
 Structure to wrap exp2() so it can be vectorized. More...
 
struct  exp_fun
 Structure to wrap exp() so that it can be vectorized. More...
 
struct  expm1_fun
 Structure to wrap expm1() so that it can be vectorized. More...
 
struct  fabs_fun
 Structure to wrap fabs() so that it can be vectorized. More...
 
struct  floor_fun
 Structure to wrap floor() so that it can be vectorized. More...
 
struct  fvar
 This template class represents scalars used in forward-mode automatic differentiation, which consist of values and directional derivatives of the specified template type. More...
 
class  gevv_vvv_vari
 
class  gp_exp_quad_cov_vari
 This is a subclass of the vari class for precomputed gradients of gp_exp_quad_cov. More...
 
class  gp_exp_quad_cov_vari< T_x, double, T_l >
 This is a subclass of the vari class for precomputed gradients of gp_exp_quad_cov. More...
 
class  gp_periodic_cov_vari
 This is a subclass of the vari class for precomputed gradients of gp_periodic_cov. More...
 
class  gp_periodic_cov_vari< T_x, double, T_l, T_p >
 This is a subclass of the vari class for precomputed gradients of gp_periodic_cov. More...
 
struct  hybrj_functor_solver
 A functor with the required operators to call Eigen's algebraic solver. More...
 
class  idas_forward_system
 IDAS DAE system with forward sensitivity calculation. More...
 
class  idas_integrator
 IDAS DAE integrator. More...
 
class  idas_system
 IDAS DAE system that contains informtion on residual equation functor, sensitivity residual equation functor, as well as initial conditions. More...
 
struct  include_summand
 Template metaprogram to calculate whether a summand needs to be included in a proportional (log) probability calculation. More...
 
struct  include_summand< propto, T >
 
struct  index_type
 Primary template class for the metaprogram to compute the index type of a container. More...
 
struct  index_type< const T >
 Template class for metaprogram to compute the type of indexes used in a constant container type. More...
 
struct  index_type< Eigen::Matrix< T, R, C > >
 Template metaprogram defining typedef for the type of index for an Eigen matrix, vector, or row vector. More...
 
struct  index_type< std::vector< T > >
 Template metaprogram class to compute the type of index for a standard vector. More...
 
struct  inv_cloglog_fun
 Structure to wrap inv_cloglog() so that it can be vectorized. More...
 
struct  inv_fun
 Structure to wrap inv() so that it can be vectorized. More...
 
struct  inv_logit_fun
 Structure to wrap inv_logit() so that it can be vectorized. More...
 
struct  inv_Phi_fun
 Structure to wrap inv_Phi() so it can be vectorized. More...
 
struct  inv_sqrt_fun
 Structure to wrap inv_sqrt() so that it can be vectorized. More...
 
struct  inv_square_fun
 Structure to wrap inv_square() so that it can be vectorized. More...
 
class  LDLT_alloc
 This object stores the actual (double typed) LDLT factorization of an Eigen::Matrix<var> along with pointers to its vari's which allow the *ldlt_ functions to save memory. More...
 
class  LDLT_factor
 LDLT_factor is a thin wrapper on Eigen::LDLT to allow for reusing factorizations and efficient autodiff of things like log determinants and solutions to linear systems. More...
 
class  LDLT_factor< var, R, C >
 A template specialization of src/stan/math/matrix/LDLT_factor.hpp for var which can be used with all the *_ldlt functions. More...
 
struct  lgamma_fun
 Structure to wrap lgamma() so that it can be vectorized. More...
 
struct  log10_fun
 Structure to wrap log10() so it can be vectorized. More...
 
struct  log1m_exp_fun
 Structure to wrap log1m_exp() so it can be vectorized. More...
 
struct  log1m_fun
 Structure to wrap log1m() so it can be vectorized. More...
 
struct  log1m_inv_logit_fun
 Structure to wrap log1m_inv_logit() so it can be vectorized. More...
 
struct  log1p_exp_fun
 Structure to wrap log1m_exp() so that it can be vectorized. More...
 
struct  log1p_fun
 Structure to wrap log1p() so it can be vectorized. More...
 
struct  log2_fun
 Structure to wrap log2() so it can be vectorized. More...
 
struct  log_fun
 Structure to wrap log() so that it can be vectorized. More...
 
struct  log_inv_logit_fun
 Structure to wrap log_inv_logit() so it can be vectorized. More...
 
struct  logit_fun
 Structure to wrap logit() so it can be vectorized. More...
 
class  matrix_cl
 Represents a matrix on the OpenCL device. More...
 
class  matrix_exp_action_handler
 
class  multiply_mat_vari
 This is a subclass of the vari class for matrix multiplication A * B where A is N by M and B is M by K. More...
 
class  multiply_mat_vari< double, 1, Ca, Tb, 1 >
 This is a subclass of the vari class for matrix multiplication A * B where A is a double row vector of length M and B is a vector of length M. More...
 
class  multiply_mat_vari< double, Ra, Ca, Tb, Cb >
 This is a subclass of the vari class for matrix multiplication A * B where A is an N by M matrix of double and B is M by K. More...
 
class  multiply_mat_vari< Ta, 1, Ca, double, 1 >
 This is a subclass of the vari class for matrix multiplication A * B where A is a row vector of length M and B is a vector of length M of doubles. More...
 
class  multiply_mat_vari< Ta, 1, Ca, Tb, 1 >
 This is a subclass of the vari class for matrix multiplication A * B where A is 1 by M and B is M by 1. More...
 
class  multiply_mat_vari< Ta, Ra, Ca, double, Cb >
 This is a subclass of the vari class for matrix multiplication A * B where A is N by M and B is an M by K matrix of doubles. More...
 
struct  nlo_functor
 A structure which gets passed to Eigen's dogleg algebraic solver. More...
 
class  op_ddv_vari
 
class  op_dv_vari
 
class  op_dvd_vari
 
class  op_dvv_vari
 
class  op_matrix_vari
 
class  op_v_vari
 
class  op_vd_vari
 
class  op_vdd_vari
 
class  op_vdv_vari
 
class  op_vector_vari
 
class  op_vv_vari
 
class  op_vvd_vari
 
class  op_vvv_vari
 
class  opencl_context
 The API to access the methods and values in opencl_context_base. More...
 
class  opencl_context_base
 The opencl_context_base class represents an OpenCL context in the standard Meyers singleton design pattern. More...
 
class  operands_and_partials
 This template builds partial derivatives with respect to a set of operands. More...
 
class  operands_and_partials< Op1, Op2, Op3, Op4, Op5, fvar< Dx > >
 This class builds partial derivatives with respect to a set of operands. More...
 
class  operands_and_partials< Op1, Op2, Op3, Op4, Op5, var >
 This class builds partial derivatives with respect to a set of operands. More...
 
struct  pass_type
 
struct  pass_type< double >
 
struct  pass_type< int >
 
struct  Phi_approx_fun
 Structure to wrap Phi_approx() so it can be vectorized. More...
 
struct  Phi_fun
 Structure to wrap Phi() so it can be vectorized. More...
 
class  precomp_v_vari
 
class  precomp_vv_vari
 
class  precomp_vvv_vari
 
class  precomputed_gradients_vari
 A variable implementation taking a sequence of operands and partial derivatives with respect to the operands. More...
 
struct  promote_elements
 Struct with static function for elementwise type promotion. More...
 
struct  promote_elements< Eigen::Matrix< T, R, C >, Eigen::Matrix< S, R, C > >
 Struct with static function for elementwise type promotion. More...
 
struct  promote_elements< Eigen::Matrix< T, R, C >, Eigen::Matrix< T, R, C > >
 Struct with static function for elementwise type promotion. More...
 
struct  promote_elements< std::vector< T >, std::vector< S > >
 Struct with static function for elementwise type promotion. More...
 
struct  promote_elements< std::vector< T >, std::vector< T > >
 Struct with static function for elementwise type promotion. More...
 
struct  promote_elements< T, T >
 Struct with static function for elementwise type promotion. More...
 
struct  promote_scalar_struct
 General struct to hold static function for promoting underlying scalar types. More...
 
struct  promote_scalar_struct< T, Eigen::Matrix< S, -1, -1 > >
 Struct to hold static function for promoting underlying scalar types. More...
 
struct  promote_scalar_struct< T, Eigen::Matrix< S, -1, 1 > >
 Struct to hold static function for promoting underlying scalar types. More...
 
struct  promote_scalar_struct< T, Eigen::Matrix< S, 1, -1 > >
 Struct to hold static function for promoting underlying scalar types. More...
 
struct  promote_scalar_struct< T, std::vector< S > >
 Struct to hold static function for promoting underlying scalar types. More...
 
struct  promote_scalar_struct< T, T >
 Struct to hold static function for promoting underlying scalar types. More...
 
struct  promote_scalar_type
 Template metaprogram to calculate a type for converting a convertible type. More...
 
struct  promote_scalar_type< T, Eigen::Matrix< S, 1, Eigen::Dynamic > >
 Template metaprogram to calculate a type for a row vector whose underlying scalar is converted from the second template parameter type to the first. More...
 
struct  promote_scalar_type< T, Eigen::Matrix< S, Eigen::Dynamic, 1 > >
 Template metaprogram to calculate a type for a vector whose underlying scalar is converted from the second template parameter type to the first. More...
 
struct  promote_scalar_type< T, Eigen::Matrix< S, Eigen::Dynamic, Eigen::Dynamic > >
 Template metaprogram to calculate a type for a matrix whose underlying scalar is converted from the second template parameter type to the first. More...
 
struct  promote_scalar_type< T, std::vector< S > >
 Template metaprogram to calculate a type for a container whose underlying scalar is converted from the second template parameter type to the first. More...
 
struct  round_fun
 Structure to wrap round() so it can be vectorized. More...
 
class  scal_squared_distance_dv_vari
 
class  scal_squared_distance_vd_vari
 
class  scal_squared_distance_vv_vari
 
class  seq_view
 
class  seq_view< double, std::vector< int > >
 
class  seq_view< T, Eigen::Matrix< S, 1, Eigen::Dynamic > >
 
class  seq_view< T, Eigen::Matrix< S, Eigen::Dynamic, 1 > >
 
class  seq_view< T, Eigen::Matrix< S, Eigen::Dynamic, Eigen::Dynamic > >
 
class  seq_view< T, std::vector< S > >
 
class  seq_view< T, std::vector< std::vector< T > > >
 
class  seq_view< T, std::vector< T > >
 
struct  sin_fun
 Structure to wrap sin() so it can be vectorized. More...
 
struct  sinh_fun
 Structure to wrap sinh() so that it can be vectorized. More...
 
struct  sqrt_fun
 Structure to wrap sqrt() so that it can be vectorized. More...
 
struct  square_fun
 Structure to wrap square() so that it can be vectorized. More...
 
class  stack_alloc
 An instance of this class provides a memory pool through which blocks of raw memory may be allocated and then collected simultaneously. More...
 
struct  store_type
 
struct  store_type< double >
 
struct  store_type< int >
 
class  stored_gradient_vari
 A var implementation that stores the daughter variable implementation pointers and the partial derivative with respect to the result explicitly in arrays constructed on the auto-diff memory stack. More...
 
class  sum_eigen_v_vari
 Class for representing sums with constructors for Eigen. More...
 
class  sum_v_vari
 Class for sums of variables constructed with standard vectors. More...
 
struct  system_functor
 A functor that allows us to treat either x or y as the independent variable. More...
 
struct  tan_fun
 Structure to wrap tan() so that it can be vectorized. More...
 
struct  tanh_fun
 Structure to wrap tanh() so that it can be vectorized. More...
 
struct  tgamma_fun
 Structure to wrap tgamma() so that it can be vectorized. More...
 
struct  trigamma_fun
 Structure to wrap trigamma() so it can be vectorized. More...
 
struct  trunc_fun
 Structure to wrap trunc() so it can be vectorized. More...
 
struct  value_type
 Primary template class for metaprogram to compute the type of values stored in a container. More...
 
struct  value_type< const T >
 Template class for metaprogram to compute the type of values stored in a constant container. More...
 
struct  value_type< Eigen::Matrix< T, R, C > >
 Template metaprogram defining the type of values stored in an Eigen matrix, vector, or row vector. More...
 
struct  value_type< std::vector< T > >
 Template metaprogram class to compute the type of values stored in a standard vector. More...
 
class  var
 Independent (input) and dependent (output) variables for gradients. More...
 
class  vari
 The variable implementation base class. More...
 
class  welford_covar_estimator
 
class  welford_var_estimator
 

Typedefs

typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
 Type for sizes and indexes in an Eigen matrix with double e. More...
 
typedef Eigen::Matrix< fvar< double >, Eigen::Dynamic, Eigen::Dynamic > matrix_fd
 
typedef Eigen::Matrix< fvar< fvar< double > >, Eigen::Dynamic, Eigen::Dynamic > matrix_ffd
 
typedef Eigen::Matrix< fvar< double >, Eigen::Dynamic, 1 > vector_fd
 
typedef Eigen::Matrix< fvar< fvar< double > >, Eigen::Dynamic, 1 > vector_ffd
 
typedef Eigen::Matrix< fvar< double >, 1, Eigen::Dynamic > row_vector_fd
 
typedef Eigen::Matrix< fvar< fvar< double > >, 1, Eigen::Dynamic > row_vector_ffd
 
typedef Eigen::Matrix< fvar< var >, Eigen::Dynamic, Eigen::Dynamic > matrix_fv
 
typedef Eigen::Matrix< fvar< fvar< var > >, Eigen::Dynamic, Eigen::Dynamic > matrix_ffv
 
typedef Eigen::Matrix< fvar< var >, Eigen::Dynamic, 1 > vector_fv
 
typedef Eigen::Matrix< fvar< fvar< var > >, Eigen::Dynamic, 1 > vector_ffv
 
typedef Eigen::Matrix< fvar< var >, 1, Eigen::Dynamic > row_vector_fv
 
typedef Eigen::Matrix< fvar< fvar< var > >, 1, Eigen::Dynamic > row_vector_ffv
 
typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > matrix_d
 Type for matrix of double values. More...
 
typedef Eigen::Matrix< double, Eigen::Dynamic, 1 > vector_d
 Type for (column) vector of double values. More...
 
typedef Eigen::Matrix< double, 1, Eigen::Dynamic > row_vector_d
 Type for (row) vector of double values. More...
 
typedef boost::math::policies::policy< boost::math::policies::overflow_error< boost::math::policies::errno_on_error >, boost::math::policies::pole_error< boost::math::policies::errno_on_error > > boost_policy_t
 Boost policy that overrides the defaults to match the built-in C++ standard library functions. More...
 
typedef AutodiffStackSingleton< vari, chainable_allocChainableStack
 
typedef Eigen::Matrix< var, Eigen::Dynamic, Eigen::Dynamic > matrix_v
 The type of a matrix holding var values. More...
 
typedef Eigen::Matrix< var, Eigen::Dynamic, 1 > vector_v
 The type of a (column) vector holding var values. More...
 
typedef Eigen::Matrix< var, 1, Eigen::Dynamic > row_vector_v
 The type of a row vector holding var values. More...
 
typedef Eigen::Matrix< vari *, Eigen::Dynamic, Eigen::Dynamic > matrix_vi
 The type of a matrix holding vari* values. More...
 
typedef Eigen::Matrix< vari *, Eigen::Dynamic, 1 > vector_vi
 The type of a (column) vector holding vari* values. More...
 
typedef Eigen::Matrix< vari *, 1, Eigen::Dynamic > row_vector_vi
 The type of a row vector holding vari* values. More...
 

Enumerations

enum  TriangularViewCL { TriangularViewCL::Lower = 0, TriangularViewCL::Upper = 1, TriangularViewCL::Entire = 2 }
 
enum  TriangularMapCL { TriangularMapCL::UpperToLower = 0, TriangularMapCL::LowerToUpper = 1 }
 

Functions

template<typename T >
fvar< T > log_sum_exp (const std::vector< fvar< T > > &v)
 
template<typename T >
fvar< T > sum (const std::vector< fvar< T > > &m)
 Return the sum of the entries of the specified standard vector. More...
 
template<typename T >
std::vector< fvar< T > > to_fvar (const std::vector< T > &v)
 
template<typename T >
std::vector< fvar< T > > to_fvar (const std::vector< T > &v, const std::vector< T > &d)
 
template<typename T >
std::vector< fvar< T > > to_fvar (const std::vector< fvar< T > > &v)
 
template<typename T >
fvar< T > operator+ (const fvar< T > &x1, const fvar< T > &x2)
 Return the sum of the specified forward mode addends. More...
 
template<typename T >
fvar< T > operator+ (double x1, const fvar< T > &x2)
 Return the sum of the specified double and forward mode addends. More...
 
template<typename T >
fvar< T > operator+ (const fvar< T > &x1, double x2)
 Return the sum of the specified forward mode and double addends. More...
 
template<typename T >
fvar< T > operator/ (const fvar< T > &x1, const fvar< T > &x2)
 Return the result of dividing the first argument by the second. More...
 
template<typename T >
fvar< T > operator/ (const fvar< T > &x1, double x2)
 Return the result of dividing the first argument by the second. More...
 
template<typename T >
fvar< T > operator/ (double x1, const fvar< T > &x2)
 Return the result of dividing the first argument by the second. More...
 
template<typename T >
bool operator== (const fvar< T > &x, const fvar< T > &y)
 Return true if the specified variables have equal values as defined by ==. More...
 
template<typename T >
bool operator== (const fvar< T > &x, double y)
 Return true if the the first variable has a value equal to the second argument as defined by by ==. More...
 
template<typename T >
bool operator== (double x, const fvar< T > &y)
 Return true if the the first argument is equal to the value of the second argument as defined by by ==. More...
 
template<typename T >
bool operator> (const fvar< T > &x, const fvar< T > &y)
 Return true if the first argument has a greater value than the second as defined by >. More...
 
template<typename T >
bool operator> (const fvar< T > &x, double y)
 Return true if the first argument has a greater value than the second as defined by >. More...
 
template<typename T >
bool operator> (double x, const fvar< T > &y)
 Return true if the first argument has a greater value than the second as defined by >. More...
 
template<typename T >
bool operator>= (const fvar< T > &x, const fvar< T > &y)
 Return true if the value of the first argument is greater than or equal to that of the second as defined by >=. More...
 
template<typename T >
bool operator>= (const fvar< T > &x, double y)
 Return true if the value of the first argument has a value greater than or equal to the second argument as defined by >=. More...
 
template<typename T >
bool operator>= (double x, const fvar< T > &y)
 Return true if the first argument is greater than or equal to the value of the second argument as defined by >=. More...
 
template<typename T >
bool operator< (const fvar< T > &x, const fvar< T > &y)
 Return true if the first argument has a value less than the value of the second argument as defined by <. More...
 
template<typename T >
bool operator< (double x, const fvar< T > &y)
 Return true if the first argument is less than the value of the second argument as defined by <. More...
 
template<typename T >
bool operator< (const fvar< T > &x, double y)
 Return true if the first argument has a value less than the second argument as defined by <. More...
 
template<typename T >
bool operator<= (const fvar< T > &x, const fvar< T > &y)
 Return true if the first argument has a value less than or equal to the value of the second argument as defined by <=. More...
 
template<typename T >
bool operator<= (const fvar< T > &x, double y)
 Return true if the first argument has a value less than or equal to the second argument as defined by <=. More...
 
template<typename T >
bool operator<= (double x, const fvar< T > &y)
 Return true if the first argument is less than or equal to the second argument's value as defined by <=. More...
 
template<typename T >
bool operator && (const fvar< T > &x, const fvar< T > &y)
 Return the logical conjunction of the values of the two arguments as defined by &&. More...
 
template<typename T >
bool operator && (const fvar< T > &x, double y)
 Return the logical conjunction of the values of the two arguments as defined by &&. More...
 
template<typename T >
bool operator && (double x, const fvar< T > &y)
 Return the logical conjunction of the values of the two arguments as defined by &&. More...
 
template<typename T >
bool operator|| (const fvar< T > &x, const fvar< T > &y)
 Return the logical disjunction of the values of the two arguments as defined by ||. More...
 
template<typename T >
bool operator|| (const fvar< T > &x, double y)
 Return the logical disjunction of the values of the two arguments as defined by ||. More...
 
template<typename T >
bool operator|| (double x, const fvar< T > &y)
 Return the logical disjunction of the values of the two arguments as defined by ||. More...
 
template<typename T >
fvar< T > operator* (const fvar< T > &x, const fvar< T > &y)
 Return the product of the two arguments. More...
 
template<typename T >
fvar< T > operator* (double x, const fvar< T > &y)
 Return the product of the two arguments. More...
 
template<typename T >
fvar< T > operator* (const fvar< T > &x, double y)
 Return the product of the two arguments. More...
 
template<typename T >
bool operator!= (const fvar< T > &x, const fvar< T > &y)
 Return true if the value of the two arguments are not equal as defined by !=. More...
 
template<typename T >
bool operator!= (const fvar< T > &x, double y)
 Return true if the value of the first argument is not equal to the second argument as defined by !=. More...
 
template<typename T >
bool operator!= (double x, const fvar< T > &y)
 Return true if the first argument is not equal to the value of the second argument as defined by !=. More...
 
template<typename T >
fvar< T > operator- (const fvar< T > &x1, const fvar< T > &x2)
 Return the difference of the specified arguments. More...
 
template<typename T >
fvar< T > operator- (double x1, const fvar< T > &x2)
 Return the difference of the specified arguments. More...
 
template<typename T >
fvar< T > operator- (const fvar< T > &x1, double x2)
 Return the difference of the specified arguments. More...
 
template<typename T >
fvar< T > operator- (const fvar< T > &x)
 Return the negation of the specified argument. More...
 
template<typename T >
bool operator! (const fvar< T > &x)
 Return the negation of the value of the argument as defined by !. More...
 
template<typename T >
fvar< T > operator+ (const fvar< T > &x)
 Returns the argument. More...
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, 1, C1 > columns_dot_product (const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, 1, C1 > columns_dot_product (const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, 1, C1 > columns_dot_product (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, 1, C > columns_dot_self (const Eigen::Matrix< fvar< T >, R, C > &x)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, C, C > crossprod (const Eigen::Matrix< fvar< T >, R, C > &m)
 
template<typename T , int R, int C>
fvar< T > determinant (const Eigen::Matrix< fvar< T >, R, C > &m)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, C > divide (const Eigen::Matrix< fvar< T >, R, C > &v, const fvar< T > &c)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, C > divide (const Eigen::Matrix< fvar< T >, R, C > &v, double c)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, C > divide (const Eigen::Matrix< double, R, C > &v, const fvar< T > &c)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, C > operator/ (const Eigen::Matrix< fvar< T >, R, C > &v, const fvar< T > &c)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, C > operator/ (const Eigen::Matrix< fvar< T >, R, C > &v, double c)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, C > operator/ (const Eigen::Matrix< double, R, C > &v, const fvar< T > &c)
 
template<typename T , int R1, int C1, int R2, int C2>
fvar< T > dot_product (const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
 
template<typename T , int R1, int C1, int R2, int C2>
fvar< T > dot_product (const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2)
 
template<typename T , int R1, int C1, int R2, int C2>
fvar< T > dot_product (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
 
template<typename T , int R1, int C1, int R2, int C2>
fvar< T > dot_product (const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2, size_type &length)
 
template<typename T , int R1, int C1, int R2, int C2>
fvar< T > dot_product (const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2, size_type &length)
 
template<typename T , int R1, int C1, int R2, int C2>
fvar< T > dot_product (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2, size_type &length)
 
template<typename T >
fvar< T > dot_product (const std::vector< fvar< T > > &v1, const std::vector< fvar< T > > &v2)
 
template<typename T >
fvar< T > dot_product (const std::vector< double > &v1, const std::vector< fvar< T > > &v2)
 
template<typename T >
fvar< T > dot_product (const std::vector< fvar< T > > &v1, const std::vector< double > &v2)
 
template<typename T >
fvar< T > dot_product (const std::vector< fvar< T > > &v1, const std::vector< fvar< T > > &v2, size_type &length)
 
template<typename T >
fvar< T > dot_product (const std::vector< double > &v1, const std::vector< fvar< T > > &v2, size_type &length)
 
template<typename T >
fvar< T > dot_product (const std::vector< fvar< T > > &v1, const std::vector< double > &v2, size_type &length)
 
template<typename T , int R, int C>
fvar< T > dot_self (const Eigen::Matrix< fvar< T >, R, C > &v)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, C > inverse (const Eigen::Matrix< fvar< T >, R, C > &m)
 
template<typename T , int R, int C>
fvar< T > log_determinant (const Eigen::Matrix< fvar< T >, R, C > &m)
 
template<typename T >
Eigen::Matrix< fvar< T >, Eigen::Dynamic, 1 > log_softmax (const Eigen::Matrix< fvar< T >, Eigen::Dynamic, 1 > &alpha)
 
template<typename T , int R, int C>
fvar< T > log_sum_exp (const Eigen::Matrix< fvar< T >, R, C > &v)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > mdivide_left (const Eigen::Matrix< fvar< T >, R1, C1 > &A, const Eigen::Matrix< fvar< T >, R2, C2 > &b)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > mdivide_left (const Eigen::Matrix< double, R1, C1 > &A, const Eigen::Matrix< fvar< T >, R2, C2 > &b)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > mdivide_left (const Eigen::Matrix< fvar< T >, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b)
 
template<int R1, int C1, int R2, int C2, typename T2 >
Eigen::Matrix< fvar< T2 >, R1, C2 > mdivide_left_ldlt (const LDLT_factor< double, R1, C1 > &A, const Eigen::Matrix< fvar< T2 >, R2, C2 > &b)
 Returns the solution of the system Ax=b given an LDLT_factor of A. More...
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C1 > mdivide_left_tri_low (const Eigen::Matrix< fvar< T >, R1, C1 > &A, const Eigen::Matrix< fvar< T >, R2, C2 > &b)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C1 > mdivide_left_tri_low (const Eigen::Matrix< double, R1, C1 > &A, const Eigen::Matrix< fvar< T >, R2, C2 > &b)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C1 > mdivide_left_tri_low (const Eigen::Matrix< fvar< T >, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > mdivide_right (const Eigen::Matrix< fvar< T >, R1, C1 > &A, const Eigen::Matrix< fvar< T >, R2, C2 > &b)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > mdivide_right (const Eigen::Matrix< fvar< T >, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > mdivide_right (const Eigen::Matrix< double, R1, C1 > &A, const Eigen::Matrix< fvar< T >, R2, C2 > &b)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C1 > mdivide_right_tri_low (const Eigen::Matrix< fvar< T >, R1, C1 > &A, const Eigen::Matrix< fvar< T >, R2, C2 > &b)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > mdivide_right_tri_low (const Eigen::Matrix< fvar< T >, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > mdivide_right_tri_low (const Eigen::Matrix< double, R1, C1 > &A, const Eigen::Matrix< fvar< T >, R2, C2 > &b)
 
template<typename T , int R1, int C1>
Eigen::Matrix< fvar< T >, R1, C1 > multiply (const Eigen::Matrix< fvar< T >, R1, C1 > &m, const fvar< T > &c)
 
template<typename T , int R2, int C2>
Eigen::Matrix< fvar< T >, R2, C2 > multiply (const Eigen::Matrix< fvar< T >, R2, C2 > &m, double c)
 
template<typename T , int R1, int C1>
Eigen::Matrix< fvar< T >, R1, C1 > multiply (const Eigen::Matrix< double, R1, C1 > &m, const fvar< T > &c)
 
template<typename T , int R1, int C1>
Eigen::Matrix< fvar< T >, R1, C1 > multiply (const fvar< T > &c, const Eigen::Matrix< fvar< T >, R1, C1 > &m)
 
template<typename T , int R1, int C1>
Eigen::Matrix< fvar< T >, R1, C1 > multiply (double c, const Eigen::Matrix< fvar< T >, R1, C1 > &m)
 
template<typename T , int R1, int C1>
Eigen::Matrix< fvar< T >, R1, C1 > multiply (const fvar< T > &c, const Eigen::Matrix< double, R1, C1 > &m)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > multiply (const Eigen::Matrix< fvar< T >, R1, C1 > &m1, const Eigen::Matrix< fvar< T >, R2, C2 > &m2)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > multiply (const Eigen::Matrix< fvar< T >, R1, C1 > &m1, const Eigen::Matrix< double, R2, C2 > &m2)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, C2 > multiply (const Eigen::Matrix< double, R1, C1 > &m1, const Eigen::Matrix< fvar< T >, R2, C2 > &m2)
 
template<typename T , int C1, int R2>
fvar< T > multiply (const Eigen::Matrix< fvar< T >, 1, C1 > &rv, const Eigen::Matrix< fvar< T >, R2, 1 > &v)
 
template<typename T , int C1, int R2>
fvar< T > multiply (const Eigen::Matrix< fvar< T >, 1, C1 > &rv, const Eigen::Matrix< double, R2, 1 > &v)
 
template<typename T , int C1, int R2>
fvar< T > multiply (const Eigen::Matrix< double, 1, C1 > &rv, const Eigen::Matrix< fvar< T >, R2, 1 > &v)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, R > multiply_lower_tri_self_transpose (const Eigen::Matrix< fvar< T >, R, C > &m)
 
template<typename T >
Eigen::Matrix< fvar< T >, Eigen::Dynamic, Eigen::Dynamic > qr_Q (const Eigen::Matrix< fvar< T >, Eigen::Dynamic, Eigen::Dynamic > &m)
 
template<typename T >
Eigen::Matrix< fvar< T >, Eigen::Dynamic, Eigen::Dynamic > qr_R (const Eigen::Matrix< fvar< T >, Eigen::Dynamic, Eigen::Dynamic > &m)
 
template<int RA, int CA, int RB, int CB, typename T >
Eigen::Matrix< fvar< T >, CB, CB > quad_form_sym (const Eigen::Matrix< fvar< T >, RA, CA > &A, const Eigen::Matrix< double, RB, CB > &B)
 
template<int RA, int CA, int RB, typename T >
fvar< T > quad_form_sym (const Eigen::Matrix< fvar< T >, RA, CA > &A, const Eigen::Matrix< double, RB, 1 > &B)
 
template<int RA, int CA, int RB, int CB, typename T >
Eigen::Matrix< fvar< T >, CB, CB > quad_form_sym (const Eigen::Matrix< double, RA, CA > &A, const Eigen::Matrix< fvar< T >, RB, CB > &B)
 
template<int RA, int CA, int RB, typename T >
fvar< T > quad_form_sym (const Eigen::Matrix< double, RA, CA > &A, const Eigen::Matrix< fvar< T >, RB, 1 > &B)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, 1 > rows_dot_product (const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, 1 > rows_dot_product (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< fvar< T >, R1, 1 > rows_dot_product (const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, 1 > rows_dot_self (const Eigen::Matrix< fvar< T >, R, C > &x)
 
template<typename T >
Eigen::Matrix< fvar< T >, Eigen::Dynamic, 1 > softmax (const Eigen::Matrix< fvar< T >, Eigen::Dynamic, 1 > &alpha)
 
template<typename T , int R, int C>
fvar< T > squared_distance (const Eigen::Matrix< fvar< T >, R, C > &v1, const Eigen::Matrix< double, R, C > &v2)
 Returns the squared distance between the specified vectors of the same dimensions. More...
 
template<typename T , int R1, int C1, int R2, int C2>
fvar< T > squared_distance (const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2)
 Returns the squared distance between the specified vectors of the same dimensions. More...
 
template<typename T , int R, int C>
fvar< T > squared_distance (const Eigen::Matrix< double, R, C > &v1, const Eigen::Matrix< fvar< T >, R, C > &v2)
 Returns the squared distance between the specified vectors of the same dimensions. More...
 
template<typename T , int R1, int C1, int R2, int C2>
fvar< T > squared_distance (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
 Returns the squared distance between the specified vectors of the same dimensions. More...
 
template<typename T , int R, int C>
fvar< T > squared_distance (const Eigen::Matrix< fvar< T >, R, C > &v1, const Eigen::Matrix< fvar< T >, R, C > &v2)
 Returns the squared distance between the specified vectors of the same dimensions. More...
 
template<typename T , int R1, int C1, int R2, int C2>
fvar< T > squared_distance (const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
 Returns the squared distance between the specified vectors of the same dimensions. More...
 
template<typename T , int R, int C>
fvar< T > sum (const Eigen::Matrix< fvar< T >, R, C > &m)
 Return the sum of the entries of the specified matrix. More...
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, R > tcrossprod (const Eigen::Matrix< fvar< T >, R, C > &m)
 
template<int R, int C, typename T >
Eigen::Matrix< T, R, C > to_fvar (const Eigen::Matrix< T, R, C > &m)
 
template<int R, int C>
Eigen::Matrix< fvar< double >, R, C > to_fvar (const Eigen::Matrix< double, R, C > &m)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, C > to_fvar (const Eigen::Matrix< T, R, C > &val, const Eigen::Matrix< T, R, C > &deriv)
 
template<int RD, int CD, int RA, int CA, int RB, int CB, typename T >
fvar< T > trace_gen_quad_form (const Eigen::Matrix< fvar< T >, RD, CD > &D, const Eigen::Matrix< fvar< T >, RA, CA > &A, const Eigen::Matrix< fvar< T >, RB, CB > &B)
 
template<int RA, int CA, int RB, int CB, typename T >
fvar< T > trace_quad_form (const Eigen::Matrix< fvar< T >, RA, CA > &A, const Eigen::Matrix< fvar< T >, RB, CB > &B)
 
template<int RA, int CA, int RB, int CB, typename T >
fvar< T > trace_quad_form (const Eigen::Matrix< fvar< T >, RA, CA > &A, const Eigen::Matrix< double, RB, CB > &B)
 
template<int RA, int CA, int RB, int CB, typename T >
fvar< T > trace_quad_form (const Eigen::Matrix< double, RA, CA > &A, const Eigen::Matrix< fvar< T >, RB, CB > &B)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, C > unit_vector_constrain (const Eigen::Matrix< fvar< T >, R, C > &y)
 
template<typename T , int R, int C>
Eigen::Matrix< fvar< T >, R, C > unit_vector_constrain (const Eigen::Matrix< fvar< T >, R, C > &y, fvar< T > &lp)
 
template<typename T , typename F >
void gradient (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, T &fx, Eigen::Matrix< T, Eigen::Dynamic, 1 > &grad_fx)
 Calculate the value and the gradient of the specified function at the specified argument. More...
 
template<typename T , typename F >
void hessian (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, T &fx, Eigen::Matrix< T, Eigen::Dynamic, 1 > &grad, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &H)
 Calculate the value, the gradient, and the Hessian, of the specified function at the specified argument in time O(N^3) time and O(N^2) space. More...
 
template<typename T , typename F >
void jacobian (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &fx, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &J)
 
template<typename T >
fvar< T > abs (const fvar< T > &x)
 
template<typename T >
fvar< T > acos (const fvar< T > &x)
 
template<typename T >
fvar< T > acosh (const fvar< T > &x)
 
template<typename T >
fvar< T > asin (const fvar< T > &x)
 
template<typename T >
fvar< T > asinh (const fvar< T > &x)
 
template<typename T >
fvar< T > atan (const fvar< T > &x)
 
template<typename T >
fvar< T > atan2 (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > atan2 (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > atan2 (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > atanh (const fvar< T > &x)
 Return inverse hyperbolic tangent of specified value. More...
 
template<typename T >
fvar< T > bessel_first_kind (int v, const fvar< T > &z)
 
template<typename T >
fvar< T > bessel_second_kind (int v, const fvar< T > &z)
 
template<typename T >
fvar< T > beta (const fvar< T > &x1, const fvar< T > &x2)
 Return fvar with the beta function applied to the specified arguments and its gradient. More...
 
template<typename T >
fvar< T > beta (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > beta (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > binary_log_loss (int y, const fvar< T > &y_hat)
 
template<typename T >
fvar< T > binomial_coefficient_log (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > binomial_coefficient_log (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > binomial_coefficient_log (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > cbrt (const fvar< T > &x)
 Return cube root of specified argument. More...
 
template<typename T >
fvar< T > ceil (const fvar< T > &x)
 
template<typename T >
fvar< T > cos (const fvar< T > &x)
 
template<typename T >
fvar< T > cosh (const fvar< T > &x)
 
template<typename T >
fvar< T > digamma (const fvar< T > &x)
 Return the derivative of the log gamma function at the specified argument. More...
 
template<typename T >
fvar< T > erf (const fvar< T > &x)
 
template<typename T >
fvar< T > erfc (const fvar< T > &x)
 
template<typename T >
fvar< T > exp (const fvar< T > &x)
 
template<typename T >
fvar< T > exp2 (const fvar< T > &x)
 
template<typename T >
fvar< T > expm1 (const fvar< T > &x)
 
template<typename T >
fvar< T > fabs (const fvar< T > &x)
 
template<typename T >
fvar< T > falling_factorial (const fvar< T > &x, int n)
 Return autodiff variable with the gradient and result of the falling factorial function applied to the inputs. More...
 
template<typename T >
fvar< T > fdim (const fvar< T > &x, const fvar< T > &y)
 Return the positive difference of the specified values (C++11). More...
 
template<typename T >
fvar< T > fdim (const fvar< T > &x, double y)
 Return the positive difference of the specified values (C++11). More...
 
template<typename T >
fvar< T > fdim (double x, const fvar< T > &y)
 Return the positive difference of the specified values (C++11). More...
 
template<typename T >
fvar< T > floor (const fvar< T > &x)
 
template<typename T1 , typename T2 , typename T3 >
fvar< typename stan::return_type< T1, T2, T3 >::type > fma (const fvar< T1 > &x1, const fvar< T2 > &x2, const fvar< T3 > &x3)
 The fused multiply-add operation (C99). More...
 
template<typename T1 , typename T2 , typename T3 >
fvar< typename stan::return_type< T1, T2, T3 >::type > fma (const T1 &x1, const fvar< T2 > &x2, const fvar< T3 > &x3)
 See all-var input signature for details on the function and derivatives. More...
 
template<typename T1 , typename T2 , typename T3 >
fvar< typename stan::return_type< T1, T2, T3 >::type > fma (const fvar< T1 > &x1, const T2 &x2, const fvar< T3 > &x3)
 See all-var input signature for details on the function and derivatives. More...
 
template<typename T1 , typename T2 , typename T3 >
fvar< typename stan::return_type< T1, T2, T3 >::type > fma (const fvar< T1 > &x1, const fvar< T2 > &x2, const T3 &x3)
 See all-var input signature for details on the function and derivatives. More...
 
template<typename T1 , typename T2 , typename T3 >
fvar< typename stan::return_type< T1, T2, T3 >::type > fma (const T1 &x1, const T2 &x2, const fvar< T3 > &x3)
 See all-var input signature for details on the function and derivatives. More...
 
template<typename T1 , typename T2 , typename T3 >
fvar< typename stan::return_type< T1, T2, T3 >::type > fma (const fvar< T1 > &x1, const T2 &x2, const T3 &x3)
 See all-var input signature for details on the function and derivatives. More...
 
template<typename T1 , typename T2 , typename T3 >
fvar< typename stan::return_type< T1, T2, T3 >::type > fma (const T1 &x1, const fvar< T2 > &x2, const T3 &x3)
 See all-var input signature for details on the function and derivatives. More...
 
template<typename T >
fvar< T > fmax (const fvar< T > &x1, const fvar< T > &x2)
 Return the greater of the two specified arguments. More...
 
template<typename T >
fvar< T > fmax (double x1, const fvar< T > &x2)
 Return the greater of the two specified arguments. More...
 
template<typename T >
fvar< T > fmax (const fvar< T > &x1, double x2)
 Return the greater of the two specified arguments. More...
 
template<typename T >
fvar< T > fmin (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > fmin (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > fmin (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > fmod (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > fmod (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > fmod (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > gamma_p (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > gamma_p (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > gamma_p (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > gamma_q (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > gamma_q (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > gamma_q (double x1, const fvar< T > &x2)
 
template<typename T >
void grad_inc_beta (fvar< T > &g1, fvar< T > &g2, fvar< T > a, fvar< T > b, fvar< T > z)
 Gradient of the incomplete beta function beta(a, b, z) with respect to the first two arguments. More...
 
template<typename T >
fvar< T > hypot (const fvar< T > &x1, const fvar< T > &x2)
 Return the length of the hypoteneuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11). More...
 
template<typename T >
fvar< T > hypot (const fvar< T > &x1, double x2)
 Return the length of the hypoteneuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11). More...
 
template<typename T >
fvar< T > hypot (double x1, const fvar< T > &x2)
 Return the length of the hypoteneuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11). More...
 
template<typename T >
fvar< T > inc_beta (const fvar< T > &a, const fvar< T > &b, const fvar< T > &x)
 
template<typename T >
fvar< T > inv (const fvar< T > &x)
 
template<typename T >
fvar< T > inv_cloglog (const fvar< T > &x)
 
template<typename T >
fvar< T > inv_logit (const fvar< T > &x)
 Returns the inverse logit function applied to the argument. More...
 
template<typename T >
fvar< T > inv_Phi (const fvar< T > &p)
 
template<typename T >
fvar< T > inv_sqrt (const fvar< T > &x)
 
template<typename T >
fvar< T > inv_square (const fvar< T > &x)
 
template<typename T >
int is_inf (const fvar< T > &x)
 Returns 1 if the input's value is infinite and 0 otherwise. More...
 
template<typename T >
int is_nan (const fvar< T > &x)
 Returns 1 if the input's value is NaN and 0 otherwise. More...
 
template<typename T >
fvar< T > lbeta (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > lbeta (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > lbeta (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > lgamma (const fvar< T > &x)
 Return the natural logarithm of the gamma function applied to the specified argument. More...
 
template<typename T >
fvar< typename stan::return_type< T, int >::type > lmgamma (int x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > log (const fvar< T > &x)
 
template<typename T >
fvar< T > log10 (const fvar< T > &x)
 
template<typename T >
fvar< T > log1m (const fvar< T > &x)
 
template<typename T >
fvar< T > log1m_exp (const fvar< T > &x)
 Return the natural logarithm of one minus the exponentiation of the specified argument. More...
 
template<typename T >
fvar< T > log1m_inv_logit (const fvar< T > &x)
 Return the natural logarithm of one minus the inverse logit of the specified argument. More...
 
template<typename T >
fvar< T > log1p (const fvar< T > &x)
 
template<typename T >
fvar< T > log1p_exp (const fvar< T > &x)
 
template<typename T >
fvar< T > log2 (const fvar< T > &x)
 Return the base two logarithm of the specified argument. More...
 
template<typename T >
fvar< T > log_diff_exp (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T1 , typename T2 >
fvar< T2 > log_diff_exp (const T1 &x1, const fvar< T2 > &x2)
 
template<typename T1 , typename T2 >
fvar< T1 > log_diff_exp (const fvar< T1 > &x1, const T2 &x2)
 
template<typename T >
fvar< T > log_falling_factorial (const fvar< T > &x, const fvar< T > &n)
 
template<typename T >
fvar< T > log_falling_factorial (double x, const fvar< T > &n)
 
template<typename T >
fvar< T > log_falling_factorial (const fvar< T > &x, double n)
 
template<typename T >
fvar< T > log_inv_logit (const fvar< T > &x)
 
template<typename T >
fvar< T > log_inv_logit_diff (const fvar< T > &x, const fvar< T > &y)
 Returns fvar with the natural logarithm of the difference of the inverse logits of the specified arguments and its gradients. More...
 
template<typename T >
fvar< T > log_inv_logit_diff (const fvar< T > &x, double y)
 
template<typename T >
fvar< T > log_inv_logit_diff (double x, const fvar< T > &y)
 
template<typename T_theta , typename T_lambda1 , typename T_lambda2 , int N>
void log_mix_partial_helper (const T_theta &theta, const T_lambda1 &lambda1, const T_lambda2 &lambda2, typename boost::math::tools::promote_args< T_theta, T_lambda1, T_lambda2 >::type(&partials_array)[N])
 
template<typename T >
fvar< T > log_mix (const fvar< T > &theta, const fvar< T > &lambda1, const fvar< T > &lambda2)
 Return the log mixture density with specified mixing proportion and log densities and its derivative at each. More...
 
template<typename T >
fvar< T > log_mix (const fvar< T > &theta, const fvar< T > &lambda1, double lambda2)
 
template<typename T >
fvar< T > log_mix (const fvar< T > &theta, double lambda1, const fvar< T > &lambda2)
 
template<typename T >
fvar< T > log_mix (double theta, const fvar< T > &lambda1, const fvar< T > &lambda2)
 
template<typename T >
fvar< T > log_mix (const fvar< T > &theta, double lambda1, double lambda2)
 
template<typename T >
fvar< T > log_mix (double theta, const fvar< T > &lambda1, double lambda2)
 
template<typename T >
fvar< T > log_mix (double theta, double lambda1, const fvar< T > &lambda2)
 
template<typename T >
fvar< T > log_rising_factorial (const fvar< T > &x, const fvar< T > &n)
 
template<typename T >
fvar< T > log_rising_factorial (const fvar< T > &x, double n)
 
template<typename T >
fvar< T > log_rising_factorial (double x, const fvar< T > &n)
 
template<typename T >
fvar< T > log_sum_exp (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > log_sum_exp (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > log_sum_exp (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > logit (const fvar< T > &x)
 
template<typename T >
fvar< T > modified_bessel_first_kind (int v, const fvar< T > &z)
 
template<typename T >
fvar< T > modified_bessel_second_kind (int v, const fvar< T > &z)
 
template<typename T >
fvar< T > multiply_log (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > multiply_log (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > multiply_log (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > owens_t (const fvar< T > &x1, const fvar< T > &x2)
 Return Owen's T function applied to the specified arguments. More...
 
template<typename T >
fvar< T > owens_t (double x1, const fvar< T > &x2)
 Return Owen's T function applied to the specified arguments. More...
 
template<typename T >
fvar< T > owens_t (const fvar< T > &x1, double x2)
 Return Owen's T function applied to the specified arguments. More...
 
template<typename T >
fvar< T > Phi (const fvar< T > &x)
 
template<typename T >
fvar< T > Phi_approx (const fvar< T > &x)
 Return an approximation of the unit normal cumulative distribution function (CDF). More...
 
template<typename T >
fvar< T > pow (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > pow (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > pow (const fvar< T > &x1, double x2)
 
template<typename T >
double primitive_value (const fvar< T > &v)
 Return the primitive value of the specified forward-mode autodiff variable. More...
 
template<typename T >
fvar< T > rising_factorial (const fvar< T > &x, int n)
 Return autodiff variable with the gradient and result of the rising factorial function applied to the inputs. More...
 
template<typename T >
fvar< T > round (const fvar< T > &x)
 Return the closest integer to the specified argument, with halfway cases rounded away from zero. More...
 
template<typename T >
fvar< T > sin (const fvar< T > &x)
 
template<typename T >
fvar< T > sinh (const fvar< T > &x)
 
template<typename T >
fvar< T > sqrt (const fvar< T > &x)
 
template<typename T >
fvar< T > square (const fvar< T > &x)
 
template<typename T >
fvar< T > tan (const fvar< T > &x)
 
template<typename T >
fvar< T > tanh (const fvar< T > &x)
 
template<typename T >
fvar< T > tgamma (const fvar< T > &x)
 Return the result of applying the gamma function to the specified argument. More...
 
template<typename T >
fvar< T > to_fvar (const T &x)
 
template<typename T >
fvar< T > to_fvar (const fvar< T > &x)
 
template<typename T >
fvar< T > trigamma (const fvar< T > &u)
 Return the value of the trigamma function at the specified argument (i.e., the second derivative of the log Gamma function at the specified argument). More...
 
template<typename T >
fvar< T > trunc (const fvar< T > &x)
 Return the nearest integral value that is not larger in magnitude than the specified argument. More...
 
template<typename T >
value_of (const fvar< T > &v)
 Return the value of the specified variable. More...
 
template<typename T >
double value_of_rec (const fvar< T > &v)
 Return the value of the specified variable. More...
 
template<typename T >
bool is_aligned (T *ptr, unsigned int bytes_aligned)
 Return true if the specified pointer is aligned on the number of bytes. More...
 
template<typename T , typename F >
void derivative (const F &f, const T &x, T &fx, T &dfx_dx)
 Return the derivative of the specified univariate function at the specified argument. More...
 
template<typename F >
void finite_diff_grad_hessian (const F &f, const Eigen::VectorXd &x, double &fx, Eigen::MatrixXd &hess, std::vector< Eigen::MatrixXd > &grad_hess_fx, double epsilon=1e-04)
 Calculate the value and the gradient of the hessian of the specified function at the specified argument using second-order autodiff and first-order finite difference. More...
 
template<typename F >
void finite_diff_grad_hessian_auto (const F &f, const Eigen::VectorXd &x, double &fx, Eigen::MatrixXd &hess, std::vector< Eigen::MatrixXd > &grad_hess_fx)
 Calculate the value, Hessian, and the gradient of the Hessian of the specified function at the specified argument using second-order autodiff and first-order finite difference. More...
 
template<typename F >
void grad_hessian (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, double &fx, Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &H, std::vector< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > > &grad_H)
 Calculate the value, the Hessian, and the gradient of the Hessian of the specified function at the specified argument. More...
 
template<typename F >
void grad_tr_mat_times_hessian (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &M, Eigen::Matrix< double, Eigen::Dynamic, 1 > &grad_tr_MH)
 
template<typename T1 , typename T2 , typename F >
void gradient_dot_vector (const F &f, const Eigen::Matrix< T1, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< T2, Eigen::Dynamic, 1 > &v, T1 &fx, T1 &grad_fx_dot_v)
 
template<typename F >
void hessian (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, double &fx, Eigen::Matrix< double, Eigen::Dynamic, 1 > &grad, Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &H)
 Calculate the value, the gradient, and the Hessian, of the specified function at the specified argument in O(N^2) time and O(N^2) space. More...
 
template<typename F >
void hessian_times_vector (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &v, double &fx, Eigen::Matrix< double, Eigen::Dynamic, 1 > &Hv)
 
template<typename T , typename F >
void hessian_times_vector (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, T &fx, Eigen::Matrix< T, Eigen::Dynamic, 1 > &Hv)
 
template<typename T , typename F >
void partial_derivative (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, int n, T &fx, T &dfx_dxn)
 Return the partial derivative of the specified multiivariate function at the specified argument. More...
 
matrix_cl add (const matrix_cl &A, const matrix_cl &B)
 Matrix addition on the OpenCL device. More...
 
auto operator+ (const matrix_cl &A, const matrix_cl &B)
 Matrix addition on the OpenCL device. More...
 
void cholesky_decompose (matrix_cl &A)
 Performs an in-place of the the lower-triangular Cholesky factor (i.e., matrix square root) of the specified square, symmetric matrix. More...
 
template<int R, int C>
matrix_cl to_matrix_cl (const Eigen::Matrix< double, R, C > &src)
 Copies the source Eigen matrix to the destination matrix that is stored on the OpenCL device. More...
 
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > from_matrix_cl (const matrix_cl &src)
 Copies the source matrix that is stored on the OpenCL device to the destination Eigen matrix. More...
 
template<TriangularViewCL triangular_view>
std::vector< double > packed_copy (const matrix_cl &src)
 Packs the flat triagnular matrix on the OpenCL device and copies it to the std::vector. More...
 
template<TriangularViewCL triangular_view>
matrix_cl packed_copy (const std::vector< double > &src, int rows)
 Copies the packed triangular matrix from the source std::vector to an OpenCL buffer and unpacks it to a flat matrix on the OpenCL device. More...
 
matrix_cl copy_cl (const matrix_cl &src)
 Copies the source matrix to the destination matrix. More...
 
template<typename T , std::enable_if_t< std::is_arithmetic< T >::value, int > = 0>
matrix_cl to_matrix_cl (const T &src)
 Copy an arithmetic type to the device. More...
 
template<TriangularViewCL triangular_view = TriangularViewCL::Entire>
matrix_cl copy_triangular (const matrix_cl &src)
 Copies the lower or upper triangular of the source matrix to the destination matrix. More...
 
matrix_cl diagonal_multiply (const matrix_cl &A, const double scalar)
 Multiplies the diagonal of a matrix on the OpenCL device with the specified scalar. More...
 
void check_diagonal_zeros (const char *function, const char *name, const matrix_cl &y)
 Check if the matrix_cl has zeros on the diagonal. More...
 
void check_matching_dims (const char *function, const char *name1, const matrix_cl &y1, const char *name2, const matrix_cl &y2)
 Check if two matrix_cls have the same dimensions. More...
 
void check_nan (const char *function, const char *name, const matrix_cl &y)
 Check if the matrix_cl has NaN values. More...
 
void check_opencl_error (const char *function, const cl::Error &e)
 Throws the domain error with specifying the OpenCL error that occured. More...
 
void check_square (const char *function, const char *name, const matrix_cl &y)
 Check if the matrix_cl is square. More...
 
void check_symmetric (const char *function, const char *name, const matrix_cl &y)
 Check if the matrix_cl is symmetric. More...
 
matrix_cl identity (int rows_cols)
 Returns the identity matrix stored on the OpenCL device. More...
 
matrix_cl multiply (const matrix_cl &A, const double scalar)
 Multiplies the specified matrix on the OpenCL device with the specified scalar. More...
 
auto multiply (const double scalar, const matrix_cl &A)
 Multiplies the specified matrix on the OpenCL device with the specified scalar. More...
 
auto multiply (const matrix_cl &A, const matrix_cl &B)
 Computes the product of the specified matrices. More...
 
matrix_cl operator* (const matrix_cl &A, const matrix_cl &B)
 Templated product operator for OpenCL matrices. More...
 
matrix_cl operator* (const matrix_cl &B, const double scalar)
 
matrix_cl operator* (const double scalar, const matrix_cl &B)
 
matrix_cl multiply_transpose (const matrix_cl &A)
 Computes the product of a square OpenCL matrix with its transpose. More...
 
auto subtract (const matrix_cl &A, const matrix_cl &B)
 Matrix subtraction on the OpenCL device Subtracts the second matrix from the first matrix and stores the result in the third matrix (C=A-B) More...
 
auto operator- (const matrix_cl &A, const matrix_cl &B)
 Matrix subtraction on the OpenCL device Subtracts the second matrix from the first matrix and stores the result in the third matrix (C=A-B) More...
 
matrix_cl transpose (const matrix_cl &src)
 Takes the transpose of the matrix on the OpenCL device. More...
 
template<TriangularViewCL triangular_view>
matrix_cl tri_inverse (const matrix_cl &A)
 Computes the inverse of a triangular matrix. More...
 
template<typename T_y1 , typename T_y2 >
void check_matching_sizes (const char *function, const char *name1, const T_y1 &y1, const char *name2, const T_y2 &y2)
 Check if two structures at the same size. More...
 
template<typename T_y >
void check_nonzero_size (const char *function, const char *name, const T_y &y)
 Check if the specified matrix/vector is of non-zero size. More...
 
template<typename T_y >
void check_ordered (const char *function, const char *name, const std::vector< T_y > &y)
 Check if the specified vector is sorted into strictly increasing order. More...
 
template<typename T_y1 , typename T_y2 >
bool is_matching_size (const T_y1 &y1, const T_y2 &y2)
 Return true if two structures are the same size. More...
 
template<typename T_y >
bool is_nonzero_size (const T_y &y)
 Returns true if the specified matrix/vector is size nonzero. More...
 
template<typename T_y >
bool is_ordered (const std::vector< T_y > &y)
 Return true if the vector is sorted into strictly increasing order. More...
 
double dot (const std::vector< double > &x, const std::vector< double > &y)
 
double dot_self (const std::vector< double > &x)
 
template<typename T , typename S >
void fill (std::vector< T > &x, const S &y)
 Fill the specified container with the specified value. More...
 
template<typename Vector >
void inverse_softmax (const Vector &simplex, Vector &y)
 Writes the inverse softmax of the simplex argument into the second argument. More...
 
double log_sum_exp (const std::vector< double > &x)
 Return the log of the sum of the exponentiated values of the specified sequence of values. More...
 
template<typename T >
std::vector< T > rep_array (const T &x, int n)
 
template<typename T >
std::vector< std::vector< T > > rep_array (const T &x, int m, int n)
 
template<typename T >
std::vector< std::vector< std::vector< T > > > rep_array (const T &x, int k, int m, int n)
 
void scaled_add (std::vector< double > &x, const std::vector< double > &y, double lambda)
 
template<typename T >
std::vector< T > sort_asc (std::vector< T > xs)
 Return the specified standard vector in ascending order. More...
 
template<typename T >
std::vector< T > sort_desc (std::vector< T > xs)
 Return the specified standard vector in descending order. More...
 
void sub (std::vector< double > &x, std::vector< double > &y, std::vector< double > &result)
 
template<typename T >
sum (const std::vector< T > &xs)
 Return the sum of the values in the specified standard vector. More...
 
template<typename T >
std::vector< typename child_type< T >::type > value_of (const std::vector< T > &x)
 Convert a std::vector of type T to a std::vector of child_type<T>::type. More...
 
const std::vector< double > & value_of (const std::vector< double > &x)
 Return the specified argument. More...
 
const std::vector< int > & value_of (const std::vector< int > &x)
 Return the specified argument. More...
 
template<typename T >
std::vector< double > value_of_rec (const std::vector< T > &x)
 Convert a std::vector of type T to a std::vector of doubles. More...
 
const std::vector< double > & value_of_rec (const std::vector< double > &x)
 Return the specified argument. More...
 
template<typename T >
const std::vector< T > & vec_concat (const std::vector< T > &v1)
 Ends the recursion to extract the event stack. More...
 
template<typename T , typename... Args>
const std::vector< T > vec_concat (const std::vector< T > &v1, const Args... args)
 Gets the event stack from a vector of events and other arguments. More...
 
template<typename F >
double integrate (const F &f, double a, double b, double relative_tolerance)
 Integrate a single variable function f from a to b to within a specified relative tolerance. More...
 
template<typename F >
double integrate_1d (const F &f, const double a, const double b, const std::vector< double > &theta, const std::vector< double > &x_r, const std::vector< int > &x_i, std::ostream &msgs, const double relative_tolerance=std::sqrt(std::numeric_limits< double >::epsilon()))
 Compute the integral of the single variable function f from a to b to within a specified relative tolerance. More...
 
template<typename F , typename T1 , typename T2 , typename T_t0 , typename T_ts >
std::vector< std::vector< typename stan::return_type< T1, T2, T_t0, T_ts >::type > > integrate_ode_rk45 (const F &f, const std::vector< T1 > &y0, const T_t0 &t0, const std::vector< T_ts > &ts, const std::vector< T2 > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs=nullptr, double relative_tolerance=1e-6, double absolute_tolerance=1e-6, int max_num_steps=1E6)
 Return the solutions for the specified system of ordinary differential equations given the specified initial state, initial times, times of desired solution, and parameters and data, writing error and warning messages to the specified stream. More...
 
template<typename T >
double as_scalar (const std::vector< T > &a)
 Converts input to a scalar. More...
 
template<typename T_y >
void check_cholesky_factor (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Check if the specified matrix is a valid Cholesky factor. More...
 
template<typename T_y >
void check_cholesky_factor_corr (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Check if the specified matrix is a valid Cholesky factor of a correlation matrix. More...
 
template<typename T_y , int R, int C>
void check_column_index (const char *function, const char *name, const Eigen::Matrix< T_y, R, C > &y, size_t i)
 Check if the specified index is a valid column of the matrix. More...
 
template<typename T >
void check_consistent_size_mvt (const char *function, const char *name, const T &x, size_t expected_size)
 Check if the dimension of x is consistent, which is defined to be expected_size if x is a vector of vectors or 1 if x is a single vector. More...
 
template<typename T1 , typename T2 >
void check_consistent_sizes_mvt (const char *function, const char *name1, const T1 &x1, const char *name2, const T2 &x2)
 Check if the dimension of x1 is consistent with x2. More...
 
template<typename T_y >
void check_corr_matrix (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Check if the specified matrix is a valid correlation matrix. More...
 
template<typename T_y >
void check_cov_matrix (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Check if the specified matrix is a valid covariance matrix. More...
 
template<typename T , int R, int C>
void check_ldlt_factor (const char *function, const char *name, LDLT_factor< T, R, C > &A)
 Raise domain error if the specified LDLT factor is invalid. More...
 
template<typename T_y >
void check_lower_triangular (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Check if the specified matrix is lower triangular. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
void check_matching_dims (const char *function, const char *name1, const Eigen::Matrix< T1, R1, C1 > &y1, const char *name2, const Eigen::Matrix< T2, R2, C2 > &y2)
 Check if the two matrices are of the same size. More...
 
template<bool check_compile, typename T1 , typename T2 , int R1, int C1, int R2, int C2>
void check_matching_dims (const char *function, const char *name1, const Eigen::Matrix< T1, R1, C1 > &y1, const char *name2, const Eigen::Matrix< T2, R2, C2 > &y2)
 Check if the two matrices are of the same size. More...
 
template<typename T1 , typename T2 >
void check_multiplicable (const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
 Check if the matrices can be multiplied. More...
 
template<typename T_y >
void check_ordered (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &y)
 Check if the specified vector is sorted into strictly increasing order. More...
 
template<typename T_y >
void check_pos_definite (const char *function, const char *name, const Eigen::Matrix< T_y, -1, -1 > &y)
 Check if the specified square, symmetric matrix is positive definite. More...
 
template<typename Derived >
void check_pos_definite (const char *function, const char *name, const Eigen::LDLT< Derived > &cholesky)
 Check if the specified LDLT transform of a matrix is positive definite. More...
 
template<typename Derived >
void check_pos_definite (const char *function, const char *name, const Eigen::LLT< Derived > &cholesky)
 Check if the specified LLT decomposition transform resulted in Eigen::Success More...
 
template<typename T_y >
void check_pos_semidefinite (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Check if the specified matrix is positive definite. More...
 
template<typename Derived >
void check_pos_semidefinite (const char *function, const char *name, const Eigen::LDLT< Derived > &cholesky)
 Check if the specified matrix is positive semidefinite. More...
 
template<typename T_y >
void check_positive_ordered (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &y)
 Check if the specified vector contains non-negative values and is sorted into strictly increasing order. More...
 
void check_range (const char *function, const char *name, int max, int index, int nested_level, const char *error_msg)
 Check if specified index is within range. More...
 
void check_range (const char *function, const char *name, int max, int index, const char *error_msg)
 Check if specified index is within range. More...
 
void check_range (const char *function, const char *name, int max, int index)
 Check if specified index is within range. More...
 
template<typename T_y , int R, int C>
void check_row_index (const char *function, const char *name, const Eigen::Matrix< T_y, R, C > &y, size_t i)
 Check if the specified index is a valid row of the matrix This check is 1-indexed by default. More...
 
template<typename T_prob >
void check_simplex (const char *function, const char *name, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 Check if the specified vector is simplex. More...
 
template<typename T_y >
void check_spsd_matrix (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Check if the specified matrix is a square, symmetric, and positive semi-definite. More...
 
template<typename T_y >
void check_square (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Check if the specified matrix is square. More...
 
template<typename T >
void check_std_vector_index (const char *function, const char *name, const std::vector< T > &y, int i)
 Check if the specified index is valid in std vector This check is 1-indexed by default. More...
 
template<typename T_y >
void check_symmetric (const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Check if the specified matrix is symmetric. More...
 
template<typename T_prob >
void check_unit_vector (const char *function, const char *name, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 Check if the specified vector is unit vector. More...
 
template<typename T , int R, int C>
void check_vector (const char *function, const char *name, const Eigen::Matrix< T, R, C > &x)
 Check if the matrix is either a row vector or column vector. More...
 
template<typename T_y >
bool is_cholesky_factor (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Return true if y is a valid Choleksy factor, if number of rows is not less than the number of columns, if there are no 0 columns, and no element in matrix is NaN. More...
 
template<typename T_y >
bool is_cholesky_factor_corr (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Return true if y is a valid Cholesky factor, if the number of rows is not less than the number of columns, if there are no zero columns, and no element in matrix is NaN. More...
 
template<typename T_y , int R, int C>
bool is_column_index (const Eigen::Matrix< T_y, R, C > &y, size_t i)
 Return true no index is invalid column. More...
 
template<typename T_y >
bool is_corr_matrix (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Return true if the matrix is square and not 0x0, if the matrix is symmetric, diagonals are near 1, positive definite, and no elements are NaN A valid correlation matrix is symmetric, has a unit diagonal (all 1 values), and has all values between -1 and 1 (inclusive). More...
 
template<typename T , int R, int C>
bool is_ldlt_factor (LDLT_factor< T, R, C > &A)
 Return true if the specified LDLT factor is invalid. More...
 
template<typename T_y >
bool is_lower_triangular (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Return true is matrix is lower triangular. More...
 
template<typename T , int R, int C>
bool is_mat_finite (const Eigen::Matrix< T, R, C > &y)
 Return true is the specified matrix is finite. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
bool is_matching_dims (const Eigen::Matrix< T1, R1, C1 > &y1, const Eigen::Matrix< T2, R2, C2 > &y2)
 Return true if the two matrices are of the same size. More...
 
template<bool check_compile, typename T1 , typename T2 , int R1, int C1, int R2, int C2>
bool is_matching_dims (const Eigen::Matrix< T1, R1, C1 > &y1, const Eigen::Matrix< T2, R2, C2 > &y2)
 Return true if the two matrices are of the same size. More...
 
template<typename T_y >
bool is_pos_definite (const Eigen::Matrix< T_y, -1, -1 > &y)
 Return true if the matrix is square or if the matrix has non-zero size, or if the matrix is symmetric, or if it is positive definite, or if no element is NaN. More...
 
template<typename Derived >
bool is_pos_definite (const Eigen::LDLT< Derived > &cholesky)
 Return true if the matrix is positive definite. More...
 
template<typename Derived >
bool is_pos_definite (const Eigen::LLT< Derived > &cholesky)
 Return true if diagonal of the L matrix is positive. More...
 
template<typename T_y >
bool is_square (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Return true if the matrix is square. More...
 
template<typename T_y >
bool is_symmetric (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
 Return true if the matrix is square, and no element not on the main diagonal is NaN. More...
 
template<typename T_prob >
bool is_unit_vector (const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 Return true if the vector is not a unit vector or if any element is NaN. More...
 
void validate_non_negative_index (const char *var_name, const char *expr, int val)
 
template<typename T >
apply_scalar_unary< acos_fun, T >::return_t acos (const T &x)
 Vectorized version of acos(). More...
 
template<typename T >
apply_scalar_unary< acosh_fun, T >::return_t acosh (const T &x)
 Return the elementwise application of acosh() to specified argument container. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R, C > add (const Eigen::Matrix< T1, R, C > &m1, const Eigen::Matrix< T2, R, C > &m2)
 Return the sum of the specified matrices. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R, C > add (const Eigen::Matrix< T1, R, C > &m, const T2 &c)
 Return the sum of the specified matrix and specified scalar. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R, C > add (const T1 &c, const Eigen::Matrix< T2, R, C > &m)
 Return the sum of the specified scalar and specified matrix. More...
 
template<typename T_m , typename T_a >
Eigen::Matrix< typename return_type< T_m, T_a >::type, Eigen::Dynamic, Eigen::Dynamic > add_diag (const Eigen::Matrix< T_m, Eigen::Dynamic, Eigen::Dynamic > &mat, const T_a &to_add)
 Returns a Matrix with values added along the main diagonal. More...
 
template<typename T_m , typename T_a , int R, int C>
Eigen::Matrix< typename return_type< T_m, T_a >::type, Eigen::Dynamic, Eigen::Dynamic > add_diag (const Eigen::Matrix< T_m, Eigen::Dynamic, Eigen::Dynamic > &mat, const Eigen::Matrix< T_a, R, C > &to_add)
 Returns a Matrix with values added along the main diagonal. More...
 
template<typename T1 , typename T2 >
append_return_type< std::vector< T1 >, std::vector< T2 > >::type append_array (const std::vector< T1 > &x, const std::vector< T2 > &y)
 Return the concatenation of two specified vectors in the order of the arguments. More...
 
template<typename T1 >
std::vector< T1 > append_array (const std::vector< T1 > &x, const std::vector< T1 > &y)
 Return the concatenation of two specified vectors in the order of the arguments. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename return_type< T1, T2 >::type, Eigen::Dynamic, Eigen::Dynamic > append_col (const Eigen::Matrix< T1, R1, C1 > &A, const Eigen::Matrix< T2, R2, C2 > &B)
 Return the result of appending the second argument matrix after the first argument matrix, that is, putting them side by side, with the first matrix followed by the second matrix. More...
 
template<typename T1 , typename T2 , int C1, int C2>
Eigen::Matrix< typename return_type< T1, T2 >::type, 1, Eigen::Dynamic > append_col (const Eigen::Matrix< T1, 1, C1 > &A, const Eigen::Matrix< T2, 1, C2 > &B)
 Return the result of concatenaing the first row vector followed by the second row vector side by side, with the result being a row vector. More...
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > append_col (const Eigen::Matrix< T, R1, C1 > &A, const Eigen::Matrix< T, R2, C2 > &B)
 Return the result of appending the second argument matrix after the first argument matrix, that is, putting them side by side, with the first matrix followed by the second matrix. More...
 
template<typename T , int C1, int C2>
Eigen::Matrix< T, 1, Eigen::Dynamic > append_col (const Eigen::Matrix< T, 1, C1 > &A, const Eigen::Matrix< T, 1, C2 > &B)
 Return the result of concatenaing the first row vector followed by the second row vector side by side, with the result being a row vector. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename return_type< T1, T2 >::type, 1, Eigen::Dynamic > append_col (const T1 &A, const Eigen::Matrix< T2, R, C > &B)
 Return the result of stacking an scalar on top of the a row vector, with the result being a row vector. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename return_type< T1, T2 >::type, 1, Eigen::Dynamic > append_col (const Eigen::Matrix< T1, R, C > &A, const T2 &B)
 Return the result of stacking a row vector on top of the an scalar, with the result being a row vector. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename return_type< T1, T2 >::type, Eigen::Dynamic, Eigen::Dynamic > append_row (const Eigen::Matrix< T1, R1, C1 > &A, const Eigen::Matrix< T2, R2, C2 > &B)
 Return the result of stacking the rows of the first argument matrix on top of the second argument matrix. More...
 
template<typename T1 , typename T2 , int R1, int R2>
Eigen::Matrix< typename return_type< T1, T2 >::type, Eigen::Dynamic, 1 > append_row (const Eigen::Matrix< T1, R1, 1 > &A, const Eigen::Matrix< T2, R2, 1 > &B)
 Return the result of stacking the first vector on top of the second vector, with the result being a vector. More...
 
template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > append_row (const Eigen::Matrix< T, R1, C1 > &A, const Eigen::Matrix< T, R2, C2 > &B)
 Return the result of stacking the rows of the first argument matrix on top of the second argument matrix. More...
 
template<typename T , int R1, int R2>
Eigen::Matrix< T, Eigen::Dynamic, 1 > append_row (const Eigen::Matrix< T, R1, 1 > &A, const Eigen::Matrix< T, R2, 1 > &B)
 Return the result of stacking the first vector on top of the second vector, with the result being a vector. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename return_type< T1, T2 >::type, Eigen::Dynamic, 1 > append_row (const T1 &A, const Eigen::Matrix< T2, R, C > &B)
 Return the result of stacking an scalar on top of the a vector, with the result being a vector. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename return_type< T1, T2 >::type, Eigen::Dynamic, 1 > append_row (const Eigen::Matrix< T1, R, C > &A, const T2 &B)
 Return the result of stacking a vector on top of the an scalar, with the result being a vector. More...
 
template<typename T >
apply_scalar_unary< asin_fun, T >::return_t asin (const T &x)
 Vectorized version of asin(). More...
 
template<typename T >
apply_scalar_unary< asinh_fun, T >::return_t asinh (const T &x)
 Vectorized version of asinh(). More...
 
template<int N>
void print_mat_size (std::ostream &o)
 Helper function to return the matrix size as either "dynamic" or "1". More...
 
template<typename T_lhs , typename T_rhs >
void assign (T_lhs &x, const T_rhs &y)
 Copy the right-hand side's value to the left-hand side variable. More...
 
template<typename T_lhs , typename T_rhs , int R1, int C1, int R2, int C2>
void assign (Eigen::Matrix< T_lhs, R1, C1 > &x, const Eigen::Matrix< T_rhs, R2, C2 > &y)
 Copy the right-hand side's value to the left-hand side variable. More...
 
template<typename T_lhs , typename T_rhs , int R, int C>
void assign (Eigen::Matrix< T_lhs, R, C > &x, const Eigen::Matrix< T_rhs, R, C > &y)
 Copy the right-hand side's value to the left-hand side variable. More...
 
template<typename T_lhs , typename T , int R, int C>
void assign (Eigen::Block< T_lhs > x, const Eigen::Matrix< T, R, C > &y)
 Copy the right-hand side's value to the left-hand side variable. More...
 
template<typename T_lhs , typename T_rhs >
void assign (std::vector< T_lhs > &x, const std::vector< T_rhs > &y)
 Copy the right-hand side's value to the left-hand side variable. More...
 
template<typename T >
apply_scalar_unary< atan_fun, T >::return_t atan (const T &x)
 Vectorized version of asinh(). More...
 
template<typename T >
apply_scalar_unary< atanh_fun, T >::return_t atanh (const T &x)
 Return the elementwise application of atanh() to specified argument container. More...
 
template<typename T >
void autocorrelation (const std::vector< T > &y, std::vector< T > &ac, Eigen::FFT< T > &fft)
 Write autocorrelation estimates for every lag for the specified input sequence into the specified result using the specified FFT engine. More...
 
template<typename T , typename DerivedA , typename DerivedB >
void autocorrelation (const Eigen::MatrixBase< DerivedA > &y, Eigen::MatrixBase< DerivedB > &ac, Eigen::FFT< T > &fft)
 Write autocorrelation estimates for every lag for the specified input sequence into the specified result using the specified FFT engine. More...
 
template<typename T >
void autocorrelation (const std::vector< T > &y, std::vector< T > &ac)
 Write autocorrelation estimates for every lag for the specified input sequence into the specified result. More...
 
template<typename T , typename DerivedA , typename DerivedB >
void autocorrelation (const Eigen::MatrixBase< DerivedA > &y, Eigen::MatrixBase< DerivedB > &ac)
 Write autocorrelation estimates for every lag for the specified input sequence into the specified result. More...
 
template<typename T >
void autocovariance (const std::vector< T > &y, std::vector< T > &acov, Eigen::FFT< T > &fft)
 Write autocovariance estimates for every lag for the specified input sequence into the specified result using the specified FFT engine. More...
 
template<typename T , typename DerivedA , typename DerivedB >
void autocovariance (const Eigen::MatrixBase< DerivedA > &y, Eigen::MatrixBase< DerivedB > &acov, Eigen::FFT< T > &fft)
 Write autocovariance estimates for every lag for the specified input sequence into the specified result using the specified FFT engine. More...
 
template<typename T >
void autocovariance (const std::vector< T > &y, std::vector< T > &acov)
 Write autocovariance estimates for every lag for the specified input sequence into the specified result. More...
 
template<typename T , typename DerivedA , typename DerivedB >
void autocovariance (const Eigen::MatrixBase< DerivedA > &y, Eigen::MatrixBase< DerivedB > &acov)
 Write autocovariance estimates for every lag for the specified input sequence into the specified result. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > block (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m, size_t i, size_t j, size_t nrows, size_t ncols)
 Return a nrows x ncols submatrix starting at (i-1, j-1). More...
 
template<typename T >
apply_scalar_unary< cbrt_fun, T >::return_t cbrt (const T &x)
 Vectorized version of cbrt(). More...
 
template<typename T >
apply_scalar_unary< ceil_fun, T >::return_t ceil (const T &x)
 Vectorized version of ceil(). More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > chol2inv (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &L)
 Returns the inverse of the matrix whose Cholesky factor is L. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > cholesky_corr_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &y, int K)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > cholesky_corr_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &y, int K, T &lp)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > cholesky_corr_free (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &x)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > cholesky_decompose (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Return the lower-triangular Cholesky factor (i.e., matrix square root) of the specified square, symmetric matrix. More...
 
template<>
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > cholesky_decompose (const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &m)
 Return the lower-triangular Cholesky factor (i.e., matrix square root) of the specified square, symmetric matrix. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > cholesky_factor_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, int M, int N)
 Return the Cholesky factor of the specified size read from the specified vector. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > cholesky_factor_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, int M, int N, T &lp)
 Return the Cholesky factor of the specified size read from the specified vector and increment the specified log probability reference with the log Jacobian adjustment of the transform. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > cholesky_factor_free (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &y)
 Return the unconstrained vector of parameters correspdonding to the specified Cholesky factor. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > col (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m, size_t j)
 Return the specified column of the specified matrix using start-at-1 indexing. More...
 
template<typename T , int R, int C>
int cols (const Eigen::Matrix< T, R, C > &m)
 Return the number of columns in the specified matrix, vector, or row vector. More...
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< double, 1, C1 > columns_dot_product (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2)
 Returns the dot product of the specified vectors. More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, 1, C > columns_dot_self (const Eigen::Matrix< T, R, C > &x)
 Returns the dot product of each column of a matrix with itself. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > corr_matrix_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, typename math::index_type< Eigen::Matrix< T, Eigen::Dynamic, 1 > >::type k)
 Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > corr_matrix_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, typename math::index_type< Eigen::Matrix< T, Eigen::Dynamic, 1 > >::type k, T &lp)
 Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > corr_matrix_free (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &y)
 Return the vector of unconstrained partial correlations that define the specified correlation matrix when transformed. More...
 
template<typename T >
apply_scalar_unary< cos_fun, T >::return_t cos (const T &x)
 Vectorized version of cos(). More...
 
template<typename T >
apply_scalar_unary< cosh_fun, T >::return_t cosh (const T &x)
 Vectorized version of cosh(). More...
 
template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x, T_sigma, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > cov_exp_quad (const std::vector< T_x > &x, const T_sigma &sigma, const T_l &length_scale)
 
template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x, T_sigma, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > cov_exp_quad (const std::vector< T_x > &x, const T_sigma &sigma, const std::vector< T_l > &length_scale)
 
template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x1, T_x2, T_sigma, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > cov_exp_quad (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_sigma &sigma, const T_l &length_scale)
 
template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x1, T_x2, T_sigma, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > cov_exp_quad (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_sigma &sigma, const std::vector< T_l > &length_scale)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > cov_matrix_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, typename math::index_type< Eigen::Matrix< T, Eigen::Dynamic, 1 > >::type K)
 Return the symmetric, positive-definite matrix of dimensions K by K resulting from transforming the specified finite vector of size K plus (K choose 2). More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > cov_matrix_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, typename math::index_type< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > >::type K, T &lp)
 Return the symmetric, positive-definite matrix of dimensions K by K resulting from transforming the specified finite vector of size K plus (K choose 2). More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > cov_matrix_constrain_lkj (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, size_t k)
 Return the covariance matrix of the specified dimensionality derived from constraining the specified vector of unconstrained values. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > cov_matrix_constrain_lkj (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, size_t k, T &lp)
 Return the covariance matrix of the specified dimensionality derived from constraining the specified vector of unconstrained values and increment the specified log probability reference with the log absolute Jacobian determinant. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > cov_matrix_free (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &y)
 The covariance matrix derived from the symmetric view of the lower-triangular view of the K by K specified matrix is freed to return a vector of size K + (K choose 2). More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > cov_matrix_free_lkj (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &y)
 Return the vector of unconstrained partial correlations and deviations that transform to the specified covariance matrix. More...
 
matrix_d crossprod (const matrix_d &M)
 Returns the result of pre-multiplying a matrix by its own transpose. More...
 
template<typename T >
const std::vector< int > csr_extract_u (const Eigen::SparseMatrix< T, Eigen::RowMajor > &A)
 Extract the NZE index for each entry from a sparse matrix. More...
 
template<typename T , int R, int C>
const std::vector< int > csr_extract_u (const Eigen::Matrix< T, R, C > &A)
 Extract the NZE index for each entry from a sparse matrix. More...
 
template<typename T >
const std::vector< int > csr_extract_v (const Eigen::SparseMatrix< T, Eigen::RowMajor > &A)
 Extract the column indexes for non-zero value from a sparse matrix. More...
 
template<typename T , int R, int C>
const std::vector< int > csr_extract_v (const Eigen::Matrix< T, R, C > &A)
 Extract the column indexes for non-zero values from a dense matrix by converting to sparse and calling the sparse matrix extractor. More...
 
template<typename T >
const Eigen::Matrix< T, Eigen::Dynamic, 1 > csr_extract_w (const Eigen::SparseMatrix< T, Eigen::RowMajor > &A)
 
template<typename T , int R, int C>
const Eigen::Matrix< T, Eigen::Dynamic, 1 > csr_extract_w (const Eigen::Matrix< T, R, C > &A)
 
template<typename T1 , typename T2 >
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, Eigen::Dynamic, 1 > csr_matrix_times_vector (int m, int n, const Eigen::Matrix< T1, Eigen::Dynamic, 1 > &w, const std::vector< int > &v, const std::vector< int > &u, const Eigen::Matrix< T2, Eigen::Dynamic, 1 > &b)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > csr_to_dense_matrix (int m, int n, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &w, const std::vector< int > &v, const std::vector< int > &u)
 Construct a dense Eigen matrix from the CSR format components. More...
 
int csr_u_to_z (const std::vector< int > &u, int i)
 Return the z vector computed from the specified u vector at the index for the z vector. More...
 
template<typename T >
std::vector< T > cumulative_sum (const std::vector< T > &x)
 Return the cumulative sum of the specified vector. More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, R, C > cumulative_sum (const Eigen::Matrix< T, R, C > &m)
 Return the cumulative sum of the specified matrix. More...
 
template<typename T , int R, int C>
determinant (const Eigen::Matrix< T, R, C > &m)
 Returns the determinant of the specified square matrix. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > diag_matrix (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v)
 Return a square diagonal matrix with the specified vector of coefficients as the diagonal values. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C1 > diag_post_multiply (const Eigen::Matrix< T1, R1, C1 > &m1, const Eigen::Matrix< T2, R2, C2 > &m2)
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R2, C2 > diag_pre_multiply (const Eigen::Matrix< T1, R1, C1 > &m1, const Eigen::Matrix< T2, R2, C2 > &m2)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > diagonal (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Return a column vector of the diagonal elements of the specified matrix. More...
 
template<typename T >
apply_scalar_unary< digamma_fun, T >::return_t digamma (const T &x)
 Vectorized version of digamma(). More...
 
template<typename T >
void dims (const T &x, std::vector< int > &result)
 
template<typename T , int R, int C>
void dims (const Eigen::Matrix< T, R, C > &x, std::vector< int > &result)
 
template<typename T >
void dims (const std::vector< T > &x, std::vector< int > &result)
 
template<typename T >
std::vector< int > dims (const T &x)
 
template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
boost::math::tools::promote_args< T1, T2 >::type distance (const Eigen::Matrix< T1, R1, C1 > &v1, const Eigen::Matrix< T2, R2, C2 > &v2)
 Returns the distance between the specified vectors. More...
 
template<int R, int C, typename T >
std::enable_if< std::is_arithmetic< T >::value, Eigen::Matrix< double, R, C > >::type divide (const Eigen::Matrix< double, R, C > &m, T c)
 Return specified matrix divided by specified scalar. More...
 
template<typename T_x , typename T_v >
std::vector< Eigen::Matrix< typename return_type< T_x, T_v, double >::type, Eigen::Dynamic, 1 > > divide_columns (const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 >> &x, const std::vector< T_v > &vec)
 Takes Stan data type vector[n] x[D] and divides column vector in x element-wise by the values in vec. More...
 
template<int R1, int C1, int R2, int C2>
double dot_product (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2)
 Returns the dot product of the specified vectors. More...
 
double dot_product (const double *v1, const double *v2, size_t length)
 Returns the dot product of the specified arrays of doubles. More...
 
double dot_product (const std::vector< double > &v1, const std::vector< double > &v2)
 Returns the dot product of the specified arrays of doubles. More...
 
template<int R, int C>
double dot_self (const Eigen::Matrix< double, R, C > &v)
 Returns the dot product of the specified vector with itself. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > eigenvalues_sym (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Return the eigenvalues of the specified symmetric matrix in descending order of magnitude. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > eigenvectors_sym (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R, C > elt_divide (const Eigen::Matrix< T1, R, C > &m1, const Eigen::Matrix< T2, R, C > &m2)
 Return the elementwise division of the specified matrices. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R, C > elt_divide (const Eigen::Matrix< T1, R, C > &m, T2 s)
 Return the elementwise division of the specified matrix by the specified scalar. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R, C > elt_divide (T1 s, const Eigen::Matrix< T2, R, C > &m)
 Return the elementwise division of the specified scalar by the specified matrix. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R, C > elt_multiply (const Eigen::Matrix< T1, R, C > &m1, const Eigen::Matrix< T2, R, C > &m2)
 Return the elementwise multiplication of the specified matrices. More...
 
template<typename T >
apply_scalar_unary< erf_fun, T >::return_t erf (const T &x)
 Vectorized version of erf(). More...
 
template<typename T >
apply_scalar_unary< erfc_fun, T >::return_t erfc (const T &x)
 Vectorized version of erfc(). More...
 
template<typename T >
apply_scalar_unary< exp_fun, T >::return_t exp (const T &x)
 Return the elementwise exponentiation of the specified argument, which may be a scalar or any Stan container of numeric scalars. More...
 
template<typename T >
apply_scalar_unary< exp2_fun, T >::return_t exp2 (const T &x)
 Return the elementwise application of exp2() to specified argument container. More...
 
template<typename T >
apply_scalar_unary< expm1_fun, T >::return_t expm1 (const T &x)
 Vectorized version of expm1(). More...
 
template<typename T >
apply_scalar_unary< fabs_fun, T >::return_t fabs (const T &x)
 Vectorized version of fabs(). More...
 
template<typename T >
bool factor_cov_matrix (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &Sigma, Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, Eigen::Array< T, Eigen::Dynamic, 1 > &sds)
 This function is intended to make starting values, given a covariance matrix Sigma. More...
 
template<typename T >
void factor_U (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &U, Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs)
 This function is intended to make starting values, given a unit upper-triangular matrix U such that U'DU is a correlation matrix. More...
 
template<typename T , int R, int C, typename S >
void fill (Eigen::Matrix< T, R, C > &x, const S &y)
 Fill the specified container with the specified value. More...
 
template<typename T >
apply_scalar_unary< floor_fun, T >::return_t floor (const T &x)
 Vectorized version of floor(). More...
 
template<typename T >
const T & get_base1 (const std::vector< T > &x, size_t i, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one index. More...
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< T > > &x, size_t i1, size_t i2, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< T > > > &x, size_t i1, size_t i2, size_t i3, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< std::vector< T > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, size_t i7, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, size_t i7, size_t i8, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
Eigen::Matrix< T, 1, Eigen::Dynamic > get_base1 (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &x, size_t m, const char *error_msg, size_t idx)
 Return a copy of the row of the specified vector at the specified base-one row index. More...
 
template<typename T >
const T & get_base1 (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &x, size_t m, size_t n, const char *error_msg, size_t idx)
 Return a reference to the value of the specified matrix at the specified base-one row and column indexes. More...
 
template<typename T >
const T & get_base1 (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, size_t m, const char *error_msg, size_t idx)
 Return a reference to the value of the specified column vector at the specified base-one index. More...
 
template<typename T >
const T & get_base1 (const Eigen::Matrix< T, 1, Eigen::Dynamic > &x, size_t n, const char *error_msg, size_t idx)
 Return a reference to the value of the specified row vector at the specified base-one index. More...
 
template<typename T >
T & get_base1_lhs (std::vector< T > &x, size_t i, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one index. More...
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< T > > &x, size_t i1, size_t i2, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< T > > > &x, size_t i1, size_t i2, size_t i3, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< std::vector< T > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, size_t i7, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, size_t i7, size_t i8, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes. More...
 
template<typename T >
Eigen::Block< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > > get_base1_lhs (Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &x, size_t m, const char *error_msg, size_t idx)
 Return a copy of the row of the specified vector at the specified base-one row index. More...
 
template<typename T >
T & get_base1_lhs (Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &x, size_t m, size_t n, const char *error_msg, size_t idx)
 Return a reference to the value of the specified matrix at the specified base-one row and column indexes. More...
 
template<typename T >
T & get_base1_lhs (Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, size_t m, const char *error_msg, size_t idx)
 Return a reference to the value of the specified column vector at the specified base-one index. More...
 
template<typename T >
T & get_base1_lhs (Eigen::Matrix< T, 1, Eigen::Dynamic > &x, size_t n, const char *error_msg, size_t idx)
 Return a reference to the value of the specified row vector at the specified base-one index. More...
 
template<typename T_lp , typename T_lp_accum >
boost::math::tools::promote_args< T_lp, T_lp_accum >::type get_lp (const T_lp &lp, const accumulator< T_lp_accum > &lp_accum)
 
template<typename T_x , typename T_sigma >
Eigen::Matrix< typename return_type< T_x, T_sigma >::type, Eigen::Dynamic, Eigen::Dynamic > gp_dot_prod_cov (const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 >> &x, const T_sigma &sigma)
 Returns a dot product covariance matrix. More...
 
template<typename T_x , typename T_sigma >
Eigen::Matrix< typename return_type< T_x, T_sigma >::type, Eigen::Dynamic, Eigen::Dynamic > gp_dot_prod_cov (const std::vector< T_x > &x, const T_sigma &sigma)
 Returns a dot product covariance matrix. More...
 
template<typename T_x1 , typename T_x2 , typename T_sigma >
Eigen::Matrix< typename return_type< T_x1, T_x2, T_sigma >::type, Eigen::Dynamic, Eigen::Dynamic > gp_dot_prod_cov (const std::vector< Eigen::Matrix< T_x1, Eigen::Dynamic, 1 >> &x1, const std::vector< Eigen::Matrix< T_x2, Eigen::Dynamic, 1 >> &x2, const T_sigma &sigma)
 Returns a dot product covariance matrix of differing x's. More...
 
template<typename T_x1 , typename T_x2 , typename T_sigma >
Eigen::Matrix< typename return_type< T_x1, T_x2, T_sigma >::type, Eigen::Dynamic, Eigen::Dynamic > gp_dot_prod_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_sigma &sigma)
 Returns a dot product covariance matrix of differing x's. More...
 
template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x, T_sigma, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_exp_quad_cov (const std::vector< T_x > &x, const T_sigma &sigma, const T_l &length_scale)
 Returns a squared exponential kernel. More...
 
template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x, T_sigma, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_exp_quad_cov (const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 >> &x, const T_sigma &sigma, const std::vector< T_l > &length_scale)
 Returns a squared exponential kernel. More...
 
template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x1, T_x2, T_sigma, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_exp_quad_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_sigma &sigma, const T_l &length_scale)
 Returns a squared exponential kernel. More...
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x1, T_x2, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_exp_quad_cov (const std::vector< Eigen::Matrix< T_x1, Eigen::Dynamic, 1 >> &x1, const std::vector< Eigen::Matrix< T_x2, Eigen::Dynamic, 1 >> &x2, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a squared exponential kernel. More...
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_exponential_cov (const std::vector< T_x > &x, const T_s &sigma, const T_l &length_scale)
 Returns a Matern exponential covariance Matrix. More...
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_exponential_cov (const std::vector< Eigen::Matrix< T_x, -1, 1 >> &x, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern exponential covariance matrix. More...
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x1, T_x2, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_exponential_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_s &sigma, const T_l &length_scale)
 Returns a Matern exponential cross covariance matrix. More...
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< typename return_type< T_x1, T_x2, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_exponential_cov (const std::vector< Eigen::Matrix< T_x1, -1, 1 >> &x1, const std::vector< Eigen::Matrix< T_x2, -1, 1 >> &x2, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern exponential cross covariance matrix. More...
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< typename return_type< T_x, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_matern32_cov (const std::vector< T_x > &x, const T_s &sigma, const T_l &length_scale)
 Returns a Matern 3/2 covariance matrix. More...
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< typename return_type< T_x, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_matern32_cov (const std::vector< Eigen::Matrix< T_x, -1, 1 >> &x, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern 3/2 covariance matrix. More...
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< typename return_type< T_x1, T_x2, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_matern32_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_s &sigma, const T_l &length_scale)
 Returns a Matern 3/2 cross covariance matrix. More...
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< typename return_type< T_x1, T_x2, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_matern32_cov (const std::vector< Eigen::Matrix< T_x1, -1, 1 >> &x1, const std::vector< Eigen::Matrix< T_x2, -1, 1 >> &x2, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern 3/2 cross covariance matrix. More...
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< typename return_type< T_x, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_matern52_cov (const std::vector< T_x > &x, const T_s &sigma, const T_l &length_scale)
 Returns a Matern 5/2 covariance matrix with one input vector. More...
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< typename return_type< T_x, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_matern52_cov (const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 >> &x, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern 5/2 covariance matrix with one input vector with automatic relevance determination (ARD). More...
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< typename return_type< T_x1, T_x2, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_matern52_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_s &sigma, const T_l &length_scale)
 Returns a Matern 5/2 covariance matrix with two different input vectors. More...
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< typename stan::return_type< T_x1, T_x2, T_s, T_l >::type, Eigen::Dynamic, Eigen::Dynamic > gp_matern52_cov (const std::vector< Eigen::Matrix< T_x1, Eigen::Dynamic, 1 >> &x1, const std::vector< Eigen::Matrix< T_x2, Eigen::Dynamic, 1 >> &x2, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern 5/2 covariance matrix with two input vectors with automatic relevance determination (ARD). More...
 
template<typename T_x , typename T_sigma , typename T_l , typename T_p >
Eigen::Matrix< typename stan::return_type< T_x, T_sigma, T_l, T_p >::type, Eigen::Dynamic, Eigen::Dynamic > gp_periodic_cov (const std::vector< T_x > &x, const T_sigma &sigma, const T_l &l, const T_p &p)
 Returns a periodic covariance matrix $ \mathbf{K} $ using the input $ \mathbf{X} $. More...
 
template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l , typename T_p >
Eigen::Matrix< typename stan::return_type< T_x1, T_x2, T_sigma, T_l, T_p >::type, Eigen::Dynamic, Eigen::Dynamic > gp_periodic_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_sigma &sigma, const T_l &l, const T_p &p)
 Returns a periodic covariance matrix $ \mathbf{K} $ using inputs $ \mathbf{X}_1 $ and $ \mathbf{X}_2 $. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > head (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, size_t n)
 Return the specified number of elements as a vector from the front of the specified vector. More...
 
template<typename T >
Eigen::Matrix< T, 1, Eigen::Dynamic > head (const Eigen::Matrix< T, 1, Eigen::Dynamic > &rv, size_t n)
 Return the specified number of elements as a row vector from the front of the specified row vector. More...
 
template<typename T >
std::vector< T > head (const std::vector< T > &sv, size_t n)
 Return the specified number of elements as a standard vector from the front of the specified standard vector. More...
 
template<typename T >
void initialize (T &x, const T &v)
 
template<typename T , typename V >
std::enable_if< std::is_arithmetic< V >::value, void >::type initialize (T &x, V v)
 
template<typename T , int R, int C, typename V >
void initialize (Eigen::Matrix< T, R, C > &x, const V &v)
 
template<typename T , typename V >
void initialize (std::vector< T > &x, const V &v)
 
template<typename T >
apply_scalar_unary< inv_fun, T >::return_t inv (const T &x)
 Vectorized version of inv(). More...
 
template<typename T >
apply_scalar_unary< inv_cloglog_fun, T >::return_t inv_cloglog (const T &x)
 Vectorized version of inv_cloglog(). More...
 
template<typename T >
apply_scalar_unary< inv_logit_fun, T >::return_t inv_logit (const T &x)
 Vectorized version of inv_logit(). More...
 
template<typename T >
apply_scalar_unary< inv_Phi_fun, T >::return_t inv_Phi (const T &x)
 Vectorized version of inv_Phi(). More...
 
template<typename T >
apply_scalar_unary< inv_sqrt_fun, T >::return_t inv_sqrt (const T &x)
 Vectorized version of inv_sqrt(). More...
 
template<typename T >
apply_scalar_unary< inv_square_fun, T >::return_t inv_square (const T &x)
 Vectorized version of inv_square(). More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, R, C > inverse (const Eigen::Matrix< T, R, C > &m)
 Returns the inverse of the specified matrix. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > inverse_spd (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Returns the inverse of the specified symmetric, pos/neg-definite matrix. More...
 
template<typename T >
apply_scalar_unary< lgamma_fun, T >::return_t lgamma (const T &x)
 Vectorized version of lgamma(). More...
 
template<typename T >
apply_scalar_unary< log_fun, T >::return_t log (const T &x)
 Return the elementwise natural log of the specified argument, which may be a scalar or any Stan container of numeric scalars. More...
 
template<typename T >
apply_scalar_unary< log10_fun, T >::return_t log10 (const T &x)
 Vectorized version of log10(). More...
 
template<typename T >
apply_scalar_unary< log1m_fun, T >::return_t log1m (const T &x)
 Vectorized version of log1m(). More...
 
template<typename T >
apply_scalar_unary< log1m_exp_fun, T >::return_t log1m_exp (const T &x)
 Vectorized version of log1m_exp(). More...
 
template<typename T >
apply_scalar_unary< log1m_inv_logit_fun, T >::return_t log1m_inv_logit (const T &x)
 Return the elementwise application of log1m_inv_logit() to specified argument container. More...
 
template<typename T >
apply_scalar_unary< log1p_fun, T >::return_t log1p (const T &x)
 Return the elementwise application of log1p() to specified argument container. More...
 
template<typename T >
apply_scalar_unary< log1p_exp_fun, T >::return_t log1p_exp (const T &x)
 Vectorized version of log1m_exp(). More...
 
template<typename T >
apply_scalar_unary< log2_fun, T >::return_t log2 (const T &x)
 Return the elementwise application of log2() to specified argument container. More...
 
template<typename T , int R, int C>
log_determinant (const Eigen::Matrix< T, R, C > &m)
 Returns the log absolute determinant of the specified square matrix. More...
 
template<int R, int C, typename T >
log_determinant_ldlt (LDLT_factor< T, R, C > &A)
 
template<typename T , int R, int C>
log_determinant_spd (const Eigen::Matrix< T, R, C > &m)
 Returns the log absolute determinant of the specified square matrix. More...
 
template<typename T >
apply_scalar_unary< log_inv_logit_fun, T >::return_t log_inv_logit (const T &x)
 Return the elementwise application of log_inv_logit() to specified argument container. More...
 
template<typename T_theta , typename T_lam >
return_type< T_theta, T_lam >::type log_mix (const T_theta &theta, const T_lam &lambda)
 Return the log mixture density with specified mixing proportions and log densities. More...
 
template<typename T_theta , typename T_lam , int R, int C>
return_type< T_theta, std::vector< Eigen::Matrix< T_lam, R, C > > >::type log_mix (const T_theta &theta, const std::vector< Eigen::Matrix< T_lam, R, C > > &lambda)
 Return the log mixture density given specified mixing proportions and array of log density vectors. More...
 
template<typename T_theta , typename T_lam >
return_type< T_theta, std::vector< std::vector< T_lam > > >::type log_mix (const T_theta &theta, const std::vector< std::vector< T_lam > > &lambda)
 Return the log mixture density given specified mixing proportions and array of log density arrays. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > log_softmax (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v)
 Return the natural logarithm of the softmax of the specified vector. More...
 
template<int R, int C>
double log_sum_exp (const Eigen::Matrix< double, R, C > &x)
 Return the log of the sum of the exponentiated values of the specified matrix of values. More...
 
template<typename T >
apply_scalar_unary< logit_fun, T >::return_t logit (const T &x)
 Return the elementwise application of logit() to specified argument container. More...
 
template<typename T >
Eigen::Array< T, Eigen::Dynamic, 1 > make_nu (const T &eta, size_t K)
 Return the degrees of freedom for the t distribution that corresponds to the shape parameter in the LKJ distribution. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > matrix_exp (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &A)
 Return the matrix exponential of the input matrix. More...
 
template<typename T , int N>
Eigen::Matrix< T, N, N > matrix_exp (const Eigen::Matrix< T, N, N > &A)
 Return the matrix exponential of the input statically-sized matrix. More...
 
template<typename T >
Eigen::Matrix< T, 1, 1 > matrix_exp (const Eigen::Matrix< T, 1, 1 > &A)
 Return the exponential of the input scalar when it's in the form of Eigen matrix. More...
 
template<typename Mtype >
Mtype matrix_exp_2x2 (const Mtype &A)
 Return the matrix exponential of a 2x2 matrix. More...
 
template<int Cb>
Eigen::Matrix< double, -1, Cb > matrix_exp_multiply (const Eigen::MatrixXd &A, const Eigen::Matrix< double, -1, Cb > &B)
 Return product of exp(A) and B, where A is a NxN double matrix, B is a NxCb double matrix, and t is a double. More...
 
template<typename MatrixType >
MatrixType matrix_exp_pade (const MatrixType &arg)
 Computes the matrix exponential, using a Pade approximation, coupled with scaling and squaring. More...
 
int max (const std::vector< int > &x)
 Returns the maximum coefficient in the specified column vector. More...
 
template<typename T >
max (const std::vector< T > &x)
 Returns the maximum coefficient in the specified column vector. More...
 
template<typename T , int R, int C>
max (const Eigen::Matrix< T, R, C > &m)
 Returns the maximum coefficient in the specified vector, row vector, or matrix. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_left (const Eigen::Matrix< T1, R1, C1 > &A, const Eigen::Matrix< T2, R2, C2 > &b)
 Returns the solution of the system Ax=b. More...
 
template<int R1, int C1, int R2, int C2, typename T1 , typename T2 >
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_left_ldlt (const LDLT_factor< T1, R1, C1 > &A, const Eigen::Matrix< T2, R2, C2 > &b)
 Returns the solution of the system Ax=b given an LDLT_factor of A. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_left_spd (const Eigen::Matrix< T1, R1, C1 > &A, const Eigen::Matrix< T2, R2, C2 > &b)
 Returns the solution of the system Ax=b where A is symmetric positive definite. More...
 
template<int TriView, typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_left_tri (const Eigen::Matrix< T1, R1, C1 > &A, const Eigen::Matrix< T2, R2, C2 > &b)
 Returns the solution of the system Ax=b when A is triangular. More...
 
template<int TriView, typename T , int R1, int C1>
Eigen::Matrix< T, R1, C1 > mdivide_left_tri (const Eigen::Matrix< T, R1, C1 > &A)
 Returns the solution of the system Ax=b when A is triangular and b=I. More...
 
template<int TriView, int R1, int C1, int R2, int C2>
Eigen::Matrix< double, R1, C2 > mdivide_left_tri (const Eigen::Matrix< double, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b)
 Returns the solution of the system Ax=b when A is triangular and A and b are matrices of doubles. More...
 
template<int TriView, int R1, int C1>
Eigen::Matrix< double, R1, C1 > mdivide_left_tri (const Eigen::Matrix< double, R1, C1 > &A)
 Returns the solution of the system Ax=b when A is triangular, b=I and both are matrices of doubles. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_left_tri_low (const Eigen::Matrix< T1, R1, C1 > &A, const Eigen::Matrix< T2, R2, C2 > &b)
 Return the result of left dividing the second argument by the first argument. More...
 
template<typename T , int R1, int C1>
Eigen::Matrix< T, R1, C1 > mdivide_left_tri_low (const Eigen::Matrix< T, R1, C1 > &A)
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_right (const Eigen::Matrix< T1, R1, C1 > &b, const Eigen::Matrix< T2, R2, C2 > &A)
 Returns the solution of the system Ax=b. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_right_ldlt (const Eigen::Matrix< T1, R1, C1 > &b, const LDLT_factor< T2, R2, C2 > &A)
 Returns the solution of the system xA=b given an LDLT_factor of A. More...
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< double, R1, C2 > mdivide_right_ldlt (const Eigen::Matrix< double, R1, C1 > &b, const LDLT_factor< double, R2, C2 > &A)
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_right_spd (const Eigen::Matrix< T1, R1, C1 > &b, const Eigen::Matrix< T2, R2, C2 > &A)
 Returns the solution of the system Ax=b where A is symmetric positive definite. More...
 
template<int TriView, typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_right_tri (const Eigen::Matrix< T1, R1, C1 > &b, const Eigen::Matrix< T2, R2, C2 > &A)
 Returns the solution of the system Ax=b when A is triangular. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_right_tri_low (const Eigen::Matrix< T1, R1, C1 > &b, const Eigen::Matrix< T2, R2, C2 > &A)
 Returns the solution of the system tri(A)x=b when tri(A) is a lower triangular view of the matrix A. More...
 
template<typename T >
boost::math::tools::promote_args< T >::type mean (const std::vector< T > &v)
 Returns the sample mean (i.e., average) of the coefficients in the specified standard vector. More...
 
template<typename T , int R, int C>
boost::math::tools::promote_args< T >::type mean (const Eigen::Matrix< T, R, C > &m)
 Returns the sample mean (i.e., average) of the coefficients in the specified vector, row vector, or matrix. More...
 
int min (const std::vector< int > &x)
 Returns the minimum coefficient in the specified column vector. More...
 
template<typename T >
min (const std::vector< T > &x)
 Returns the minimum coefficient in the specified column vector. More...
 
template<typename T , int R, int C>
min (const Eigen::Matrix< T, R, C > &m)
 Returns the minimum coefficient in the specified matrix, vector, or row vector. More...
 
template<typename T >
minus (const T &x)
 Returns the negation of the specified scalar or matrix. More...
 
template<int R, int C, typename T >
std::enable_if< std::is_arithmetic< T >::value, Eigen::Matrix< double, R, C > >::type multiply (const Eigen::Matrix< double, R, C > &m, T c)
 Return specified matrix multiplied by specified scalar. More...
 
template<int R, int C, typename T >
std::enable_if< std::is_arithmetic< T >::value, Eigen::Matrix< double, R, C > >::type multiply (T c, const Eigen::Matrix< double, R, C > &m)
 Return specified scalar multiplied by specified matrix. More...
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< double, R1, C2 > multiply (const Eigen::Matrix< double, R1, C1 > &m1, const Eigen::Matrix< double, R2, C2 > &m2)
 Return the product of the specified matrices. More...
 
template<int C1, int R2>
double multiply (const Eigen::Matrix< double, 1, C1 > &rv, const Eigen::Matrix< double, R2, 1 > &v)
 Return the scalar product of the specified row vector and specified column vector. More...
 
matrix_d multiply_lower_tri_self_transpose (const matrix_d &L)
 Returns the result of multiplying the lower triangular portion of the input matrix by its own transpose. More...
 
template<typename T >
int num_elements (const T &x)
 Returns 1, the number of elements in a primitive type. More...
 
template<typename T , int R, int C>
int num_elements (const Eigen::Matrix< T, R, C > &m)
 Returns the size of the specified matrix. More...
 
template<typename T >
int num_elements (const std::vector< T > &v)
 Returns the number of elements in the specified vector. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > ordered_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x)
 Return an increasing ordered vector derived from the specified free vector. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > ordered_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, T &lp)
 Return a positive valued, increasing ordered vector derived from the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > ordered_free (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &y)
 Return the vector of unconstrained scalars that transform to the specified positive ordered vector. More...
 
template<typename T >
apply_scalar_unary< Phi_fun, T >::return_t Phi (const T &x)
 Vectorized version of Phi(). More...
 
template<typename T >
apply_scalar_unary< Phi_approx_fun, T >::return_t Phi_approx (const T &x)
 Return the elementwise application of Phi_approx() to specified argument container. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > positive_ordered_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x)
 Return an increasing positive ordered vector derived from the specified free vector. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > positive_ordered_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, T &lp)
 Return a positive valued, increasing positive ordered vector derived from the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > positive_ordered_free (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &y)
 Return the vector of unconstrained scalars that transform to the specified positive ordered vector. More...
 
template<typename T >
prod (const std::vector< T > &v)
 Returns the product of the coefficients of the specified standard vector. More...
 
template<typename T , int R, int C>
prod (const Eigen::Matrix< T, R, C > &v)
 Returns the product of the coefficients of the specified column vector. More...
 
template<typename T1 , typename T2 , typename F >
common_type< T1, T2 >::type promote_common (const F &u)
 Return the result of promoting either a scalar or the scalar elements of a container to either of two specified types, as determined by stan::math::common_type. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > qr_Q (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Returns the orthogonal factor of the fat QR decomposition. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > qr_R (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Returns the upper triangular factor of the fat QR decomposition. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > qr_thin_Q (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Returns the orthogonal factor of the thin QR decomposition. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > qr_thin_R (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Returns the upper triangular factor of the thin QR decomposition. More...
 
template<int RA, int CA, int RB, int CB, typename T >
Eigen::Matrix< T, CB, CB > quad_form (const Eigen::Matrix< T, RA, CA > &A, const Eigen::Matrix< T, RB, CB > &B)
 Compute B^T A B. More...
 
template<int RA, int CA, int RB, typename T >
quad_form (const Eigen::Matrix< T, RA, CA > &A, const Eigen::Matrix< T, RB, 1 > &B)
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, Eigen::Dynamic, Eigen::Dynamic > quad_form_diag (const Eigen::Matrix< T1, Eigen::Dynamic, Eigen::Dynamic > &mat, const Eigen::Matrix< T2, R, C > &vec)
 
template<int RA, int CA, int RB, int CB, typename T >
Eigen::Matrix< T, CB, CB > quad_form_sym (const Eigen::Matrix< T, RA, CA > &A, const Eigen::Matrix< T, RB, CB > &B)
 
template<int RA, int CA, int RB, typename T >
quad_form_sym (const Eigen::Matrix< T, RA, CA > &A, const Eigen::Matrix< T, RB, 1 > &B)
 
template<typename C >
int rank (const C &v, int s)
 Return the number of components of v less than v[s]. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > read_corr_L (const Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, size_t K)
 Return the Cholesky factor of the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > read_corr_L (const Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, size_t K, T &log_prob)
 Return the Cholesky factor of the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations, incrementing the specified scalar reference with the log absolute determinant of the Jacobian of the transformation. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > read_corr_matrix (const Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, size_t K)
 Return the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > read_corr_matrix (const Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, size_t K, T &log_prob)
 Return the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations, incrementing the specified scalar reference with the log absolute determinant of the Jacobian of the transformation. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > read_cov_L (const Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, const Eigen::Array< T, Eigen::Dynamic, 1 > &sds, T &log_prob)
 This is the function that should be called prior to evaluating the density of any elliptical distribution. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > read_cov_matrix (const Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, const Eigen::Array< T, Eigen::Dynamic, 1 > &sds, T &log_prob)
 A generally worse alternative to call prior to evaluating the density of an elliptical distribution. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > read_cov_matrix (const Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, const Eigen::Array< T, Eigen::Dynamic, 1 > &sds)
 Builds a covariance matrix from CPCs and standard deviations. More...
 
template<typename T >
Eigen::Matrix< typename boost::math::tools::promote_args< T >::type, Eigen::Dynamic, Eigen::Dynamic > rep_matrix (const T &x, int m, int n)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > rep_matrix (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, int n)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > rep_matrix (const Eigen::Matrix< T, 1, Eigen::Dynamic > &rv, int m)
 
template<typename T >
Eigen::Matrix< typename boost::math::tools::promote_args< T >::type, 1, Eigen::Dynamic > rep_row_vector (const T &x, int m)
 
template<typename T >
Eigen::Matrix< typename boost::math::tools::promote_args< T >::type, Eigen::Dynamic, 1 > rep_vector (const T &x, int n)
 
template<typename T >
void resize (T &x, std::vector< int > dims)
 Recursively resize the specified vector of vectors, which must bottom out at scalar values, Eigen vectors or Eigen matrices. More...
 
template<typename T >
apply_scalar_unary< round_fun, T >::return_t round (const T &x)
 Vectorized version of round. More...
 
template<typename T >
Eigen::Matrix< T, 1, Eigen::Dynamic > row (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m, size_t i)
 Return the specified row of the specified matrix, using start-at-1 indexing. More...
 
template<typename T , int R, int C>
int rows (const Eigen::Matrix< T, R, C > &m)
 Return the number of rows in the specified matrix, vector, or row vector. More...
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< double, R1, 1 > rows_dot_product (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2)
 Returns the dot product of the specified vectors. More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, R, 1 > rows_dot_self (const Eigen::Matrix< T, R, C > &x)
 Returns the dot product of each row of a matrix with itself. More...
 
template<int Cb>
Eigen::Matrix< double, -1, Cb > scale_matrix_exp_multiply (const double &t, const Eigen::MatrixXd &A, const Eigen::Matrix< double, -1, Cb > &B)
 Return product of exp(At) and B, where A is a NxN double matrix, B is a NxCb double matrix, and t is a double. More...
 
template<typename T >
boost::math::tools::promote_args< T >::type sd (const std::vector< T > &v)
 Returns the unbiased sample standard deviation of the coefficients in the specified column vector. More...
 
template<typename T , int R, int C>
boost::math::tools::promote_args< T >::type sd (const Eigen::Matrix< T, R, C > &m)
 Returns the unbiased sample standard deviation of the coefficients in the specified vector, row vector, or matrix. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > segment (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, size_t i, size_t n)
 Return the specified number of elements as a vector starting from the specified element - 1 of the specified vector. More...
 
template<typename T >
Eigen::Matrix< T, 1, Eigen::Dynamic > segment (const Eigen::Matrix< T, 1, Eigen::Dynamic > &v, size_t i, size_t n)
 
template<typename T >
std::vector< T > segment (const std::vector< T > &sv, size_t i, size_t n)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > simplex_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &y)
 Return the simplex corresponding to the specified free vector. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > simplex_constrain (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &y, T &lp)
 Return the simplex corresponding to the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > simplex_free (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x)
 Return an unconstrained vector that when transformed produces the specified simplex. More...
 
template<typename T >
apply_scalar_unary< sin_fun, T >::return_t sin (const T &x)
 Vectorized version of sin(). More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > singular_values (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Return the vector of the singular values of the specified matrix in decreasing order of magnitude. More...
 
template<typename T >
apply_scalar_unary< sinh_fun, T >::return_t sinh (const T &x)
 Vectorized version of sinh(). More...
 
template<typename T >
int size (const std::vector< T > &x)
 Return the size of the specified standard vector. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > softmax (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v)
 Return the softmax of the specified vector. More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, R, C > sort_asc (Eigen::Matrix< T, R, C > xs)
 Return the specified vector in ascending order. More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, R, C > sort_desc (Eigen::Matrix< T, R, C > xs)
 Return the specified vector in descending order. More...
 
template<bool ascending, typename C >
std::vector< int > sort_indices (const C &xs)
 Return an integer array of indices of the specified container sorting the values in ascending or descending order based on the value of the first template prameter. More...
 
template<typename C >
std::vector< int > sort_indices_asc (const C &xs)
 Return a sorted copy of the argument container in ascending order. More...
 
template<typename C >
std::vector< int > sort_indices_desc (const C &xs)
 Return a sorted copy of the argument container in ascending order. More...
 
template<typename T >
apply_scalar_unary< sqrt_fun, T >::return_t sqrt (const T &x)
 Vectorized version of sqrt(). More...
 
template<typename T >
apply_scalar_unary< square_fun, T >::return_t square (const T &x)
 Vectorized version of square(). More...
 
template<int R, int C>
double squared_distance (const Eigen::Matrix< double, R, C > &v1, const Eigen::Matrix< double, R, C > &v2)
 Returns the squared distance between the specified vectors of the same dimensions. More...
 
template<int R1, int C1, int R2, int C2>
double squared_distance (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2)
 Returns the squared distance between the specified vectors of the same dimensions. More...
 
template<typename T >
void stan_print (std::ostream *o, const T &x)
 
template<typename T >
void stan_print (std::ostream *o, const std::vector< T > &x)
 
template<typename T >
void stan_print (std::ostream *o, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x)
 
template<typename T >
void stan_print (std::ostream *o, const Eigen::Matrix< T, 1, Eigen::Dynamic > &x)
 
template<typename T >
void stan_print (std::ostream *o, const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &x)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > sub_col (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m, size_t i, size_t j, size_t nrows)
 Return a nrows x 1 subcolumn starting at (i-1, j-1). More...
 
template<typename T >
Eigen::Matrix< T, 1, Eigen::Dynamic > sub_row (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m, size_t i, size_t j, size_t ncols)
 Return a 1 x nrows subrow starting at (i-1, j-1). More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R, C > subtract (const Eigen::Matrix< T1, R, C > &m1, const Eigen::Matrix< T2, R, C > &m2)
 Return the result of subtracting the second specified matrix from the first specified matrix. More...
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R, C > subtract (const T1 &c, const Eigen::Matrix< T2, R, C > &m)
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R, C > subtract (const Eigen::Matrix< T1, R, C > &m, const T2 &c)
 
template<typename Derived >
Eigen::DenseBase< Derived >::Scalar sum (const Eigen::DenseBase< Derived > &v)
 Returns the sum of the coefficients of the specified Eigen Matrix, Array or expression. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > tail (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, size_t n)
 Return the specified number of elements as a vector from the back of the specified vector. More...
 
template<typename T >
Eigen::Matrix< T, 1, Eigen::Dynamic > tail (const Eigen::Matrix< T, 1, Eigen::Dynamic > &rv, size_t n)
 Return the specified number of elements as a row vector from the back of the specified row vector. More...
 
template<typename T >
std::vector< T > tail (const std::vector< T > &sv, size_t n)
 Return the specified number of elements as a standard vector from the back of the specified standard vector. More...
 
template<typename T >
apply_scalar_unary< tan_fun, T >::return_t tan (const T &x)
 Vectorized version of tan(). More...
 
template<typename T >
apply_scalar_unary< tanh_fun, T >::return_t tanh (const T &x)
 Vectorized version of tanh(). More...
 
matrix_d tcrossprod (const matrix_d &M)
 Returns the result of post-multiplying a matrix by its own transpose. More...
 
template<typename T >
apply_scalar_unary< tgamma_fun, T >::return_t tgamma (const T &x)
 Vectorized version of tgamma(). More...
 
template<typename T , int R, int C>
std::vector< T > to_array_1d (const Eigen::Matrix< T, R, C > &matrix)
 
template<typename T >
std::vector< T > to_array_1d (const std::vector< T > &x)
 
template<typename T >
std::vector< typename scalar_type< T >::type > to_array_1d (const std::vector< std::vector< T > > &x)
 
template<typename T >
std::vector< std::vector< T > > to_array_2d (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &matrix)
 
template<typename T , int R, int C>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const Eigen::Matrix< T, R, C > &x)
 Returns a matrix with dynamic dimensions constructed from an Eigen matrix which is either a row vector, column vector, or matrix. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const std::vector< Eigen::Matrix< T, 1, Eigen::Dynamic > > &x)
 Returns a matrix representation of a standard vector of Eigen row vectors with the same dimensions and indexing order. More...
 
template<typename T >
Eigen::Matrix< typename boost::math::tools::promote_args< T, double >::type, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const std::vector< std::vector< T > > &x)
 Returns a matrix representation of the standard vector of standard vectors with the same dimensions and indexing order. More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const Eigen::Matrix< T, R, C > &x, int m, int n)
 Returns a matrix representation of the vector in column-major order with the specified number of rows and columns. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const std::vector< T > &x, int m, int n)
 Returns a matrix representation of the vector in column-major order with the specified number of rows and columns. More...
 
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const std::vector< int > &x, int m, int n)
 Returns a matrix representation of the vector in column-major order with the specified number of rows and columns. More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const Eigen::Matrix< T, R, C > &x, int m, int n, bool col_major)
 Returns a matrix representation of the vector in column-major order with the specified number of rows and columns. More...
 
template<typename T >
Eigen::Matrix< typename boost::math::tools::promote_args< T, double >::type, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const std::vector< T > &x, int m, int n, bool col_major)
 Returns a matrix representation of the vector in column-major order with the specified number of rows and columns. More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, 1, Eigen::Dynamic > to_row_vector (const Eigen::Matrix< T, R, C > &matrix)
 
template<typename T >
Eigen::Matrix< T, 1, Eigen::Dynamic > to_row_vector (const std::vector< T > &vec)
 
Eigen::Matrix< double, 1, Eigen::Dynamic > to_row_vector (const std::vector< int > &vec)
 
template<typename T , int R, int C>
Eigen::Matrix< T, Eigen::Dynamic, 1 > to_vector (const Eigen::Matrix< T, R, C > &matrix)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > to_vector (const std::vector< T > &vec)
 
Eigen::Matrix< double, Eigen::Dynamic, 1 > to_vector (const std::vector< int > &vec)
 
template<typename T >
trace (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Returns the trace of the specified matrix. More...
 
template<typename T >
trace (const T &m)
 
template<typename T1 , typename T2 , typename T3 , int R1, int C1, int R2, int C2, int R3, int C3>
std::enable_if< !stan::is_var< T1 >::value &&!stan::is_var< T2 >::value &&!stan::is_var< T3 >::value, typename boost::math::tools::promote_args< T1, T2, T3 >::type >::type trace_gen_inv_quad_form_ldlt (const Eigen::Matrix< T1, R1, C1 > &D, const LDLT_factor< T2, R2, C2 > &A, const Eigen::Matrix< T3, R3, C3 > &B)
 
template<int RD, int CD, int RA, int CA, int RB, int CB>
double trace_gen_quad_form (const Eigen::Matrix< double, RD, CD > &D, const Eigen::Matrix< double, RA, CA > &A, const Eigen::Matrix< double, RB, CB > &B)
 Compute trace(D B^T A B). More...
 
template<typename T1 , typename T2 , int R2, int C2, int R3, int C3>
std::enable_if< !stan::is_var< T1 >::value &&!stan::is_var< T2 >::value, typename boost::math::tools::promote_args< T1, T2 >::type >::type trace_inv_quad_form_ldlt (const LDLT_factor< T1, R2, C2 > &A, const Eigen::Matrix< T2, R3, C3 > &B)
 
template<int RA, int CA, int RB, int CB>
double trace_quad_form (const Eigen::Matrix< double, RA, CA > &A, const Eigen::Matrix< double, RB, CB > &B)
 Compute trace(B^T A B). More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, C, R > transpose (const Eigen::Matrix< T, R, C > &m)
 
template<typename T >
apply_scalar_unary< trigamma_fun, T >::return_t trigamma (const T &x)
 Return the elementwise application of trigamma() to specified argument container. More...
 
template<typename T >
apply_scalar_unary< trunc_fun, T >::return_t trunc (const T &x)
 Return the elementwise application of trunc() to specified argument container. More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, R, C > unit_vector_constrain (const Eigen::Matrix< T, R, C > &y)
 Return the unit length vector corresponding to the free vector y. More...
 
template<typename T , int R, int C>
Eigen::Matrix< T, R, C > unit_vector_constrain (const Eigen::Matrix< T, R, C > &y, T &lp)
 Return the unit length vector corresponding to the free vector y. More...
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > unit_vector_free (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x)
 Transformation of a unit length vector to a "free" vector However, we are just fixing the unidentified radius to 1. More...
 
template<typename T , int R, int C>
Eigen::Matrix< typename child_type< T >::type, R, C > value_of (const Eigen::Matrix< T, R, C > &M)
 Convert a matrix of type T to a matrix of doubles. More...
 
template<int R, int C>
const Eigen::Matrix< double, R, C > & value_of (const Eigen::Matrix< double, R, C > &x)
 Return the specified argument. More...
 
template<typename T , int R, int C>
Eigen::Matrix< double, R, C > value_of_rec (const Eigen::Matrix< T, R, C > &M)
 Convert a matrix of type T to a matrix of doubles. More...
 
template<int R, int C>
const Eigen::Matrix< double, R, C > & value_of_rec (const Eigen::Matrix< double, R, C > &x)
 Return the specified argument. More...
 
template<typename T >
boost::math::tools::promote_args< T >::type variance (const std::vector< T > &v)
 Returns the sample variance (divide by length - 1) of the coefficients in the specified standard vector. More...
 
template<typename T , int R, int C>
boost::math::tools::promote_args< T >::type variance (const Eigen::Matrix< T, R, C > &m)
 Returns the sample variance (divide by length - 1) of the coefficients in the specified column vector. More...
 
template<typename F >
void finite_diff_gradient (const F &f, const Eigen::VectorXd &x, double &fx, Eigen::VectorXd &grad_fx, double epsilon=1e-03)
 Calculate the value and the gradient of the specified function at the specified argument using finite difference. More...
 
template<typename F >
void finite_diff_gradient_auto (const F &f, const Eigen::VectorXd &x, double &fx, Eigen::VectorXd &grad_fx)
 Calculate the value and the gradient of the specified function at the specified argument using finite difference. More...
 
template<typename F >
void finite_diff_hessian (const F &f, const Eigen::VectorXd &x, double &fx, Eigen::VectorXd &grad_fx, Eigen::MatrixXd &hess_fx, double epsilon=1e-03)
 Calculate the value and the Hessian of the specified function at the specified argument using second-order finite difference with the specified perturbation step size. More...
 
template<typename F >
void finite_diff_hessian_auto (const F &f, const Eigen::VectorXd &x, double &fx, Eigen::VectorXd &grad_fx, Eigen::MatrixXd &hess_fx)
 Calculate the value and the Hessian of the specified function at the specified argument using second-order finite difference, automatically setting the stepsize between the function evaluations along a dimension. More...
 
template<typename F >
double finite_diff_hessian_helper (const F &f, const Eigen::VectorXd &x, int i, double epsilon=1e-03)
 Return the subcalculation required by finite_diff_hessian and finite_diff_hessian_auto. More...
 
template<int call_id, typename F , typename T_shared_param , typename T_job_param >
Eigen::Matrix< typename stan::return_type< T_shared_param, T_job_param >::type, Eigen::Dynamic, 1 > map_rect (const Eigen::Matrix< T_shared_param, Eigen::Dynamic, 1 > &shared_params, const std::vector< Eigen::Matrix< T_job_param, Eigen::Dynamic, 1 >> &job_params, const std::vector< std::vector< double >> &x_r, const std::vector< std::vector< int >> &x_i, std::ostream *msgs=nullptr)
 Map N function evaluations to parameters and data which are in rectangular format. More...
 
template<typename T , int R, int C>
Eigen::ArrayWrapper< const Eigen::Matrix< T, R, C > > as_array_or_scalar (const Eigen::Matrix< T, R, C > &v)
 Converts a matrix type to an array. More...
 
template<typename T , int R, int C>
Eigen::ArrayWrapper< const Eigen::Map< const Eigen::Matrix< T, R, C > > > as_array_or_scalar (const Eigen::Map< const Eigen::Matrix< T, R, C >> &v)
 Converts a matrix type to an array. More...
 
template<typename T >
Eigen::Map< const Eigen::Array< T, Eigen::Dynamic, 1 > > as_array_or_scalar (const std::vector< T > &v)
 Converts a std::vector type to an array. More...
 
template<typename T >
const Eigen::Matrix< T, Eigen::Dynamic, 1 > & as_column_vector_or_scalar (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &a)
 Converts input argument to a column vector or a scalar. More...
 
template<typename T >
Eigen::Map< const Eigen::Matrix< T, Eigen::Dynamic, 1 > > as_column_vector_or_scalar (const Eigen::Matrix< T, 1, Eigen::Dynamic > &a)
 Converts input argument to a column vector or a scalar. More...
 
template<typename T >
Eigen::Map< const Eigen::Matrix< T, Eigen::Dynamic, 1 > > as_column_vector_or_scalar (const std::vector< T > &a)
 Converts input argument to a column vector or a scalar. More...
 
template<typename Derived >
double as_scalar (const Eigen::DenseBase< Derived > &a)
 Converts input to a scalar. More...
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type< T_x, T_alpha, T_beta >::type bernoulli_logit_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type< T_x, T_alpha, T_beta >::type bernoulli_logit_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type< T_x, T_alpha, T_beta >::type bernoulli_logit_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 Returns the log PMF of the Generalized Linear Model (GLM) with Bernoulli distribution and logit link function. More...
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type< T_x, T_beta, T_alpha >::type bernoulli_logit_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<typename T_x , typename T_alpha , typename T_beta , class RNG >
VectorBuilder< true, int, T_alpha >::type bernoulli_logit_glm_rng (const T_x &x, const T_alpha &alpha, const T_beta &beta, RNG &rng)
 Returns a draw from the Generalized Linear Model (GLM) with Bernoulli distribution and logit link function. More...
 
template<bool propto, typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_log (int n, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_log (const typename math::index_type< Eigen::VectorXd >::type n, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<bool propto, typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_log (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_log (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<bool propto, typename T_y , typename T_x_scalar , int T_x_rows, typename T_alpha_scalar , typename T_beta_scalar >
return_type< T_x_scalar, T_alpha_scalar, T_beta_scalar >::type categorical_logit_glm_lpmf (const T_y &y, const Eigen::Matrix< T_x_scalar, T_x_rows, Eigen::Dynamic > &x, const Eigen::Matrix< T_alpha_scalar, Eigen::Dynamic, 1 > &alpha, const Eigen::Matrix< T_beta_scalar, Eigen::Dynamic, Eigen::Dynamic > &beta)
 Returns the log PMF of the Generalized Linear Model (GLM) with categorical distribution and logit (softmax) link function. More...
 
template<typename T_y , typename T_x_scalar , int T_x_rows, typename T_alpha_scalar , typename T_beta_scalar >
return_type< T_x_scalar, T_alpha_scalar, T_beta_scalar >::type categorical_logit_glm_lpmf (const T_y &y, const Eigen::Matrix< T_x_scalar, T_x_rows, Eigen::Dynamic > &x, const Eigen::Matrix< T_alpha_scalar, Eigen::Dynamic, 1 > &alpha, const Eigen::Matrix< T_beta_scalar, Eigen::Dynamic, Eigen::Dynamic > &beta)
 
template<bool propto, typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_logit_log (int n, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &beta)
 
template<typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_logit_log (int n, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &beta)
 
template<bool propto, typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_logit_log (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &beta)
 
template<typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_logit_log (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &beta)
 
template<bool propto, typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_logit_lpmf (int n, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &beta)
 
template<typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_logit_lpmf (int n, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &beta)
 
template<bool propto, typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_logit_lpmf (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &beta)
 
template<typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_logit_lpmf (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &beta)
 
template<class RNG >
int categorical_logit_rng (const Eigen::VectorXd &beta, RNG &rng)
 Return a draw from a Categorical distribution given a a vector of unnormalized log probabilities and a psuedo-random number generator. More...
 
template<bool propto, typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_lpmf (int n, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_lpmf (const typename math::index_type< Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > >::type n, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<bool propto, typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_lpmf (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<typename T_prob >
boost::math::tools::promote_args< T_prob >::type categorical_lpmf (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<class RNG >
int categorical_rng (const Eigen::Matrix< double, Eigen::Dynamic, 1 > &theta, RNG &rng)
 
template<bool propto, typename T_prob , typename T_prior_size >
return_type< T_prob, T_prior_size >::type dirichlet_log (const T_prob &theta, const T_prior_size &alpha)
 The log of the Dirichlet density for the given theta and a vector of prior sample sizes, alpha. More...
 
template<typename T_prob , typename T_prior_size >
return_type< T_prob, T_prior_size >::type dirichlet_log (const T_prob &theta, const T_prior_size &alpha)
 
template<bool propto, typename T_prob , typename T_prior_size >
return_type< T_prob, T_prior_size >::type dirichlet_lpmf (const T_prob &theta, const T_prior_size &alpha)
 The log of the Dirichlet density for the given theta and a vector of prior sample sizes, alpha. More...
 
template<typename T_prob , typename T_prior_size >
return_type< T_prob, T_prior_size >::type dirichlet_lpmf (const T_prob &theta, const T_prior_size &alpha)
 
template<class RNG >
Eigen::VectorXd dirichlet_rng (const Eigen::Matrix< double, Eigen::Dynamic, 1 > &alpha, RNG &rng)
 Return a draw from a Dirichlet distribution with specified parameters and pseudo-random number generator. More...
 
template<bool propto, typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type< T_F, T_G, T_V, T_W, T_m0, T_C0 >::type >::type gaussian_dlm_obs_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &F, const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &G, const Eigen::Matrix< T_V, Eigen::Dynamic, Eigen::Dynamic > &V, const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &W, const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &m0, const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &C0)
 The log of a Gaussian dynamic linear model (GDLM). More...
 
template<typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type< T_F, T_G, T_V, T_W, T_m0, T_C0 >::type >::type gaussian_dlm_obs_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &F, const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &G, const Eigen::Matrix< T_V, Eigen::Dynamic, Eigen::Dynamic > &V, const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &W, const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &m0, const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &C0)
 
template<bool propto, typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type< T_F, T_G, T_V, T_W, T_m0, T_C0 >::type >::type gaussian_dlm_obs_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &F, const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &G, const Eigen::Matrix< T_V, Eigen::Dynamic, 1 > &V, const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &W, const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &m0, const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &C0)
 The log of a Gaussian dynamic linear model (GDLM) with uncorrelated observation disturbances. More...
 
template<typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type< T_F, T_G, T_V, T_W, T_m0, T_C0 >::type >::type gaussian_dlm_obs_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &F, const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &G, const Eigen::Matrix< T_V, Eigen::Dynamic, 1 > &V, const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &W, const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &m0, const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &C0)
 
template<bool propto, typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type< T_F, T_G, T_V, T_W, T_m0, T_C0 >::type >::type gaussian_dlm_obs_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &F, const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &G, const Eigen::Matrix< T_V, Eigen::Dynamic, Eigen::Dynamic > &V, const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &W, const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &m0, const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &C0)
 The log of a Gaussian dynamic linear model (GDLM). More...
 
template<typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type< T_F, T_G, T_V, T_W, T_m0, T_C0 >::type >::type gaussian_dlm_obs_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &F, const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &G, const Eigen::Matrix< T_V, Eigen::Dynamic, Eigen::Dynamic > &V, const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &W, const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &m0, const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &C0)
 
template<bool propto, typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type< T_F, T_G, T_V, T_W, T_m0, T_C0 >::type >::type gaussian_dlm_obs_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &F, const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &G, const Eigen::Matrix< T_V, Eigen::Dynamic, 1 > &V, const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &W, const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &m0, const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &C0)
 The log of a Gaussian dynamic linear model (GDLM) with uncorrelated observation disturbances. More...
 
template<typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type< T_F, T_G, T_V, T_W, T_m0, T_C0 >::type >::type gaussian_dlm_obs_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &F, const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &G, const Eigen::Matrix< T_V, Eigen::Dynamic, 1 > &V, const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &W, const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &m0, const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &C0)
 
template<class RNG >
Eigen::MatrixXd gaussian_dlm_obs_rng (const Eigen::MatrixXd &F, const Eigen::MatrixXd &G, const Eigen::MatrixXd &V, const Eigen::MatrixXd &W, const Eigen::VectorXd &m0, const Eigen::MatrixXd &C0, const int T, RNG &rng)
 Simulate random draw from Gaussian dynamic linear model (GDLM). More...
 
template<class RNG >
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > gaussian_dlm_obs_rng (const Eigen::MatrixXd &F, const Eigen::MatrixXd &G, const Eigen::VectorXd &V, const Eigen::MatrixXd &W, const Eigen::VectorXd &m0, const Eigen::MatrixXd &C0, const int T, RNG &rng)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args< T_y, T_dof, T_scale >::type inv_wishart_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &W, const T_dof &nu, const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &S)
 The log of the Inverse-Wishart density for the given W, degrees of freedom, and scale matrix. More...
 
template<typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args< T_y, T_dof, T_scale >::type inv_wishart_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &W, const T_dof &nu, const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &S)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args< T_y, T_dof, T_scale >::type inv_wishart_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &W, const T_dof &nu, const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &S)
 The log of the Inverse-Wishart density for the given W, degrees of freedom, and scale matrix. More...
 
template<typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args< T_y, T_dof, T_scale >::type inv_wishart_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &W, const T_dof &nu, const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &S)
 
template<class RNG >
Eigen::MatrixXd inv_wishart_rng (double nu, const Eigen::MatrixXd &S, RNG &rng)
 
template<bool propto, typename T_covar , typename T_shape >
boost::math::tools::promote_args< T_covar, T_shape >::type lkj_corr_cholesky_log (const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &L, const T_shape &eta)
 
template<typename T_covar , typename T_shape >
boost::math::tools::promote_args< T_covar, T_shape >::type lkj_corr_cholesky_log (const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &L, const T_shape &eta)
 
template<bool propto, typename T_covar , typename T_shape >
boost::math::tools::promote_args< T_covar, T_shape >::type lkj_corr_cholesky_lpdf (const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &L, const T_shape &eta)
 
template<typename T_covar , typename T_shape >
boost::math::tools::promote_args< T_covar, T_shape >::type lkj_corr_cholesky_lpdf (const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &L, const T_shape &eta)
 
template<class RNG >
Eigen::MatrixXd lkj_corr_cholesky_rng (size_t K, double eta, RNG &rng)
 
template<bool propto, typename T_y , typename T_shape >
boost::math::tools::promote_args< T_y, T_shape >::type lkj_corr_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const T_shape &eta)
 
template<typename T_y , typename T_shape >
boost::math::tools::promote_args< T_y, T_shape >::type lkj_corr_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const T_shape &eta)
 
template<typename T_shape >
boost::math::tools::promote_args< double, T_shape >::type do_lkj_constant (const T_shape &eta, const unsigned int &K)
 
template<bool propto, typename T_y , typename T_shape >
boost::math::tools::promote_args< T_y, T_shape >::type lkj_corr_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const T_shape &eta)
 
template<typename T_y , typename T_shape >
boost::math::tools::promote_args< T_y, T_shape >::type lkj_corr_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const T_shape &eta)
 
template<class RNG >
Eigen::MatrixXd lkj_corr_rng (size_t K, double eta, RNG &rng)
 Return a random correlation matrix (symmetric, positive definite, unit diagonal) of the specified dimensionality drawn from the LKJ distribution with the specified degrees of freedom using the specified random number generator. More...
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args< T_y, T_loc, T_scale, T_shape >::type lkj_cov_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &mu, const Eigen::Matrix< T_scale, Eigen::Dynamic, 1 > &sigma, const T_shape &eta)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args< T_y, T_loc, T_scale, T_shape >::type lkj_cov_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &mu, const Eigen::Matrix< T_scale, Eigen::Dynamic, 1 > &sigma, const T_shape &eta)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args< T_y, T_loc, T_scale, T_shape >::type lkj_cov_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const T_loc &mu, const T_scale &sigma, const T_shape &eta)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args< T_y, T_loc, T_scale, T_shape >::type lkj_cov_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const T_loc &mu, const T_scale &sigma, const T_shape &eta)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args< T_y, T_loc, T_scale, T_shape >::type lkj_cov_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &mu, const Eigen::Matrix< T_scale, Eigen::Dynamic, 1 > &sigma, const T_shape &eta)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args< T_y, T_loc, T_scale, T_shape >::type lkj_cov_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &mu, const Eigen::Matrix< T_scale, Eigen::Dynamic, 1 > &sigma, const T_shape &eta)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args< T_y, T_loc, T_scale, T_shape >::type lkj_cov_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const T_loc &mu, const T_scale &sigma, const T_shape &eta)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args< T_y, T_loc, T_scale, T_shape >::type lkj_cov_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const T_loc &mu, const T_scale &sigma, const T_shape &eta)
 
template<bool propto, typename T_y , typename T_Mu , typename T_Sigma , typename T_D >
boost::math::tools::promote_args< T_y, T_Mu, T_Sigma, T_D >::type matrix_normal_prec_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_Mu, Eigen::Dynamic, Eigen::Dynamic > &Mu, const Eigen::Matrix< T_Sigma, Eigen::Dynamic, Eigen::Dynamic > &Sigma, const Eigen::Matrix< T_D, Eigen::Dynamic, Eigen::Dynamic > &D)
 The log of the matrix normal density for the given y, mu, Sigma and D where Sigma and D are given as precision matrices, not covariance matrices. More...
 
template<typename T_y , typename T_Mu , typename T_Sigma , typename T_D >
boost::math::tools::promote_args< T_y, T_Mu, T_Sigma, T_D >::type matrix_normal_prec_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_Mu, Eigen::Dynamic, Eigen::Dynamic > &Mu, const Eigen::Matrix< T_Sigma, Eigen::Dynamic, Eigen::Dynamic > &Sigma, const Eigen::Matrix< T_D, Eigen::Dynamic, Eigen::Dynamic > &D)
 
template<bool propto, typename T_y , typename T_Mu , typename T_Sigma , typename T_D >
boost::math::tools::promote_args< T_y, T_Mu, T_Sigma, T_D >::type matrix_normal_prec_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_Mu, Eigen::Dynamic, Eigen::Dynamic > &Mu, const Eigen::Matrix< T_Sigma, Eigen::Dynamic, Eigen::Dynamic > &Sigma, const Eigen::Matrix< T_D, Eigen::Dynamic, Eigen::Dynamic > &D)
 The log of the matrix normal density for the given y, mu, Sigma and D where Sigma and D are given as precision matrices, not covariance matrices. More...
 
template<typename T_y , typename T_Mu , typename T_Sigma , typename T_D >
boost::math::tools::promote_args< T_y, T_Mu, T_Sigma, T_D >::type matrix_normal_prec_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_Mu, Eigen::Dynamic, Eigen::Dynamic > &Mu, const Eigen::Matrix< T_Sigma, Eigen::Dynamic, Eigen::Dynamic > &Sigma, const Eigen::Matrix< T_D, Eigen::Dynamic, Eigen::Dynamic > &D)
 
template<class RNG >
Eigen::MatrixXd matrix_normal_prec_rng (const Eigen::MatrixXd &Mu, const Eigen::MatrixXd &Sigma, const Eigen::MatrixXd &D, RNG &rng)
 Sample from the the matrix normal distribution for the given Mu, Sigma and D where Sigma and D are given as precision matrices, not covariance matrices. More...
 
template<bool propto, typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args< T_y, T_covar, T_w >::type multi_gp_cholesky_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &L, const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &w)
 The log of a multivariate Gaussian Process for the given y, w, and a Cholesky factor L of the kernel matrix Sigma. More...
 
template<typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args< T_y, T_covar, T_w >::type multi_gp_cholesky_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &L, const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &w)
 
template<bool propto, typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args< T_y, T_covar, T_w >::type multi_gp_cholesky_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &L, const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &w)
 The log of a multivariate Gaussian Process for the given y, w, and a Cholesky factor L of the kernel matrix Sigma. More...
 
template<typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args< T_y, T_covar, T_w >::type multi_gp_cholesky_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &L, const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &w)
 
template<bool propto, typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args< T_y, T_covar, T_w >::type multi_gp_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &Sigma, const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &w)
 The log of a multivariate Gaussian Process for the given y, Sigma, and w. More...
 
template<typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args< T_y, T_covar, T_w >::type multi_gp_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &Sigma, const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &w)
 
template<bool propto, typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args< T_y, T_covar, T_w >::type multi_gp_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &Sigma, const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &w)
 The log of a multivariate Gaussian Process for the given y, Sigma, and w. More...
 
template<typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args< T_y, T_covar, T_w >::type multi_gp_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &Sigma, const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &w)
 
template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_cholesky_log (const T_y &y, const T_loc &mu, const T_covar &L)
 The log of the multivariate normal density for the given y, mu, and a Cholesky factor L of the variance matrix. More...
 
template<typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_cholesky_log (const T_y &y, const T_loc &mu, const T_covar &L)
 
template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_cholesky_lpdf (const T_y &y, const T_loc &mu, const T_covar &L)
 The log of the multivariate normal density for the given y, mu, and a Cholesky factor L of the variance matrix. More...
 
template<typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_cholesky_lpdf (const T_y &y, const T_loc &mu, const T_covar &L)
 
template<typename T_loc , class RNG >
StdVectorBuilder< true, Eigen::VectorXd, T_loc >::type multi_normal_cholesky_rng (const T_loc &mu, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &L, RNG &rng)
 Return a multivariate normal random variate with the given location and Cholesky factorization of the covariance using the specified random number generator. More...
 
template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_log (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_log (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_lpdf (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_lpdf (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_prec_log (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_prec_log (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_prec_lpdf (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<typename T_y , typename T_loc , typename T_covar >
return_type< T_y, T_loc, T_covar >::type multi_normal_prec_lpdf (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<typename T_loc , class RNG >
StdVectorBuilder< true, Eigen::VectorXd, T_loc >::type multi_normal_prec_rng (const T_loc &mu, const Eigen::MatrixXd &S, RNG &rng)
 Return a multivariate normal random variate with the given location and precision using the specified random number generator. More...
 
template<typename T_loc , class RNG >
StdVectorBuilder< true, Eigen::VectorXd, T_loc >::type multi_normal_rng (const T_loc &mu, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &S, RNG &rng)
 Return a multivariate normal random variate with the given location and covariance using the specified random number generator. More...
 
template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type multi_student_t_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &Sigma)
 Return the log of the multivariate Student t distribution at the specified arguments. More...
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type multi_student_t_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &Sigma)
 
template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type multi_student_t_lpdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &Sigma)
 Return the log of the multivariate Student t distribution at the specified arguments. More...
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type multi_student_t_lpdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &Sigma)
 
template<typename T_loc , class RNG >
StdVectorBuilder< true, Eigen::VectorXd, T_loc >::type multi_student_t_rng (double nu, const T_loc &mu, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &S, RNG &rng)
 Return a multivariate student-t random variate with the given degrees of freedom location and covariance using the specified random number generator. More...
 
template<bool propto, typename T_prob >
boost::math::tools::promote_args< T_prob >::type multinomial_log (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<typename T_prob >
boost::math::tools::promote_args< T_prob >::type multinomial_log (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<bool propto, typename T_prob >
boost::math::tools::promote_args< T_prob >::type multinomial_lpmf (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<typename T_prob >
boost::math::tools::promote_args< T_prob >::type multinomial_lpmf (const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
 
template<class RNG >
std::vector< int > multinomial_rng (const Eigen::Matrix< double, Eigen::Dynamic, 1 > &theta, int N, RNG &rng)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type< T_x, T_alpha, T_beta, T_precision >::type neg_binomial_2_log_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_precision &phi)
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type< T_x, T_alpha, T_beta, T_precision >::type neg_binomial_2_log_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_precision &phi)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type< T_x, T_alpha, T_beta, T_precision >::type neg_binomial_2_log_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_precision &phi)
 Returns the log PMF of the Generalized Linear Model (GLM) with Negative-Binomial-2 distribution and log link function. More...
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type< T_x, T_alpha, T_beta, T_precision >::type neg_binomial_2_log_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_precision &phi)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type< T_y, T_x, T_alpha, T_beta, T_scale >::type normal_id_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_scale &sigma)
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type< T_y, T_x, T_alpha, T_beta, T_scale >::type normal_id_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type< T_y, T_x, T_alpha, T_beta, T_scale >::type normal_id_glm_lpdf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_scale &sigma)
 Returns the log PDF of the Generalized Linear Model (GLM) with Normal distribution and id link function. More...
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type< T_y, T_x, T_alpha, T_beta, T_scale >::type normal_id_glm_lpdf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_logistic_log (const T_y &y, const T_loc &lambda, const T_cut &c)
 Returns the (natural) log probability of the integer/s given the vector of continuous location/s and specified cutpoints in an ordered logistic model. More...
 
template<typename T_y , typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_logistic_log (const T_y &y, const T_loc &lambda, const T_cut &c)
 
template<bool propto, typename T_y , typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_logistic_lpmf (const T_y &y, const T_loc &lambda, const T_cut &c)
 Returns the (natural) log probability of the specified array of integers given the vector of continuous locations and specified cutpoints in an ordered logistic model. More...
 
template<typename T_y , typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_logistic_lpmf (const T_y &y, const T_loc &lambda, const T_cut &c)
 
template<class RNG >
int ordered_logistic_rng (double eta, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &c, RNG &rng)
 
template<bool propto, typename T_y , typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_probit_log (const T_y &y, const T_loc &lambda, const T_cut &c)
 Returns the (natural) log probability of the integer/s given the vector of continuous location/s and specified cutpoints in an ordered probit model. More...
 
template<typename T_y , typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_probit_log (const T_y &y, const T_loc &lambda, const T_cut &c)
 
template<bool propto, typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_probit_lpmf (int y, const T_loc &lambda, const Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > &c)
 Returns the (natural) log probability of the specified integer outcome given the continuous location and specified cutpoints in an ordered probit model. More...
 
template<typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_probit_lpmf (int y, const T_loc &lambda, const Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > &c)
 
template<bool propto, typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_probit_lpmf (const std::vector< int > &y, const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &lambda, const Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > &c)
 Returns the (natural) log probability of the specified array of integers given the vector of continuous locations and specified cutpoints in an ordered probit model. More...
 
template<typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_probit_lpmf (const std::vector< int > &y, const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &lambda, const Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > &c)
 
template<bool propto, typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_probit_lpmf (const std::vector< int > &y, const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &lambda, const std::vector< Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > > &c)
 Returns the (natural) log probability of the specified array of integers given the vector of continuous locations and array of specified cutpoints in an ordered probit model. More...
 
template<typename T_loc , typename T_cut >
return_type< T_loc, T_cut >::type ordered_probit_lpmf (const std::vector< int > &y, const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &lambda, const std::vector< Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > > &c)
 
template<class RNG >
int ordered_probit_rng (double eta, const Eigen::VectorXd &c, RNG &rng)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type< T_x, T_alpha, T_beta >::type poisson_log_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type< T_x, T_alpha, T_beta >::type poisson_log_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type< T_x, T_alpha, T_beta >::type poisson_log_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 Returns the log PMF of the Generalized Linear Model (GLM) with Poisson distribution and log link function. More...
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type< T_x, T_alpha, T_beta >::type poisson_log_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args< T_y, T_dof, T_scale >::type wishart_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &W, const T_dof &nu, const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &S)
 The log of the Wishart density for the given W, degrees of freedom, and scale matrix. More...
 
template<typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args< T_y, T_dof, T_scale >::type wishart_log (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &W, const T_dof &nu, const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &S)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args< T_y, T_dof, T_scale >::type wishart_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &W, const T_dof &nu, const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &S)
 The log of the Wishart density for the given W, degrees of freedom, and scale matrix. More...
 
template<typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args< T_y, T_dof, T_scale >::type wishart_lpdf (const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &W, const T_dof &nu, const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &S)
 
template<class RNG >
Eigen::MatrixXd wishart_rng (double nu, const Eigen::MatrixXd &S, RNG &rng)
 
template<typename T_a1 , typename T_a2 , typename T_b1 , typename T_z >
void check_2F1_converges (const char *function, const T_a1 &a1, const T_a2 &a2, const T_b1 &b1, const T_z &z)
 Check if the hypergeometric function (2F1) called with supplied arguments will converge, assuming arguments are finite values. More...
 
template<typename T_a1 , typename T_a2 , typename T_a3 , typename T_b1 , typename T_b2 , typename T_z >
void check_3F2_converges (const char *function, const T_a1 &a1, const T_a2 &a2, const T_a3 &a3, const T_b1 &b1, const T_b2 &b2, const T_z &z)
 Check if the hypergeometric function (3F2) called with supplied arguments will converge, assuming arguments are finite values. More...
 
template<typename T_y , typename T_low , typename T_high >
void check_bounded (const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)
 Check if the value is between the low and high values, inclusively. More...
 
template<typename T >
void check_consistent_size (const char *function, const char *name, const T &x, size_t expected_size)
 Check if the dimension of x is consistent, which is defined to be expected_size if x is a vector or 1 if x is not a vector. More...
 
template<typename T1 , typename T2 >
void check_consistent_sizes (const char *function, const char *name1, const T1 &x1, const char *name2, const T2 &x2)
 Check if the dimension of x1 is consistent with x2. More...
 
template<typename T1 , typename T2 , typename T3 >
void check_consistent_sizes (const char *function, const char *name1, const T1 &x1, const char *name2, const T2 &x2, const char *name3, const T3 &x3)
 Check if the dimension of x1, x2, and x3 areconsistent. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
void check_consistent_sizes (const char *function, const char *name1, const T1 &x1, const char *name2, const T2 &x2, const char *name3, const T3 &x3, const char *name4, const T4 &x4)
 Check if the dimension of x1, x2, x3, and x4are consistent. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
void check_consistent_sizes (const char *function, const char *name1, const T1 &x1, const char *name2, const T2 &x2, const char *name3, const T3 &x3, const char *name4, const T4 &x4, const char *name5, const T5 &x5)
 
template<typename T_y >
void check_finite (const char *function, const char *name, const T_y &y)
 Check if y is finite. More...
 
template<typename T_y , typename T_low >
void check_greater (const char *function, const char *name, const T_y &y, const T_low &low)
 Check if y is strictly greater than low. More...
 
template<typename T_y , typename T_low >
void check_greater_or_equal (const char *function, const char *name, const T_y &y, const T_low &low)
 Check if y is greater or equal than low. More...
 
template<typename T_y , typename T_high >
void check_less (const char *function, const char *name, const T_y &y, const T_high &high)
 Check if y is strictly less than high. More...
 
template<typename T_y , typename T_high >
void check_less_or_equal (const char *function, const char *name, const T_y &y, const T_high &high)
 Check if y is less or equal to high. More...
 
template<typename T_y >
void check_nonnegative (const char *function, const char *name, const T_y &y)
 Check if y is non-negative. More...
 
template<typename T_y >
void check_not_nan (const char *function, const char *name, const T_y &y)
 Check if y is not NaN. More...
 
template<typename T_y >
void check_positive (const char *function, const char *name, const T_y &y)
 Check if y is positive. More...
 
void check_positive (const char *function, const char *name, const char *expr, int size)
 Check if size is positive. More...
 
template<typename T_y >
void check_positive_finite (const char *function, const char *name, const T_y &y)
 Check if y is positive and finite. More...
 
template<typename T_size1 , typename T_size2 >
void check_size_match (const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
 Check if the provided sizes match. More...
 
template<typename T_size1 , typename T_size2 >
void check_size_match (const char *function, const char *expr_i, const char *name_i, T_size1 i, const char *expr_j, const char *name_j, T_size2 j)
 Check if the provided sizes match. More...
 
template<typename T >
void domain_error (const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
 Throw a domain error with a consistently formatted message. More...
 
template<typename T >
void domain_error (const char *function, const char *name, const T &y, const char *msg1)
 Throw a domain error with a consistently formatted message. More...
 
template<typename T >
void domain_error_vec (const char *function, const char *name, const T &y, size_t i, const char *msg1, const char *msg2)
 Throw a domain error with a consistently formatted message. More...
 
template<typename T >
void domain_error_vec (const char *function, const char *name, const T &y, size_t i, const char *msg)
 Throw a domain error with a consistently formatted message. More...
 
template<typename T >
void invalid_argument (const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
 Throw an invalid_argument exception with a consistently formatted message. More...
 
template<typename T >
void invalid_argument (const char *function, const char *name, const T &y, const char *msg1)
 Throw an invalid_argument exception with a consistently formatted message. More...
 
template<typename T >
void invalid_argument_vec (const char *function, const char *name, const T &y, size_t i, const char *msg1, const char *msg2)
 Throw an invalid argument exception with a consistently formatted message. More...
 
template<typename T >
void invalid_argument_vec (const char *function, const char *name, const T &y, size_t i, const char *msg)
 Throw an invalid argument exception with a consistently formatted message. More...
 
template<typename T_y , typename T_high >
bool is_less_or_equal (const T_y &y, const T_high &high)
 Return true if y is less or equal to high. More...
 
template<typename T_y >
bool is_not_nan (const T_y &y)
 Return true if y is not NaN. More...
 
template<typename T_y >
bool is_positive (const T_y &y)
 Return true if y is positive. More...
 
bool is_positive (int size)
 Return true if size is positive. More...
 
template<typename T_y >
bool is_scal_finite (const T_y &y)
 Return true if y is finite. More...
 
template<typename T_size1 , typename T_size2 >
bool is_size_match (T_size1 i, T_size2 j)
 Return true if the provided sizes match. More...
 
void out_of_range (const char *function, int max, int index, const char *msg1="", const char *msg2="")
 Throw an out_of_range exception with a consistently formatted message. More...
 
void system_error (const char *function, const char *name, const int &y, const char *msg1, const char *msg2)
 Throw a system error with a consistently formatted message. More...
 
void system_error (const char *function, const char *name, const int &y, const char *msg1)
 Throw a system error with a consistently formatted message. More...
 
double abs (double x)
 Return floating-point absolute value. More...
 
double acosh (double x)
 Return the inverse hyperbolic cosine of the specified value. More...
 
double acosh (int x)
 Integer version of acosh. More...
 
template<typename T >
bool as_bool (const T &x)
 Return true if the argument is not equal to zero (in the != operator sense) and false otherwise. More...
 
double asinh (double x)
 Return the inverse hyperbolic sine of the specified value. More...
 
double asinh (int x)
 Integer version of asinh. More...
 
double atanh (double x)
 Return the inverse hyperbolic tangent of the specified value. More...
 
double atanh (int x)
 Integer version of atanh. More...
 
template<typename T2 >
T2 bessel_first_kind (int v, const T2 z)
 

\[ \mbox{bessel\_first\_kind}(v, x) = \begin{cases} J_v(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{error} & \mbox{if } x = \textrm{NaN} \end{cases} \]

More...
 
template<typename T2 >
T2 bessel_second_kind (int v, const T2 z)
 

\[ \mbox{bessel\_second\_kind}(v, x) = \begin{cases} \textrm{error} & \mbox{if } x \leq 0 \\ Y_v(x) & \mbox{if } x > 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type beta (const T1 a, const T2 b)
 Return the beta function applied to the specified arguments. More...
 
template<typename T >
binary_log_loss (int y, const T &y_hat)
 Returns the log loss function for binary classification with specified reference and response values. More...
 
template<typename T_N , typename T_n >
boost::math::tools::promote_args< T_N, T_n >::type binomial_coefficient_log (const T_N N, const T_n n)
 Return the log of the binomial coefficient for the specified arguments. More...
 
double cbrt (double x)
 Return the cube root of the specified value. More...
 
double cbrt (int x)
 Integer version of cbrt. More...
 
int choose (int n, int k)
 Return the binomial coefficient for the specified integer arguments. More...
 
double pi ()
 Return the value of pi. More...
 
double e ()
 Return the base of the natural logarithm. More...
 
double sqrt2 ()
 Return the square root of two. More...
 
double log10 ()
 Return natural logarithm of ten. More...
 
double positive_infinity ()
 Return positive infinity. More...
 
double negative_infinity ()
 Return negative infinity. More...
 
double not_a_number ()
 Return (quiet) not-a-number. More...
 
double machine_precision ()
 Returns the difference between 1.0 and the next value representable. More...
 
template<typename T >
corr_constrain (const T &x)
 Return the result of transforming the specified scalar to have a valid correlation value between -1 and 1 (inclusive). More...
 
template<typename T >
corr_constrain (const T &x, T &lp)
 Return the result of transforming the specified scalar to have a valid correlation value between -1 and 1 (inclusive). More...
 
template<typename T >
corr_free (const T &y)
 Return the unconstrained scalar that when transformed to a valid correlation produces the specified value. More...
 
double digamma (double x)
 Return the derivative of the log gamma function at the specified value. More...
 
template<typename T1 , typename T2 >
return_type< T1, T2 >::type distance (const T1 &x1, const T2 &x2)
 Returns the distance between two scalars. More...
 
template<typename T1 , typename T2 >
stan::return_type< T1, T2 >::type divide (const T1 &x, const T2 &y)
 Return the division of the first scalar by the second scalar. More...
 
int divide (int x, int y)
 
double erf (double x)
 Return the error function of the specified value. More...
 
double erf (int x)
 Return the error function of the specified argument. More...
 
double erfc (double x)
 Return the complementary error function of the specified value. More...
 
double erfc (int x)
 Return the error function of the specified argument. More...
 
double exp (int x)
 Return the natural exponential of the specified argument. More...
 
double exp2 (double y)
 Return the exponent base 2 of the specified argument (C99, C++11). More...
 
double exp2 (int y)
 Return the exponent base 2 of the specified argument (C99, C++11). More...
 
double expm1 (double x)
 Return the natural exponentiation of x minus one. More...
 
double expm1 (int x)
 Integer version of expm1. More...
 
template<typename T >
F32 (const T &a1, const T &a2, const T &a3, const T &b1, const T &b2, const T &z, double precision=1e-6, int max_steps=1e5)
 Hypergeometric function (3F2). More...
 
template<typename T >
boost::math::tools::promote_args< T >::type falling_factorial (const T &x, int n)
 Return the falling factorial function evaluated at the inputs. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type fdim (T1 x, T2 y)
 Return the positive difference of the specified values (C++11). More...
 
template<typename T , typename S >
void fill (T &x, const S &y)
 Fill the specified container with the specified value. More...
 
double finite_diff_stepsize (double u)
 Return the stepsize for finite difference evaluations at the specified scalar. More...
 
template<typename T1 , typename T2 , typename T3 >
boost::math::tools::promote_args< T1, T2, T3 >::type fma (const T1 &x, const T2 &y, const T3 &z)
 Return the product of the first two arguments plus the third argument. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type fmax (const T1 &x, const T2 &y)
 Return the greater of the two specified arguments. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type fmin (const T1 &x, const T2 &y)
 Return the lesser of the two specified arguments. More...
 
double gamma_p (double x, double a)
 

\[ \mbox{gamma\_p}(a, z) = \begin{cases} \textrm{error} & \mbox{if } a\leq 0 \textrm{ or } z < 0\\ P(a, z) & \mbox{if } a > 0, z \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } a = \textrm{NaN or } z = \textrm{NaN} \end{cases} \]

More...
 
double gamma_q (double x, double a)
 

\[ \mbox{gamma\_q}(a, z) = \begin{cases} \textrm{error} & \mbox{if } a\leq 0 \textrm{ or } z < 0\\ Q(a, z) & \mbox{if } a > 0, z \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } a = \textrm{NaN or } z = \textrm{NaN} \end{cases} \]

More...
 
template<typename T >
void grad_2F1 (T &g_a1, T &g_b1, const T &a1, const T &a2, const T &b1, const T &z, const T &precision=1e-10, int max_steps=1e5)
 Gradients of the hypergeometric function, 2F1. More...
 
template<typename T >
void grad_F32 (T *g, const T &a1, const T &a2, const T &a3, const T &b1, const T &b2, const T &z, const T &precision=1e-6, int max_steps=1e5)
 Gradients of the hypergeometric function, 3F2. More...
 
void grad_inc_beta (double &g1, double &g2, double a, double b, double z)
 
template<typename T >
void grad_reg_inc_beta (T &g1, T &g2, const T &a, const T &b, const T &z, const T &digammaA, const T &digammaB, const T &digammaSum, const T &betaAB)
 Computes the gradients of the regularized incomplete beta function. More...
 
template<typename T1 , typename T2 >
return_type< T1, T2 >::type grad_reg_inc_gamma (T1 a, T2 z, T1 g, T1 dig, double precision=1e-6, int max_steps=1e5)
 Gradient of the regularized incomplete gamma functions igamma(a, z) More...
 
template<typename T1 , typename T2 >
return_type< T1, T2 >::type grad_reg_lower_inc_gamma (const T1 &a, const T2 &z, double precision=1e-10, int max_steps=1e5)
 Computes the gradient of the lower regularized incomplete gamma function. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type hypot (const T1 &x, const T2 &y)
 Return the length of the hypoteneuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11). More...
 
double ibeta (double a, double b, double x)
 The normalized incomplete beta function of a, b, and x. More...
 
template<typename T >
identity_constrain (const T &x)
 Returns the result of applying the identity constraint transform to the input. More...
 
template<typename T >
identity_constrain (const T &x, T &)
 Returns the result of applying the identity constraint transform to the input and increments the log probability reference with the log absolute Jacobian determinant. More...
 
template<typename T >
identity_free (const T &y)
 Returns the result of applying the inverse of the identity constraint transform to the input. More...
 
template<typename T_true , typename T_false >
boost::math::tools::promote_args< T_true, T_false >::type if_else (const bool c, const T_true y_true, const T_false y_false)
 Return the second argument if the first argument is true and otherwise return the second argument. More...
 
double inc_beta (double a, double b, double x)
 
template<typename T >
inc_beta_dda (T a, T b, T z, T digamma_a, T digamma_ab)
 Returns the partial derivative of the regularized incomplete beta function, I_{z}(a, b) with respect to a. More...
 
template<typename T >
inc_beta_ddb (T a, T b, T z, T digamma_b, T digamma_ab)
 Returns the partial derivative of the regularized incomplete beta function, I_{z}(a, b) with respect to b. More...
 
template<typename T >
inc_beta_ddz (T a, T b, T z)
 Returns the partial derivative of the regularized incomplete beta function, I_{z}(a, b) with respect to z. More...
 
template<>
double inc_beta_ddz (double a, double b, double z)
 
template<typename T >
int int_step (const T &y)
 The integer step, or Heaviside, function. More...
 
double inv (double x)
 
double inv_cloglog (double x)
 The inverse complementary log-log function. More...
 
double inv_logit (double a)
 Returns the inverse logit function applied to the argument. More...
 
double inv_Phi (double p)
 The inverse of the unit normal cumulative distribution function. More...
 
double inv_sqrt (double x)
 
double inv_square (double x)
 
template<typename T >
bool is_any_nan (const T &x)
 Returns true if the input is NaN and false otherwise. More...
 
template<typename T , typename... Ts>
bool is_any_nan (const T &x, const Ts &... xs)
 Returns true if any input is NaN and false otherwise. More...
 
bool is_inf (double x)
 Returns true if the input is infinite and false otherwise. More...
 
template<typename T >
bool is_integer (T x)
 Returns true if the input is an integer and false otherwise. More...
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, bool > is_nan (T x)
 Returns true if the input is NaN and false otherwise. More...
 
template<typename T >
bool is_nonpositive_integer (T x)
 Returns true if the input is a nonpositive integer and false otherwise. More...
 
template<typename T >
bool is_uninitialized (T x)
 Returns true if the specified variable is uninitialized. More...
 
template<typename T , typename L >
boost::math::tools::promote_args< T, L >::type lb_constrain (const T &x, const L &lb)
 Return the lower-bounded value for the specified unconstrained input and specified lower bound. More...
 
template<typename T , typename L >
boost::math::tools::promote_args< T, L >::type lb_constrain (const T &x, const L &lb, T &lp)
 Return the lower-bounded value for the speicifed unconstrained input and specified lower bound, incrementing the specified reference with the log absolute Jacobian determinant of the transform. More...
 
template<typename T , typename L >
boost::math::tools::promote_args< T, L >::type lb_free (const T &y, const L &lb)
 Return the unconstrained value that produces the specified lower-bound constrained value. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type lbeta (const T1 a, const T2 b)
 Return the log of the beta function applied to the specified arguments. More...
 
template<typename T >
ldexp (const T &a, int b)
 Returns the product of a (the significand) and 2 to power b (the exponent). More...
 
double lgamma (double x)
 Return the natural logarithm of the gamma function applied to the specified argument. More...
 
double lgamma (int x)
 Return the natural logarithm of the gamma function applied to the specified argument. More...
 
template<typename T >
boost::math::tools::promote_args< T >::type lmgamma (int k, T x)
 Return the natural logarithm of the multivariate gamma function with the speciifed dimensions and argument. More...
 
template<typename T , typename M , typename S >
boost::math::tools::promote_args< T, M, S >::type locscale_constrain (const T &x, const M &mu, const S &sigma)
 Return the linearly transformed value for the specified unconstrained input and specified location and scale. More...
 
template<typename T , typename M , typename S >
boost::math::tools::promote_args< T, M, S >::type locscale_constrain (const T &x, const M &mu, const S &sigma, T &lp)
 Return the linearly transformed value for the specified unconstrained input and specified location and scale, incrementing the specified reference with the log absolute Jacobian determinant of the transform. More...
 
template<typename T , typename L , typename S >
boost::math::tools::promote_args< T, L, S >::type locscale_free (const T &y, const L &mu, const S &sigma)
 Return the unconstrained scalar that transforms to the specified location and scale constrained scalar given the specified location and scale. More...
 
double log (int x)
 Return the natural log of the specified argument. More...
 
double log1m (double x)
 Return the natural logarithm of one minus the specified value. More...
 
double log1m_exp (double a)
 Calculates the natural logarithm of one minus the exponential of the specified value without overflow,. More...
 
double log1m_inv_logit (double u)
 Returns the natural logarithm of 1 minus the inverse logit of the specified argument. More...
 
double log1m_inv_logit (int u)
 Return the natural logarithm of one minus the inverse logit of the specified argument. More...
 
double log1p (double x)
 Return the natural logarithm of one plus the specified value. More...
 
double log1p (int x)
 Return the natural logarithm of one plus the specified argument. More...
 
double log1p_exp (double a)
 Calculates the log of 1 plus the exponential of the specified value without overflow. More...
 
double log2 (double u)
 Returns the base two logarithm of the argument (C99, C++11). More...
 
double log2 (int u)
 Return the base two logarithm of the specified argument. More...
 
double log2 ()
 Return natural logarithm of two. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type log_diff_exp (const T1 x, const T2 y)
 The natural logarithm of the difference of the natural exponentiation of x1 and the natural exponentiation of x2. More...
 
template<typename T1 , typename T2 >
return_type< T1, T2 >::type log_falling_factorial (const T1 x, const T2 n)
 Return the natural log of the falling factorial of the specified arguments. More...
 
double log_inv_logit (double u)
 Returns the natural logarithm of the inverse logit of the specified argument. More...
 
double log_inv_logit (int u)
 Returns the natural logarithm of the inverse logit of the specified argument. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type log_inv_logit_diff (const T1 &x, const T2 &y)
 Returns the natural logarithm of the difference of the inverse logits of the specified arguments. More...
 
double log_mix (double theta, double lambda1, double lambda2)
 Return the log mixture density with specified mixing proportion and log densities. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2, double >::type log_modified_bessel_first_kind (const T1 v, const T2 z)
 
template<typename T1 , typename T2 >
return_type< T1, T2 >::type log_rising_factorial (const T1 &x, const T2 &n)
 Return the natural logarithm of the rising factorial from the first specified argument to the second. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type log_sum_exp (const T2 &a, const T1 &b)
 Calculates the log sum of exponetials without overflow. More...
 
template<typename T1 , typename T2 >
int logical_and (const T1 x1, const T2 x2)
 The logical and function which returns 1 if both arguments are unequal to zero and 0 otherwise. More...
 
template<typename T1 , typename T2 >
int logical_eq (const T1 x1, const T2 x2)
 Return 1 if the first argument is equal to the second. More...
 
template<typename T1 , typename T2 >
int logical_gt (const T1 x1, const T2 x2)
 Return 1 if the first argument is strictly greater than the second. More...
 
template<typename T1 , typename T2 >
int logical_gte (const T1 x1, const T2 x2)
 Return 1 if the first argument is greater than or equal to the second. More...
 
template<typename T1 , typename T2 >
int logical_lt (T1 x1, T2 x2)
 Return 1 if the first argument is strictly less than the second. More...
 
template<typename T1 , typename T2 >
int logical_lte (const T1 x1, const T2 x2)
 Return 1 if the first argument is less than or equal to the second. More...
 
template<typename T >
int logical_negation (const T &x)
 The logical negation function which returns one if the input is equal to zero and zero otherwise. More...
 
template<typename T1 , typename T2 >
int logical_neq (const T1 x1, const T2 x2)
 Return 1 if the first argument is unequal to the second. More...
 
template<typename T1 , typename T2 >
int logical_or (T1 x1, T2 x2)
 The logical or function which returns 1 if either argument is unequal to zero and 0 otherwise. More...
 
double logit (double u)
 Return the log odds of the argument. More...
 
double logit (int u)
 Return the log odds of the argument. More...
 
template<typename T , typename L , typename U >
boost::math::tools::promote_args< T, L, U >::type lub_constrain (const T &x, const L &lb, const U &ub)
 Return the lower- and upper-bounded scalar derived by transforming the specified free scalar given the specified lower and upper bounds. More...
 
template<typename T , typename L , typename U >
boost::math::tools::promote_args< T, L, U >::type lub_constrain (const T &x, const L &lb, const U &ub, T &lp)
 Return the lower- and upper-bounded scalar derived by transforming the specified free scalar given the specified lower and upper bounds and increment the specified log probability with the log absolute Jacobian determinant. More...
 
template<typename T , typename L , typename U >
boost::math::tools::promote_args< T, L, U >::type lub_free (const T &y, const L &lb, const U &ub)
 Return the unconstrained scalar that transforms to the specified lower- and upper-bounded scalar given the specified bounds. More...
 
template<typename T2 >
T2 modified_bessel_first_kind (int v, const T2 z)
 

\[ \mbox{modified\_bessel\_first\_kind}(v, z) = \begin{cases} I_v(z) & \mbox{if } -\infty\leq z \leq \infty \\[6pt] \textrm{error} & \mbox{if } z = \textrm{NaN} \end{cases} \]

More...
 
template<typename T2 >
T2 modified_bessel_second_kind (int v, const T2 z)
 

\[ \mbox{modified\_bessel\_second\_kind}(v, z) = \begin{cases} \textrm{error} & \mbox{if } z \leq 0 \\ K_v(z) & \mbox{if } z > 0 \\[6pt] \textrm{NaN} & \mbox{if } z = \textrm{NaN} \end{cases} \]

More...
 
int modulus (int x, int y)
 
template<typename T_a , typename T_b >
boost::math::tools::promote_args< T_a, T_b >::type multiply_log (const T_a a, const T_b b)
 Calculated the value of the first argument times log of the second argument while behaving properly with 0 inputs. More...
 
template<typename T , typename M , typename S >
boost::math::tools::promote_args< T, M, S >::type offset_multiplier_constrain (const T &x, const M &mu, const S &sigma)
 Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier. More...
 
template<typename T , typename M , typename S >
boost::math::tools::promote_args< T, M, S >::type offset_multiplier_constrain (const T &x, const M &mu, const S &sigma, T &lp)
 Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier, incrementing the specified reference with the log absolute Jacobian determinant of the transform. More...
 
template<typename T , typename L , typename S >
boost::math::tools::promote_args< T, L, S >::type offset_multiplier_free (const T &y, const L &mu, const S &sigma)
 Return the unconstrained scalar that transforms to the specified offset and multiplier constrained scalar given the specified offset and multiplier. More...
 
double owens_t (double h, double a)
 Return the result of applying Owen's T function to the specified arguments. More...
 
double Phi (double x)
 The unit normal cumulative distribution function. More...
 
double Phi_approx (double x)
 Return an approximation of the unit normal CDF. More...
 
double Phi_approx (int x)
 Return an approximation of the unit normal CDF. More...
 
template<typename T >
positive_constrain (const T &x)
 Return the positive value for the specified unconstrained input. More...
 
template<typename T >
positive_constrain (const T &x, T &lp)
 Return the positive value for the specified unconstrained input, incrementing the scalar reference with the log absolute Jacobian determinant. More...
 
template<typename T >
positive_free (const T &y)
 Return the unconstrained value corresponding to the specified positive-constrained value. More...
 
template<typename T >
std::enable_if< std::is_arithmetic< T >::value, T >::type primitive_value (T x)
 Return the value of the specified arithmetic argument unmodified with its own declared type. More...
 
template<typename T >
std::enable_if<!std::is_arithmetic< T >::value, double >::type primitive_value (const T &x)
 Return the primitive value of the specified argument. More...
 
template<typename T >
prob_constrain (const T &x)
 Return a probability value constrained to fall between 0 and 1 (inclusive) for the specified free scalar. More...
 
template<typename T >
prob_constrain (const T &x, T &lp)
 Return a probability value constrained to fall between 0 and 1 (inclusive) for the specified free scalar and increment the specified log probability reference with the log absolute Jacobian determinant of the transform. More...
 
template<typename T >
prob_free (const T &y)
 Return the free scalar that when transformed to a probability produces the specified scalar. More...
 
template<typename T , typename S >
promote_scalar_type< T, S >::type promote_scalar (const S &x)
 This is the top-level function to call to promote the scalar types of an input of type S to type T. More...
 
template<typename T >
boost::math::tools::promote_args< T >::type rising_factorial (const T &x, int n)
 Return the rising factorial function evaluated at the inputs. More...
 
double round (double x)
 Return the closest integer to the specified argument, with halfway cases rounded away from zero. More...
 
double round (int x)
 Return the closest integer to the specified argument, with halfway cases rounded away from zero. More...
 
template<typename T >
int sign (const T &z)
 
template<typename T >
bool size_zero (T &x)
 Returns 1 if input is of length 0, returns 0 otherwise. More...
 
template<typename T , typename... Ts>
bool size_zero (T &x, Ts &&... xs)
 Returns 1 if any inputs are of length 0, returns 0 otherwise. More...
 
double sqrt (int x)
 Return the square root of the specified argument. More...
 
double square (double x)
 Return the square of the specified argument. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type squared_distance (const T1 &x1, const T2 &x2)
 Returns the squared distance. More...
 
template<typename T >
double step (const T &y)
 The step, or Heaviside, function. More...
 
double sum (double v)
 Returns specified input value. More...
 
int sum (int v)
 Returns specified input value. More...
 
double tgamma (double x)
 Return the gamma function applied to the specified argument. More...
 
template<typename T >
trigamma_impl (const T &x)
 Return the trigamma function applied to the argument. More...
 
double trigamma (double u)
 Return the second derivative of the log Gamma function evaluated at the specified argument. More...
 
double trigamma (int u)
 Return the second derivative of the log Gamma function evaluated at the specified argument. More...
 
double trunc (double x)
 Return the nearest integral value that is not larger in magnitude than the specified argument. More...
 
double trunc (int x)
 Return the nearest integral value that is not larger in magnitude than the specified argument. More...
 
template<typename T , typename U >
boost::math::tools::promote_args< T, U >::type ub_constrain (const T &x, const U &ub)
 Return the upper-bounded value for the specified unconstrained scalar and upper bound. More...
 
template<typename T , typename U >
boost::math::tools::promote_args< T, U >::type ub_constrain (const T &x, const U &ub, T &lp)
 Return the upper-bounded value for the specified unconstrained scalar and upper bound and increment the specified log probability reference with the log absolute Jacobian determinant of the transform. More...
 
template<typename T , typename U >
boost::math::tools::promote_args< T, U >::type ub_free (const T &y, const U &ub)
 Return the free scalar that corresponds to the specified upper-bounded value with respect to the specified upper bound. More...
 
template<typename T >
double value_of (const T x)
 Return the value of the specified scalar argument converted to a double value. More...
 
template<>
double value_of< double > (double x)
 Return the specified argument. More...
 
int value_of (int x)
 Return the specified argument. More...
 
template<typename T >
double value_of_rec (const T x)
 Return the value of the specified scalar argument converted to a double value. More...
 
template<>
double value_of_rec< double > (double x)
 Return the specified argument. More...
 
template<typename T >
const T & as_array_or_scalar (const T &v)
 Returns specified input value. More...
 
template<typename T >
const T & as_column_vector_or_scalar (const T &a)
 Converts input argument to a column vector or a scalar. More...
 
double as_scalar (double a)
 Converts input to a scalar. More...
 
int as_scalar (int a)
 Converts input to a scalar. More...
 
template<typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_ccdf_log (const T_n &n, const T_prob &theta)
 
template<typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_cdf (const T_n &n, const T_prob &theta)
 Returns the CDF of the Bernoulli distribution. More...
 
template<typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_cdf_log (const T_n &n, const T_prob &theta)
 
template<typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_lccdf (const T_n &n, const T_prob &theta)
 Returns the log CCDF of the Bernoulli distribution. More...
 
template<typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_lcdf (const T_n &n, const T_prob &theta)
 Returns the log CDF of the Bernoulli distribution. More...
 
template<bool propto, typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_log (const T_n &n, const T_prob &theta)
 
template<typename T_y , typename T_prob >
return_type< T_prob >::type bernoulli_log (const T_y &n, const T_prob &theta)
 
template<bool propto, typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_logit_log (const T_n &n, const T_prob &theta)
 
template<typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_logit_log (const T_n &n, const T_prob &theta)
 
template<bool propto, typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_logit_lpmf (const T_n &n, const T_prob &theta)
 Returns the log PMF of the logit-parametrized Bernoulli distribution. More...
 
template<typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_logit_lpmf (const T_n &n, const T_prob &theta)
 
template<typename T_t , class RNG >
VectorBuilder< true, int, T_t >::type bernoulli_logit_rng (const T_t &t, RNG &rng)
 Return a Bernoulli random variate with logit-parameterized chance of success using the specified random number generator. More...
 
template<bool propto, typename T_n , typename T_prob >
return_type< T_prob >::type bernoulli_lpmf (const T_n &n, const T_prob &theta)
 Returns the log PMF of the Bernoulli distribution. More...
 
template<typename T_y , typename T_prob >
return_type< T_prob >::type bernoulli_lpmf (const T_y &n, const T_prob &theta)
 
template<typename T_theta , class RNG >
VectorBuilder< true, int, T_theta >::type bernoulli_rng (const T_theta &theta, RNG &rng)
 Return a Bernoulli random variate with specified chance of success parameter using the specified random number generator. More...
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type< T_size1, T_size2 >::type beta_binomial_ccdf_log (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type< T_size1, T_size2 >::type beta_binomial_cdf (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 Returns the CDF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters. More...
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type< T_size1, T_size2 >::type beta_binomial_cdf_log (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type< T_size1, T_size2 >::type beta_binomial_lccdf (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 Returns the log CCDF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters. More...
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type< T_size1, T_size2 >::type beta_binomial_lcdf (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 Returns the log CDF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters. More...
 
template<bool propto, typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type< T_size1, T_size2 >::type beta_binomial_log (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type< T_size1, T_size2 >::type beta_binomial_log (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 
template<bool propto, typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type< T_size1, T_size2 >::type beta_binomial_lpmf (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 Returns the log PMF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters. More...
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type< T_size1, T_size2 >::type beta_binomial_lpmf (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 
template<typename T_N , typename T_shape1 , typename T_shape2 , class RNG >
VectorBuilder< true, int, T_N, T_shape1, T_shape2 >::type beta_binomial_rng (const T_N &N, const T_shape1 &alpha, const T_shape2 &beta, RNG &rng)
 Return a beta-binomial random variate with the specified population size, success, and failure parameters using the given random number generator. More...
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type< T_y, T_scale_succ, T_scale_fail >::type beta_ccdf_log (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type< T_y, T_scale_succ, T_scale_fail >::type beta_cdf (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 Calculates the beta cumulative distribution function for the given variate and scale variables. More...
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type< T_y, T_scale_succ, T_scale_fail >::type beta_cdf_log (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type< T_y, T_scale_succ, T_scale_fail >::type beta_lccdf (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 Returns the beta log complementary cumulative distribution function for the given probability, success, and failure parameters. More...
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type< T_y, T_scale_succ, T_scale_fail >::type beta_lcdf (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 Returns the beta log cumulative distribution function for the given probability, success, and failure parameters. More...
 
template<bool propto, typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type< T_y, T_scale_succ, T_scale_fail >::type beta_log (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 The log of the beta density for the specified scalar(s) given the specified sample size(s). More...
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type< T_y, T_scale_succ, T_scale_fail >::type beta_log (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 
template<bool propto, typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type< T_y, T_scale_succ, T_scale_fail >::type beta_lpdf (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 The log of the beta density for the specified scalar(s) given the specified sample size(s). More...
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type< T_y, T_scale_succ, T_scale_fail >::type beta_lpdf (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 
template<typename T_y , typename T_loc , typename T_prec >
return_type< T_y, T_loc, T_prec >::type beta_proportion_ccdf_log (const T_y &y, const T_loc &mu, const T_prec &kappa)
 Returns the beta log complementary cumulative distribution function for specified probability, location, and precision parameters: beta_proportion_lccdf(y | mu, kappa) = beta_lccdf(y | mu * kappa, (1 - mu) * kappa). More...
 
template<typename T_y , typename T_loc , typename T_prec >
return_type< T_y, T_loc, T_prec >::type beta_proportion_cdf_log (const T_y &y, const T_loc &mu, const T_prec &kappa)
 Returns the beta log cumulative distribution function for specified probability, location, and precision parameters: beta_proportion_lcdf(y | mu, kappa) = beta_lcdf(y | mu * kappa, (1 - mu) * kappa). More...
 
template<typename T_y , typename T_loc , typename T_prec >
return_type< T_y, T_loc, T_prec >::type beta_proportion_lccdf (const T_y &y, const T_loc &mu, const T_prec &kappa)
 Returns the beta log complementary cumulative distribution function for specified probability, location, and precision parameters: beta_proportion_lccdf(y | mu, kappa) = beta_lccdf(y | mu * kappa, (1 - mu) * kappa). More...
 
template<typename T_y , typename T_loc , typename T_prec >
return_type< T_y, T_loc, T_prec >::type beta_proportion_lcdf (const T_y &y, const T_loc &mu, const T_prec &kappa)
 Returns the beta log cumulative distribution function for specified probability, location, and precision parameters: beta_proportion_lcdf(y | mu, kappa) = beta_lcdf(y | mu * kappa, (1 - mu) * kappa). More...
 
template<bool propto, typename T_y , typename T_loc , typename T_prec >
return_type< T_y, T_loc, T_prec >::type beta_proportion_log (const T_y &y, const T_loc &mu, const T_prec &kappa)
 The log of the beta density for specified y, location, and precision: beta_proportion_lpdf(y | mu, kappa) = beta_lpdf(y | mu * kappa, (1 - mu) * kappa). More...
 
template<typename T_y , typename T_loc , typename T_prec >
return_type< T_y, T_loc, T_prec >::type beta_proportion_log (const T_y &y, const T_loc &mu, const T_prec &kappa)
 
template<bool propto, typename T_y , typename T_loc , typename T_prec >
return_type< T_y, T_loc, T_prec >::type beta_proportion_lpdf (const T_y &y, const T_loc &mu, const T_prec &kappa)
 The log of the beta density for specified y, location, and precision: beta_proportion_lpdf(y | mu, kappa) = beta_lpdf(y | mu * kappa, (1 - mu) * kappa). More...
 
template<typename T_y , typename T_loc , typename T_prec >
return_type< T_y, T_loc, T_prec >::type beta_proportion_lpdf (const T_y &y, const T_loc &mu, const T_prec &kappa)
 
template<typename T_loc , typename T_prec , class RNG >
VectorBuilder< true, double, T_loc, T_prec >::type beta_proportion_rng (const T_loc &mu, const T_prec &kappa, RNG &rng)
 Return a Beta random variate specified probability, location, and precision parameters: beta_proportion_rng(y | mu, kappa) = beta_rng(y | mu * kappa, (1 - mu) * kappa). More...
 
template<typename T_shape1 , typename T_shape2 , class RNG >
VectorBuilder< true, double, T_shape1, T_shape2 >::type beta_rng (const T_shape1 &alpha, const T_shape2 &beta, RNG &rng)
 Return a Beta random variate with the supplied success and failure parameters using the given random number generator. More...
 
template<typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_ccdf_log (const T_n &n, const T_N &N, const T_prob &theta)
 
template<typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_cdf (const T_n &n, const T_N &N, const T_prob &theta)
 Returns the CDF for the binomial distribution evaluated at the specified success, population size, and chance of success. More...
 
template<typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_cdf_log (const T_n &n, const T_N &N, const T_prob &theta)
 
template<typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_lccdf (const T_n &n, const T_N &N, const T_prob &theta)
 Returns the log CCDF for the binomial distribution evaluated at the specified success, population size, and chance of success. More...
 
template<typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_lcdf (const T_n &n, const T_N &N, const T_prob &theta)
 Returns the log CDF for the binomial distribution evaluated at the specified success, population size, and chance of success. More...
 
template<bool propto, typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_log (const T_n &n, const T_N &N, const T_prob &theta)
 
template<typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_log (const T_n &n, const T_N &N, const T_prob &theta)
 
template<bool propto, typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_logit_log (const T_n &n, const T_N &N, const T_prob &alpha)
 
template<typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_logit_log (const T_n &n, const T_N &N, const T_prob &alpha)
 
template<bool propto, typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_logit_lpmf (const T_n &n, const T_N &N, const T_prob &alpha)
 Binomial log PMF in logit parametrization. More...
 
template<typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_logit_lpmf (const T_n &n, const T_N &N, const T_prob &alpha)
 
template<bool propto, typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_lpmf (const T_n &n, const T_N &N, const T_prob &theta)
 Returns the log PMF for the binomial distribution evaluated at the specified success, population size, and chance of success. More...
 
template<typename T_n , typename T_N , typename T_prob >
return_type< T_prob >::type binomial_lpmf (const T_n &n, const T_N &N, const T_prob &theta)
 
template<typename T_N , typename T_theta , class RNG >
VectorBuilder< true, int, T_N, T_theta >::type binomial_rng (const T_N &N, const T_theta &theta, RNG &rng)
 Return a pseudorandom binomial random variable for the given population size and chance of success parameters using the specified random number generator. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type cauchy_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type cauchy_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the cauchy cumulative distribution function for the given location, and scale. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type cauchy_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type cauchy_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the cauchy log complementary cumulative distribution function for the given location, and scale. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type cauchy_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the cauchy log cumulative distribution function for the given location, and scale. More...
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type cauchy_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 The log of the Cauchy density for the specified scalar(s) given the specified location parameter(s) and scale parameter(s). More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type cauchy_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type cauchy_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 The log of the Cauchy density for the specified scalar(s) given the specified location parameter(s) and scale parameter(s). More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type cauchy_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type cauchy_rng (const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a Cauchy random variate for the given location and scale using the specified random number generator. More...
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type chi_square_ccdf_log (const T_y &y, const T_dof &nu)
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type chi_square_cdf (const T_y &y, const T_dof &nu)
 Returns the chi square cumulative distribution function for the given variate and degrees of freedom. More...
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type chi_square_cdf_log (const T_y &y, const T_dof &nu)
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type chi_square_lccdf (const T_y &y, const T_dof &nu)
 Returns the chi square log complementary cumulative distribution function for the given variate and degrees of freedom. More...
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type chi_square_lcdf (const T_y &y, const T_dof &nu)
 Returns the chi square log cumulative distribution function for the given variate and degrees of freedom. More...
 
template<bool propto, typename T_y , typename T_dof >
return_type< T_y, T_dof >::type chi_square_log (const T_y &y, const T_dof &nu)
 The log of a chi-squared density for y with the specified degrees of freedom parameter. More...
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type chi_square_log (const T_y &y, const T_dof &nu)
 
template<bool propto, typename T_y , typename T_dof >
return_type< T_y, T_dof >::type chi_square_lpdf (const T_y &y, const T_dof &nu)
 The log of a chi-squared density for y with the specified degrees of freedom parameter. More...
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type chi_square_lpdf (const T_y &y, const T_dof &nu)
 
template<typename T_deg , class RNG >
VectorBuilder< true, double, T_deg >::type chi_square_rng (const T_deg &nu, RNG &rng)
 Return a chi squared random variate with nu degrees of freedom using the specified random number generator. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type double_exponential_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type double_exponential_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the double exponential cumulative density function. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type double_exponential_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type double_exponential_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the double exponential log complementary cumulative density function. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type double_exponential_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the double exponential log cumulative density function. More...
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type double_exponential_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type double_exponential_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type double_exponential_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the double exponential log probability density function. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type double_exponential_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type double_exponential_rng (const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a double exponential random variate with the given location and scale using the specified random number generator. More...
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type< T_y, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type< T_y, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type< T_y, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type< T_y, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type< T_y, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type< T_y, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type< T_y, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type< T_y, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type< T_y, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_loc , typename T_scale , typename T_inv_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_rng (const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda, RNG &rng)
 Return an exponentially modified normal random variate for the given location, scale, and inverse scale using the specified random number generator. More...
 
template<typename T_y , typename T_inv_scale >
return_type< T_y, T_inv_scale >::type exponential_ccdf_log (const T_y &y, const T_inv_scale &beta)
 
template<typename T_y , typename T_inv_scale >
return_type< T_y, T_inv_scale >::type exponential_cdf (const T_y &y, const T_inv_scale &beta)
 Calculates the exponential cumulative distribution function for the given y and beta. More...
 
template<typename T_y , typename T_inv_scale >
return_type< T_y, T_inv_scale >::type exponential_cdf_log (const T_y &y, const T_inv_scale &beta)
 
template<typename T_y , typename T_inv_scale >
return_type< T_y, T_inv_scale >::type exponential_lccdf (const T_y &y, const T_inv_scale &beta)
 
template<typename T_y , typename T_inv_scale >
return_type< T_y, T_inv_scale >::type exponential_lcdf (const T_y &y, const T_inv_scale &beta)
 
template<bool propto, typename T_y , typename T_inv_scale >
return_type< T_y, T_inv_scale >::type exponential_log (const T_y &y, const T_inv_scale &beta)
 The log of an exponential density for y with the specified inverse scale parameter. More...
 
template<typename T_y , typename T_inv_scale >
return_type< T_y, T_inv_scale >::type exponential_log (const T_y &y, const T_inv_scale &beta)
 
template<bool propto, typename T_y , typename T_inv_scale >
return_type< T_y, T_inv_scale >::type exponential_lpdf (const T_y &y, const T_inv_scale &beta)
 The log of an exponential density for y with the specified inverse scale parameter. More...
 
template<typename T_y , typename T_inv_scale >
return_type< T_y, T_inv_scale >::type exponential_lpdf (const T_y &y, const T_inv_scale &beta)
 
template<typename T_inv , class RNG >
VectorBuilder< true, double, T_inv >::type exponential_rng (const T_inv &beta, RNG &rng)
 Return a exponential random variate with inverse scale beta using the specified random number generator. More...
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type frechet_ccdf_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type frechet_cdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type frechet_cdf_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type frechet_lccdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type frechet_lcdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type frechet_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type frechet_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type frechet_lpdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type frechet_lpdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_shape , typename T_scale , class RNG >
VectorBuilder< true, double, T_shape, T_scale >::type frechet_rng (const T_shape &alpha, const T_scale &sigma, RNG &rng)
 Return a pseudorandom Frechet variate for the given shape and scale parameters using the specified random number generator. More...
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type< T_y, T_shape, T_inv_scale >::type gamma_ccdf_log (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type< T_y, T_shape, T_inv_scale >::type gamma_cdf (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 The cumulative density function for a gamma distribution for y with the specified shape and inverse scale parameters. More...
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type< T_y, T_shape, T_inv_scale >::type gamma_cdf_log (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type< T_y, T_shape, T_inv_scale >::type gamma_lccdf (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type< T_y, T_shape, T_inv_scale >::type gamma_lcdf (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<bool propto, typename T_y , typename T_shape , typename T_inv_scale >
return_type< T_y, T_shape, T_inv_scale >::type gamma_log (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 The log of a gamma density for y with the specified shape and inverse scale parameters. More...
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type< T_y, T_shape, T_inv_scale >::type gamma_log (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<bool propto, typename T_y , typename T_shape , typename T_inv_scale >
return_type< T_y, T_shape, T_inv_scale >::type gamma_lpdf (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 The log of a gamma density for y with the specified shape and inverse scale parameters. More...
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type< T_y, T_shape, T_inv_scale >::type gamma_lpdf (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_shape , typename T_inv , class RNG >
VectorBuilder< true, double, T_shape, T_inv >::type gamma_rng (const T_shape &alpha, const T_inv &beta, RNG &rng)
 Return a gamma random variate for the given shape and inverse scale parameters using the specified random number generator. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type gumbel_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &beta)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type gumbel_cdf (const T_y &y, const T_loc &mu, const T_scale &beta)
 Returns the Gumbel distribution cumulative distribution for the given location and scale. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type gumbel_cdf_log (const T_y &y, const T_loc &mu, const T_scale &beta)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type gumbel_lccdf (const T_y &y, const T_loc &mu, const T_scale &beta)
 Returns the Gumbel log complementary cumulative distribution for the given location and scale. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type gumbel_lcdf (const T_y &y, const T_loc &mu, const T_scale &beta)
 Returns the Gumbel log cumulative distribution for the given location and scale. More...
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type gumbel_log (const T_y &y, const T_loc &mu, const T_scale &beta)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type gumbel_log (const T_y &y, const T_loc &mu, const T_scale &beta)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type gumbel_lpdf (const T_y &y, const T_loc &mu, const T_scale &beta)
 Returns the Gumbel log probability density for the given location and scale. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type gumbel_lpdf (const T_y &y, const T_loc &mu, const T_scale &beta)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type gumbel_rng (const T_loc &mu, const T_scale &beta, RNG &rng)
 Return a Gumbel random variate with the given location and scale using the specified random number generator. More...
 
template<bool propto, typename T_n , typename T_N , typename T_a , typename T_b >
double hypergeometric_log (const T_n &n, const T_N &N, const T_a &a, const T_b &b)
 
template<typename T_n , typename T_N , typename T_a , typename T_b >
double hypergeometric_log (const T_n &n, const T_N &N, const T_a &a, const T_b &b)
 
template<bool propto, typename T_n , typename T_N , typename T_a , typename T_b >
double hypergeometric_lpmf (const T_n &n, const T_N &N, const T_a &a, const T_b &b)
 
template<typename T_n , typename T_N , typename T_a , typename T_b >
double hypergeometric_lpmf (const T_n &n, const T_N &N, const T_a &a, const T_b &b)
 
template<class RNG >
int hypergeometric_rng (int N, int a, int b, RNG &rng)
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type inv_chi_square_ccdf_log (const T_y &y, const T_dof &nu)
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type inv_chi_square_cdf (const T_y &y, const T_dof &nu)
 Returns the inverse chi square cumulative distribution function for the given variate and degrees of freedom. More...
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type inv_chi_square_cdf_log (const T_y &y, const T_dof &nu)
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type inv_chi_square_lccdf (const T_y &y, const T_dof &nu)
 Returns the inverse chi square log complementary cumulative distribution function for the given variate and degrees of freedom. More...
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type inv_chi_square_lcdf (const T_y &y, const T_dof &nu)
 Returns the inverse chi square log cumulative distribution function for the given variate and degrees of freedom. More...
 
template<bool propto, typename T_y , typename T_dof >
return_type< T_y, T_dof >::type inv_chi_square_log (const T_y &y, const T_dof &nu)
 The log of an inverse chi-squared density for y with the specified degrees of freedom parameter. More...
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type inv_chi_square_log (const T_y &y, const T_dof &nu)
 
template<bool propto, typename T_y , typename T_dof >
return_type< T_y, T_dof >::type inv_chi_square_lpdf (const T_y &y, const T_dof &nu)
 The log of an inverse chi-squared density for y with the specified degrees of freedom parameter. More...
 
template<typename T_y , typename T_dof >
return_type< T_y, T_dof >::type inv_chi_square_lpdf (const T_y &y, const T_dof &nu)
 
template<typename T_deg , class RNG >
VectorBuilder< true, double, T_deg >::type inv_chi_square_rng (const T_deg &nu, RNG &rng)
 Return a pseudorandom inverse chi squared variate with the nu degrees of freedom using the specified random number generator. More...
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type inv_gamma_ccdf_log (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type inv_gamma_cdf (const T_y &y, const T_shape &alpha, const T_scale &beta)
 The CDF of an inverse gamma density for y with the specified shape and scale parameters. More...
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type inv_gamma_cdf_log (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type inv_gamma_lccdf (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type inv_gamma_lcdf (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type inv_gamma_log (const T_y &y, const T_shape &alpha, const T_scale &beta)
 The log of an inverse gamma density for y with the specified shape and scale parameters. More...
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type inv_gamma_log (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type inv_gamma_lpdf (const T_y &y, const T_shape &alpha, const T_scale &beta)
 The log of an inverse gamma density for y with the specified shape and scale parameters. More...
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type inv_gamma_lpdf (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<typename T_shape , typename T_scale , class RNG >
VectorBuilder< true, double, T_shape, T_scale >::type inv_gamma_rng (const T_shape &alpha, const T_scale &beta, RNG &rng)
 Return a pseudorandom inverse gamma variate for the given shape and scale parameters using the specified random number generator. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type logistic_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type logistic_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type logistic_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type logistic_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type logistic_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type logistic_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type logistic_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type logistic_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type logistic_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type logistic_rng (const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a Logistic random variate for the given location and scale using the specified random number generator. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type lognormal_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type lognormal_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type lognormal_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type lognormal_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type lognormal_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type lognormal_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type lognormal_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type lognormal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type lognormal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type lognormal_rng (const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a lognormal random variate for the given location and scale using the specified random number generator. More...
 
template<typename T_n , typename T_location , typename T_precision >
return_type< T_location, T_precision >::type neg_binomial_2_ccdf_log (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type< T_location, T_precision >::type neg_binomial_2_cdf (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type< T_location, T_precision >::type neg_binomial_2_cdf_log (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type< T_location, T_precision >::type neg_binomial_2_lccdf (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type< T_location, T_precision >::type neg_binomial_2_lcdf (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<bool propto, typename T_n , typename T_location , typename T_precision >
return_type< T_location, T_precision >::type neg_binomial_2_log (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type< T_location, T_precision >::type neg_binomial_2_log (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<bool propto, typename T_n , typename T_log_location , typename T_precision >
return_type< T_log_location, T_precision >::type neg_binomial_2_log_log (const T_n &n, const T_log_location &eta, const T_precision &phi)
 
template<typename T_n , typename T_log_location , typename T_precision >
return_type< T_log_location, T_precision >::type neg_binomial_2_log_log (const T_n &n, const T_log_location &eta, const T_precision &phi)
 
template<bool propto, typename T_n , typename T_log_location , typename T_precision >
return_type< T_log_location, T_precision >::type neg_binomial_2_log_lpmf (const T_n &n, const T_log_location &eta, const T_precision &phi)
 
template<typename T_n , typename T_log_location , typename T_precision >
return_type< T_log_location, T_precision >::type neg_binomial_2_log_lpmf (const T_n &n, const T_log_location &eta, const T_precision &phi)
 
template<typename T_loc , typename T_inv , class RNG >
VectorBuilder< true, int, T_loc, T_inv >::type neg_binomial_2_log_rng (const T_loc &eta, const T_inv &phi, RNG &rng)
 Return a negative binomial random variate with the specified log-location and inverse dispersion parameters using the given random number generator. More...
 
template<bool propto, typename T_n , typename T_location , typename T_precision >
return_type< T_location, T_precision >::type neg_binomial_2_lpmf (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type< T_location, T_precision >::type neg_binomial_2_lpmf (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_loc , typename T_prec , class RNG >
VectorBuilder< true, int, T_loc, T_prec >::type neg_binomial_2_rng (const T_loc &mu, const T_prec &phi, RNG &rng)
 Return a negative binomial random variate with the specified location and precision parameters using the given random number generator. More...
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type< T_shape, T_inv_scale >::type neg_binomial_ccdf_log (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type< T_shape, T_inv_scale >::type neg_binomial_cdf (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type< T_shape, T_inv_scale >::type neg_binomial_cdf_log (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type< T_shape, T_inv_scale >::type neg_binomial_lccdf (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type< T_shape, T_inv_scale >::type neg_binomial_lcdf (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<bool propto, typename T_n , typename T_shape , typename T_inv_scale >
return_type< T_shape, T_inv_scale >::type neg_binomial_log (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type< T_shape, T_inv_scale >::type neg_binomial_log (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<bool propto, typename T_n , typename T_shape , typename T_inv_scale >
return_type< T_shape, T_inv_scale >::type neg_binomial_lpmf (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type< T_shape, T_inv_scale >::type neg_binomial_lpmf (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_shape , typename T_inv , class RNG >
VectorBuilder< true, int, T_shape, T_inv >::type neg_binomial_rng (const T_shape &alpha, const T_inv &beta, RNG &rng)
 Return a negative binomial random variate with the specified shape and inverse scale parameters using the given random number generator. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type normal_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type normal_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Calculates the normal cumulative distribution function for the given variate, location, and scale. More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type normal_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type normal_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type normal_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 The log of the normal density for the specified scalar(s) given the specified mean(s) and deviation(s). More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 The log of the normal density for the specified scalar(s) given the specified mean(s) and deviation(s). More...
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type normal_rng (const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a Normal random variate for the given location and scale using the specified random number generator. More...
 
template<bool propto, typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type< T_y, T_s, T_loc, T_scale >::type normal_sufficient_log (const T_y &y_bar, const T_s &s_squared, const T_n &n_obs, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type< T_y, T_s, T_loc, T_scale >::type normal_sufficient_log (const T_y &y_bar, const T_s &s_squared, const T_n &n_obs, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type< T_y, T_s, T_loc, T_scale >::type normal_sufficient_lpdf (const T_y &y_bar, const T_s &s_squared, const T_n &n_obs, const T_loc &mu, const T_scale &sigma)
 The log of the normal density for the specified scalar(s) given the specified mean(s) and deviation(s). More...
 
template<typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type< T_y, T_s, T_loc, T_scale >::type normal_sufficient_lpdf (const T_y &y_bar, const T_s &s_squared, const T_n &n_obs, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type< T_y, T_scale, T_shape >::type pareto_ccdf_log (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type< T_y, T_scale, T_shape >::type pareto_cdf (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type< T_y, T_scale, T_shape >::type pareto_cdf_log (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type< T_y, T_scale, T_shape >::type pareto_lccdf (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type< T_y, T_scale, T_shape >::type pareto_lcdf (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_scale , typename T_shape >
return_type< T_y, T_scale, T_shape >::type pareto_log (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type< T_y, T_scale, T_shape >::type pareto_log (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_scale , typename T_shape >
return_type< T_y, T_scale, T_shape >::type pareto_lpdf (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type< T_y, T_scale, T_shape >::type pareto_lpdf (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_shape , typename T_scale , class RNG >
VectorBuilder< true, double, T_shape, T_scale >::type pareto_rng (const T_scale &y_min, const T_shape &alpha, RNG &rng)
 Return a Pareto random variate for the given shape and scale parameters using the specified random number generator. More...
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type pareto_type_2_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type pareto_type_2_cdf (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type pareto_type_2_cdf_log (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type pareto_type_2_lccdf (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type pareto_type_2_lcdf (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type pareto_type_2_log (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type pareto_type_2_log (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type pareto_type_2_lpdf (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type pareto_type_2_lpdf (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_loc , typename T_scale , typename T_shape , class RNG >
VectorBuilder< true, double, T_loc, T_scale, T_shape >::type pareto_type_2_rng (const T_loc &mu, const T_scale &lambda, const T_shape &alpha, RNG &rng)
 Return a Pareto type 2 random variate for the given location, scale, and shape using the specified random number generator. More...
 
template<typename T_n , typename T_rate >
return_type< T_rate >::type poisson_ccdf_log (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type< T_rate >::type poisson_cdf (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type< T_rate >::type poisson_cdf_log (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type< T_rate >::type poisson_lccdf (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type< T_rate >::type poisson_lcdf (const T_n &n, const T_rate &lambda)
 
template<bool propto, typename T_n , typename T_rate >
return_type< T_rate >::type poisson_log (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type< T_rate >::type poisson_log (const T_n &n, const T_rate &lambda)
 
template<bool propto, typename T_n , typename T_log_rate >
return_type< T_log_rate >::type poisson_log_log (const T_n &n, const T_log_rate &alpha)
 
template<typename T_n , typename T_log_rate >
return_type< T_log_rate >::type poisson_log_log (const T_n &n, const T_log_rate &alpha)
 
template<bool propto, typename T_n , typename T_log_rate >
return_type< T_log_rate >::type poisson_log_lpmf (const T_n &n, const T_log_rate &alpha)
 
template<typename T_n , typename T_log_rate >
return_type< T_log_rate >::type poisson_log_lpmf (const T_n &n, const T_log_rate &alpha)
 
template<typename T_rate , class RNG >
VectorBuilder< true, int, T_rate >::type poisson_log_rng (const T_rate &alpha, RNG &rng)
 Return a Poisson random variate with specified log rate parameter using the given random number generator. More...
 
template<bool propto, typename T_n , typename T_rate >
return_type< T_rate >::type poisson_lpmf (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type< T_rate >::type poisson_lpmf (const T_n &n, const T_rate &lambda)
 
template<typename T_rate , class RNG >
VectorBuilder< true, int, T_rate >::type poisson_rng (const T_rate &lambda, RNG &rng)
 Return a Poisson random variate with specified rate parameter using the given random number generator. More...
 
template<typename T_y , typename T_scale >
return_type< T_y, T_scale >::type rayleigh_ccdf_log (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale >
return_type< T_y, T_scale >::type rayleigh_cdf (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale >
return_type< T_y, T_scale >::type rayleigh_cdf_log (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale >
return_type< T_y, T_scale >::type rayleigh_lccdf (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale >
return_type< T_y, T_scale >::type rayleigh_lcdf (const T_y &y, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_scale >
return_type< T_y, T_scale >::type rayleigh_log (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale >
return_type< T_y, T_scale >::type rayleigh_log (const T_y &y, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_scale >
return_type< T_y, T_scale >::type rayleigh_lpdf (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale >
return_type< T_y, T_scale >::type rayleigh_lpdf (const T_y &y, const T_scale &sigma)
 
template<typename T_scale , class RNG >
VectorBuilder< true, double, T_scale >::type rayleigh_rng (const T_scale &sigma, RNG &rng)
 Return a Rayleigh random variate with scale parameter sigma using the specified random number generator. More...
 
template<typename T_y , typename T_dof , typename T_scale >
return_type< T_y, T_dof, T_scale >::type scaled_inv_chi_square_ccdf_log (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<typename T_y , typename T_dof , typename T_scale >
return_type< T_y, T_dof, T_scale >::type scaled_inv_chi_square_cdf (const T_y &y, const T_dof &nu, const T_scale &s)
 The CDF of a scaled inverse chi-squared density for y with the specified degrees of freedom parameter and scale parameter. More...
 
template<typename T_y , typename T_dof , typename T_scale >
return_type< T_y, T_dof, T_scale >::type scaled_inv_chi_square_cdf_log (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<typename T_y , typename T_dof , typename T_scale >
return_type< T_y, T_dof, T_scale >::type scaled_inv_chi_square_lccdf (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<typename T_y , typename T_dof , typename T_scale >
return_type< T_y, T_dof, T_scale >::type scaled_inv_chi_square_lcdf (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale >
return_type< T_y, T_dof, T_scale >::type scaled_inv_chi_square_log (const T_y &y, const T_dof &nu, const T_scale &s)
 The log of a scaled inverse chi-squared density for y with the specified degrees of freedom parameter and scale parameter. More...
 
template<typename T_y , typename T_dof , typename T_scale >
return_type< T_y, T_dof, T_scale >::type scaled_inv_chi_square_log (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale >
return_type< T_y, T_dof, T_scale >::type scaled_inv_chi_square_lpdf (const T_y &y, const T_dof &nu, const T_scale &s)
 The log of a scaled inverse chi-squared density for y with the specified degrees of freedom parameter and scale parameter. More...
 
template<typename T_y , typename T_dof , typename T_scale >
return_type< T_y, T_dof, T_scale >::type scaled_inv_chi_square_lpdf (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<typename T_deg , typename T_scale , class RNG >
VectorBuilder< true, double, T_deg, T_scale >::type scaled_inv_chi_square_rng (const T_deg &nu, const T_scale &s, RNG &rng)
 Return a scaled chi square random variate for the given number of degrees of freedom and scale using the specified random number generator. More...
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type skew_normal_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type skew_normal_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type skew_normal_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type skew_normal_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type skew_normal_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type skew_normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type skew_normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type skew_normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type< T_y, T_loc, T_scale, T_shape >::type skew_normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_loc , typename T_scale , typename T_shape , class RNG >
VectorBuilder< true, double, T_loc, T_scale, T_shape >::type skew_normal_rng (const T_loc &mu, const T_scale &sigma, const T_shape &alpha, RNG &rng)
 Return a Skew-normal random variate for the given location, scale, and shape using the specified random number generator. More...
 
template<bool propto, typename T_y >
return_type< T_y >::type std_normal_log (const T_y &y)
 The log of a standard normal density for the specified scalar(s). More...
 
template<typename T_y >
return_type< T_y >::type std_normal_log (const T_y &y)
 
template<bool propto, typename T_y >
return_type< T_y >::type std_normal_lpdf (const T_y &y)
 The log of the normal density for the specified scalar(s) given a location of 0 and a scale of 1. More...
 
template<typename T_y >
return_type< T_y >::type std_normal_lpdf (const T_y &y)
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type student_t_ccdf_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type student_t_cdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type student_t_cdf_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type student_t_lccdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type student_t_lcdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type student_t_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 The log of the Student-t density for the given y, nu, mean, and scale parameter. More...
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type student_t_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type student_t_lpdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 The log of the Student-t density for the given y, nu, mean, and scale parameter. More...
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type< T_y, T_dof, T_loc, T_scale >::type student_t_lpdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<typename T_deg , typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_deg, T_loc, T_scale >::type student_t_rng (const T_deg &nu, const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a student-t random variate for the given degrees of freedom, location, and scale using the specified random number generator. More...
 
template<typename T_y , typename T_low , typename T_high >
return_type< T_y, T_low, T_high >::type uniform_ccdf_log (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<typename T_y , typename T_low , typename T_high >
return_type< T_y, T_low, T_high >::type uniform_cdf (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<typename T_y , typename T_low , typename T_high >
return_type< T_y, T_low, T_high >::type uniform_cdf_log (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<typename T_y , typename T_low , typename T_high >
return_type< T_y, T_low, T_high >::type uniform_lccdf (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<typename T_y , typename T_low , typename T_high >
return_type< T_y, T_low, T_high >::type uniform_lcdf (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<bool propto, typename T_y , typename T_low , typename T_high >
return_type< T_y, T_low, T_high >::type uniform_log (const T_y &y, const T_low &alpha, const T_high &beta)
 The log of a uniform density for the given y, lower, and upper bound. More...
 
template<typename T_y , typename T_low , typename T_high >
return_type< T_y, T_low, T_high >::type uniform_log (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<bool propto, typename T_y , typename T_low , typename T_high >
return_type< T_y, T_low, T_high >::type uniform_lpdf (const T_y &y, const T_low &alpha, const T_high &beta)
 The log of a uniform density for the given y, lower, and upper bound. More...
 
template<typename T_y , typename T_low , typename T_high >
return_type< T_y, T_low, T_high >::type uniform_lpdf (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<typename T_alpha , typename T_beta , class RNG >
VectorBuilder< true, double, T_alpha, T_beta >::type uniform_rng (const T_alpha &alpha, const T_beta &beta, RNG &rng)
 Return a uniform random variate for the given upper and lower bounds using the specified random number generator. More...
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type von_mises_log (T_y const &y, T_loc const &mu, T_scale const &kappa)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type von_mises_log (T_y const &y, T_loc const &mu, T_scale const &kappa)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type von_mises_lpdf (T_y const &y, T_loc const &mu, T_scale const &kappa)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type< T_y, T_loc, T_scale >::type von_mises_lpdf (T_y const &y, T_loc const &mu, T_scale const &kappa)
 
template<typename T_loc , typename T_conc , class RNG >
VectorBuilder< true, double, T_loc, T_conc >::type von_mises_rng (const T_loc &mu, const T_conc &kappa, RNG &rng)
 Return a von Mises random variate for the given location and concentration using the specified random number generator. More...
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type weibull_ccdf_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type weibull_cdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 Returns the Weibull cumulative distribution function for the given location and scale. More...
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type weibull_cdf_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type weibull_lccdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 Returns the Weibull log complementary cumulative distribution function for the given location and scale. More...
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type weibull_lcdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 Returns the Weibull log cumulative distribution function for the given location and scale. More...
 
template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type weibull_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type weibull_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type weibull_lpdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 Returns the Weibull log probability density for the given location and scale. More...
 
template<typename T_y , typename T_shape , typename T_scale >
return_type< T_y, T_shape, T_scale >::type weibull_lpdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_shape , typename T_scale , class RNG >
VectorBuilder< true, double, T_shape, T_scale >::type weibull_rng (const T_shape &alpha, const T_scale &sigma, RNG &rng)
 Return a Weibull random variate for the given shape and scale parameters using the specified random number generator. More...
 
template<bool propto, typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type< T_y, T_alpha, T_tau, T_beta, T_delta >::type wiener_log (const T_y &y, const T_alpha &alpha, const T_tau &tau, const T_beta &beta, const T_delta &delta)
 The log of the first passage time density function for a (Wiener) drift diffusion model for the given $y$, boundary separation $\alpha$, nondecision time $\tau$, relative bias $\beta$, and drift rate $\delta$. More...
 
template<typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type< T_y, T_alpha, T_tau, T_beta, T_delta >::type wiener_log (const T_y &y, const T_alpha &alpha, const T_tau &tau, const T_beta &beta, const T_delta &delta)
 
template<bool propto, typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type< T_y, T_alpha, T_tau, T_beta, T_delta >::type wiener_lpdf (const T_y &y, const T_alpha &alpha, const T_tau &tau, const T_beta &beta, const T_delta &delta)
 The log of the first passage time density function for a (Wiener) drift diffusion model for the given $y$, boundary separation $\alpha$, nondecision time $\tau$, relative bias $\beta$, and drift rate $\delta$. More...
 
template<typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type< T_y, T_alpha, T_tau, T_beta, T_delta >::type wiener_lpdf (const T_y &y, const T_alpha &alpha, const T_tau &tau, const T_beta &beta, const T_delta &delta)
 
var log_sum_exp (const std::vector< var > &x)
 Returns the log sum of exponentials. More...
 
var sum (const std::vector< var > &m)
 Returns the sum of the entries of the specified vector. More...
 
std::vector< varto_var (const std::vector< double > &v)
 Converts argument to an automatic differentiation variable. More...
 
std::vector< varto_var (const std::vector< var > &v)
 Converts argument to an automatic differentiation variable. More...
 
template<typename F >
double gradient_of_f (const F &f, const double &x, const double &xc, const std::vector< double > &theta_vals, const std::vector< double > &x_r, const std::vector< int > &x_i, size_t n, std::ostream &msgs)
 Calculate first derivative of f(x, param, std::ostream&) with respect to the nth parameter. More...
 
template<typename F , typename T_a , typename T_b , typename T_theta >
std::enable_if< std::is_same< T_a, var >::value||std::is_same< T_b, var >::value||std::is_same< T_theta, var >::value, var >::type integrate_1d (const F &f, const T_a &a, const T_b &b, const std::vector< T_theta > &theta, const std::vector< double > &x_r, const std::vector< int > &x_i, std::ostream &msgs, const double relative_tolerance=std::sqrt(std::numeric_limits< double >::epsilon()))
 Compute the integral of the single variable function f from a to b to within a specified relative tolerance. More...
 
template<int R, int C>
vari ** build_vari_array (const Eigen::Matrix< var, R, C > &x)
 Allocates and populates a flat array of vari pointers in the autodiff arena with the varis pointed to by the vars in the input Eigen matrix. More...
 
static bool empty_nested ()
 Return true if there is no nested autodiff being executed. More...
 
static void grad (vari *vi)
 Compute the gradient for all variables starting from the specified root variable implementation. More...
 
static size_t nested_size ()
 
var operator+ (const var &a, const var &b)
 Addition operator for variables (C++). More...
 
var operator+ (const var &a, double b)
 Addition operator for variable and scalar (C++). More...
 
var operator+ (double a, const var &b)
 Addition operator for scalar and variable (C++). More...
 
var operator/ (const var &a, const var &b)
 Division operator for two variables (C++). More...
 
var operator/ (const var &a, double b)
 Division operator for dividing a variable by a scalar (C++). More...
 
var operator/ (double a, const var &b)
 Division operator for dividing a scalar by a variable (C++). More...
 
bool operator== (const var &a, const var &b)
 Equality operator comparing two variables' values (C++). More...
 
bool operator== (const var &a, double b)
 Equality operator comparing a variable's value and a double (C++). More...
 
bool operator== (double a, const var &b)
 Equality operator comparing a scalar and a variable's value (C++). More...
 
bool operator> (const var &a, const var &b)
 Greater than operator comparing variables' values (C++). More...
 
bool operator> (const var &a, double b)
 Greater than operator comparing variable's value and double (C++). More...
 
bool operator> (double a, const var &b)
 Greater than operator comparing a double and a variable's value (C++). More...
 
bool operator>= (const var &a, const var &b)
 Greater than or equal operator comparing two variables' values (C++). More...
 
bool operator>= (const var &a, double b)
 Greater than or equal operator comparing variable's value and double (C++). More...
 
bool operator>= (double a, const var &b)
 Greater than or equal operator comparing double and variable's value (C++). More...
 
bool operator< (const var &a, const var &b)
 Less than operator comparing variables' values (C++). More...
 
bool operator< (const var &a, double b)
 Less than operator comparing variable's value and a double (C++). More...
 
bool operator< (double a, const var &b)
 Less than operator comparing a double and variable's value (C++). More...
 
bool operator<= (const var &a, const var &b)
 Less than or equal operator comparing two variables' values (C++). More...
 
bool operator<= (const var &a, double b)
 Less than or equal operator comparing a variable's value and a scalar (C++). More...
 
bool operator<= (double a, const var &b)
 Less than or equal operator comparing a double and variable's value (C++). More...
 
bool operator && (const var &x, const var &y)
 Return the logical conjunction of the values of the two arguments as defined by &&. More...
 
template<typename T >
bool operator && (const var &x, double y)
 Return the logical conjunction of the values of the two arguments as defined by &&. More...
 
template<typename T >
bool operator && (double x, const var &y)
 Return the logical conjunction of the values of the two arguments as defined by &&. More...
 
bool operator|| (const var &x, const var &y)
 Return the logical disjunction of the values of the two arguments as defined by ||. More...
 
template<typename T >
bool operator|| (const var &x, double y)
 Return the logical disjunction of the values of the two arguments as defined by ||. More...
 
template<typename T >
bool operator|| (double x, const var &y)
 Return the logical disjunction of the values of the two arguments as defined by ||. More...
 
var operator* (const var &a, const var &b)
 Multiplication operator for two variables (C++). More...
 
var operator* (const var &a, double b)
 Multiplication operator for a variable and a scalar (C++). More...
 
var operator* (double a, const var &b)
 Multiplication operator for a scalar and a variable (C++). More...
 
bool operator!= (const var &a, const var &b)
 Inequality operator comparing two variables' values (C++). More...
 
bool operator!= (const var &a, double b)
 Inequality operator comparing a variable's value and a double (C++). More...
 
bool operator!= (double a, const var &b)
 Inequality operator comparing a double and a variable's value (C++). More...
 
var operator- (const var &a, const var &b)
 Subtraction operator for variables (C++). More...
 
var operator- (const var &a, double b)
 Subtraction operator for variable and scalar (C++). More...
 
var operator- (double a, const var &b)
 Subtraction operator for scalar and variable (C++). More...
 
varoperator-- (var &a)
 Prefix decrement operator for variables (C++). More...
 
var operator-- (var &a, int)
 Postfix decrement operator for variables (C++). More...
 
varoperator++ (var &a)
 Prefix increment operator for variables (C++). More...
 
var operator++ (var &a, int)
 Postfix increment operator for variables (C++). More...
 
var operator- (const var &a)
 Unary negation operator for variables (C++). More...
 
bool operator! (const var &x)
 Return the negation of the value of the argument as defined by !. More...
 
var operator+ (const var &a)
 Unary plus operator for variables (C++). More...
 
var precomputed_gradients (double value, const std::vector< var > &operands, const std::vector< double > &gradients)
 This function returns a var for an expression that has the specified value, vector of operands, and vector of partial derivatives of value with respect to the operands. More...
 
void print_stack (std::ostream &o)
 Prints the auto-dif variable stack. More...
 
static void recover_memory ()
 Recover memory used for all variables for reuse. More...
 
static void recover_memory_nested ()
 Recover only the memory used for the top nested call. More...
 
static void set_zero_all_adjoints ()
 Reset all adjoint values in the stack to zero. More...
 
static void set_zero_all_adjoints_nested ()
 Reset all adjoint values in the top nested portion of the stack to zero. More...
 
static void start_nested ()
 Record the current position so that recover_memory_nested() can find it. More...
 
static void grad (vari *vi)
 
Eigen::Matrix< var, -1, -1 > cholesky_decompose (const Eigen::Matrix< var, -1, -1 > &A)
 Reverse mode specialization of cholesky decomposition. More...
 
template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
std::enable_if< std::is_same< T1, var >::value||std::is_same< T2, var >::value, Eigen::Matrix< var, 1, C1 > >::type columns_dot_product (const Eigen::Matrix< T1, R1, C1 > &v1, const Eigen::Matrix< T2, R2, C2 > &v2)
 
template<int R, int C>
Eigen::Matrix< var, 1, C > columns_dot_self (const Eigen::Matrix< var, R, C > &x)
 Returns the dot product of each column of a matrix with itself. More...
 
template<typename T_x >
std::enable_if< std::is_same< typename scalar_type< T_x >::type, double >::value, Eigen::Matrix< var, -1, -1 > >::type cov_exp_quad (const std::vector< T_x > &x, const var &sigma, const var &l)
 
template<typename T_x >
std::enable_if< std::is_same< typename scalar_type< T_x >::type, double >::value, Eigen::Matrix< var, -1, -1 > >::type cov_exp_quad (const std::vector< T_x > &x, double sigma, const var &l)
 
matrix_v crossprod (const matrix_v &M)
 Returns the result of pre-multiplying a matrix by its own transpose. More...
 
template<int R, int C>
var determinant (const Eigen::Matrix< var, R, C > &m)
 
template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix< var, R, C > divide (const Eigen::Matrix< T1, R, C > &v, const T2 &c)
 Return the division of the specified column vector by the specified scalar. More...
 
template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
std::enable_if< std::is_same< T1, var >::value||std::is_same< T2, var >::value, var >::type dot_product (const Eigen::Matrix< T1, R1, C1 > &v1, const Eigen::Matrix< T2, R2, C2 > &v2)
 Returns the dot product. More...
 
template<typename T1 , typename T2 >
std::enable_if< std::is_same< T1, var >::value||std::is_same< T2, var >::value, var >::type dot_product (const T1 *v1, const T2 *v2, size_t length)
 Returns the dot product. More...
 
template<typename T1 , typename T2 >
std::enable_if< std::is_same< T1, var >::value||std::is_same< T2, var >::value, var >::type dot_product (const std::vector< T1 > &v1, const std::vector< T2 > &v2)
 Returns the dot product. More...
 
template<int R, int C>
var dot_self (const Eigen::Matrix< var, R, C > &v)
 Returns the dot product of a vector with itself. More...
 
template<typename T_x >
std::enable_if< std::is_same< typename scalar_type< T_x >::type, double >::value, Eigen::Matrix< var, -1, -1 > >::type gp_exp_quad_cov (const std::vector< T_x > &x, const var &sigma, const var &length_scale)
 Returns a squared exponential kernel. More...
 
template<typename T_x >
std::enable_if< std::is_same< typename scalar_type< T_x >::type, double >::value, Eigen::Matrix< var, -1, -1 > >::type gp_exp_quad_cov (const std::vector< T_x > &x, double sigma, const var &length_scale)
 Returns a squared exponential kernel. More...
 
template<typename T_x >
std::enable_if< std::is_same< typename scalar_type< T_x >::type, double >::value, Eigen::Matrix< var, Eigen::Dynamic, Eigen::Dynamic > >::type gp_periodic_cov (const std::vector< T_x > &x, const var &sigma, const var &l, const var &p)
 Returns a periodic covariance matrix $ \mathbf{K} $ using the input $ \mathbf{X} $. More...
 
template<typename T_x >
std::enable_if< std::is_same< typename scalar_type< T_x >::type, double >::value, Eigen::Matrix< var, Eigen::Dynamic, Eigen::Dynamic > >::type gp_periodic_cov (const std::vector< T_x > &x, double sigma, const var &l, const var &p)
 Returns a periodic covariance matrix $ \mathbf{K} $ using the input $ \mathbf{X} $. More...
 
void grad (var &v, Eigen::Matrix< var, Eigen::Dynamic, 1 > &x, Eigen::VectorXd &g)
 Propagate chain rule to calculate gradients starting from the specified variable. More...
 
void initialize_variable (var &variable, const var &value)
 Initialize variable to value. More...
 
template<int R, int C>
void initialize_variable (Eigen::Matrix< var, R, C > &matrix, const var &value)
 Initialize every cell in the matrix to the specified value. More...
 
template<typename T >
void initialize_variable (std::vector< T > &variables, const var &value)
 Initialize the variables in the standard vector recursively. More...
 
template<int R, int C>
var log_determinant (const Eigen::Matrix< var, R, C > &m)
 
template<int R, int C>
var log_determinant_ldlt (LDLT_factor< var, R, C > &A)
 
template<int R, int C>
var log_determinant_spd (const Eigen::Matrix< var, R, C > &m)
 
Eigen::Matrix< var, Eigen::Dynamic, 1 > log_softmax (const Eigen::Matrix< var, Eigen::Dynamic, 1 > &alpha)
 Return the softmax of the specified Eigen vector. More...
 
template<int R, int C>
var log_sum_exp (const Eigen::Matrix< var, R, C > &x)
 Returns the log sum of exponentials. More...
 
template<typename Ta , typename Tb , int Cb>
Eigen::Matrix< typename stan::return_type< Ta, Tb >::type, -1, Cb > matrix_exp_multiply (const Eigen::Matrix< Ta, -1, -1 > &A, const Eigen::Matrix< Tb, -1, Cb > &B)
 Wrapper of matrix_exp_action function for a more literal name. More...
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left (const Eigen::Matrix< var, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b)
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left (const Eigen::Matrix< var, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b)
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left (const Eigen::Matrix< double, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b)
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left_ldlt (const LDLT_factor< var, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b)
 Returns the solution of the system Ax=b given an LDLT_factor of A. More...
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left_ldlt (const LDLT_factor< var, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b)
 Returns the solution of the system Ax=b given an LDLT_factor of A. More...
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left_ldlt (const LDLT_factor< double, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b)
 Returns the solution of the system Ax=b given an LDLT_factor of A. More...
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left_spd (const Eigen::Matrix< var, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b)
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left_spd (const Eigen::Matrix< var, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b)
 
template<int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left_spd (const Eigen::Matrix< double, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b)
 
template<int TriView, int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left_tri (const Eigen::Matrix< var, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b)
 
template<int TriView, int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left_tri (const Eigen::Matrix< double, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b)
 
template<int TriView, int R1, int C1, int R2, int C2>
Eigen::Matrix< var, R1, C2 > mdivide_left_tri (const Eigen::Matrix< var, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b)
 
template<typename T1 , typename T2 >
std::enable_if<(boost::is_scalar< T1 >::value||std::is_same< T1, var >::value) &&(boost::is_scalar< T2 >::value||std::is_same< T2, var >::value), typename boost::math::tools::promote_args< T1, T2 >::type >::type multiply (const T1 &v, const T2 &c)
 Return the product of two scalars. More...
 
template<typename T1 , typename T2 , int R2, int C2>
Eigen::Matrix< var, R2, C2 > multiply (const T1 &c, const Eigen::Matrix< T2, R2, C2 > &m)
 Return the product of scalar and matrix. More...
 
template<typename T1 , int R1, int C1, typename T2 >
Eigen::Matrix< var, R1, C1 > multiply (const Eigen::Matrix< T1, R1, C1 > &m, const T2 &c)
 Return the product of scalar and matrix. More...
 
template<typename Ta , int Ra, int Ca, typename Tb , int Cb>
std::enable_if< std::is_same< Ta, var >::value||std::is_same< Tb, var >::value, Eigen::Matrix< var, Ra, Cb > >::type multiply (const Eigen::Matrix< Ta, Ra, Ca > &A, const Eigen::Matrix< Tb, Ca, Cb > &B)
 Return the product of two matrices. More...
 
template<typename Ta , int Ca, typename Tb >
std::enable_if< std::is_same< Ta, var >::value||std::is_same< Tb, var >::value, var >::type multiply (const Eigen::Matrix< Ta, 1, Ca > &A, const Eigen::Matrix< Tb, Ca, 1 > &B)
 Return the scalar product of a row vector and a vector. More...
 
matrix_v multiply_lower_tri_self_transpose (const matrix_v &L)
 
Eigen::Matrix< var, Eigen::Dynamic, 1 > ordered_constrain (const Eigen::Matrix< var, Eigen::Dynamic, 1 > &x)
 Return an increasing ordered vector derived from the specified free vector. More...
 
Eigen::Matrix< var, Eigen::Dynamic, 1 > positive_ordered_constrain (const Eigen::Matrix< var, Eigen::Dynamic, 1 > &x)
 Return an increasing positive ordered vector derived from the specified free vector. More...
 
template<typename Ta , int Ra, int Ca, typename Tb , int Rb, int Cb>
std::enable_if< std::is_same< Ta, var >::value||std::is_same< Tb, var >::value, Eigen::Matrix< var, Cb, Cb > >::type quad_form (const Eigen::Matrix< Ta, Ra, Ca > &A, const Eigen::Matrix< Tb, Rb, Cb > &B)
 
template<typename Ta , int Ra, int Ca, typename Tb , int Rb>
std::enable_if< std::is_same< Ta, var >::value||std::is_same< Tb, var >::value, var >::type quad_form (const Eigen::Matrix< Ta, Ra, Ca > &A, const Eigen::Matrix< Tb, Rb, 1 > &B)
 
template<typename Ta , int Ra, int Ca, typename Tb , int Rb, int Cb>
std::enable_if< std::is_same< Ta, var >::value||std::is_same< Tb, var >::value, Eigen::Matrix< var, Cb, Cb > >::type quad_form_sym (const Eigen::Matrix< Ta, Ra, Ca > &A, const Eigen::Matrix< Tb, Rb, Cb > &B)
 
template<typename Ta , int Ra, int Ca, typename Tb , int Rb>
std::enable_if< std::is_same< Ta, var >::value||std::is_same< Tb, var >::value, var >::type quad_form_sym (const Eigen::Matrix< Ta, Ra, Ca > &A, const Eigen::Matrix< Tb, Rb, 1 > &B)
 
template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
std::enable_if< std::is_same< T1, var >::value||std::is_same< T2, var >::value, Eigen::Matrix< var, R1, 1 > >::type rows_dot_product (const Eigen::Matrix< T1, R1, C1 > &v1, const Eigen::Matrix< T2, R2, C2 > &v2)
 
template<typename Ta , typename Tb , int Cb>
Eigen::Matrix< typename stan::return_type< Ta, Tb >::type, -1, Cb > scale_matrix_exp_multiply (const double &t, const Eigen::Matrix< Ta, -1, -1 > &A, const Eigen::Matrix< Tb, -1, Cb > &B)
 Return product of exp(At) and B, where A is a NxN matrix, B is a NxCb matrix, and t is a double. More...
 
var sd (const std::vector< var > &v)
 Return the sample standard deviation of the specified standard vector. More...
 
template<int R, int C>
var sd (const Eigen::Matrix< var, R, C > &m)
 
Eigen::Matrix< var, Eigen::Dynamic, 1 > simplex_constrain (const Eigen::Matrix< var, Eigen::Dynamic, 1 > &y)
 Return the simplex corresponding to the specified free vector. More...
 
Eigen::Matrix< var, Eigen::Dynamic, 1 > softmax (const Eigen::Matrix< var, Eigen::Dynamic, 1 > &alpha)
 Return the softmax of the specified Eigen vector. More...
 
template<int R1, int C1, int R2, int C2>
var squared_distance (const Eigen::Matrix< var, R1, C1 > &v1, const Eigen::Matrix< var, R2, C2 > &v2)
 
template<int R1, int C1, int R2, int C2>
var squared_distance (const Eigen::Matrix< var, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2)
 
template<int R1, int C1, int R2, int C2>
var squared_distance (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< var, R2, C2 > &v2)
 
void stan_print (std::ostream *o, const var &x)
 
template<int R, int C>
var sum (const Eigen::Matrix< var, R, C > &m)
 Returns the sum of the coefficients of the specified matrix, column vector or row vector. More...
 
matrix_v tcrossprod (const matrix_v &M)
 Returns the result of post-multiplying a matrix by its own transpose. More...
 
matrix_v to_var (const matrix_d &m)
 Converts argument to an automatic differentiation variable. More...
 
matrix_v to_var (const matrix_v &m)
 Converts argument to an automatic differentiation variable. More...
 
vector_v to_var (const vector_d &v)
 Converts argument to an automatic differentiation variable. More...
 
vector_v to_var (const vector_v &v)
 Converts argument to an automatic differentiation variable. More...
 
row_vector_v to_var (const row_vector_d &rv)
 Converts argument to an automatic differentiation variable. More...
 
row_vector_v to_var (const row_vector_v &rv)
 Converts argument to an automatic differentiation variable. More...
 
template<typename T1 , int R1, int C1, typename T2 , int R2, int C2, typename T3 , int R3, int C3>
std::enable_if< stan::is_var< T1 >::value||stan::is_var< T2 >::value||stan::is_var< T3 >::value, var >::type trace_gen_inv_quad_form_ldlt (const Eigen::Matrix< T1, R1, C1 > &D, const LDLT_factor< T2, R2, C2 > &A, const Eigen::Matrix< T3, R3, C3 > &B)
 Compute the trace of an inverse quadratic form. More...
 
template<typename Td , int Rd, int Cd, typename Ta , int Ra, int Ca, typename Tb , int Rb, int Cb>
std::enable_if< std::is_same< Td, var >::value||std::is_same< Ta, var >::value||std::is_same< Tb, var >::value, var >::type trace_gen_quad_form (const Eigen::Matrix< Td, Rd, Cd > &D, const Eigen::Matrix< Ta, Ra, Ca > &A, const Eigen::Matrix< Tb, Rb, Cb > &B)
 
template<typename T2 , int R2, int C2, typename T3 , int R3, int C3>
std::enable_if< stan::is_var< T2 >::value||stan::is_var< T3 >::value, var >::type trace_inv_quad_form_ldlt (const LDLT_factor< T2, R2, C2 > &A, const Eigen::Matrix< T3, R3, C3 > &B)
 Compute the trace of an inverse quadratic form. More...
 
template<typename Ta , int Ra, int Ca, typename Tb , int Rb, int Cb>
std::enable_if< std::is_same< Ta, var >::value||std::is_same< Tb, var >::value, var >::type trace_quad_form (const Eigen::Matrix< Ta, Ra, Ca > &A, const Eigen::Matrix< Tb, Rb, Cb > &B)
 
template<int R, int C>
Eigen::Matrix< var, R, C > unit_vector_constrain (const Eigen::Matrix< var, R, C > &y)
 Return the unit length vector corresponding to the free vector y. More...
 
template<int R, int C>
Eigen::Matrix< var, R, C > unit_vector_constrain (const Eigen::Matrix< var, R, C > &y, var &lp)
 Return the unit length vector corresponding to the free vector y. More...
 
var variance (const std::vector< var > &v)
 Return the sample variance of the specified standard vector. More...
 
template<int R, int C>
var variance (const Eigen::Matrix< var, R, C > &m)
 
template<typename F , typename... Targs>
auto adj_jac_apply (const Targs &... args)
 Return the result of applying the function defined by a nullary construction of F to the specified input argument. More...
 
template<typename F , typename T >
Eigen::VectorXd algebra_solver (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, const Eigen::VectorXd &y, const std::vector< double > &dat, const std::vector< int > &dat_int, std::ostream *msgs=nullptr, double relative_tolerance=1e-10, double function_tolerance=1e-6, long int max_num_steps=1e+3)
 Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system. More...
 
template<typename F , typename T1 , typename T2 >
Eigen::Matrix< T2, Eigen::Dynamic, 1 > algebra_solver (const F &f, const Eigen::Matrix< T1, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< T2, Eigen::Dynamic, 1 > &y, const std::vector< double > &dat, const std::vector< int > &dat_int, std::ostream *msgs=nullptr, double relative_tolerance=1e-10, double function_tolerance=1e-6, long int max_num_steps=1e+3)
 Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system. More...
 
void cvodes_silent_err_handler (int error_code, const char *module, const char *function, char *msg, void *eh_data)
 
void cvodes_check_flag (int flag, const char *func_name)
 
void cvodes_set_options (void *cvodes_mem, double rel_tol, double abs_tol, long int max_num_steps)
 
template<typename F >
void gradient (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, double &fx, Eigen::Matrix< double, Eigen::Dynamic, 1 > &grad_fx)
 Calculate the value and the gradient of the specified function at the specified argument. More...
 
template<typename F , typename Tpar >
std::vector< std::vector< Tpar > > integrate_dae (const F &f, const std::vector< double > &yy0, const std::vector< double > &yp0, double t0, const std::vector< double > &ts, const std::vector< Tpar > &theta, const std::vector< double > &x_r, const std::vector< int > &x_i, const double rtol, const double atol, const int64_t max_num_steps=idas_integrator::IDAS_MAX_STEPS, std::ostream *msgs=nullptr)
 Return the solutions for a semi-explicit DAE system with residual specified by functor F, given the specified consistent initial state yy0 and yp0. More...
 
template<typename F , typename T_initial , typename T_param , typename T_t0 , typename T_ts >
std::vector< std::vector< typename stan::return_type< T_initial, T_param, T_t0, T_ts >::type > > integrate_ode_adams (const F &f, const std::vector< T_initial > &y0, const T_t0 &t0, const std::vector< T_ts > &ts, const std::vector< T_param > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs=nullptr, double relative_tolerance=1e-10, double absolute_tolerance=1e-10, long int max_num_steps=1e8)
 
template<typename F , typename T_initial , typename T_param , typename T_t0 , typename T_ts >
std::vector< std::vector< typename stan::return_type< T_initial, T_param, T_t0, T_ts >::type > > integrate_ode_bdf (const F &f, const std::vector< T_initial > &y0, const T_t0 &t0, const std::vector< T_ts > &ts, const std::vector< T_param > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs=nullptr, double relative_tolerance=1e-10, double absolute_tolerance=1e-10, long int max_num_steps=1e8)
 
template<typename F >
void jacobian (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, Eigen::Matrix< double, Eigen::Dynamic, 1 > &fx, Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &J)
 
var abs (const var &a)
 Return the absolute value of the variable (std). More...
 
var acos (const var &a)
 Return the principal value of the arc cosine of a variable, in radians (cmath). More...
 
var acosh (const var &a)
 The inverse hyperbolic cosine function for variables (C99). More...
 
int as_bool (const var &v)
 Return 1 if the argument is unequal to zero and 0 otherwise. More...
 
var asin (const var &a)
 Return the principal value of the arc sine, in radians, of the specified variable (cmath). More...
 
var asinh (const var &a)
 The inverse hyperbolic sine function for variables (C99). More...
 
var atan (const var &a)
 Return the principal value of the arc tangent, in radians, of the specified variable (cmath). More...
 
var atan2 (const var &a, const var &b)
 Return the principal value of the arc tangent, in radians, of the first variable divided by the second (cmath). More...
 
var atan2 (const var &a, double b)
 Return the principal value of the arc tangent, in radians, of the first variable divided by the second scalar (cmath). More...
 
var atan2 (double a, const var &b)
 Return the principal value of the arc tangent, in radians, of the first scalar divided by the second variable (cmath). More...
 
var atanh (const var &a)
 The inverse hyperbolic tangent function for variables (C99). More...
 
var bessel_first_kind (int v, const var &a)
 
var bessel_second_kind (int v, const var &a)
 
var beta (const var &a, const var &b)
 
var beta (const var &a, double b)
 
var beta (double a, const var &b)
 
var binary_log_loss (int y, const var &y_hat)
 The log loss function for variables (stan). More...
 
double calculate_chain (double x, double val)
 
var cbrt (const var &a)
 Returns the cube root of the specified variable (C99). More...
 
var ceil (const var &a)
 Return the ceiling of the specified variable (cmath). More...
 
var cos (const var &a)
 Return the cosine of a radian-scaled variable (cmath). More...
 
var cosh (const var &a)
 Return the hyperbolic cosine of the specified variable (cmath). More...
 
var digamma (const var &a)
 
var erf (const var &a)
 The error function for variables (C99). More...
 
var erfc (const var &a)
 The complementary error function for variables (C99). More...
 
var exp (const var &a)
 Return the exponentiation of the specified variable (cmath). More...
 
var exp2 (const var &a)
 Exponentiation base 2 function for variables (C99). More...
 
var expm1 (const var &a)
 The exponentiation of the specified variable minus 1 (C99). More...
 
var fabs (const var &a)
 Return the absolute value of the variable (cmath). More...
 
var falling_factorial (const var &a, int b)
 
var fdim (const var &a, const var &b)
 Return the positive difference between the first variable's the value and the second's (C99, C++11). More...
 
var fdim (double a, const var &b)
 Return the positive difference between the first value and the value of the second variable (C99, C++11). More...
 
var fdim (const var &a, double b)
 Return the positive difference between the first variable's value and the second value (C99, C++11). More...
 
var floor (const var &a)
 Return the floor of the specified variable (cmath). More...
 
var fma (const var &a, const var &b, const var &c)
 The fused multiply-add function for three variables (C99). More...
 
var fma (const var &a, const var &b, double c)
 The fused multiply-add function for two variables and a value (C99). More...
 
var fma (const var &a, double b, const var &c)
 The fused multiply-add function for a variable, value, and variable (C99). More...
 
var fma (const var &a, double b, double c)
 The fused multiply-add function for a variable and two values (C99). More...
 
var fma (double a, const var &b, double c)
 The fused multiply-add function for a value, variable, and value (C99). More...
 
var fma (double a, double b, const var &c)
 The fused multiply-add function for two values and a variable, and value (C99). More...
 
var fma (double a, const var &b, const var &c)
 The fused multiply-add function for a value and two variables (C99). More...
 
var fmax (const var &a, const var &b)
 Returns the maximum of the two variable arguments (C99). More...
 
var fmax (const var &a, double b)
 Returns the maximum of the variable and scalar, promoting the scalar to a variable if it is larger (C99). More...
 
var fmax (double a, const var &b)
 Returns the maximum of a scalar and variable, promoting the scalar to a variable if it is larger (C99). More...
 
var fmin (const var &a, const var &b)
 Returns the minimum of the two variable arguments (C99). More...
 
var fmin (const var &a, double b)
 Returns the minimum of the variable and scalar, promoting the scalar to a variable if it is larger (C99). More...
 
var fmin (double a, const var &b)
 Returns the minimum of a scalar and variable, promoting the scalar to a variable if it is larger (C99). More...
 
var fmod (const var &a, const var &b)
 Return the floating point remainder after dividing the first variable by the second (cmath). More...
 
var fmod (const var &a, double b)
 Return the floating point remainder after dividing the the first variable by the second scalar (cmath). More...
 
var fmod (double a, const var &b)
 Return the floating point remainder after dividing the first scalar by the second variable (cmath). More...
 
var gamma_p (const var &a, const var &b)
 
var gamma_p (const var &a, double b)
 
var gamma_p (double a, const var &b)
 
var gamma_q (const var &a, const var &b)
 
var gamma_q (const var &a, double b)
 
var gamma_q (double a, const var &b)
 
void grad_inc_beta (var &g1, var &g2, const var &a, const var &b, const var &z)
 Gradient of the incomplete beta function beta(a, b, z) with respect to the first two arguments. More...
 
var hypot (const var &a, const var &b)
 Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99). More...
 
var hypot (const var &a, double b)
 Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99). More...
 
var hypot (double a, const var &b)
 Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99). More...
 
var ibeta (const var &a, const var &b, const var &x)
 The normalized incomplete beta function of a, b, and x. More...
 
var if_else (bool c, const var &y_true, const var &y_false)
 If the specified condition is true, return the first variable, otherwise return the second variable. More...
 
var if_else (bool c, double y_true, const var &y_false)
 If the specified condition is true, return a new variable constructed from the first scalar, otherwise return the second variable. More...
 
var if_else (bool c, const var &y_true, double y_false)
 If the specified condition is true, return the first variable, otherwise return a new variable constructed from the second scalar. More...
 
var inc_beta (const var &a, const var &b, const var &c)
 
var inv (const var &a)
 

\[ \mbox{inv}(x) = \begin{cases} \frac{1}{x} & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

More...
 
var inv_cloglog (const var &a)
 Return the inverse complementary log-log function applied specified variable (stan). More...
 
var inv_logit (const var &a)
 The inverse logit function for variables (stan). More...
 
var inv_Phi (const var &p)
 The inverse of unit normal cumulative density function. More...
 
var inv_sqrt (const var &a)
 

\[ \mbox{inv\_sqrt}(x) = \begin{cases} \frac{1}{\sqrt{x}} & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

More...
 
var inv_square (const var &a)
 

\[ \mbox{inv\_square}(x) = \begin{cases} \frac{1}{x^2} & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

More...
 
int is_inf (const var &v)
 Returns 1 if the input's value is infinite and 0 otherwise. More...
 
bool is_nan (const var &v)
 Returns 1 if the input's value is NaN and 0 otherwise. More...
 
bool is_uninitialized (var x)
 Returns true if the specified variable is uninitialized. More...
 
var lbeta (const var &a, const var &b)
 
var lbeta (const var &a, double b)
 
var lbeta (double a, const var &b)
 
var lgamma (const var &a)
 The log gamma function for variables (C99). More...
 
var lmgamma (int a, const var &b)
 
var log (const var &a)
 Return the natural log of the specified variable (cmath). More...
 
var log10 (const var &a)
 Return the base 10 log of the specified variable (cmath). More...
 
var log1m (const var &a)
 The log (1 - x) function for variables. More...
 
var log1m_exp (const var &x)
 Return the log of 1 minus the exponential of the specified variable. More...
 
var log1m_inv_logit (const var &u)
 Return the natural logarithm of one minus the inverse logit of the specified argument. More...
 
var log1p (const var &a)
 The log (1 + x) function for variables (C99). More...
 
var log1p_exp (const var &a)
 Return the log of 1 plus the exponential of the specified variable. More...
 
var log2 (const var &a)
 Returns the base 2 logarithm of the specified variable (C99). More...
 
var log_diff_exp (const var &a, const var &b)
 Returns the log difference of the exponentiated arguments. More...
 
var log_diff_exp (const var &a, double b)
 Returns the log difference of the exponentiated arguments. More...
 
var log_diff_exp (double a, const var &b)
 Returns the log difference of the exponentiated arguments. More...
 
var log_falling_factorial (const var &a, double b)
 
var log_falling_factorial (const var &a, const var &b)
 
var log_falling_factorial (double a, const var &b)
 
var log_inv_logit (const var &u)
 Return the natural logarithm of the inverse logit of the specified argument. More...
 
var log_inv_logit_diff (const var &a, double b)
 
var log_inv_logit_diff (const var &a, const var &b)
 
var log_inv_logit_diff (double a, const var &b)
 
void log_mix_partial_helper (double theta_val, double lambda1_val, double lambda2_val, double &one_m_exp_lam2_m_lam1, double &one_m_t_prod_exp_lam2_m_lam1, double &one_d_t_plus_one_m_t_prod_exp_lam2_m_lam1)
 
template<typename T_theta , typename T_lambda1 , typename T_lambda2 >
return_type< T_theta, T_lambda1, T_lambda2 >::type log_mix (const T_theta &theta, const T_lambda1 &lambda1, const T_lambda2 &lambda2)
 Return the log mixture density with specified mixing proportion and log densities and its derivative at each. More...
 
var log_rising_factorial (const var &a, double b)
 
var log_rising_factorial (const var &a, const var &b)
 
var log_rising_factorial (double a, const var &b)
 
var log_sum_exp (const var &a, const var &b)
 Returns the log sum of exponentials. More...
 
var log_sum_exp (const var &a, double b)
 Returns the log sum of exponentials. More...
 
var log_sum_exp (double a, const var &b)
 Returns the log sum of exponentials. More...
 
var logit (const var &u)
 Return the log odds of the specified argument. More...
 
var modified_bessel_first_kind (int v, const var &a)
 
var modified_bessel_second_kind (int v, const var &a)
 
var multiply_log (const var &a, const var &b)
 Return the value of a*log(b). More...
 
var multiply_log (const var &a, double b)
 Return the value of a*log(b). More...
 
var multiply_log (double a, const var &b)
 Return the value of a*log(b). More...
 
var owens_t (const var &h, const var &a)
 The Owen's T function of h and a. More...
 
var owens_t (const var &h, double a)
 The Owen's T function of h and a. More...
 
var owens_t (double h, const var &a)
 The Owen's T function of h and a. More...
 
var Phi (const var &a)
 The unit normal cumulative density function for variables (stan). More...
 
var Phi_approx (const var &a)
 Approximation of the unit normal CDF for variables (stan). More...
 
var pow (const var &base, const var &exponent)
 Return the base raised to the power of the exponent (cmath). More...
 
var pow (const var &base, double exponent)
 Return the base variable raised to the power of the exponent scalar (cmath). More...
 
var pow (double base, const var &exponent)
 Return the base scalar raised to the power of the exponent variable (cmath). More...
 
double primitive_value (const var &v)
 Return the primitive double value for the specified auto-diff variable. More...
 
var rising_factorial (const var &a, int b)
 
var round (const var &a)
 Returns the rounded form of the specified variable (C99). More...
 
var sin (const var &a)
 Return the sine of a radian-scaled variable (cmath). More...
 
var sinh (const var &a)
 Return the hyperbolic sine of the specified variable (cmath). More...
 
var sqrt (const var &a)
 Return the square root of the specified variable (cmath). More...
 
var square (const var &x)
 Return the square of the input variable. More...
 
var squared_distance (const var &a, const var &b)
 Returns the log sum of exponentials. More...
 
var squared_distance (const var &a, double b)
 Returns the log sum of exponentials. More...
 
var squared_distance (double a, const var &b)
 Returns the log sum of exponentials. More...
 
var step (const var &a)
 Return the step, or heaviside, function applied to the specified variable (stan). More...
 
var tan (const var &a)
 Return the tangent of a radian-scaled variable (cmath). More...
 
var tanh (const var &a)
 Return the hyperbolic tangent of the specified variable (cmath). More...
 
var tgamma (const var &a)
 Return the Gamma function applied to the specified variable (C99). More...
 
var to_var (double x)
 Converts argument to an automatic differentiation variable. More...
 
var to_var (const var &x)
 Converts argument to an automatic differentiation variable. More...
 
var trigamma (const var &u)
 Return the value of the trigamma function at the specified argument (i.e., the second derivative of the log Gamma function at the specified argument). More...
 
var trunc (const var &a)
 Returns the truncatation of the specified variable (C99). More...
 
double value_of (const var &v)
 Return the value of the specified variable. More...
 
double value_of_rec (const var &v)
 Return the value of the specified variable. More...
 

Variables

static opencl_context opencl_context
 
const double CONSTRAINT_TOLERANCE = 1E-8
 The tolerance for checking arithmetic bounds In rank and in simplexes. More...
 
const double E = boost::math::constants::e<double>()
 The base of the natural logarithm, $ e $. More...
 
const double SQRT_2 = sqrt(2.0)
 The value of the square root of 2, $ \sqrt{2} $. More...
 
const double INV_SQRT_2 = inv(SQRT_2)
 The value of 1 over the square root of 2, $ 1 / \sqrt{2} $. More...
 
const double LOG_2 = log(2.0)
 The natural logarithm of 2, $ \log 2 $. More...
 
const double LOG_10 = log(10.0)
 The natural logarithm of 10, $ \log 10 $. More...
 
const double INFTY = std::numeric_limits<double>::infinity()
 Positive infinity. More...
 
const double NEGATIVE_INFTY = -INFTY
 Negative infinity. More...
 
const double NOT_A_NUMBER = std::numeric_limits<double>::quiet_NaN()
 (Quiet) not-a-number value. More...
 
const double EPSILON = std::numeric_limits<double>::epsilon()
 Smallest positive value. More...
 
const double NEGATIVE_EPSILON = -EPSILON
 Largest negative value (i.e., smallest absolute value). More...
 
const double POISSON_MAX_RATE = pow(2.0, 30)
 Largest rate parameter allowed in Poisson RNG. More...
 
const double SQRT_PI = sqrt(pi())
 
const double SQRT_2_TIMES_SQRT_PI = SQRT_2 * SQRT_PI
 
const double TWO_OVER_SQRT_PI = 2.0 / SQRT_PI
 
const double NEG_TWO_OVER_SQRT_PI = -TWO_OVER_SQRT_PI
 
const double SQRT_TWO_PI = sqrt(2.0 * pi())
 
const double INV_SQRT_TWO_PI = inv(SQRT_TWO_PI)
 
const double LOG_PI = log(pi())
 
const double LOG_PI_OVER_FOUR = LOG_PI / 4.0
 
const double LOG_SQRT_PI = log(SQRT_PI)
 
const double LOG_ZERO = log(0.0)
 
const double LOG_HALF = log(0.5)
 
const double NEG_LOG_TWO = -LOG_2
 
const double NEG_LOG_SQRT_TWO_PI = -log(SQRT_TWO_PI)
 
const double NEG_LOG_PI = -LOG_PI
 
const double NEG_LOG_SQRT_PI = -LOG_SQRT_PI
 
const double NEG_LOG_TWO_OVER_TWO = -LOG_2 / 2.0
 
const double LOG_TWO_PI = LOG_2 + LOG_PI
 
const double NEG_LOG_TWO_PI = -LOG_TWO_PI
 
const double LOG_EPSILON = log(EPSILON)
 
const std::string MAJOR_VERSION = STAN_STRING(STAN_MATH_MAJOR)
 Major version number for Stan math library. More...
 
const std::string MINOR_VERSION = STAN_STRING(STAN_MATH_MINOR)
 Minor version number for Stan math library. More...
 
const std::string PATCH_VERSION = STAN_STRING(STAN_MATH_PATCH)
 Patch version for Stan math library. More...
 

Detailed Description

Matrices and templated mathematical functions.

Templated probability distributions. All paramaterizations are based on Bayesian Data Analysis. Function gradients via reverse-mode automatic differentiation.

Typedef Documentation

◆ boost_policy_t

typedef boost::math::policies::policy< boost::math::policies::overflow_error< boost::math::policies::errno_on_error>, boost::math::policies::pole_error<boost::math::policies::errno_on_error> > stan::math::boost_policy_t

Boost policy that overrides the defaults to match the built-in C++ standard library functions.

The non-default behavior from Boost's built-ins are (1) overflow errors return error numbers on error. (2) pole errors return error numbers on error.

Definition at line 23 of file boost_policy.hpp.

◆ ChainableStack

Definition at line 10 of file chainablestack.hpp.

◆ matrix_d

typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> stan::math::matrix_d

Type for matrix of double values.

Definition at line 19 of file typedefs.hpp.

◆ matrix_fd

typedef Eigen::Matrix<fvar<double>, Eigen::Dynamic, Eigen::Dynamic> stan::math::matrix_fd

Definition at line 13 of file typedefs.hpp.

◆ matrix_ffd

typedef Eigen::Matrix<fvar<fvar<double> >, Eigen::Dynamic, Eigen::Dynamic> stan::math::matrix_ffd

Definition at line 16 of file typedefs.hpp.

◆ matrix_ffv

typedef Eigen::Matrix<fvar<fvar<var> >, Eigen::Dynamic, Eigen::Dynamic> stan::math::matrix_ffv

Definition at line 15 of file typedefs.hpp.

◆ matrix_fv

typedef Eigen::Matrix<fvar<var>, Eigen::Dynamic, Eigen::Dynamic> stan::math::matrix_fv

Definition at line 12 of file typedefs.hpp.

◆ matrix_v

typedef Eigen::Matrix<var, Eigen::Dynamic, Eigen::Dynamic> stan::math::matrix_v

The type of a matrix holding var values.

Definition at line 17 of file typedefs.hpp.

◆ matrix_vi

typedef Eigen::Matrix<vari*, Eigen::Dynamic, Eigen::Dynamic> stan::math::matrix_vi

The type of a matrix holding vari* values.

Definition at line 35 of file typedefs.hpp.

◆ row_vector_d

typedef Eigen::Matrix<double, 1, Eigen::Dynamic> stan::math::row_vector_d

Type for (row) vector of double values.

Definition at line 29 of file typedefs.hpp.

◆ row_vector_fd

typedef Eigen::Matrix<fvar<double>, 1, Eigen::Dynamic> stan::math::row_vector_fd

Definition at line 22 of file typedefs.hpp.

◆ row_vector_ffd

typedef Eigen::Matrix<fvar<fvar<double> >, 1, Eigen::Dynamic> stan::math::row_vector_ffd

Definition at line 24 of file typedefs.hpp.

◆ row_vector_ffv

typedef Eigen::Matrix<fvar<fvar<var> >, 1, Eigen::Dynamic> stan::math::row_vector_ffv

Definition at line 23 of file typedefs.hpp.

◆ row_vector_fv

typedef Eigen::Matrix<fvar<var>, 1, Eigen::Dynamic> stan::math::row_vector_fv

Definition at line 21 of file typedefs.hpp.

◆ row_vector_v

typedef Eigen::Matrix<var, 1, Eigen::Dynamic> stan::math::row_vector_v

The type of a row vector holding var values.

Definition at line 29 of file typedefs.hpp.

◆ row_vector_vi

typedef Eigen::Matrix<vari*, 1, Eigen::Dynamic> stan::math::row_vector_vi

The type of a row vector holding vari* values.

Definition at line 47 of file typedefs.hpp.

◆ size_type

typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index stan::math::size_type

Type for sizes and indexes in an Eigen matrix with double e.

Definition at line 11 of file typedefs.hpp.

◆ vector_d

typedef Eigen::Matrix<double, Eigen::Dynamic, 1> stan::math::vector_d

Type for (column) vector of double values.

Definition at line 24 of file typedefs.hpp.

◆ vector_fd

typedef Eigen::Matrix<fvar<double>, Eigen::Dynamic, 1> stan::math::vector_fd

Definition at line 18 of file typedefs.hpp.

◆ vector_ffd

typedef Eigen::Matrix<fvar<fvar<double> >, Eigen::Dynamic, 1> stan::math::vector_ffd

Definition at line 20 of file typedefs.hpp.

◆ vector_ffv

typedef Eigen::Matrix<fvar<fvar<var> >, Eigen::Dynamic, 1> stan::math::vector_ffv

Definition at line 19 of file typedefs.hpp.

◆ vector_fv

typedef Eigen::Matrix<fvar<var>, Eigen::Dynamic, 1> stan::math::vector_fv

Definition at line 17 of file typedefs.hpp.

◆ vector_v

typedef Eigen::Matrix<var, Eigen::Dynamic, 1> stan::math::vector_v

The type of a (column) vector holding var values.

Definition at line 23 of file typedefs.hpp.

◆ vector_vi

typedef Eigen::Matrix<vari*, Eigen::Dynamic, 1> stan::math::vector_vi

The type of a (column) vector holding vari* values.

Definition at line 41 of file typedefs.hpp.

Enumeration Type Documentation

◆ TriangularMapCL

Enumerator
UpperToLower 
LowerToUpper 

Definition at line 7 of file constants.hpp.

◆ TriangularViewCL

Enumerator
Lower 
Upper 
Entire 

Definition at line 6 of file constants.hpp.

Function Documentation

◆ abs() [1/3]

template<typename T >
fvar<T> stan::math::abs ( const fvar< T > &  x)
inline

Definition at line 14 of file abs.hpp.

◆ abs() [2/3]

double stan::math::abs ( double  x)
inline

Return floating-point absolute value.

Delegates to fabs(double) rather than std::abs(int).

Parameters
xscalar
Returns
absolute value of scalar

Definition at line 19 of file abs.hpp.

◆ abs() [3/3]

var stan::math::abs ( const var a)
inline

Return the absolute value of the variable (std).

Delegates to fabs() (see for doc).

\[ \mbox{abs}(x) = \begin{cases} |x| & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{abs}(x)}{\partial x} = \begin{cases} -1 & \mbox{if } x < 0 \\ 0 & \mbox{if } x = 0 \\ 1 & \mbox{if } x > 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable input.
Returns
Absolute value of variable.

Definition at line 36 of file abs.hpp.

◆ acos() [1/3]

template<typename T >
fvar<T> stan::math::acos ( const fvar< T > &  x)
inline

Definition at line 13 of file acos.hpp.

◆ acos() [2/3]

template<typename T >
apply_scalar_unary<acos_fun, T>::return_t stan::math::acos ( const T &  x)
inline

Vectorized version of acos().

Parameters
xContainer of variables.
Template Parameters
TContainer type.
Returns
Arc cosine of each variable in the container, in radians.

Definition at line 31 of file acos.hpp.

◆ acos() [3/3]

var stan::math::acos ( const var a)
inline

Return the principal value of the arc cosine of a variable, in radians (cmath).

The derivative is defined by

$\frac{d}{dx} \arccos x = \frac{-1}{\sqrt{1 - x^2}}$.

\[ \mbox{acos}(x) = \begin{cases} \textrm{NaN} & \mbox{if } x < -1\\ \arccos(x) & \mbox{if } -1\leq x\leq 1 \\ \textrm{NaN} & \mbox{if } x > 1\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{acos}(x)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x < -1\\ \frac{\partial\, \arccos(x)}{\partial x} & \mbox{if } -1\leq x\leq 1 \\ \textrm{NaN} & \mbox{if } x < -1\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial \, \arccos(x)}{\partial x} = -\frac{1}{\sqrt{1-x^2}} \]

Parameters
aVariable in range [-1, 1].
Returns
Arc cosine of variable, in radians.

Definition at line 57 of file acos.hpp.

◆ acosh() [1/5]

template<typename T >
fvar<T> stan::math::acosh ( const fvar< T > &  x)
inline

Definition at line 13 of file acosh.hpp.

◆ acosh() [2/5]

double stan::math::acosh ( double  x)
inline

Return the inverse hyperbolic cosine of the specified value.

Returns nan for nan argument.

Parameters
[in]xArgument.
Returns
Inverse hyperbolic cosine of the argument.
Exceptions
std::domain_errorIf argument is less than 1.

Definition at line 21 of file acosh.hpp.

◆ acosh() [3/5]

template<typename T >
apply_scalar_unary<acosh_fun, T>::return_t stan::math::acosh ( const T &  x)
inline

Return the elementwise application of acosh() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
TContainer type.
Parameters
xContainer.
Returns
Elementwise acosh of members of container.

Definition at line 38 of file acosh.hpp.

◆ acosh() [4/5]

double stan::math::acosh ( int  x)
inline

Integer version of acosh.

Parameters
[in]xArgument.
Returns
Inverse hyperbolic cosine of the argument.
Exceptions
std::domain_errorIf argument is less than 1.

Definition at line 41 of file acosh.hpp.

◆ acosh() [5/5]

var stan::math::acosh ( const var a)
inline

The inverse hyperbolic cosine function for variables (C99).

For non-variable function, see acosh().

The derivative is defined by

$\frac{d}{dx} \mbox{acosh}(x) = \frac{x}{x^2 - 1}$.

\[ \mbox{acosh}(x) = \begin{cases} \textrm{NaN} & \mbox{if } x < 1 \\ \cosh^{-1}(x) & \mbox{if } x \geq 1 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{acosh}(x)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x < 1 \\ \frac{\partial\, \cosh^{-1}(x)}{\partial x} & \mbox{if } x \geq 1 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \cosh^{-1}(x)=\ln\left(x+\sqrt{x^2-1}\right) \]

\[ \frac{\partial \, \cosh^{-1}(x)}{\partial x} = \frac{1}{\sqrt{x^2-1}} \]

Parameters
aThe variable.
Returns
Inverse hyperbolic cosine of the variable.

Definition at line 61 of file acosh.hpp.

◆ add() [1/4]

matrix_cl stan::math::add ( const matrix_cl A,
const matrix_cl B 
)
inline

Matrix addition on the OpenCL device.

Parameters
Afirst matrix
Bsecond matrix
Returns
sum of A and B
Exceptions
<code>std::invalid_argument</code>if the input matrices do not have matching dimensions

Definition at line 24 of file add.hpp.

◆ add() [2/4]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C> stan::math::add ( const Eigen::Matrix< T1, R, C > &  m1,
const Eigen::Matrix< T2, R, C > &  m2 
)
inline

Return the sum of the specified matrices.

The two matrices must have the same dimensions.

Template Parameters
T1Scalar type of first matrix.
T2Scalar type of second matrix.
RRow type of matrices.
CColumn type of matrices.
Parameters
m1First matrix.
m2Second matrix.
Returns
Sum of the matrices.
Exceptions
std::invalid_argumentif m1 and m2 do not have the same dimensions.

Definition at line 27 of file add.hpp.

◆ add() [3/4]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C> stan::math::add ( const Eigen::Matrix< T1, R, C > &  m,
const T2 &  c 
)
inline

Return the sum of the specified matrix and specified scalar.

Template Parameters
T1Scalar type of matrix.
T2Type of scalar.
Parameters
mMatrix.
cScalar.
Returns
The matrix plus the scalar.

Definition at line 44 of file add.hpp.

◆ add() [4/4]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C> stan::math::add ( const T1 &  c,
const Eigen::Matrix< T2, R, C > &  m 
)
inline

Return the sum of the specified scalar and specified matrix.

Template Parameters
T1Type of scalar.
T2Scalar type of matrix.
Parameters
cScalar.
mMatrix.
Returns
The scalar plus the matrix.

Definition at line 60 of file add.hpp.

◆ add_diag() [1/2]

template<typename T_m , typename T_a >
Eigen::Matrix<typename return_type<T_m, T_a>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::add_diag ( const Eigen::Matrix< T_m, Eigen::Dynamic, Eigen::Dynamic > &  mat,
const T_a &  to_add 
)
inline

Returns a Matrix with values added along the main diagonal.

Template Parameters
T_mtype of element in Eigen::Matrix
T_aType of element to add along the diagonal
Parameters
mata matrix
to_addvalue to add along the diagonal
Returns
a matrix with to_add added along main diagonal

Definition at line 23 of file add_diag.hpp.

◆ add_diag() [2/2]

template<typename T_m , typename T_a , int R, int C>
Eigen::Matrix<typename return_type<T_m, T_a>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::add_diag ( const Eigen::Matrix< T_m, Eigen::Dynamic, Eigen::Dynamic > &  mat,
const Eigen::Matrix< T_a, R, C > &  to_add 
)
inline

Returns a Matrix with values added along the main diagonal.

Template Parameters
T_mtype of element in Eigen::Matrix
T_aType of element to add along the diagonal
Parameters
mata matrix
to_addSequence of values to add along the diagonal
Returns
a matrix with to_add added along main diagonal
Exceptions
invalid_argumentif to_add is vector-like but does not have the same number of elements as the main diagonal of mat

Definition at line 46 of file add_diag.hpp.

◆ adj_jac_apply()

template<typename F , typename... Targs>
auto stan::math::adj_jac_apply ( const Targs &...  args)

Return the result of applying the function defined by a nullary construction of F to the specified input argument.

adj_jac_apply makes it possible to write efficient reverse-mode autodiff code without ever touching Stan's autodiff internals

Mathematically, to use a function in reverse mode autodiff, you need to be able to evaluate the function (y = f(x)) and multiply the Jacobian of that function (df(x)/dx) by a vector.

As an example, pretend there exists some large, complicated function, L(x1, x2), which contains our smaller function f(x1, x2). The goal of autodiff is to compute the partials dL/dx1 and dL/dx2. If we break the large function into pieces:

y = f(x1, x2) L = g(y)

If we were given dL/dy we could compute dL/dx1 by the product dL/dy * dy/dx1 or dL/dx2 by the product dL/dy * dy/dx2

Because y = f(x1, x2), dy/dx1 is just df(x1, x2)/dx1, the Jacobian of the function we're trying to define with x2 held fixed. A similar thing happens for dy/dx2. In vector form,

dL/dx1 = (dL/dy)' * df(x1, x2)/dx1 and dL/dx2 = (dL/dy)' * df(x1, x2)/dx2

So implementing f(x1, x2) and the products above are all that is required mathematically to implement reverse-mode autodiff for a function.

adj_jac_apply takes as a template argument a functor F that supplies the non-static member functions (leaving exact template arguments off):

(required) Eigen::VectorXd operator()(const std::array<bool, size>& needs_adj, const T1& x1..., const T2& x2, ...)

where there can be any number of input arguments x1, x2, ... and T1, T2, ... can be either doubles or any Eigen::Matrix type with double scalar values. needs_adj is an array of size equal to the number of input arguments indicating whether or not the adjoint^T Jacobian product must be computed for each input argument. This argument is passed to operator() so that any unnecessary preparatory calculations for multiply_adjoint_jacobian can be avoided if possible.

(required) std::tuple<T1, T2, ...> multiply_adjoint_jacobian(const std::array<bool, size>& needs_adj, const Eigen::VectorXd& adj)

where T1, T2, etc. are the same types as in operator(), needs_adj is the same as in operator(), and adj is the vector dL/dy.

operator() is responsible for computing f(x) and multiply_adjoint_jacobian is responsible for computing the necessary adjoint transpose Jacobian products (which frequently does not require the calculation of the full Jacobian).

operator() will be called before multiply_adjoint_jacobian is called, and is only called once in the lifetime of the functor multiply_adjoint_jacobian is called after operator() and may be called multiple times for any single functor

The functor supplied to adj_jac_apply must be careful to allocate any variables it defines in the autodiff arena because its destructor will never be called and memory will leak if allocated anywhere else.

Targs (the input argument types) can be any mix of doubles, vars, ints, std::vectors with double, var, or int scalar components, or Eigen::Matrix s of any shape with var or double scalar components

Template Parameters
Ffunctor to be connected to the autodiff stack
Targstypes of arguments to pass to functor
Parameters
argsinput to the functor
Returns
the result of the specified operation wrapped up in vars

Definition at line 615 of file adj_jac_apply.hpp.

◆ algebra_solver() [1/2]

template<typename F , typename T >
Eigen::VectorXd stan::math::algebra_solver ( const F &  f,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
const Eigen::VectorXd &  y,
const std::vector< double > &  dat,
const std::vector< int > &  dat_int,
std::ostream *  msgs = nullptr,
double  relative_tolerance = 1e-10,
double  function_tolerance = 1e-6,
long int  max_num_steps = 1e+3 
)

Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.

The user can also specify the relative tolerance (xtol in Eigen's code), the function tolerance, and the maximum number of steps (maxfev in Eigen's code).

Throw an exception if the norm of f(x), where f is the output of the algebraic system and x the proposed solution, is greater than the function tolerance. We here use the norm as a metric to measure how far we are from the origin (0).

Template Parameters
Ftype of equation system function.
Ttype of initial guess vector.
Parameters
[in]fFunctor that evaluates the system of equations.
[in]xVector of starting values.
[in]yparameter vector for the equation system. The function is overloaded to treat y as a vector of doubles or of a a template type T.
[in]datcontinuous data vector for the equation system.
[in]dat_intinteger data vector for the equation system.
[in,out]msgsthe print stream for warning messages.
[in]relative_tolerancedetermines the convergence criteria for the solution.
[in]function_tolerancedetermines whether roots are acceptable.
[in]max_num_stepsmaximum number of function evaluations.
Returns
theta Vector of solutions to the system of equations.
Exceptions
<code>std::invalid_argument</code>if x has size zero.
<code>std::invalid_argument</code>if x has non-finite elements.
<code>std::invalid_argument</code>if y has non-finite elements.
<code>std::invalid_argument</code>if dat has non-finite elements.
<code>std::invalid_argument</code>if dat_int has non-finite elements.
<code>std::invalid_argument</code>if relative_tolerance is strictly negative.
<code>std::invalid_argument</code>if function_tolerance is strictly negative.
<code>std::invalid_argument</code>if max_num_steps is not positive.
<code>boost::math::evaluation_error</code>(which is a subclass of std::runtime_error) if solver exceeds max_num_steps.
<code>boost::math::evaluation_error</code>(which is a subclass of std::runtime_error) if the norm of the solution exceeds the function tolerance.

Definition at line 124 of file algebra_solver.hpp.

◆ algebra_solver() [2/2]

template<typename F , typename T1 , typename T2 >
Eigen::Matrix<T2, Eigen::Dynamic, 1> stan::math::algebra_solver ( const F &  f,
const Eigen::Matrix< T1, Eigen::Dynamic, 1 > &  x,
const Eigen::Matrix< T2, Eigen::Dynamic, 1 > &  y,
const std::vector< double > &  dat,
const std::vector< int > &  dat_int,
std::ostream *  msgs = nullptr,
double  relative_tolerance = 1e-10,
double  function_tolerance = 1e-6,
long int  max_num_steps = 1e+3 
)

Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.

The user can also specify the relative tolerance (xtol in Eigen's code), the function tolerance, and the maximum number of steps (maxfev in Eigen's code).

Overload the previous definition to handle the case where y is a vector of parameters (var). The overload calls the algebraic solver defined above and builds a vari object on top, using the algebra_solver_vari class.

Template Parameters
Ftype of equation system function.
T1Type of elements in x vector.
T2Type of elements in y vector.
Parameters
[in]fFunctor that evaluates the system of equations.
[in]xVector of starting values (initial guess).
[in]yparameter vector for the equation system.
[in]datcontinuous data vector for the equation system.
[in]dat_intinteger data vector for the equation system.
[in,out]msgsthe print stream for warning messages.
[in]relative_tolerancedetermines the convergence criteria for the solution.
[in]function_tolerancedetermines whether roots are acceptable.
[in]max_num_stepsmaximum number of function evaluations.
Returns
theta Vector of solutions to the system of equations.
Exceptions
<code>std::invalid_argument</code>if x has size zero.
<code>std::invalid_argument</code>if x has non-finite elements.
<code>std::invalid_argument</code>if y has non-finite elements.
<code>std::invalid_argument</code>if dat has non-finite elements.
<code>std::invalid_argument</code>if dat_int has non-finite elements.
<code>std::invalid_argument</code>if relative_tolerance is strictly negative.
<code>std::invalid_argument</code>if function_tolerance is strictly negative.
<code>std::invalid_argument</code>if max_num_steps is not positive.
<code>boost::math::evaluation_error</code>(which is a subclass of std::runtime_error) if solver exceeds max_num_steps.
<code>boost::math::evaluation_error</code>(which is a subclass of std::runtime_error) if the norm of the solution exceeds the function tolerance.

Definition at line 236 of file algebra_solver.hpp.

◆ append_array() [1/2]

template<typename T1 , typename T2 >
append_return_type<std::vector<T1>, std::vector<T2> >::type stan::math::append_array ( const std::vector< T1 > &  x,
const std::vector< T2 > &  y 
)
inline

Return the concatenation of two specified vectors in the order of the arguments.

The return type is computed with append_return_type

Template Parameters
T1Scalar type of first vector
T2Scalar type of second vector
Parameters
xFirst vector
ySecond vector
Returns
A vector of x and y concatenated together (in that order)

Definition at line 29 of file append_array.hpp.

◆ append_array() [2/2]

template<typename T1 >
std::vector<T1> stan::math::append_array ( const std::vector< T1 > &  x,
const std::vector< T1 > &  y 
)
inline

Return the concatenation of two specified vectors in the order of the arguments.

Template Parameters
T1Type of vectors
Parameters
xFirst vector
ySecond vector
Returns
A vector of x and y concatenated together (in that order)

Definition at line 57 of file append_array.hpp.

◆ append_col() [1/6]

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename return_type<T1, T2>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::append_col ( const Eigen::Matrix< T1, R1, C1 > &  A,
const Eigen::Matrix< T2, R2, C2 > &  B 
)
inline

Return the result of appending the second argument matrix after the first argument matrix, that is, putting them side by side, with the first matrix followed by the second matrix.

The inputs can be (matrix, matrix), (matrix, vector), (vector, matrix), or (vector, vector) and the output is always a matrix.

Template Parameters
T1Scalar type of first matrix.
T2Scalar type of second matrix.
R1Row specification of first matrix.
C1Column specification of first matrix.
R2Row specification of second matrix.
C2Column specification of second matrix.
Parameters
AFirst matrix.
BSecond matrix.
Returns
Result of appending the first matrix followed by the second matrix side by side.

Definition at line 38 of file append_col.hpp.

◆ append_col() [2/6]

template<typename T1 , typename T2 , int C1, int C2>
Eigen::Matrix<typename return_type<T1, T2>::type, 1, Eigen::Dynamic> stan::math::append_col ( const Eigen::Matrix< T1, 1, C1 > &  A,
const Eigen::Matrix< T2, 1, C2 > &  B 
)
inline

Return the result of concatenaing the first row vector followed by the second row vector side by side, with the result being a row vector.

This function applies to (row_vector, row_vector) and returns a row_vector.

Template Parameters
T1Scalar type of first row vector.
T2Scalar type of second row vector.
C1Column specification of first row vector.
C2Column specification of second row vector.
Parameters
AFirst vector.
BSecond vector
Returns
Result of appending the second row vector to the right of the first row vector.

Definition at line 80 of file append_col.hpp.

◆ append_col() [3/6]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::append_col ( const Eigen::Matrix< T, R1, C1 > &  A,
const Eigen::Matrix< T, R2, C2 > &  B 
)
inline

Return the result of appending the second argument matrix after the first argument matrix, that is, putting them side by side, with the first matrix followed by the second matrix.

This is an overloaded template function for the case when both matrices have the same type.

The inputs can be (matrix, matrix), (matrix, vector), (vector, matrix), or (vector, vector), and the output is always a matrix.

Template Parameters
TScalar type of both matrices.
R1Row specification of first matrix.
C1Column specification of first matrix.
R2Row specification of second matrix.
C2Column specification of second matrix.
Parameters
AFirst matrix.
BSecond matrix.
Returns
Result of appending the first matrix followed by the second matrix side by side.

Definition at line 120 of file append_col.hpp.

◆ append_col() [4/6]

template<typename T , int C1, int C2>
Eigen::Matrix<T, 1, Eigen::Dynamic> stan::math::append_col ( const Eigen::Matrix< T, 1, C1 > &  A,
const Eigen::Matrix< T, 1, C2 > &  B 
)
inline

Return the result of concatenaing the first row vector followed by the second row vector side by side, with the result being a row vector.

This function applies to (row_vector, row_vector) and returns a row_vector.

Template Parameters
TScalar type of both vectors.
C1Column specification of first row vector.
C2Column specification of second row vector.
Parameters
AFirst vector.
BSecond vector
Returns
Result of appending the second row vector to the right of the first row vector.

Definition at line 149 of file append_col.hpp.

◆ append_col() [5/6]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename return_type<T1, T2>::type, 1, Eigen::Dynamic> stan::math::append_col ( const T1 &  A,
const Eigen::Matrix< T2, R, C > &  B 
)
inline

Return the result of stacking an scalar on top of the a row vector, with the result being a row vector.

This function applies to (scalar, row vector) and returns a row vector.

Template Parameters
T1Scalar type of the scalar
T2Scalar type of the row vector.
RRow specification of the row vector.
Parameters
Ascalar.
Brow vector.
Returns
Result of stacking the scalar on top of the row vector.

Definition at line 175 of file append_col.hpp.

◆ append_col() [6/6]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename return_type<T1, T2>::type, 1, Eigen::Dynamic> stan::math::append_col ( const Eigen::Matrix< T1, R, C > &  A,
const T2 &  B 
)
inline

Return the result of stacking a row vector on top of the an scalar, with the result being a row vector.

This function applies to (row vector, scalar) and returns a row vector.

Template Parameters
T1Scalar type of the row vector.
T2Scalar type of the scalar
RRow specification of the row vector.
Parameters
Arow vector.
Bscalar.
Returns
Result of stacking the row vector on top of the scalar.

Definition at line 201 of file append_col.hpp.

◆ append_row() [1/6]

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename return_type<T1, T2>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::append_row ( const Eigen::Matrix< T1, R1, C1 > &  A,
const Eigen::Matrix< T2, R2, C2 > &  B 
)
inline

Return the result of stacking the rows of the first argument matrix on top of the second argument matrix.

The inputs can be (matrix, matrix), (matrix, row_vector), (row_vector, matrix), or (row_vector, row_vector), and the output is always a matrix.

Template Parameters
T1Scalar type of first matrix.
T2Scalar type of second matrix.
R1Row specification of first matrix.
C1Column specification of first matrix.
R2Row specification of second matrix.
C2Column specification of second matrix.
Parameters
AFirst matrix.
BSecond matrix.
Returns
Result of stacking first matrix on top of second.

Definition at line 36 of file append_row.hpp.

◆ append_row() [2/6]

template<typename T1 , typename T2 , int R1, int R2>
Eigen::Matrix<typename return_type<T1, T2>::type, Eigen::Dynamic, 1> stan::math::append_row ( const Eigen::Matrix< T1, R1, 1 > &  A,
const Eigen::Matrix< T2, R2, 1 > &  B 
)
inline

Return the result of stacking the first vector on top of the second vector, with the result being a vector.

This function applies to (vector, vector) and returns a vector.

Template Parameters
T1Scalar type of first vector.
T2Scalar type of second vector.
R1Row specification of first vector.
R2Row specification of second vector.
Parameters
AFirst vector.
BSecond vector.
Returns
Result of stacking first vector on top of the second vector.

Definition at line 75 of file append_row.hpp.

◆ append_row() [3/6]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::append_row ( const Eigen::Matrix< T, R1, C1 > &  A,
const Eigen::Matrix< T, R2, C2 > &  B 
)
inline

Return the result of stacking the rows of the first argument matrix on top of the second argument matrix.

This is an overload for the case when the scalar types of the two input matrix are the same.

The inputs can be (matrix, matrix), (matrix, row_vector), (row_vector, matrix), or (row_vector, row_vector), and the output is always a matrix.

Template Parameters
TScalar type of both matrices.
R1Row specification of first matrix.
C1Column specification of first matrix.
R2Row specification of second matrix.
C2Column specification of second matrix.
Parameters
AFirst matrix.
BSecond matrix.
Returns
Result of stacking first matrix on top of second.

Definition at line 113 of file append_row.hpp.

◆ append_row() [4/6]

template<typename T , int R1, int R2>
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::append_row ( const Eigen::Matrix< T, R1, 1 > &  A,
const Eigen::Matrix< T, R2, 1 > &  B 
)
inline

Return the result of stacking the first vector on top of the second vector, with the result being a vector.

This is an overloaded template function for the case where both inputs have the same scalar type.

This function applies to (vector, vector) and returns a vector.

Template Parameters
TScalar type of both vectors.
R1Row specification of first vector.
R2Row specification of second vector.
Parameters
AFirst vector.
BSecond vector.
Returns
Result of stacking first vector on top of the second vector.

Definition at line 143 of file append_row.hpp.

◆ append_row() [5/6]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename return_type<T1, T2>::type, Eigen::Dynamic, 1> stan::math::append_row ( const T1 &  A,
const Eigen::Matrix< T2, R, C > &  B 
)
inline

Return the result of stacking an scalar on top of the a vector, with the result being a vector.

This function applies to (scalar, vector) and returns a vector.

Template Parameters
T1Scalar type of the scalar
T2Scalar type of the vector.
RRow specification of the vector.
Parameters
Ascalar.
Bvector.
Returns
Result of stacking the scalar on top of the vector.

Definition at line 168 of file append_row.hpp.

◆ append_row() [6/6]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename return_type<T1, T2>::type, Eigen::Dynamic, 1> stan::math::append_row ( const Eigen::Matrix< T1, R, C > &  A,
const T2 &  B 
)
inline

Return the result of stacking a vector on top of the an scalar, with the result being a vector.

This function applies to (vector, scalar) and returns a vector.

Template Parameters
T1Scalar type of the vector.
T2Scalar type of the scalar
RRow specification of the vector.
Parameters
Avector.
Bscalar.
Returns
Result of stacking the vector on top of the scalar.

Definition at line 193 of file append_row.hpp.

◆ as_array_or_scalar() [1/4]

template<typename T >
const T& stan::math::as_array_or_scalar ( const T &  v)
inline

Returns specified input value.

Template Parameters
TType of element.
Parameters
vSpecified value.
Returns
Same value.

Definition at line 15 of file as_array_or_scalar.hpp.

◆ as_array_or_scalar() [2/4]

template<typename T , int R, int C>
Eigen::ArrayWrapper<const Eigen::Matrix<T, R, C> > stan::math::as_array_or_scalar ( const Eigen::Matrix< T, R, C > &  v)
inline

Converts a matrix type to an array.

Template Parameters
TType of scalar element.
RRow type of input matrix.
CColumn type of input matrix.
Parameters
vSpecified matrix.
Returns
Matrix converted to an array.

Definition at line 20 of file as_array_or_scalar.hpp.

◆ as_array_or_scalar() [3/4]

template<typename T , int R, int C>
Eigen::ArrayWrapper<const Eigen::Map<const Eigen::Matrix<T, R, C> > > stan::math::as_array_or_scalar ( const Eigen::Map< const Eigen::Matrix< T, R, C >> &  v)
inline

Converts a matrix type to an array.

Template Parameters
TType of scalar element.
RRow type of input matrix.
CColumn type of input matrix.
Parameters
vSpecified matrix.
Returns
Matrix converted to an array.

Definition at line 36 of file as_array_or_scalar.hpp.

◆ as_array_or_scalar() [4/4]

template<typename T >
Eigen::Map<const Eigen::Array<T, Eigen::Dynamic, 1> > stan::math::as_array_or_scalar ( const std::vector< T > &  v)
inline

Converts a std::vector type to an array.

Template Parameters
TType of scalar element.
Parameters
vSpecified vector.
Returns
Matrix converted to an array.

Definition at line 48 of file as_array_or_scalar.hpp.

◆ as_bool() [1/2]

int stan::math::as_bool ( const var v)
inline

Return 1 if the argument is unequal to zero and 0 otherwise.

Parameters
vValue.
Returns
1 if argument is equal to zero (or NaN) and 0 otherwise.

Definition at line 16 of file as_bool.hpp.

◆ as_bool() [2/2]

template<typename T >
bool stan::math::as_bool ( const T &  x)
inline

Return true if the argument is not equal to zero (in the != operator sense) and false otherwise.

Template Parameters
Ttype of scalar
Parameters
xvalue
Returns
true if value is not equal to zero

Definition at line 17 of file as_bool.hpp.

◆ as_column_vector_or_scalar() [1/4]

template<typename T >
const T& stan::math::as_column_vector_or_scalar ( const T &  a)
inline

Converts input argument to a column vector or a scalar.

For scalar inputs that is an identity function.

Template Parameters
TType of scalar element.
Parameters
aSpecified scalar.
Returns
1x1 matrix that contains the value of scalar.

Definition at line 16 of file as_column_vector_or_scalar.hpp.

◆ as_column_vector_or_scalar() [2/4]

template<typename T >
const Eigen::Matrix<T, Eigen::Dynamic, 1>& stan::math::as_column_vector_or_scalar ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  a)
inline

Converts input argument to a column vector or a scalar.

For column vector inputs this is an identity function.

Template Parameters
TType of scalar element.
Parameters
aSpecified vector.
Returns
Same vector.

Definition at line 19 of file as_column_vector_or_scalar.hpp.

◆ as_column_vector_or_scalar() [3/4]

template<typename T >
Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, 1> > stan::math::as_column_vector_or_scalar ( const Eigen::Matrix< T, 1, Eigen::Dynamic > &  a)
inline

Converts input argument to a column vector or a scalar.

For a row vector input this is transpose.

Template Parameters
TType of scalar element.
Parameters
aSpecified vector.
Returns
Transposed vector.

Definition at line 34 of file as_column_vector_or_scalar.hpp.

◆ as_column_vector_or_scalar() [4/4]

template<typename T >
Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, 1> > stan::math::as_column_vector_or_scalar ( const std::vector< T > &  a)
inline

Converts input argument to a column vector or a scalar.

std::vector will be converted to a column vector.

Template Parameters
TType of scalar element.
Parameters
aSpecified vector.
Returns
intut converted to a column vector.

Definition at line 50 of file as_column_vector_or_scalar.hpp.

◆ as_scalar() [1/4]

double stan::math::as_scalar ( double  a)
inline

Converts input to a scalar.

For scalar arguments this is an identity function.

Parameters
aInput value
Returns
Same value

Definition at line 13 of file as_scalar.hpp.

◆ as_scalar() [2/4]

template<typename T >
double stan::math::as_scalar ( const std::vector< T > &  a)
inline

Converts input to a scalar.

As this is not possible for vectors it always throws. This is intended to never be called, only used in templated functions in branches that will be optimized out - to prevent compiler from complaining about expressions with incompatible types.

Parameters
aInput expression
Exceptions
runtime_errorAlways throws
Returns
Never returns

Definition at line 20 of file as_scalar.hpp.

◆ as_scalar() [3/4]

int stan::math::as_scalar ( int  a)
inline

Converts input to a scalar.

For scalar arguments this is an identity function.

Parameters
aInput value
Returns
Same value

Definition at line 21 of file as_scalar.hpp.

◆ as_scalar() [4/4]

template<typename Derived >
double stan::math::as_scalar ( const Eigen::DenseBase< Derived > &  a)
inline

Converts input to a scalar.

As this is not possible for matrices, arrays or Eigen expressions it always throws. This is intended to never be called, only used in templated functions in branches that will be optimized out - to prevent compiler from complaining about expressions with incompatible types.

Template Parameters
DerivedType of input Eigen expression.
Parameters
aInput expression
Exceptions
runtime_errorAlways throws
Returns
Never returns

Definition at line 21 of file as_scalar.hpp.

◆ asin() [1/3]

template<typename T >
fvar<T> stan::math::asin ( const fvar< T > &  x)
inline

Definition at line 13 of file asin.hpp.

◆ asin() [2/3]

template<typename T >
apply_scalar_unary<asin_fun, T>::return_t stan::math::asin ( const T &  x)
inline

Vectorized version of asin().

Parameters
xContainer of variables.
Template Parameters
TContainer type.
Returns
Arcsine of each variable in the container, in radians.

Definition at line 31 of file asin.hpp.

◆ asin() [3/3]

var stan::math::asin ( const var a)
inline

Return the principal value of the arc sine, in radians, of the specified variable (cmath).

The derivative is defined by

$\frac{d}{dx} \arcsin x = \frac{1}{\sqrt{1 - x^2}}$.

\[ \mbox{asin}(x) = \begin{cases} \textrm{NaN} & \mbox{if } x < -1\\ \arcsin(x) & \mbox{if } -1\leq x\leq 1 \\ \textrm{NaN} & \mbox{if } x > 1\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{asin}(x)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x < -1\\ \frac{\partial\, \arcsin(x)}{\partial x} & \mbox{if } -1\leq x\leq 1 \\ \textrm{NaN} & \mbox{if } x < -1\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial \, \arcsin(x)}{\partial x} = \frac{1}{\sqrt{1-x^2}} \]

Parameters
aVariable in range [-1, 1].
Returns
Arc sine of variable, in radians.

Definition at line 57 of file asin.hpp.

◆ asinh() [1/5]

template<typename T >
fvar<T> stan::math::asinh ( const fvar< T > &  x)
inline

Definition at line 14 of file asinh.hpp.

◆ asinh() [2/5]

double stan::math::asinh ( double  x)
inline

Return the inverse hyperbolic sine of the specified value.

Returns infinity for infinity argument and -infinity for -infinity argument. Returns nan for nan argument.

Parameters
[in]xArgument.
Returns
Inverse hyperbolic sine of the argument.

Definition at line 19 of file asinh.hpp.

◆ asinh() [3/5]

double stan::math::asinh ( int  x)
inline

Integer version of asinh.

Parameters
[in]xArgument.
Returns
Inverse hyperbolic sine of the argument.

Definition at line 27 of file asinh.hpp.

◆ asinh() [4/5]

template<typename T >
apply_scalar_unary<asinh_fun, T>::return_t stan::math::asinh ( const T &  x)
inline

Vectorized version of asinh().

Template Parameters
TContainer type.
Parameters
xContainer.
Returns
Inverse hyperbolic sine of each value in the container.

Definition at line 32 of file asinh.hpp.

◆ asinh() [5/5]

var stan::math::asinh ( const var a)
inline

The inverse hyperbolic sine function for variables (C99).

The derivative is defined by

$\frac{d}{dx} \mbox{asinh}(x) = \frac{x}{x^2 + 1}$.

\[ \mbox{asinh}(x) = \begin{cases} \sinh^{-1}(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{asinh}(x)}{\partial x} = \begin{cases} \frac{\partial\, \sinh^{-1}(x)}{\partial x} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \sinh^{-1}(x)=\ln\left(x+\sqrt{x^2+1}\right) \]

\[ \frac{\partial \, \sinh^{-1}(x)}{\partial x} = \frac{1}{\sqrt{x^2+1}} \]

Parameters
aThe variable.
Returns
Inverse hyperbolic sine of the variable.

Definition at line 55 of file asinh.hpp.

◆ assign() [1/5]

template<typename T_lhs , typename T_rhs >
void stan::math::assign ( T_lhs &  x,
const T_rhs &  y 
)
inline

Copy the right-hand side's value to the left-hand side variable.

The assign() function is overloaded. This instance will match arguments where the right-hand side is assignable to the left and they are not both std::vector or Eigen::Matrix types.

Template Parameters
T_lhsType of left-hand side.
T_rhsType of right-hand side.
Parameters
xLeft-hand side.
yRight-hand side.

Definition at line 47 of file assign.hpp.

◆ assign() [2/5]

template<typename T_lhs , typename T_rhs , int R1, int C1, int R2, int C2>
void stan::math::assign ( Eigen::Matrix< T_lhs, R1, C1 > &  x,
const Eigen::Matrix< T_rhs, R2, C2 > &  y 
)
inline

Copy the right-hand side's value to the left-hand side variable.

The assign() function is overloaded. This instance will be called for arguments that are both Eigen::Matrix types, but whose shapes are not compatible. The shapes are specified in the row and column template parameters.

Template Parameters
T_lhsType of left-hand side matrix elements.
T_rhsType of right-hand side matrix elements.
R1Row shape of left-hand side matrix.
C1Column shape of left-hand side matrix.
R2Row shape of right-hand side matrix.
C2Column shape of right-hand side matrix.
Parameters
xLeft-hand side matrix.
yRight-hand side matrix.
Exceptions
std::invalid_argument

Definition at line 72 of file assign.hpp.

◆ assign() [3/5]

template<typename T_lhs , typename T_rhs , int R, int C>
void stan::math::assign ( Eigen::Matrix< T_lhs, R, C > &  x,
const Eigen::Matrix< T_rhs, R, C > &  y 
)
inline

Copy the right-hand side's value to the left-hand side variable.

The assign() function is overloaded. This instance will be called for arguments that are both Eigen::Matrix types and whose shapes match. The shapes are specified in the row and column template parameters.

Template Parameters
T_lhsType of left-hand side matrix elements.
T_rhsType of right-hand side matrix elements.
RRow shape of both matrices.
CColumn shape of both mtarices.
Parameters
xLeft-hand side matrix.
yRight-hand side matrix.
Exceptions
std::invalid_argumentif sizes do not match.

Definition at line 107 of file assign.hpp.

◆ assign() [4/5]

template<typename T_lhs , typename T , int R, int C>
void stan::math::assign ( Eigen::Block< T_lhs >  x,
const Eigen::Matrix< T, R, C > &  y 
)
inline

Copy the right-hand side's value to the left-hand side variable.

The assign() function is overloaded. This instance will be called for arguments that are both Eigen::Matrix types and whose shapes match. The shape of the right-hand side matrix is specified in the row and column shape template parameters.

The left-hand side is intentionally not a reference, because that won't match generally enough; instead, a non-reference is used, which still holds onto a reference to the contained matrix and thus still updates the appropriate values.

Template Parameters
T_lhsType of matrix block elements.
TType of right-hand side matrix elements.
RRow shape for right-hand side matrix.
CColumn shape for right-hand side matrix.
Parameters
xLeft-hand side block view of matrix.
yRight-hand side matrix.
Exceptions
std::invalid_argumentif sizes do not match.

Definition at line 138 of file assign.hpp.

◆ assign() [5/5]

template<typename T_lhs , typename T_rhs >
void stan::math::assign ( std::vector< T_lhs > &  x,
const std::vector< T_rhs > &  y 
)
inline

Copy the right-hand side's value to the left-hand side variable.

The assign() function is overloaded. This instance will be called for arguments that are both std::vector, and will call assign() element-by element.

For example, a std::vector<int> can be assigned to a std::vector<double> using this function.

Template Parameters
T_lhsType of left-hand side vector elements.
T_rhsType of right-hand side vector elements.
Parameters
xLeft-hand side vector.
yRight-hand side vector.
Exceptions
std::invalid_argumentif sizes do not match.

Definition at line 168 of file assign.hpp.

◆ atan() [1/3]

template<typename T >
fvar<T> stan::math::atan ( const fvar< T > &  x)
inline

Definition at line 13 of file atan.hpp.

◆ atan() [2/3]

template<typename T >
apply_scalar_unary<atan_fun, T>::return_t stan::math::atan ( const T &  x)
inline

Vectorized version of asinh().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Arctan of each value in x, in radians.

Definition at line 31 of file atan.hpp.

◆ atan() [3/3]

var stan::math::atan ( const var a)
inline

Return the principal value of the arc tangent, in radians, of the specified variable (cmath).

The derivative is defined by

$\frac{d}{dx} \arctan x = \frac{1}{1 + x^2}$.

\[ \mbox{atan}(x) = \begin{cases} \arctan(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{atan}(x)}{\partial x} = \begin{cases} \frac{\partial\, \arctan(x)}{\partial x} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial \, \arctan(x)}{\partial x} = \frac{1}{x^2+1} \]

Parameters
aVariable in range [-1, 1].
Returns
Arc tangent of variable, in radians.

Definition at line 49 of file atan.hpp.

◆ atan2() [1/6]

template<typename T >
fvar<T> stan::math::atan2 ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 13 of file atan2.hpp.

◆ atan2() [2/6]

template<typename T >
fvar<T> stan::math::atan2 ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 21 of file atan2.hpp.

◆ atan2() [3/6]

template<typename T >
fvar<T> stan::math::atan2 ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 28 of file atan2.hpp.

◆ atan2() [4/6]

var stan::math::atan2 ( const var a,
const var b 
)
inline

Return the principal value of the arc tangent, in radians, of the first variable divided by the second (cmath).

The partial derivatives are defined by

$ \frac{\partial}{\partial x} \arctan \frac{x}{y} = \frac{y}{x^2 + y^2}$, and

$ \frac{\partial}{\partial y} \arctan \frac{x}{y} = \frac{-x}{x^2 + y^2}$.

Parameters
aNumerator variable.
bDenominator variable.
Returns
The arc tangent of the fraction, in radians.

Definition at line 61 of file atan2.hpp.

◆ atan2() [5/6]

var stan::math::atan2 ( const var a,
double  b 
)
inline

Return the principal value of the arc tangent, in radians, of the first variable divided by the second scalar (cmath).

The derivative with respect to the variable is

$ \frac{d}{d x} \arctan \frac{x}{c} = \frac{c}{x^2 + c^2}$.

Parameters
aNumerator variable.
bDenominator scalar.
Returns
The arc tangent of the fraction, in radians.

Definition at line 77 of file atan2.hpp.

◆ atan2() [6/6]

var stan::math::atan2 ( double  a,
const var b 
)
inline

Return the principal value of the arc tangent, in radians, of the first scalar divided by the second variable (cmath).

The derivative with respect to the variable is

$ \frac{\partial}{\partial y} \arctan \frac{c}{y} = \frac{-c}{c^2 + y^2}$.

\[ \mbox{atan2}(x, y) = \begin{cases} \arctan\left(\frac{x}{y}\right) & \mbox{if } -\infty\leq x \leq \infty, -\infty\leq y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{atan2}(x, y)}{\partial x} = \begin{cases} \frac{y}{x^2+y^2} & \mbox{if } -\infty\leq x\leq \infty, -\infty\leq y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{atan2}(x, y)}{\partial y} = \begin{cases} -\frac{x}{x^2+y^2} & \mbox{if } -\infty\leq x\leq \infty, -\infty\leq y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aNumerator scalar.
bDenominator variable.
Returns
The arc tangent of the fraction, in radians.

Definition at line 117 of file atan2.hpp.

◆ atanh() [1/5]

template<typename T >
fvar<T> stan::math::atanh ( const fvar< T > &  x)
inline

Return inverse hyperbolic tangent of specified value.

Template Parameters
Tscalar type of forward-mode autodiff variable argument.
Parameters
xArgument.
Returns
Inverse hyperbolic tangent of argument.
Exceptions
std::domain_errorif x < -1 or x > 1.

Definition at line 22 of file atanh.hpp.

◆ atanh() [2/5]

double stan::math::atanh ( double  x)
inline

Return the inverse hyperbolic tangent of the specified value.

An argument of -1 returns negative infinity and an argument of 1 returns infinity. Returns nan for nan argument.

Parameters
[in]xArgument.
Returns
Inverse hyperbolic tangent of the argument.
Exceptions
std::domain_errorIf argument is not in [-1, 1].

Definition at line 22 of file atanh.hpp.

◆ atanh() [3/5]

template<typename T >
apply_scalar_unary<atanh_fun, T>::return_t stan::math::atanh ( const T &  x)
inline

Return the elementwise application of atanh() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
TContainer type.
Parameters
xContainer.
Returns
Elementwise atanh of members of container.

Definition at line 38 of file atanh.hpp.

◆ atanh() [4/5]

double stan::math::atanh ( int  x)
inline

Integer version of atanh.

Parameters
[in]xArgument.
Returns
Inverse hyperbolic tangent of the argument.
Exceptions
std::domain_errorIf argument is less than 1.

Definition at line 38 of file atanh.hpp.

◆ atanh() [5/5]

var stan::math::atanh ( const var a)
inline

The inverse hyperbolic tangent function for variables (C99).

The derivative is defined by

$\frac{d}{dx} \mbox{atanh}(x) = \frac{1}{1 - x^2}$.

\[ \mbox{atanh}(x) = \begin{cases} \textrm{NaN} & \mbox{if } x < -1\\ \tanh^{-1}(x) & \mbox{if } -1\leq x \leq 1 \\ \textrm{NaN} & \mbox{if } x > 1\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{atanh}(x)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x < -1\\ \frac{\partial\, \tanh^{-1}(x)}{\partial x} & \mbox{if } -1\leq x\leq 1 \\ \textrm{NaN} & \mbox{if } x > 1\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \tanh^{-1}(x)=\frac{1}{2}\ln\left(\frac{1+x}{1-x}\right) \]

\[ \frac{\partial \, \tanh^{-1}(x)}{\partial x} = \frac{1}{1-x^2} \]

Parameters
aThe variable.
Returns
Inverse hyperbolic tangent of the variable.
Exceptions
std::domain_errorif a < -1 or a > 1

Definition at line 58 of file atanh.hpp.

◆ autocorrelation() [1/4]

template<typename T >
void stan::math::autocorrelation ( const std::vector< T > &  y,
std::vector< T > &  ac,
Eigen::FFT< T > &  fft 
)

Write autocorrelation estimates for every lag for the specified input sequence into the specified result using the specified FFT engine.

The return vector be resized to the same length as the input sequence with lags given by array index.

The implementation involves a fast Fourier transform, followed by a normalization, followed by an inverse transform.

An FFT engine can be created for reuse for type double with:

    Eigen::FFT<double> fft;
Template Parameters
TScalar type.
Parameters
yInput sequence.
acAutocorrelations.
fftFFT engine instance.

Definition at line 56 of file autocorrelation.hpp.

◆ autocorrelation() [2/4]

template<typename T , typename DerivedA , typename DerivedB >
void stan::math::autocorrelation ( const Eigen::MatrixBase< DerivedA > &  y,
Eigen::MatrixBase< DerivedB > &  ac,
Eigen::FFT< T > &  fft 
)

Write autocorrelation estimates for every lag for the specified input sequence into the specified result using the specified FFT engine.

The return vector be resized to the same length as the input sequence with lags given by array index.

The implementation involves a fast Fourier transform, followed by a normalization, followed by an inverse transform.

An FFT engine can be created for reuse for type double with:

    Eigen::FFT<double> fft;
Template Parameters
TScalar type.
Parameters
yInput sequence.
acAutocorrelations.
fftFFT engine instance.

Definition at line 110 of file autocorrelation.hpp.

◆ autocorrelation() [3/4]

template<typename T >
void stan::math::autocorrelation ( const std::vector< T > &  y,
std::vector< T > &  ac 
)

Write autocorrelation estimates for every lag for the specified input sequence into the specified result.

The return vector be resized to the same length as the input sequence with lags given by array index.

The implementation involves a fast Fourier transform, followed by a normalization, followed by an inverse transform.

This method is just a light wrapper around the three-argument autocorrelation function.

Template Parameters
TScalar type.
Parameters
yInput sequence.
acAutocorrelations.

Definition at line 154 of file autocorrelation.hpp.

◆ autocorrelation() [4/4]

template<typename T , typename DerivedA , typename DerivedB >
void stan::math::autocorrelation ( const Eigen::MatrixBase< DerivedA > &  y,
Eigen::MatrixBase< DerivedB > &  ac 
)

Write autocorrelation estimates for every lag for the specified input sequence into the specified result.

The return vector be resized to the same length as the input sequence with lags given by array index.

The implementation involves a fast Fourier transform, followed by a normalization, followed by an inverse transform.

This method is just a light wrapper around the three-argument autocorrelation function

Template Parameters
TScalar type.
Parameters
yInput sequence.
acAutocorrelations.

Definition at line 181 of file autocorrelation.hpp.

◆ autocovariance() [1/4]

template<typename T >
void stan::math::autocovariance ( const std::vector< T > &  y,
std::vector< T > &  acov,
Eigen::FFT< T > &  fft 
)

Write autocovariance estimates for every lag for the specified input sequence into the specified result using the specified FFT engine.

The return vector be resized to the same length as the input sequence with lags given by array index.

The implementation involves a fast Fourier transform, followed by a normalization, followed by an inverse transform.

An FFT engine can be created for reuse for type double with:

    Eigen::FFT<double> fft;
Template Parameters
TScalar type.
Parameters
yInput sequence.
acovAutocovariance.
fftFFT engine instance.

Definition at line 33 of file autocovariance.hpp.

◆ autocovariance() [2/4]

template<typename T , typename DerivedA , typename DerivedB >
void stan::math::autocovariance ( const Eigen::MatrixBase< DerivedA > &  y,
Eigen::MatrixBase< DerivedB > &  acov,
Eigen::FFT< T > &  fft 
)

Write autocovariance estimates for every lag for the specified input sequence into the specified result using the specified FFT engine.

The return vector be resized to the same length as the input sequence with lags given by array index.

The implementation involves a fast Fourier transform, followed by a normalization, followed by an inverse transform.

An FFT engine can be created for reuse for type double with:

    Eigen::FFT<double> fft;
Template Parameters
TScalar type.
Parameters
yInput sequence.
acovAutocovariance.
fftFFT engine instance.

Definition at line 64 of file autocovariance.hpp.

◆ autocovariance() [3/4]

template<typename T >
void stan::math::autocovariance ( const std::vector< T > &  y,
std::vector< T > &  acov 
)

Write autocovariance estimates for every lag for the specified input sequence into the specified result.

The return vector be resized to the same length as the input sequence with lags given by array index.

The implementation involves a fast Fourier transform, followed by a normalization, followed by an inverse transform.

This method is just a light wrapper around the three-argument autocovariance function.

Template Parameters
TScalar type.
Parameters
yInput sequence.
acovAutocovariances.

Definition at line 87 of file autocovariance.hpp.

◆ autocovariance() [4/4]

template<typename T , typename DerivedA , typename DerivedB >
void stan::math::autocovariance ( const Eigen::MatrixBase< DerivedA > &  y,
Eigen::MatrixBase< DerivedB > &  acov 
)

Write autocovariance estimates for every lag for the specified input sequence into the specified result.

The return vector be resized to the same length as the input sequence with lags given by array index.

The implementation involves a fast Fourier transform, followed by a normalization, followed by an inverse transform.

This method is just a light wrapper around the three-argument autocovariance function

Template Parameters
TScalar type.
Parameters
yInput sequence.
acovAutocovariances.

Definition at line 114 of file autocovariance.hpp.

◆ bernoulli_ccdf_log()

template<typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_ccdf_log ( const T_n &  n,
const T_prob &  theta 
)
Deprecated:
use bernoulli_lccdf

Definition at line 14 of file bernoulli_ccdf_log.hpp.

◆ bernoulli_cdf()

template<typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_cdf ( const T_n &  n,
const T_prob &  theta 
)

Returns the CDF of the Bernoulli distribution.

If containers are supplied, returns the product of the probabilities.

Template Parameters
T_ntype of integer parameter
T_probtype of chance of success parameter
Parameters
ninteger parameter
thetachance of success parameter
Returns
probability or product of probabilities
Exceptions
std::domain_errorif theta is not a valid probability
std::invalid_argumentif container sizes mismatch.

Definition at line 28 of file bernoulli_cdf.hpp.

◆ bernoulli_cdf_log()

template<typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_cdf_log ( const T_n &  n,
const T_prob &  theta 
)
Deprecated:
use bernoulli_lcdf

Definition at line 14 of file bernoulli_cdf_log.hpp.

◆ bernoulli_lccdf()

template<typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_lccdf ( const T_n &  n,
const T_prob &  theta 
)

Returns the log CCDF of the Bernoulli distribution.

If containers are supplied, returns the log sum of the probabilities.

Template Parameters
T_ntype of integer parameter
T_probtype of chance of success parameter
Parameters
ninteger parameter
thetachance of success parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif theta is not a valid probability
std::invalid_argumentif container sizes mismatch.

Definition at line 29 of file bernoulli_lccdf.hpp.

◆ bernoulli_lcdf()

template<typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_lcdf ( const T_n &  n,
const T_prob &  theta 
)

Returns the log CDF of the Bernoulli distribution.

If containers are supplied, returns the log sum of the probabilities.

Template Parameters
T_ntype of integer parameter
T_probtype of chance of success parameter
Parameters
ninteger parameter
thetachance of success parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif theta is not a valid probability
std::invalid_argumentif container sizes mismatch.

Definition at line 29 of file bernoulli_lcdf.hpp.

◆ bernoulli_log() [1/2]

template<bool propto, typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_log ( const T_n &  n,
const T_prob &  theta 
)
Deprecated:
use bernoulli_lpmf

Definition at line 14 of file bernoulli_log.hpp.

◆ bernoulli_log() [2/2]

template<typename T_y , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_log ( const T_y &  n,
const T_prob &  theta 
)
inline
Deprecated:
use bernoulli_lpmf

Definition at line 23 of file bernoulli_log.hpp.

◆ bernoulli_logit_glm_log() [1/2]

template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type<T_x, T_alpha, T_beta>::type stan::math::bernoulli_logit_glm_log ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta 
)
Deprecated:
use bernoulli_logit_glm_lpmf

Definition at line 15 of file bernoulli_logit_glm_log.hpp.

◆ bernoulli_logit_glm_log() [2/2]

template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type<T_x, T_alpha, T_beta>::type stan::math::bernoulli_logit_glm_log ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta 
)
inline
Deprecated:
use bernoulli_logit_glm_lpmf

Definition at line 25 of file bernoulli_logit_glm_log.hpp.

◆ bernoulli_logit_glm_lpmf() [1/2]

template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type<T_x, T_alpha, T_beta>::type stan::math::bernoulli_logit_glm_lpmf ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta 
)

Returns the log PMF of the Generalized Linear Model (GLM) with Bernoulli distribution and logit link function.

The idea is that bernoulli_logit_glm_lpmf(y, x, alpha, beta) should compute a more efficient version of bernoulli_logit_lpmf(y, alpha + x * beta) by using analytically simplified gradients. If containers are supplied, returns the log sum of the probabilities.

Template Parameters
T_ytype of binary vector of dependent variables (labels); this can also be a single binary value;
T_xtype of the matrix of independent variables (features); this should be an Eigen::Matrix type whose number of rows should match the length of y and whose number of columns should match the length of beta
T_alphatype of the intercept(s); this can be a vector (of the same length as y) of intercepts or a single value (for models with constant intercept);
T_betatype of the weight vector; this can also be a single value;
Parameters
ybinary vector parameter
xdesign matrix
alphaintercept (in log odds)
betaweight vector
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif x, beta or alpha is infinite.
std::domain_errorif y is not binary.
std::invalid_argumentif container sizes mismatch.

Definition at line 46 of file bernoulli_logit_glm_lpmf.hpp.

◆ bernoulli_logit_glm_lpmf() [2/2]

template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type<T_x, T_beta, T_alpha>::type stan::math::bernoulli_logit_glm_lpmf ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta 
)
inline

Definition at line 136 of file bernoulli_logit_glm_lpmf.hpp.

◆ bernoulli_logit_glm_rng()

template<typename T_x , typename T_alpha , typename T_beta , class RNG >
VectorBuilder<true, int, T_alpha>::type stan::math::bernoulli_logit_glm_rng ( const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta,
RNG &  rng 
)
inline

Returns a draw from the Generalized Linear Model (GLM) with Bernoulli distribution and logit link function.

This is a convenience wrapper around bernoulli_logit_rng(alpha + x * beta, rng).

Template Parameters
T_xtype of the matrix of independent variables (features); this should be an Eigen::Matrix whose number of columns should match the length of beta; the number of rows is the number of samples.
T_alphatype of the intercept(s); this can be a vector of the same length as y) of intercepts or a single value (for models with constant intercept); if a vector its length should match x's row-count;
T_betatype of the weight vector;
RNGType of pseudo-random number generator.
Parameters
xdesign matrix
alphaintercept (in log odds)
betaweight vector
rngPseudo-random number generator.
Returns
Bernoulli logit glm random variate
Exceptions
std::domain_errorif x, beta or alpha is infinite.
std::invalid_argumentif container sizes mismatch.

Definition at line 42 of file bernoulli_logit_glm_rng.hpp.

◆ bernoulli_logit_log() [1/2]

template<bool propto, typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_logit_log ( const T_n &  n,
const T_prob &  theta 
)
Deprecated:
use bernoulli_logit_lpmf

Definition at line 14 of file bernoulli_logit_log.hpp.

◆ bernoulli_logit_log() [2/2]

template<typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_logit_log ( const T_n &  n,
const T_prob &  theta 
)
inline
Deprecated:
use bernoulli_logit_lpmf

Definition at line 23 of file bernoulli_logit_log.hpp.

◆ bernoulli_logit_lpmf() [1/2]

template<bool propto, typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_logit_lpmf ( const T_n &  n,
const T_prob &  theta 
)

Returns the log PMF of the logit-parametrized Bernoulli distribution.

If containers are supplied, returns the log sum of the probabilities.

Template Parameters
T_ntype of integer parameter
T_probtype of chance of success parameter
Parameters
ninteger parameter
thetalogit-transformed chance of success parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif theta is infinite.
std::invalid_argumentif container sizes mismatch.

Definition at line 29 of file bernoulli_logit_lpmf.hpp.

◆ bernoulli_logit_lpmf() [2/2]

template<typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_logit_lpmf ( const T_n &  n,
const T_prob &  theta 
)
inline

Definition at line 85 of file bernoulli_logit_lpmf.hpp.

◆ bernoulli_logit_rng()

template<typename T_t , class RNG >
VectorBuilder<true, int, T_t>::type stan::math::bernoulli_logit_rng ( const T_t &  t,
RNG &  rng 
)
inline

Return a Bernoulli random variate with logit-parameterized chance of success using the specified random number generator.

t can be a scalar or a one-dimensional container.

Template Parameters
T_ttype of logit-parameterized chance of success parameter
RNGtype of random number generator
Parameters
t(Sequence of) logit-parameterized chance of success parameter(s)
rngrandom number generator
Returns
(Sequence of) Bernoulli random variate(s)
Exceptions
std::domain_errorif logit-parameterized chance of success parameter is not finite

Definition at line 28 of file bernoulli_logit_rng.hpp.

◆ bernoulli_lpmf() [1/2]

template<bool propto, typename T_n , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_lpmf ( const T_n &  n,
const T_prob &  theta 
)

Returns the log PMF of the Bernoulli distribution.

If containers are supplied, returns the log sum of the probabilities.

Template Parameters
T_ntype of integer parameters
T_probtype of chance of success parameters
Parameters
ninteger parameter
thetachance of success parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif theta is not a valid probability
std::invalid_argumentif container sizes mismatch.

Definition at line 29 of file bernoulli_lpmf.hpp.

◆ bernoulli_lpmf() [2/2]

template<typename T_y , typename T_prob >
return_type<T_prob>::type stan::math::bernoulli_lpmf ( const T_y &  n,
const T_prob &  theta 
)
inline

Definition at line 105 of file bernoulli_lpmf.hpp.

◆ bernoulli_rng()

template<typename T_theta , class RNG >
VectorBuilder<true, int, T_theta>::type stan::math::bernoulli_rng ( const T_theta &  theta,
RNG &  rng 
)
inline

Return a Bernoulli random variate with specified chance of success parameter using the specified random number generator.

theta can be a scalar or a one-dimensional container.

Template Parameters
T_thetatype of chance of success parameter
RNGtype of random number generator
Parameters
theta(Sequence of) chance of success parameter(s)
rngrandom number generator
Returns
(Sequence of) Bernoulli random variate(s)
Exceptions
std::domain_errorif chance of success parameter is less than zero or greater than one.

Definition at line 28 of file bernoulli_rng.hpp.

◆ bessel_first_kind() [1/3]

template<typename T >
fvar<T> stan::math::bessel_first_kind ( int  v,
const fvar< T > &  z 
)
inline

Definition at line 12 of file bessel_first_kind.hpp.

◆ bessel_first_kind() [2/3]

var stan::math::bessel_first_kind ( int  v,
const var a 
)
inline

Definition at line 25 of file bessel_first_kind.hpp.

◆ bessel_first_kind() [3/3]

template<typename T2 >
T2 stan::math::bessel_first_kind ( int  v,
const T2  z 
)
inline

\[ \mbox{bessel\_first\_kind}(v, x) = \begin{cases} J_v(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{error} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{bessel\_first\_kind}(v, x)}{\partial x} = \begin{cases} \frac{\partial\, J_v(x)}{\partial x} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{error} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ J_v(x)=\left(\frac{1}{2}x\right)^v \sum_{k=0}^\infty \frac{\left(-\frac{1}{4}x^2\right)^k}{k!\, \Gamma(v+k+1)} \]

\[ \frac{\partial \, J_v(x)}{\partial x} = \frac{v}{x}J_v(x)-J_{v+1}(x) \]

Definition at line 38 of file bessel_first_kind.hpp.

◆ bessel_second_kind() [1/3]

template<typename T >
fvar<T> stan::math::bessel_second_kind ( int  v,
const fvar< T > &  z 
)
inline

Definition at line 12 of file bessel_second_kind.hpp.

◆ bessel_second_kind() [2/3]

var stan::math::bessel_second_kind ( int  v,
const var a 
)
inline

Definition at line 25 of file bessel_second_kind.hpp.

◆ bessel_second_kind() [3/3]

template<typename T2 >
T2 stan::math::bessel_second_kind ( int  v,
const T2  z 
)
inline

\[ \mbox{bessel\_second\_kind}(v, x) = \begin{cases} \textrm{error} & \mbox{if } x \leq 0 \\ Y_v(x) & \mbox{if } x > 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{bessel\_second\_kind}(v, x)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0 \\ \frac{\partial\, Y_v(x)}{\partial x} & \mbox{if } x > 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ Y_v(x)=\frac{J_v(x)\cos(v\pi)-J_{-v}(x)}{\sin(v\pi)} \]

\[ \frac{\partial \, Y_v(x)}{\partial x} = \frac{v}{x}Y_v(x)-Y_{v+1}(x) \]

Definition at line 40 of file bessel_second_kind.hpp.

◆ beta() [1/7]

template<typename T >
fvar<T> stan::math::beta ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Return fvar with the beta function applied to the specified arguments and its gradient.

The beta function is defined for $a > 0$ and $b > 0$ by

$\mbox{B}(a, b) = \frac{\Gamma(a) \Gamma(b)}{\Gamma(a+b)}$.

\[ \mbox{beta}(\alpha, \beta) = \begin{cases} \int_0^1 u^{\alpha - 1} (1 - u)^{\beta - 1} \, du & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{beta}(\alpha, \beta)}{\partial \alpha} = \begin{cases} \left(\psi(\alpha)-\psi(\alpha+\beta)\right)*\mbox{beta}(\alpha, \beta) & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{beta}(\alpha, \beta)}{\partial \beta} = \begin{cases} \left(\psi(\beta)-\psi(\alpha+\beta)\right)*\mbox{beta}(\alpha, \beta) & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

Template Parameters
TType of values.
Parameters
x1First value
x2Second value
Returns
Fvar with result beta function of arguments and gradients.

Definition at line 51 of file beta.hpp.

◆ beta() [2/7]

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2>::type stan::math::beta ( const T1  a,
const T2  b 
)
inline

Return the beta function applied to the specified arguments.

The beta function is defined for $a > 0$ and $b > 0$ by

$\mbox{B}(a, b) = \frac{\Gamma(a) \Gamma(b)}{\Gamma(a+b)}$.

\[ \mbox{beta}(\alpha, \beta) = \begin{cases} \int_0^1 u^{\alpha - 1} (1 - u)^{\beta - 1} \, du & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{beta}(\alpha, \beta)}{\partial \alpha} = \begin{cases} \left(\psi(\alpha)-\psi(\alpha+\beta)\right)*\mbox{beta}(\alpha, \beta) & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{beta}(\alpha, \beta)}{\partial \beta} = \begin{cases} \left(\psi(\beta)-\psi(\alpha+\beta)\right)*\mbox{beta}(\alpha, \beta) & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

Template Parameters
T1Type of first value.
T2Type of second value.
Parameters
aFirst value
bSecond value
Returns
Beta function applied to the two values.

Definition at line 51 of file beta.hpp.

◆ beta() [3/7]

template<typename T >
fvar<T> stan::math::beta ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 60 of file beta.hpp.

◆ beta() [4/7]

template<typename T >
fvar<T> stan::math::beta ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 67 of file beta.hpp.

◆ beta() [5/7]

var stan::math::beta ( const var a,
const var b 
)
inline

Definition at line 69 of file beta.hpp.

◆ beta() [6/7]

var stan::math::beta ( const var a,
double  b 
)
inline

Definition at line 91 of file beta.hpp.

◆ beta() [7/7]

var stan::math::beta ( double  a,
const var b 
)
inline

Definition at line 113 of file beta.hpp.

◆ beta_binomial_ccdf_log()

template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type<T_size1, T_size2>::type stan::math::beta_binomial_ccdf_log ( const T_n &  n,
const T_N &  N,
const T_size1 &  alpha,
const T_size2 &  beta 
)
Deprecated:
use beta_binomial_lccdf

Definition at line 14 of file beta_binomial_ccdf_log.hpp.

◆ beta_binomial_cdf()

template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type<T_size1, T_size2>::type stan::math::beta_binomial_cdf ( const T_n &  n,
const T_N &  N,
const T_size1 &  alpha,
const T_size2 &  beta 
)

Returns the CDF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters.

Given containers of matching sizes, returns the product of probabilities.

Template Parameters
T_ntype of success parameter
T_Ntype of population size parameter
T_size1type of prior success parameter
T_size2type of prior failure parameter
Parameters
nsuccess parameter
Npopulation size parameter
alphaprior success parameter
betaprior failure parameter
Returns
probability or product of probabilities
Exceptions
std::domain_errorif N, alpha, or beta fails to be positive
std::invalid_argumentif container sizes mismatch

Definition at line 39 of file beta_binomial_cdf.hpp.

◆ beta_binomial_cdf_log()

template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type<T_size1, T_size2>::type stan::math::beta_binomial_cdf_log ( const T_n &  n,
const T_N &  N,
const T_size1 &  alpha,
const T_size2 &  beta 
)
Deprecated:
use beta_binomial_lcdf

Definition at line 14 of file beta_binomial_cdf_log.hpp.

◆ beta_binomial_lccdf()

template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type<T_size1, T_size2>::type stan::math::beta_binomial_lccdf ( const T_n &  n,
const T_N &  N,
const T_size1 &  alpha,
const T_size2 &  beta 
)

Returns the log CCDF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters.

Given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ntype of success parameter
T_Ntype of population size parameter
T_size1type of prior success parameter
T_size2type of prior failure parameter
Parameters
nsuccess parameter
Npopulation size parameter
alphaprior success parameter
betaprior failure parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif N, alpha, or beta fails to be positive
std::invalid_argumentif container sizes mismatch

Definition at line 39 of file beta_binomial_lccdf.hpp.

◆ beta_binomial_lcdf()

template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type<T_size1, T_size2>::type stan::math::beta_binomial_lcdf ( const T_n &  n,
const T_N &  N,
const T_size1 &  alpha,
const T_size2 &  beta 
)

Returns the log CDF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters.

Given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ntype of success parameter
T_Ntype of population size parameter
T_size1type of prior success parameter
T_size2type of prior failure parameter
Parameters
nsuccess parameter
Npopulation size parameter
alphaprior success parameter
betaprior failure parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif N, alpha, or beta fails to be positive
std::invalid_argumentif container sizes mismatch

Definition at line 39 of file beta_binomial_lcdf.hpp.

◆ beta_binomial_log() [1/2]

template<bool propto, typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type<T_size1, T_size2>::type stan::math::beta_binomial_log ( const T_n &  n,
const T_N &  N,
const T_size1 &  alpha,
const T_size2 &  beta 
)
Deprecated:
use beta_binomial_lpmf

Definition at line 15 of file beta_binomial_log.hpp.

◆ beta_binomial_log() [2/2]

template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type<T_size1, T_size2>::type stan::math::beta_binomial_log ( const T_n &  n,
const T_N &  N,
const T_size1 &  alpha,
const T_size2 &  beta 
)
Deprecated:
use beta_binomial_lpmf

Definition at line 25 of file beta_binomial_log.hpp.

◆ beta_binomial_lpmf() [1/2]

template<bool propto, typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type<T_size1, T_size2>::type stan::math::beta_binomial_lpmf ( const T_n &  n,
const T_N &  N,
const T_size1 &  alpha,
const T_size2 &  beta 
)

Returns the log PMF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters.

Given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ntype of success parameter
T_Ntype of population size parameter
T_size1type of prior success parameter
T_size2type of prior failure parameter
Parameters
nsuccess parameter
Npopulation size parameter
alphaprior success parameter
betaprior failure parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif N, alpha, or beta fails to be positive
std::invalid_argumentif container sizes mismatch

Definition at line 40 of file beta_binomial_lpmf.hpp.

◆ beta_binomial_lpmf() [2/2]

template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type<T_size1, T_size2>::type stan::math::beta_binomial_lpmf ( const T_n &  n,
const T_N &  N,
const T_size1 &  alpha,
const T_size2 &  beta 
)

Definition at line 151 of file beta_binomial_lpmf.hpp.

◆ beta_binomial_rng()

template<typename T_N , typename T_shape1 , typename T_shape2 , class RNG >
VectorBuilder<true, int, T_N, T_shape1, T_shape2>::type stan::math::beta_binomial_rng ( const T_N &  N,
const T_shape1 &  alpha,
const T_shape2 &  beta,
RNG &  rng 
)
inline

Return a beta-binomial random variate with the specified population size, success, and failure parameters using the given random number generator.

N, alpha, and beta can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_NType of population size parameter
T_shape1Type of success parameter
T_shape2Type of failure parameter
RNGtype of random number generator
Parameters
N(Sequence of) population size parameter(s)
alpha(Sequence of) positive success parameter(s)
beta(Sequence of) positive failure parameter(s)
rngrandom number generator
Returns
(Sequence of) beta-binomial random variate(s)
Exceptions
std::domain_errorif N is negative, or alpha or beta are nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 33 of file beta_binomial_rng.hpp.

◆ beta_ccdf_log()

template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::beta_ccdf_log ( const T_y &  y,
const T_scale_succ &  alpha,
const T_scale_fail &  beta 
)
Deprecated:
use beta_lccdf

Definition at line 14 of file beta_ccdf_log.hpp.

◆ beta_cdf()

template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::beta_cdf ( const T_y &  y,
const T_scale_succ &  alpha,
const T_scale_fail &  beta 
)

Calculates the beta cumulative distribution function for the given variate and scale variables.

Parameters
yA scalar variate.
alphaPrior sample size.
betaPrior sample size.
Returns
The beta cdf evaluated at the specified arguments.
Template Parameters
T_yType of y.
T_scale_succType of alpha.
T_scale_failType of beta.

Definition at line 35 of file beta_cdf.hpp.

◆ beta_cdf_log()

template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::beta_cdf_log ( const T_y &  y,
const T_scale_succ &  alpha,
const T_scale_fail &  beta 
)
Deprecated:
use beta_lcdf

Definition at line 14 of file beta_cdf_log.hpp.

◆ beta_lccdf()

template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::beta_lccdf ( const T_y &  y,
const T_scale_succ &  alpha,
const T_scale_fail &  beta 
)

Returns the beta log complementary cumulative distribution function for the given probability, success, and failure parameters.

Any arguments other than scalars must be containers of the same size. With non-scalar arguments, the return is the sum of the log ccdfs with scalars broadcast as necessary.

Template Parameters
T_ytype of y
T_scale_succtype of success parameter
T_scale_failtype of failure parameter
Parameters
y(Sequence of) scalar(s) between zero and one
alpha(Sequence of) success parameter(s)
beta(Sequence of) failure parameter(s)
Returns
log probability or sum of log of proabilities
Exceptions
std::domain_errorif alpha or beta is negative
std::domain_errorif y is not a valid probability
std::invalid_argumentif container sizes mismatch

Definition at line 40 of file beta_lccdf.hpp.

◆ beta_lcdf()

template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::beta_lcdf ( const T_y &  y,
const T_scale_succ &  alpha,
const T_scale_fail &  beta 
)

Returns the beta log cumulative distribution function for the given probability, success, and failure parameters.

Any arguments other than scalars must be containers of the same size. With non-scalar arguments, the return is the sum of the log cdfs with scalars broadcast as necessary.

Template Parameters
T_ytype of y
T_scale_succtype of success parameter
T_scale_failtype of failure parameter
Parameters
y(Sequence of) scalar(s) between zero and one
alpha(Sequence of) success parameter(s)
beta(Sequence of) failure parameter(s)
Returns
log probability or sum of log of proabilities
Exceptions
std::domain_errorif alpha or beta is negative
std::domain_errorif y is not a valid probability
std::invalid_argumentif container sizes mismatch

Definition at line 40 of file beta_lcdf.hpp.

◆ beta_log() [1/2]

template<bool propto, typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::beta_log ( const T_y &  y,
const T_scale_succ &  alpha,
const T_scale_fail &  beta 
)

The log of the beta density for the specified scalar(s) given the specified sample size(s).

y, alpha, or beta can each either be scalar or a vector. Any vector inputs must be the same length.

The result log probability is defined to be the sum of the log probabilities for each observation/alpha/beta triple.

Prior sample sizes, alpha and beta, must be greater than 0.

Deprecated:
use beta_lpdf
Parameters
y(Sequence of) scalar(s).
alpha(Sequence of) prior sample size(s).
beta(Sequence of) prior sample size(s).
Returns
The log of the product of densities.
Template Parameters
T_yType of scalar outcome.
T_scale_succType of prior scale for successes.
T_scale_failType of prior scale for failures.

Definition at line 32 of file beta_log.hpp.

◆ beta_log() [2/2]

template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::beta_log ( const T_y &  y,
const T_scale_succ &  alpha,
const T_scale_fail &  beta 
)
inline
Deprecated:
use beta_lpdf

Definition at line 41 of file beta_log.hpp.

◆ beta_lpdf() [1/2]

template<bool propto, typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::beta_lpdf ( const T_y &  y,
const T_scale_succ &  alpha,
const T_scale_fail &  beta 
)

The log of the beta density for the specified scalar(s) given the specified sample size(s).

y, alpha, or beta can each either be scalar or a vector. Any vector inputs must be the same length.

The result log probability is defined to be the sum of the log probabilities for each observation/alpha/beta triple.

Prior sample sizes, alpha and beta, must be greater than 0.

Parameters
y(Sequence of) scalar(s).
alpha(Sequence of) prior sample size(s).
beta(Sequence of) prior sample size(s).
Returns
The log of the product of densities.
Template Parameters
T_yType of scalar outcome.
T_scale_succType of prior scale for successes.
T_scale_failType of prior scale for failures.

Definition at line 42 of file beta_lpdf.hpp.

◆ beta_lpdf() [2/2]

template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::beta_lpdf ( const T_y &  y,
const T_scale_succ &  alpha,
const T_scale_fail &  beta 
)
inline

Definition at line 167 of file beta_lpdf.hpp.

◆ beta_proportion_ccdf_log()

template<typename T_y , typename T_loc , typename T_prec >
return_type<T_y, T_loc, T_prec>::type stan::math::beta_proportion_ccdf_log ( const T_y &  y,
const T_loc &  mu,
const T_prec &  kappa 
)

Returns the beta log complementary cumulative distribution function for specified probability, location, and precision parameters: beta_proportion_lccdf(y | mu, kappa) = beta_lccdf(y | mu * kappa, (1 - mu) * kappa).

Any arguments other than scalars must be containers of the same size. With non-scalar arguments, the return is the sum of the log ccdfs with scalars broadcast as necessary.

Deprecated:
use beta_proportion_lccdf
Template Parameters
T_ytype of y
T_loctype of location parameter
T_prectype of precision parameter
Parameters
y(Sequence of) scalar(s) between zero and one
mu(Sequence of) location parameter(s)
kappa(Sequence of) precision parameter(s)
Returns
log probability or sum of log of probabilities
Exceptions
std::domain_errorif mu is outside (0, 1)
std::domain_errorif kappa is nonpositive
std::domain_errorif 1 - y is not a valid probability
std::invalid_argumentif container sizes mismatch

Definition at line 33 of file beta_proportion_ccdf_log.hpp.

◆ beta_proportion_cdf_log()

template<typename T_y , typename T_loc , typename T_prec >
return_type<T_y, T_loc, T_prec>::type stan::math::beta_proportion_cdf_log ( const T_y &  y,
const T_loc &  mu,
const T_prec &  kappa 
)

Returns the beta log cumulative distribution function for specified probability, location, and precision parameters: beta_proportion_lcdf(y | mu, kappa) = beta_lcdf(y | mu * kappa, (1 - mu) * kappa).

Any arguments other than scalars must be containers of the same size. With non-scalar arguments, the return is the sum of the log cdfs with scalars broadcast as necessary.

Deprecated:
use beta_proportion_lcdf
Template Parameters
T_ytype of y
T_loctype of location parameter
T_prectype of precision parameter
Parameters
y(Sequence of) scalar(s) between zero and one
mu(Sequence of) location parameter(s)
kappa(Sequence of) precision parameter(s)
Returns
log probability or sum of log of probabilities
Exceptions
std::domain_errorif mu is outside of (0, 1)
std::domain_errorif kappa is nonpositive
std::domain_errorif y is not a valid probability
std::invalid_argumentif container sizes mismatch

Definition at line 33 of file beta_proportion_cdf_log.hpp.

◆ beta_proportion_lccdf()

template<typename T_y , typename T_loc , typename T_prec >
return_type<T_y, T_loc, T_prec>::type stan::math::beta_proportion_lccdf ( const T_y &  y,
const T_loc &  mu,
const T_prec &  kappa 
)

Returns the beta log complementary cumulative distribution function for specified probability, location, and precision parameters: beta_proportion_lccdf(y | mu, kappa) = beta_lccdf(y | mu * kappa, (1 - mu) * kappa).

Any arguments other than scalars must be containers of the same size. With non-scalar arguments, the return is the sum of the log ccdfs with scalars broadcast as necessary.

Template Parameters
T_ytype of y
T_loctype of location parameter
T_prectype of precision parameter
Parameters
y(Sequence of) scalar(s) between zero and one
mu(Sequence of) location parameter(s)
kappa(Sequence of) precision parameter(s)
Returns
log probability or sum of log of probabilities
Exceptions
std::domain_errorif mu is outside (0, 1)
std::domain_errorif kappa is nonpositive
std::domain_errorif 1 - y is not a valid probability
std::invalid_argumentif container sizes mismatch

Definition at line 42 of file beta_proportion_lccdf.hpp.

◆ beta_proportion_lcdf()

template<typename T_y , typename T_loc , typename T_prec >
return_type<T_y, T_loc, T_prec>::type stan::math::beta_proportion_lcdf ( const T_y &  y,
const T_loc &  mu,
const T_prec &  kappa 
)

Returns the beta log cumulative distribution function for specified probability, location, and precision parameters: beta_proportion_lcdf(y | mu, kappa) = beta_lcdf(y | mu * kappa, (1 - mu) * kappa).

Any arguments other than scalars must be containers of the same size. With non-scalar arguments, the return is the sum of the log cdfs with scalars broadcast as necessary.

Template Parameters
T_ytype of y
T_loctype of location parameter
T_prectype of precision parameter
Parameters
y(Sequence of) scalar(s) between zero and one
mu(Sequence of) location parameter(s)
kappa(Sequence of) precision parameter(s)
Returns
log probability or sum of log of probabilities
Exceptions
std::domain_errorif mu is outside of (0, 1)
std::domain_errorif kappa is nonpositive
std::domain_errorif y is not a valid probability
std::invalid_argumentif container sizes mismatch

Definition at line 43 of file beta_proportion_lcdf.hpp.

◆ beta_proportion_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_prec >
return_type<T_y, T_loc, T_prec>::type stan::math::beta_proportion_log ( const T_y &  y,
const T_loc &  mu,
const T_prec &  kappa 
)

The log of the beta density for specified y, location, and precision: beta_proportion_lpdf(y | mu, kappa) = beta_lpdf(y | mu * kappa, (1 - mu) * kappa).

Any arguments other than scalars must be containers of the same size. With non-scalar arguments, the return is the sum of the log pdfs with scalars broadcast as necessary.

The result log probability is defined to be the sum of the log probabilities for each observation/mu/kappa triple.

Prior location, mu, must be contained in (0, 1). Prior precision must be positive.

Deprecated:
use beta_proportion_lpdf
Parameters
y(Sequence of) scalar(s) between zero and one
mu(Sequence of) location parameter(s)
kappa(Sequence of) precision parameter(s)
Returns
The log of the product of densities.
Template Parameters
T_yType of scalar outcome.
T_locType of prior location.
T_precType of prior precision.

Definition at line 34 of file beta_proportion_log.hpp.

◆ beta_proportion_log() [2/2]

template<typename T_y , typename T_loc , typename T_prec >
return_type<T_y, T_loc, T_prec>::type stan::math::beta_proportion_log ( const T_y &  y,
const T_loc &  mu,
const T_prec &  kappa 
)
inline
Deprecated:
use beta_proportion_lpdf

Definition at line 43 of file beta_proportion_log.hpp.

◆ beta_proportion_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_prec >
return_type<T_y, T_loc, T_prec>::type stan::math::beta_proportion_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_prec &  kappa 
)

The log of the beta density for specified y, location, and precision: beta_proportion_lpdf(y | mu, kappa) = beta_lpdf(y | mu * kappa, (1 - mu) * kappa).

Any arguments other than scalars must be containers of the same size. With non-scalar arguments, the return is the sum of the log pdfs with scalars broadcast as necessary.

The result log probability is defined to be the sum of the log probabilities for each observation/mu/kappa triple.

Prior location, mu, must be contained in (0, 1). Prior precision must be positive.

Parameters
y(Sequence of) scalar(s) between zero and one
mu(Sequence of) location parameter(s)
kappa(Sequence of) precision parameter(s)
Returns
The log of the product of densities.
Template Parameters
T_yType of scalar outcome.
T_locType of prior location.
T_precType of prior precision.

Definition at line 43 of file beta_proportion_lpdf.hpp.

◆ beta_proportion_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_prec >
return_type<T_y, T_loc, T_prec>::type stan::math::beta_proportion_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_prec &  kappa 
)
inline

Definition at line 171 of file beta_proportion_lpdf.hpp.

◆ beta_proportion_rng()

template<typename T_loc , typename T_prec , class RNG >
VectorBuilder<true, double, T_loc, T_prec>::type stan::math::beta_proportion_rng ( const T_loc &  mu,
const T_prec &  kappa,
RNG &  rng 
)
inline

Return a Beta random variate specified probability, location, and precision parameters: beta_proportion_rng(y | mu, kappa) = beta_rng(y | mu * kappa, (1 - mu) * kappa).

Any arguments other than scalars must be containers of the same size. With non-scalar arguments, the return is a container matching the size of the arguments with scalars broadcast as necessary.

Template Parameters
T_locType of location parameter
T_precType of precision parameter
RNGtype of random number generator
Parameters
mu(Sequence of) location parameter(s) in (0, 1)
kappa(Sequence of) positive finite precision parameter(s)
rngrandom number generator
Returns
(Sequence of) beta random variate(s)
Exceptions
std::domain_errorif mu is outside of (0, 1)
std::domain_errorif kappa is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 35 of file beta_proportion_rng.hpp.

◆ beta_rng()

template<typename T_shape1 , typename T_shape2 , class RNG >
VectorBuilder<true, double, T_shape1, T_shape2>::type stan::math::beta_rng ( const T_shape1 &  alpha,
const T_shape2 &  beta,
RNG &  rng 
)
inline

Return a Beta random variate with the supplied success and failure parameters using the given random number generator.

alpha and beta can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_shape1Type of success parameter
T_shape2Type of failure parameter
RNGtype of random number generator
Parameters
alpha(Sequence of) positive finite success parameter(s)
beta(Sequence of) positive finite failure parameter(s)
rngrandom number generator
Returns
(Sequence of) beta random variate(s)
Exceptions
std::domain_errorif alpha or beta are nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 34 of file beta_rng.hpp.

◆ binary_log_loss() [1/3]

template<typename T >
fvar<T> stan::math::binary_log_loss ( int  y,
const fvar< T > &  y_hat 
)
inline

Definition at line 12 of file binary_log_loss.hpp.

◆ binary_log_loss() [2/3]

template<typename T >
T stan::math::binary_log_loss ( int  y,
const T &  y_hat 
)
inline

Returns the log loss function for binary classification with specified reference and response values.

The log loss function for prediction $\hat{y} \in [0, 1]$ given outcome $y \in \{ 0, 1 \}$ is

$\mbox{logloss}(1, \hat{y}) = -\log \hat{y} $, and

$\mbox{logloss}(0, \hat{y}) = -\log (1 - \hat{y}) $.

Template Parameters
Tvalue type
Parameters
[in]yreference value, either 0 or 1
[in]y_hatresponse value in [0, 1]
Returns
Log loss for response given reference value

Definition at line 27 of file binary_log_loss.hpp.

◆ binary_log_loss() [3/3]

var stan::math::binary_log_loss ( int  y,
const var y_hat 
)
inline

The log loss function for variables (stan).

See binary_log_loss() for the double-based version.

The derivative with respect to the variable $\hat{y}$ is

$\frac{d}{d\hat{y}} \mbox{logloss}(1, \hat{y}) = - \frac{1}{\hat{y}}$, and

$\frac{d}{d\hat{y}} \mbox{logloss}(0, \hat{y}) = \frac{1}{1 - \hat{y}}$.

\[ \mbox{binary\_log\_loss}(y, \hat{y}) = \begin{cases} y \log \hat{y} + (1 - y) \log (1 - \hat{y}) & \mbox{if } 0\leq \hat{y}\leq 1, y\in\{ 0, 1 \}\\[6pt] \textrm{NaN} & \mbox{if } \hat{y} = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{binary\_log\_loss}(y, \hat{y})}{\partial \hat{y}} = \begin{cases} \frac{y}{\hat{y}}-\frac{1-y}{1-\hat{y}} & \mbox{if } 0\leq \hat{y}\leq 1, y\in\{ 0, 1 \}\\[6pt] \textrm{NaN} & \mbox{if } \hat{y} = \textrm{NaN} \end{cases} \]

Parameters
yReference value.
y_hatResponse variable.
Returns
Log loss of response versus reference value.

Definition at line 61 of file binary_log_loss.hpp.

◆ binomial_ccdf_log()

template<typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_ccdf_log ( const T_n &  n,
const T_N &  N,
const T_prob &  theta 
)
Deprecated:
use binomial_lccdf

Definition at line 14 of file binomial_ccdf_log.hpp.

◆ binomial_cdf()

template<typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_cdf ( const T_n &  n,
const T_N &  N,
const T_prob &  theta 
)

Returns the CDF for the binomial distribution evaluated at the specified success, population size, and chance of success.

If given containers of matching lengths, returns the product of probabilities.

Template Parameters
T_ntype of successes parameter
T_Ntype of population size parameter
thetatype of chance of success parameter
Parameters
nsuccesses parameter
Npopulation size parameter
thetachance of success parameter
Returns
probability or product of probabilities
Exceptions
std::domain_errorif N is negative
std::domain_errorif theta is not a valid probability
std::invalid_argumentif container sizes mismatch

Definition at line 35 of file binomial_cdf.hpp.

◆ binomial_cdf_log()

template<typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_cdf_log ( const T_n &  n,
const T_N &  N,
const T_prob &  theta 
)
Deprecated:
use binomial_lcdf

Definition at line 14 of file binomial_cdf_log.hpp.

◆ binomial_coefficient_log() [1/4]

template<typename T >
fvar<T> stan::math::binomial_coefficient_log ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 14 of file binomial_coefficient_log.hpp.

◆ binomial_coefficient_log() [2/4]

template<typename T >
fvar<T> stan::math::binomial_coefficient_log ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 39 of file binomial_coefficient_log.hpp.

◆ binomial_coefficient_log() [3/4]

template<typename T >
fvar<T> stan::math::binomial_coefficient_log ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 60 of file binomial_coefficient_log.hpp.

◆ binomial_coefficient_log() [4/4]

template<typename T_N , typename T_n >
boost::math::tools::promote_args<T_N, T_n>::type stan::math::binomial_coefficient_log ( const T_N  N,
const T_n  n 
)
inline

Return the log of the binomial coefficient for the specified arguments.

The binomial coefficient, ${N \choose n}$, read "N choose n", is defined for $0 \leq n \leq N$ by

${N \choose n} = \frac{N!}{n! (N-n)!}$.

This function uses Gamma functions to define the log and generalize the arguments to continuous N and n.

$ \log {N \choose n} = \log \ \Gamma(N+1) - \log \Gamma(n+1) - \log \Gamma(N-n+1)$.

\[ \mbox{binomial\_coefficient\_log}(x, y) = \begin{cases} \textrm{error} & \mbox{if } y > x \textrm{ or } y < 0\\ \ln\Gamma(x+1) & \mbox{if } 0\leq y \leq x \\ \quad -\ln\Gamma(y+1)& \\ \quad -\ln\Gamma(x-y+1)& \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{binomial\_coefficient\_log}(x, y)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } y > x \textrm{ or } y < 0\\ \Psi(x+1) & \mbox{if } 0\leq y \leq x \\ \quad -\Psi(x-y+1)& \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{binomial\_coefficient\_log}(x, y)}{\partial y} = \begin{cases} \textrm{error} & \mbox{if } y > x \textrm{ or } y < 0\\ -\Psi(y+1) & \mbox{if } 0\leq y \leq x \\ \quad +\Psi(x-y+1)& \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
Ntotal number of objects.
nnumber of objects chosen.
Returns
log (N choose n).

Definition at line 64 of file binomial_coefficient_log.hpp.

◆ binomial_lccdf()

template<typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_lccdf ( const T_n &  n,
const T_N &  N,
const T_prob &  theta 
)

Returns the log CCDF for the binomial distribution evaluated at the specified success, population size, and chance of success.

If given containers of matching lengths, returns the log sum of probabilities.

Template Parameters
T_ntype of successes parameter
T_Ntype of population size parameter
thetatype of chance of success parameter
Parameters
nsuccesses parameter
Npopulation size parameter
thetachance of success parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif N is negative
std::domain_errorif theta is not a valid probability
std::invalid_argumentif container sizes mismatch

Definition at line 36 of file binomial_lccdf.hpp.

◆ binomial_lcdf()

template<typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_lcdf ( const T_n &  n,
const T_N &  N,
const T_prob &  theta 
)

Returns the log CDF for the binomial distribution evaluated at the specified success, population size, and chance of success.

If given containers of matching lengths, returns the log sum of probabilities.

Template Parameters
T_ntype of successes parameter
T_Ntype of population size parameter
thetatype of chance of success parameter
Parameters
nsuccesses parameter
Npopulation size parameter
thetachance of success parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif N is negative
std::domain_errorif theta is not a valid probability
std::invalid_argumentif container sizes mismatch

Definition at line 36 of file binomial_lcdf.hpp.

◆ binomial_log() [1/2]

template<bool propto, typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_log ( const T_n &  n,
const T_N &  N,
const T_prob &  theta 
)
Deprecated:
use binomial_lpmf

Definition at line 14 of file binomial_log.hpp.

◆ binomial_log() [2/2]

template<typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_log ( const T_n &  n,
const T_N &  N,
const T_prob &  theta 
)
inline
Deprecated:
use binomial_lpmf

Definition at line 23 of file binomial_log.hpp.

◆ binomial_logit_log() [1/2]

template<bool propto, typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_logit_log ( const T_n &  n,
const T_N &  N,
const T_prob &  alpha 
)
Deprecated:
use binomial_logit_lpmf

Definition at line 14 of file binomial_logit_log.hpp.

◆ binomial_logit_log() [2/2]

template<typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_logit_log ( const T_n &  n,
const T_N &  N,
const T_prob &  alpha 
)
inline
Deprecated:
use binomial_logit_lpmf

Definition at line 24 of file binomial_logit_log.hpp.

◆ binomial_logit_lpmf() [1/2]

template<bool propto, typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_logit_lpmf ( const T_n &  n,
const T_N &  N,
const T_prob &  alpha 
)

Binomial log PMF in logit parametrization.

Binomial(n|n, inv_logit(alpha))

If given vectors of matching lengths, returns the log sum of probabilities.

Parameters
nsuccesses variable
Npopulation size parameter
alphalogit transformed probability parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif N is negative or probability parameter is invalid
std::invalid_argumentif vector sizes do not match

Definition at line 36 of file binomial_logit_lpmf.hpp.

◆ binomial_logit_lpmf() [2/2]

template<typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_logit_lpmf ( const T_n &  n,
const T_N &  N,
const T_prob &  alpha 
)
inline

Definition at line 109 of file binomial_logit_lpmf.hpp.

◆ binomial_lpmf() [1/2]

template<bool propto, typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_lpmf ( const T_n &  n,
const T_N &  N,
const T_prob &  theta 
)

Returns the log PMF for the binomial distribution evaluated at the specified success, population size, and chance of success.

If given containers of matching lengths, returns the log sum of probabilities.

Template Parameters
T_ntype of successes parameter
T_Ntype of population size parameter
thetatype of chance of success parameter
Parameters
nsuccesses parameter
Npopulation size parameter
thetachance of success parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif n is negative or greater than N
std::domain_errorif N is negative
std::domain_errorif theta is not a valid probability
std::invalid_argumentif container sizes mismatch

Definition at line 36 of file binomial_lpmf.hpp.

◆ binomial_lpmf() [2/2]

template<typename T_n , typename T_N , typename T_prob >
return_type<T_prob>::type stan::math::binomial_lpmf ( const T_n &  n,
const T_N &  N,
const T_prob &  theta 
)
inline

Definition at line 103 of file binomial_lpmf.hpp.

◆ binomial_rng()

template<typename T_N , typename T_theta , class RNG >
VectorBuilder<true, int, T_N, T_theta>::type stan::math::binomial_rng ( const T_N &  N,
const T_theta &  theta,
RNG &  rng 
)
inline

Return a pseudorandom binomial random variable for the given population size and chance of success parameters using the specified random number generator.

beta can be a scalar or a one-dimensional container.

Template Parameters
T_NType of population size parameter
T_thetaType of change of success parameter
RNGclass of rng
Parameters
N(Sequence of) population size parameter(s)
theta(Sequence of) chance of success parameter(s)
rngrandom number generator
Returns
(Sequence of) binomial random variate(s)
Exceptions
std::domain_errorif N is negative
std::domain_errorif theta is not a valid probability

Definition at line 32 of file binomial_rng.hpp.

◆ block()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::block ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m,
size_t  i,
size_t  j,
size_t  nrows,
size_t  ncols 
)
inline

Return a nrows x ncols submatrix starting at (i-1, j-1).

Parameters
mMatrix.
iStarting row.
jStarting column.
nrowsNumber of rows in block.
ncolsNumber of columns in block.
Exceptions
std::out_of_rangeif either index is out of range.

Definition at line 22 of file block.hpp.

◆ build_vari_array()

template<int R, int C>
vari** stan::math::build_vari_array ( const Eigen::Matrix< var, R, C > &  x)

Allocates and populates a flat array of vari pointers in the autodiff arena with the varis pointed to by the vars in the input Eigen matrix.

Template Parameters
REigen row type of x
CEigen column type of x
Parameters
xInput
Returns
Flat array of vari pointers

Definition at line 21 of file build_vari_array.hpp.

◆ calculate_chain()

double stan::math::calculate_chain ( double  x,
double  val 
)
inline

Definition at line 10 of file calculate_chain.hpp.

◆ categorical_log() [1/4]

template<bool propto, typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_log ( int  n,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)
Deprecated:
use categorical_lpmf

Definition at line 17 of file categorical_log.hpp.

◆ categorical_log() [2/4]

template<typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_log ( const typename math::index_type< Eigen::VectorXd >::type  n,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)
Deprecated:
use categorical_lpmf

Definition at line 26 of file categorical_log.hpp.

◆ categorical_log() [3/4]

template<bool propto, typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_log ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)
Deprecated:
use categorical_lpmf

Definition at line 36 of file categorical_log.hpp.

◆ categorical_log() [4/4]

template<typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_log ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)
inline
Deprecated:
use categorical_lpmf

Definition at line 46 of file categorical_log.hpp.

◆ categorical_logit_glm_lpmf() [1/2]

template<bool propto, typename T_y , typename T_x_scalar , int T_x_rows, typename T_alpha_scalar , typename T_beta_scalar >
return_type<T_x_scalar, T_alpha_scalar, T_beta_scalar>::type stan::math::categorical_logit_glm_lpmf ( const T_y &  y,
const Eigen::Matrix< T_x_scalar, T_x_rows, Eigen::Dynamic > &  x,
const Eigen::Matrix< T_alpha_scalar, Eigen::Dynamic, 1 > &  alpha,
const Eigen::Matrix< T_beta_scalar, Eigen::Dynamic, Eigen::Dynamic > &  beta 
)

Returns the log PMF of the Generalized Linear Model (GLM) with categorical distribution and logit (softmax) link function.

Template Parameters
T_ytype of classes. It can be either std::vector<int> or int.
T_x_scalartype of a scalar in the matrix of independent variables (features)
T_x_rowscompile-time number of rows of x. It can be either Eigen::Dynamic or 1.
T_alpha_scalartype of scalar in the intercept vector
T_beta_scalartype of a scalar in the matrix of weights
Parameters
ya scalar or vector of classes. If it is a scalar it will be broadcast - used for all instances. Values should be between 1 and number of classes, including endpoints.
xdesign matrix or row vector. If it is a row vector it will be broadcast - used for all instances.
alphaintercept vector (in log odds)
betaweight matrix
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorx, beta or alpha is infinite or y is not within bounds
std::invalid_argumentif container sizes mismatch.

Definition at line 39 of file categorical_logit_glm_lpmf.hpp.

◆ categorical_logit_glm_lpmf() [2/2]

template<typename T_y , typename T_x_scalar , int T_x_rows, typename T_alpha_scalar , typename T_beta_scalar >
return_type<T_x_scalar, T_alpha_scalar, T_beta_scalar>::type stan::math::categorical_logit_glm_lpmf ( const T_y &  y,
const Eigen::Matrix< T_x_scalar, T_x_rows, Eigen::Dynamic > &  x,
const Eigen::Matrix< T_alpha_scalar, Eigen::Dynamic, 1 > &  alpha,
const Eigen::Matrix< T_beta_scalar, Eigen::Dynamic, Eigen::Dynamic > &  beta 
)

Definition at line 189 of file categorical_logit_glm_lpmf.hpp.

◆ categorical_logit_log() [1/4]

template<bool propto, typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_logit_log ( int  n,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  beta 
)
Deprecated:
use categorical_logit_lpmf

Definition at line 17 of file categorical_logit_log.hpp.

◆ categorical_logit_log() [2/4]

template<typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_logit_log ( int  n,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  beta 
)
inline
Deprecated:
use categorical_logit_lpmf

Definition at line 27 of file categorical_logit_log.hpp.

◆ categorical_logit_log() [3/4]

template<bool propto, typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_logit_log ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  beta 
)
Deprecated:
use categorical_logit_lpmf

Definition at line 36 of file categorical_logit_log.hpp.

◆ categorical_logit_log() [4/4]

template<typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_logit_log ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  beta 
)
inline
Deprecated:
use categorical_logit_lpmf

Definition at line 47 of file categorical_logit_log.hpp.

◆ categorical_logit_lpmf() [1/4]

template<bool propto, typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_logit_lpmf ( int  n,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  beta 
)

Definition at line 19 of file categorical_logit_lpmf.hpp.

◆ categorical_logit_lpmf() [2/4]

template<typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_logit_lpmf ( int  n,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  beta 
)
inline

Definition at line 36 of file categorical_logit_lpmf.hpp.

◆ categorical_logit_lpmf() [3/4]

template<bool propto, typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_logit_lpmf ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  beta 
)

Definition at line 42 of file categorical_logit_lpmf.hpp.

◆ categorical_logit_lpmf() [4/4]

template<typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_logit_lpmf ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  beta 
)
inline

Definition at line 71 of file categorical_logit_lpmf.hpp.

◆ categorical_logit_rng()

template<class RNG >
int stan::math::categorical_logit_rng ( const Eigen::VectorXd &  beta,
RNG &  rng 
)
inline

Return a draw from a Categorical distribution given a a vector of unnormalized log probabilities and a psuedo-random number generator.

This is a convenience wrapper around categorical_rng(softmax(beta), rng).

Template Parameters
RNGType of pseudo-random number generator.
Parameters
betaVector of unnormalized log probabilities.
rngPseudo-random number generator.
Returns
Categorical random variate

Definition at line 29 of file categorical_logit_rng.hpp.

◆ categorical_lpmf() [1/4]

template<bool propto, typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_lpmf ( int  n,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)

Definition at line 17 of file categorical_lpmf.hpp.

◆ categorical_lpmf() [2/4]

template<typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_lpmf ( const typename math::index_type< Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > >::type  n,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)
inline

Definition at line 34 of file categorical_lpmf.hpp.

◆ categorical_lpmf() [3/4]

template<bool propto, typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_lpmf ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)

Definition at line 42 of file categorical_lpmf.hpp.

◆ categorical_lpmf() [4/4]

template<typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::categorical_lpmf ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)
inline

Definition at line 77 of file categorical_lpmf.hpp.

◆ categorical_rng()

template<class RNG >
int stan::math::categorical_rng ( const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  theta,
RNG &  rng 
)
inline

Definition at line 14 of file categorical_rng.hpp.

◆ cauchy_ccdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::cauchy_ccdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use cauchy_lccdf

Definition at line 14 of file cauchy_ccdf_log.hpp.

◆ cauchy_cdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::cauchy_cdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Returns the cauchy cumulative distribution function for the given location, and scale.

If given containers of matching sizes returns the product of probabilities.

Template Parameters
T_ytype of real parameter
T_loctype of location parameter
T_scaletype of scale parameter
Parameters
yreal parameter
mulocation parameter
sigmascale parameter
Returns
probability or product of probabilities
Exceptions
std::domain_errorif sigma is nonpositive or y, mu are nan
std::invalid_argumentif container sizes mismatch

Definition at line 33 of file cauchy_cdf.hpp.

◆ cauchy_cdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::cauchy_cdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use cauchy_lcdf

Definition at line 14 of file cauchy_cdf_log.hpp.

◆ cauchy_lccdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::cauchy_lccdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Returns the cauchy log complementary cumulative distribution function for the given location, and scale.

If given containers of matching sizes returns the log sum of probabilities.

Template Parameters
T_ytype of real parameter
T_loctype of location parameter
T_scaletype of scale parameter
Parameters
yreal parameter
mulocation parameter
sigmascale parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif sigma is nonpositive or y, mu are nan
std::invalid_argumentif container sizes mismatch

Definition at line 33 of file cauchy_lccdf.hpp.

◆ cauchy_lcdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::cauchy_lcdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Returns the cauchy log cumulative distribution function for the given location, and scale.

If given containers of matching sizes returns the log sum of probabilities.

Template Parameters
T_ytype of real parameter
T_loctype of location parameter
T_scaletype of scale parameter
Parameters
yreal parameter
mulocation parameter
sigmascale parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif sigma is nonpositive or y, mu are nan
std::invalid_argumentif container sizes mismatch

Definition at line 33 of file cauchy_lcdf.hpp.

◆ cauchy_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::cauchy_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

The log of the Cauchy density for the specified scalar(s) given the specified location parameter(s) and scale parameter(s).

y, mu, or sigma can each either be scalar a vector. Any vector inputs must be the same length.

The result log probability is defined to be the sum of the log probabilities for each observation/mu/sigma triple.

Deprecated:
use cauchy_lpdf
Parameters
y(Sequence of) scalar(s).
mu(Sequence of) location(s).
sigma(Sequence of) scale(s).
Returns
The log of the product of densities.
Template Parameters
T_yType of scalar outcome.
T_locType of location.
T_scaleType of scale.

Definition at line 30 of file cauchy_log.hpp.

◆ cauchy_log() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::cauchy_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
inline
Deprecated:
use cauchy_lpdf

Definition at line 39 of file cauchy_log.hpp.

◆ cauchy_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::cauchy_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

The log of the Cauchy density for the specified scalar(s) given the specified location parameter(s) and scale parameter(s).

y, mu, or sigma can each either be scalar a vector. Any vector inputs must be the same length.

The result log probability is defined to be the sum of the log probabilities for each observation/mu/sigma triple.

Parameters
y(Sequence of) scalar(s).
mu(Sequence of) location(s).
sigma(Sequence of) scale(s).
Returns
The log of the product of densities.
Template Parameters
T_yType of scalar outcome.
T_locType of location.
T_scaleType of scale.

Definition at line 36 of file cauchy_lpdf.hpp.

◆ cauchy_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::cauchy_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
inline

Definition at line 111 of file cauchy_lpdf.hpp.

◆ cauchy_rng()

template<typename T_loc , typename T_scale , class RNG >
VectorBuilder<true, double, T_loc, T_scale>::type stan::math::cauchy_rng ( const T_loc &  mu,
const T_scale &  sigma,
RNG &  rng 
)
inline

Return a Cauchy random variate for the given location and scale using the specified random number generator.

mu and sigma can each be a scalar or a vector. Any non-scalar inputs must be the same length.

Template Parameters
T_locType of location parameter
T_scaleType of scale parameter
RNGtype of random number generator
Parameters
mu(Sequence of) location parameter(s)
sigma(Sequence of) scale parameter(s)
rngrandom number generator
Returns
(Sequence of) Cauchy random variate(s)
Exceptions
std::domain_errorif mu is infinite or sigma is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 33 of file cauchy_rng.hpp.

◆ cbrt() [1/5]

double stan::math::cbrt ( double  x)
inline

Return the cube root of the specified value.

Parameters
[in]xArgument.
Returns
Cube root of the argument.
Exceptions
std::domain_errorIf argument is negative.

Definition at line 17 of file cbrt.hpp.

◆ cbrt() [2/5]

template<typename T >
fvar<T> stan::math::cbrt ( const fvar< T > &  x)
inline

Return cube root of specified argument.

Template Parameters
TScalar type of autodiff variable.
Parameters
xArgument.
Returns
Cube root of argument.

Definition at line 19 of file cbrt.hpp.

◆ cbrt() [3/5]

double stan::math::cbrt ( int  x)
inline

Integer version of cbrt.

Parameters
[in]xArgument.
Returns
Cube root of the argument.
Exceptions
std::domain_errorIf argument is less than 1.

Definition at line 26 of file cbrt.hpp.

◆ cbrt() [4/5]

template<typename T >
apply_scalar_unary<cbrt_fun, T>::return_t stan::math::cbrt ( const T &  x)
inline

Vectorized version of cbrt().

Parameters
xContainer of variables.
Template Parameters
TContainer type.
Returns
Cube root of each value in x.

Definition at line 30 of file cbrt.hpp.

◆ cbrt() [5/5]

var stan::math::cbrt ( const var a)
inline

Returns the cube root of the specified variable (C99).

The derivative is

$\frac{d}{dx} x^{1/3} = \frac{1}{3 x^{2/3}}$.

\[ \mbox{cbrt}(x) = \begin{cases} \sqrt[3]{x} & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{cbrt}(x)}{\partial x} = \begin{cases} \frac{1}{3x^{2/3}} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aSpecified variable.
Returns
Cube root of the variable.

Definition at line 45 of file cbrt.hpp.

◆ ceil() [1/3]

template<typename T >
fvar<T> stan::math::ceil ( const fvar< T > &  x)
inline

Definition at line 12 of file ceil.hpp.

◆ ceil() [2/3]

template<typename T >
apply_scalar_unary<ceil_fun, T>::return_t stan::math::ceil ( const T &  x)
inline

Vectorized version of ceil().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Least integer >= each value in x.

Definition at line 31 of file ceil.hpp.

◆ ceil() [3/3]

var stan::math::ceil ( const var a)
inline

Return the ceiling of the specified variable (cmath).

The derivative of the ceiling function is defined and zero everywhere but at integers, and we set them to zero for convenience,

$\frac{d}{dx} {\lceil x \rceil} = 0$.

The ceiling function rounds up. For double values, this is the smallest integral value that is not less than the specified value. Although this function is not differentiable because it is discontinuous at integral values, its gradient is returned as zero everywhere.

\[ \mbox{ceil}(x) = \begin{cases} \lceil x\rceil & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{ceil}(x)}{\partial x} = \begin{cases} 0 & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aInput variable.
Returns
Ceiling of the variable.

Definition at line 58 of file ceil.hpp.

◆ check_2F1_converges()

template<typename T_a1 , typename T_a2 , typename T_b1 , typename T_z >
void stan::math::check_2F1_converges ( const char *  function,
const T_a1 &  a1,
const T_a2 &  a2,
const T_b1 &  b1,
const T_z &  z 
)
inline

Check if the hypergeometric function (2F1) called with supplied arguments will converge, assuming arguments are finite values.

Template Parameters
T_a1Type of a1
T_a2Type of a2
T_b1Type of b1
T_zType of z
Parameters
functionName of function ultimately relying on 2F1 (for error messages)
a1Variable to check
a2Variable to check
b1Variable to check
zVariable to check
Exceptions
<code>domain_error</code>if 2F1(a1, a2, b1, z) does not meet convergence conditions, or if any coefficient is NaN.

Definition at line 34 of file check_2F1_converges.hpp.

◆ check_3F2_converges()

template<typename T_a1 , typename T_a2 , typename T_a3 , typename T_b1 , typename T_b2 , typename T_z >
void stan::math::check_3F2_converges ( const char *  function,
const T_a1 &  a1,
const T_a2 &  a2,
const T_a3 &  a3,
const T_b1 &  b1,
const T_b2 &  b2,
const T_z &  z 
)
inline

Check if the hypergeometric function (3F2) called with supplied arguments will converge, assuming arguments are finite values.

Template Parameters
T_a1Type of a1
T_a2Type of a2
T_a3Type of a3
T_b1Type of b1
T_b2Type of b2
T_zType of z
Parameters
functionName of function ultimately relying on 3F2 (for error & messages)
a1Variable to check
a2Variable to check
a3Variable to check
b1Variable to check
b2Variable to check
zVariable to check
Exceptions
<code>domain_error</code>if 3F2(a1, a2, a3, b1, b2, z) does not meet convergence conditions, or if any coefficient is NaN.

Definition at line 39 of file check_3F2_converges.hpp.

◆ check_bounded()

template<typename T_y , typename T_low , typename T_high >
void stan::math::check_bounded ( const char *  function,
const char *  name,
const T_y &  y,
const T_low &  low,
const T_high &  high 
)
inline

Check if the value is between the low and high values, inclusively.

Template Parameters
T_yType of value
T_lowType of low value
T_highType of high value
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yValue to check
lowLow bound
highHigh bound
Exceptions
<code>std::domain_error</code>otherwise. This also throws if any of the arguments are NaN.

Definition at line 70 of file check_bounded.hpp.

◆ check_cholesky_factor()

template<typename T_y >
void stan::math::check_cholesky_factor ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y 
)
inline

Check if the specified matrix is a valid Cholesky factor.

A Cholesky factor is a lower triangular matrix whose diagonal elements are all positive. Note that Cholesky factors need not be square, but require at least as many rows M as columns N (i.e., M >= N).

Template Parameters
T_yType of elements of Cholesky factor
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
Exceptions
<code>std::domain_error</code>if y is not a valid Choleksy factor, if number of rows is less than the number of columns, if there are 0 columns, or if any element in matrix is NaN

Definition at line 28 of file check_cholesky_factor.hpp.

◆ check_cholesky_factor_corr()

template<typename T_y >
void stan::math::check_cholesky_factor_corr ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y 
)

Check if the specified matrix is a valid Cholesky factor of a correlation matrix.

A Cholesky factor is a lower triangular matrix whose diagonal elements are all positive. Note that Cholesky factors need not be square, but requires at least as many rows M as columns N (i.e., M >= N). Tolerance is specified by math::CONSTRAINT_TOLERANCE.

Template Parameters
T_yType of elements of Cholesky factor
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
Exceptions
<code>std::domain_error</code>if y is not a valid Choleksy factor, if number of rows is less than the number of columns, if there are 0 columns, or if any element in matrix is NaN

Definition at line 31 of file check_cholesky_factor_corr.hpp.

◆ check_column_index()

template<typename T_y , int R, int C>
void stan::math::check_column_index ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, R, C > &  y,
size_t  i 
)
inline

Check if the specified index is a valid column of the matrix.

By default this is a 1-indexed check (as opposed to 0-indexed). Behavior can be changed by setting stan::error_index::value. This function will throw an std::out_of_range exception if the index is out of bounds.

Template Parameters
T_yType of scalar
RNumber of rows of the matrix
CNumber of columns of the matrix
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
iIndex to check
Exceptions
<code>std::out_of_range</code>if index is an invalid column

Definition at line 30 of file check_column_index.hpp.

◆ check_consistent_size()

template<typename T >
void stan::math::check_consistent_size ( const char *  function,
const char *  name,
const T &  x,
size_t  expected_size 
)
inline

Check if the dimension of x is consistent, which is defined to be expected_size if x is a vector or 1 if x is not a vector.

Template Parameters
TType of value
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
xVariable to check for consistent size
expected_sizeExpected size if x is a vector
Exceptions
<code>invalid_argument</code>if the size is inconsistent

Definition at line 23 of file check_consistent_size.hpp.

◆ check_consistent_size_mvt()

template<typename T >
void stan::math::check_consistent_size_mvt ( const char *  function,
const char *  name,
const T &  x,
size_t  expected_size 
)
inline

Check if the dimension of x is consistent, which is defined to be expected_size if x is a vector of vectors or 1 if x is a single vector.

Template Parameters
TType of value
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
xVariable to check for consistent size
expected_sizeExpected size if x is a vector
Exceptions
<code>invalid_argument</code>if the size is inconsistent

Definition at line 25 of file check_consistent_size_mvt.hpp.

◆ check_consistent_sizes() [1/4]

template<typename T1 , typename T2 >
void stan::math::check_consistent_sizes ( const char *  function,
const char *  name1,
const T1 &  x1,
const char *  name2,
const T2 &  x2 
)
inline

Check if the dimension of x1 is consistent with x2.

Consistent size is defined as having the same size if vector-like or being a scalar.

Template Parameters
T1Type of x1
T2Type of x2
Parameters
functionFunction name (for error messages)
name1Variable name (for error messages)
x1Variable to check for consistent size
name2Variable name (for error messages)
x2Variable to check for consistent size
Exceptions
<code>invalid_argument</code>if sizes are inconsistent

Definition at line 25 of file check_consistent_sizes.hpp.

◆ check_consistent_sizes() [2/4]

template<typename T1 , typename T2 , typename T3 >
void stan::math::check_consistent_sizes ( const char *  function,
const char *  name1,
const T1 &  x1,
const char *  name2,
const T2 &  x2,
const char *  name3,
const T3 &  x3 
)
inline

Check if the dimension of x1, x2, and x3 areconsistent.

Consistent size is defined as having the same size if vector-like or being a scalar.

Template Parameters
T1Type of x1
T2Type of x2
T3Type of x3
Parameters
functionFunction name (for error messages)
name1Variable name (for error messages)
x1Variable to check for consistent size
name2Variable name (for error messages)
x2Variable to check for consistent size
name3Variable name (for error messages)
x3Variable to check for consistent size
Exceptions
<code>invalid_argument</code>if sizes are inconsistent

Definition at line 51 of file check_consistent_sizes.hpp.

◆ check_consistent_sizes() [3/4]

template<typename T1 , typename T2 , typename T3 , typename T4 >
void stan::math::check_consistent_sizes ( const char *  function,
const char *  name1,
const T1 &  x1,
const char *  name2,
const T2 &  x2,
const char *  name3,
const T3 &  x3,
const char *  name4,
const T4 &  x4 
)
inline

Check if the dimension of x1, x2, x3, and x4are consistent.

Consistent size is defined as having the same size if vector-like or being a scalar.

Template Parameters
T1Type of x1
T2Type of x2
T3Type of x3
T4Type of x4
Parameters
functionFunction name (for error messages)
name1Variable name (for error messages)
x1Variable to check for consistent size
name2Variable name (for error messages)
x2Variable to check for consistent size
name3Variable name (for error messages)
x3Variable to check for consistent size
name4Variable name (for error messages)
x4Variable to check for consistent size
Exceptions
<code>invalid_argument</code>if sizes are inconsistent

Definition at line 83 of file check_consistent_sizes.hpp.

◆ check_consistent_sizes() [4/4]

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
void stan::math::check_consistent_sizes ( const char *  function,
const char *  name1,
const T1 &  x1,
const char *  name2,
const T2 &  x2,
const char *  name3,
const T3 &  x3,
const char *  name4,
const T4 &  x4,
const char *  name5,
const T5 &  x5 
)
inline

Definition at line 99 of file check_consistent_sizes.hpp.

◆ check_consistent_sizes_mvt()

template<typename T1 , typename T2 >
void stan::math::check_consistent_sizes_mvt ( const char *  function,
const char *  name1,
const T1 &  x1,
const char *  name2,
const T2 &  x2 
)
inline

Check if the dimension of x1 is consistent with x2.

Consistent size is defined as having the same size if vector of vectors or being a single vector.

Template Parameters
T1Type of x1
T2Type of x2
Parameters
functionFunction name (for error messages)
name1Variable name (for error messages)
x1Variable to check for consistent size
name2Variable name (for error messages)
x2Variable to check for consistent size
Exceptions
<code>invalid_argument</code>if sizes are inconsistent

Definition at line 25 of file check_consistent_sizes_mvt.hpp.

◆ check_corr_matrix()

template<typename T_y >
void stan::math::check_corr_matrix ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y 
)
inline

Check if the specified matrix is a valid correlation matrix.

A valid correlation matrix is symmetric, has a unit diagonal (all 1 values), and has all values between -1 and 1 (inclusive). This function throws exceptions if the variable is not a valid correlation matrix.

Template Parameters
T_yType of scalar
Parameters
functionName of the function this was called from
nameName of the variable
yMatrix to test
Exceptions
<code>std::invalid_argument</code>if the matrix is not square or if the matrix is 0x0
<code>std::domain_error</code>if the matrix is non-symmetric, diagonals not near 1, not positive definite, or any of the elements nan

Definition at line 35 of file check_corr_matrix.hpp.

◆ check_cov_matrix()

template<typename T_y >
void stan::math::check_cov_matrix ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y 
)
inline

Check if the specified matrix is a valid covariance matrix.

A valid covariance matrix is a square, symmetric matrix that is positive definite.

Template Parameters
TType of scalar.
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
Exceptions
<code>std::invalid_argument</code>if the matrix is not square or if the matrix is 0x0
<code>std::domain_error</code>if the matrix is not symmetric, if the matrix is not positive definite, or if any element of the matrix is nan

Definition at line 25 of file check_cov_matrix.hpp.

◆ check_diagonal_zeros()

void stan::math::check_diagonal_zeros ( const char *  function,
const char *  name,
const matrix_cl y 
)
inline

Check if the matrix_cl has zeros on the diagonal.

Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
ymatrix_cl to test
Exceptions
<code>std::domain_error</code>if any diagonal element of the matrix is zero.

Definition at line 23 of file check_diagonal_zeros.hpp.

◆ check_finite()

template<typename T_y >
void stan::math::check_finite ( const char *  function,
const char *  name,
const T_y &  y 
)
inline

Check if y is finite.

This function is vectorized and will check each element of y.

Template Parameters
T_yType of y
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVariable to check
Exceptions
<code>domain_error</code>if y is infinity, -infinity, or NaN

Definition at line 44 of file check_finite.hpp.

◆ check_greater()

template<typename T_y , typename T_low >
void stan::math::check_greater ( const char *  function,
const char *  name,
const T_y &  y,
const T_low &  low 
)
inline

Check if y is strictly greater than low.

This function is vectorized and will check each element of y against each element of low.

Template Parameters
T_yType of y
T_lowType of lower bound
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVariable to check
lowLower bound
Exceptions
<code>domain_error</code>if y is not greater than low or if any element of y or low is NaN.

Definition at line 63 of file check_greater.hpp.

◆ check_greater_or_equal()

template<typename T_y , typename T_low >
void stan::math::check_greater_or_equal ( const char *  function,
const char *  name,
const T_y &  y,
const T_low &  low 
)
inline

Check if y is greater or equal than low.

This function is vectorized and will check each element of y against each element of low.

Template Parameters
T_yType of y
T_lowType of lower bound
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVariable to check
lowLower bound
Exceptions
<code>domain_error</code>if y is not greater or equal to low or if any element of y or low is NaN.

Definition at line 62 of file check_greater_or_equal.hpp.

◆ check_ldlt_factor()

template<typename T , int R, int C>
void stan::math::check_ldlt_factor ( const char *  function,
const char *  name,
LDLT_factor< T, R, C > &  A 
)
inline

Raise domain error if the specified LDLT factor is invalid.

An LDLT_factor is invalid if it was constructed from a matrix that is not positive definite. The check is that the success() method returns true.

Template Parameters
TType of scalar
RRows of the matrix
CColumns of the matrix
Parameters
[in]functionFunction name for error messages
[in]nameVariable name for error messages
[in]AThe LDLT factor to check for validity
Exceptions
<code>std::domain_error</code>if the LDLT factor is invalid

Definition at line 28 of file check_ldlt_factor.hpp.

◆ check_less()

template<typename T_y , typename T_high >
void stan::math::check_less ( const char *  function,
const char *  name,
const T_y &  y,
const T_high &  high 
)
inline

Check if y is strictly less than high.

This function is vectorized and will check each element of y against each element of high.

Template Parameters
T_yType of y
T_highType of upper bound
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVariable to check
highUpper bound
Exceptions
<code>domain_error</code>if y is not less than low or if any element of y or high is NaN.

Definition at line 63 of file check_less.hpp.

◆ check_less_or_equal()

template<typename T_y , typename T_high >
void stan::math::check_less_or_equal ( const char *  function,
const char *  name,
const T_y &  y,
const T_high &  high 
)
inline

Check if y is less or equal to high.

This function is vectorized and will check each element of y against each element of high.

Template Parameters
T_yType of y
T_highType of upper bound
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVariable to check
highUpper bound
Exceptions
<code>std::domain_error</code>if y is not less than or equal to low or if any element of y or high is NaN

Definition at line 62 of file check_less_or_equal.hpp.

◆ check_lower_triangular()

template<typename T_y >
void stan::math::check_lower_triangular ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y 
)
inline

Check if the specified matrix is lower triangular.

A matrix x is not lower triangular if there is a non-zero entry x[m, n] with m < n. This function only inspects the upper triangular portion of the matrix, not including the diagonal.

Template Parameters
TType of scalar of the matrix
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
Exceptions
<code>std::domain_error</code>if the matrix is not lower triangular or if any element in the upper triangular portion is NaN

Definition at line 27 of file check_lower_triangular.hpp.

◆ check_matching_dims() [1/3]

void stan::math::check_matching_dims ( const char *  function,
const char *  name1,
const matrix_cl y1,
const char *  name2,
const matrix_cl y2 
)
inline

Check if two matrix_cls have the same dimensions.

Parameters
functionFunction name (for error messages)
name1Variable name for the first matrix (for error messages)
y1First matrix_cl
name2Variable name for the second matrix (for error messages)
y2Second matrix_cl
Exceptions
<code>std::invalid_argument</code>if the dimensions of the matrices do not match

Definition at line 21 of file check_matching_dims.hpp.

◆ check_matching_dims() [2/3]

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
void stan::math::check_matching_dims ( const char *  function,
const char *  name1,
const Eigen::Matrix< T1, R1, C1 > &  y1,
const char *  name2,
const Eigen::Matrix< T2, R2, C2 > &  y2 
)
inline

Check if the two matrices are of the same size.

This function checks the runtime sizes only.

Template Parameters
T1Scalar type of the first matrix
T2Scalar type of the second matrix
R1Rows specified at compile time of the first matrix
C1Columns specified at compile time of the first matrix
R2Rows specified at compile time of the second matrix
C2Columns specified at compile time of the second matrix
Parameters
functionFunction name (for error messages)
name1Variable name for the first matrix (for error messages)
y1First matrix to test
name2Variable name for the second matrix (for error messages)
y2Second matrix to test
Exceptions
<code>std::invalid_argument</code>if the dimensions of the matrices do not match

Definition at line 33 of file check_matching_dims.hpp.

◆ check_matching_dims() [3/3]

template<bool check_compile, typename T1 , typename T2 , int R1, int C1, int R2, int C2>
void stan::math::check_matching_dims ( const char *  function,
const char *  name1,
const Eigen::Matrix< T1, R1, C1 > &  y1,
const char *  name2,
const Eigen::Matrix< T2, R2, C2 > &  y2 
)
inline

Check if the two matrices are of the same size.

This function checks the runtime sizes and can also check the static sizes as well. For example, a 4x1 matrix is not the same as a vector with 4 elements.

Template Parameters
check_compileWhether to check the static sizes
T1Scalar type of the first matrix
T2Scalar type of the second matrix
R1Rows specified at compile time of the first matrix
C1Columns specified at compile time of the first matrix
R2Rows specified at compile time of the second matrix
C2Columns specified at compile time of the second matrix
Parameters
functionFunction name (for error messages)
name1Variable name for the first matrix (for error messages)
y1First matrix to test
name2Variable name for the second matrix (for error messages)
y2Second matrix to test
Exceptions
<code>std::invalid_argument</code>if the dimensions of the matrices do not match

Definition at line 65 of file check_matching_dims.hpp.

◆ check_matching_sizes()

template<typename T_y1 , typename T_y2 >
void stan::math::check_matching_sizes ( const char *  function,
const char *  name1,
const T_y1 &  y1,
const char *  name2,
const T_y2 &  y2 
)
inline

Check if two structures at the same size.

This function only checks the runtime sizes for variables that implement a size() method.

Template Parameters
T_y1Type of the first variable
T_y2Type of the second variable
Parameters
functionFunction name (for error messages)
name1First variable name (for error messages)
y1First variable
name2Second variable name (for error messages)
y2Second variable
Exceptions
<code>std::invalid_argument</code>if the sizes do not match

Definition at line 25 of file check_matching_sizes.hpp.

◆ check_multiplicable()

template<typename T1 , typename T2 >
void stan::math::check_multiplicable ( const char *  function,
const char *  name1,
const T1 &  y1,
const char *  name2,
const T2 &  y2 
)
inline

Check if the matrices can be multiplied.

This checks the runtime sizes to determine whether the two matrices are multiplicable. This allows Eigen matrices, vectors, and row vectors to be checked.

Template Parameters
T1Type of first matrix
T2Type of second matrix
Parameters
functionFunction name (for error messages)
name1Variable name for the first matrix (for error messages)
y1First matrix to test, requires class access to .rows() and .cols()
name2Variable name for the second matrix (for error messages)
y2Second matrix to test, requires class access to .rows() and .cols()
Exceptions
<code>std::invalid_argument</code>if the matrices are not multiplicable or if either matrix is size 0 for either rows or columns

Definition at line 30 of file check_multiplicable.hpp.

◆ check_nan()

void stan::math::check_nan ( const char *  function,
const char *  name,
const matrix_cl y 
)
inline

Check if the matrix_cl has NaN values.

Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
ymatrix_cl to test
Exceptions
<code>std::domain_error</code>if any element of the matrix is NaN.

Definition at line 24 of file check_nan.hpp.

◆ check_nonnegative()

template<typename T_y >
void stan::math::check_nonnegative ( const char *  function,
const char *  name,
const T_y &  y 
)
inline

Check if y is non-negative.

This function is vectorized and will check each element of y.

Template Parameters
T_yType of y
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVariable to check
Exceptions
<code>domain_error</code>if y is negative or if any element of y is NaN.

Definition at line 46 of file check_nonnegative.hpp.

◆ check_nonzero_size()

template<typename T_y >
void stan::math::check_nonzero_size ( const char *  function,
const char *  name,
const T_y &  y 
)
inline

Check if the specified matrix/vector is of non-zero size.

Throws a std:invalid_argument otherwise. The message will indicate that the variable name "has size 0".

Template Parameters
T_yType of container
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yContainer to test. This will accept matrices and vectors
Exceptions
<code>std::invalid_argument</code>if the specified matrix/vector has zero size

Definition at line 22 of file check_nonzero_size.hpp.

◆ check_not_nan()

template<typename T_y >
void stan::math::check_not_nan ( const char *  function,
const char *  name,
const T_y &  y 
)
inline

Check if y is not NaN.

This function is vectorized and will check each element of y. If any element is NaN, this function will throw an exception.

Template Parameters
T_yType of y
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVariable to check
Exceptions
<code>domain_error</code>if any element of y is NaN

Definition at line 45 of file check_not_nan.hpp.

◆ check_opencl_error()

void stan::math::check_opencl_error ( const char *  function,
const cl::Error &  e 
)
inline

Throws the domain error with specifying the OpenCL error that occured.

It outputs the OpenCL errors that are specified in OpenCL 2.0. If no matching error number is found, it throws the error with the number.

Parameters
functionthe name of the function where the error occurred
eThe error number

Definition at line 26 of file check_opencl.hpp.

◆ check_ordered() [1/2]

template<typename T_y >
void stan::math::check_ordered ( const char *  function,
const char *  name,
const std::vector< T_y > &  y 
)

Check if the specified vector is sorted into strictly increasing order.

Template Parameters
T_yType of scalar
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
ystd::vector to test
Exceptions
<code>std::domain_error</code>if the vector elements are not ordered, if there are duplicated values, or if any element is NaN.

Definition at line 24 of file check_ordered.hpp.

◆ check_ordered() [2/2]

template<typename T_y >
void stan::math::check_ordered ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &  y 
)

Check if the specified vector is sorted into strictly increasing order.

Template Parameters
T_yType of scalar
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVector to test
Exceptions
<code>std::domain_error</code>if the vector elements are not ordered, if there are duplicated values, or if any element is NaN.

Definition at line 25 of file check_ordered.hpp.

◆ check_pos_definite() [1/3]

template<typename T_y >
void stan::math::check_pos_definite ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, -1, -1 > &  y 
)
inline

Check if the specified square, symmetric matrix is positive definite.

Template Parameters
T_yType of scalar of the matrix
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
Exceptions
<code>std::invalid_argument</code>if the matrix is not square or if the matrix has 0 size.
<code>std::domain_error</code>if the matrix is not symmetric, if it is not positive definite, or if any element is NaN

Definition at line 28 of file check_pos_definite.hpp.

◆ check_pos_definite() [2/3]

template<typename Derived >
void stan::math::check_pos_definite ( const char *  function,
const char *  name,
const Eigen::LDLT< Derived > &  cholesky 
)
inline

Check if the specified LDLT transform of a matrix is positive definite.

Template Parameters
DerivedDerived type of the Eigen::LDLT transform.
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
choleskyEigen::LDLT to test, whose progenitor must not have any NaN elements
Exceptions
<code>std::domain_error</code>if the matrix is not positive definite

Definition at line 53 of file check_pos_definite.hpp.

◆ check_pos_definite() [3/3]

template<typename Derived >
void stan::math::check_pos_definite ( const char *  function,
const char *  name,
const Eigen::LLT< Derived > &  cholesky 
)
inline

Check if the specified LLT decomposition transform resulted in Eigen::Success

Template Parameters
DerivedDerived type of the Eigen::LLT transform.
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
choleskyEigen::LLT to test, whose progenitor must not have any NaN elements
Exceptions
<code>std::domain_error</code>if the diagonal of the L matrix is not positive

Definition at line 72 of file check_pos_definite.hpp.

◆ check_pos_semidefinite() [1/2]

template<typename T_y >
void stan::math::check_pos_semidefinite ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y 
)
inline

Check if the specified matrix is positive definite.

Template Parameters
T_yscalar type of the matrix
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
Exceptions
<code>std::invalid_argument</code>if the matrix is not square or if the matrix has 0 size.
<code>std::domain_error</code>if the matrix is not symmetric, or if it is not positive semi-definite, or if any element of the matrix is NaN.

Definition at line 29 of file check_pos_semidefinite.hpp.

◆ check_pos_semidefinite() [2/2]

template<typename Derived >
void stan::math::check_pos_semidefinite ( const char *  function,
const char *  name,
const Eigen::LDLT< Derived > &  cholesky 
)
inline

Check if the specified matrix is positive semidefinite.

Template Parameters
DerivedDerived type of the Eigen::LDLT transform.
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
choleskyEigen::LDLT to test
Exceptions
<code>std::domain_error</code>if the matrix is not positive semi-definite.

Definition at line 59 of file check_pos_semidefinite.hpp.

◆ check_positive() [1/2]

template<typename T_y >
void stan::math::check_positive ( const char *  function,
const char *  name,
const T_y &  y 
)
inline

Check if y is positive.

This function is vectorized and will check each element of y.

Template Parameters
T_yType of y
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVariable to check
Exceptions
<code>domain_error</code>if y is negative or zero or if any element of y is NaN

Definition at line 52 of file check_positive.hpp.

◆ check_positive() [2/2]

void stan::math::check_positive ( const char *  function,
const char *  name,
const char *  expr,
int  size 
)
inline

Check if size is positive.

Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
exprExpression for the dimension size (for error messages)
sizeSize value to check
Exceptions
<code>std::invalid_argument</code>if size is zero or negative.

Definition at line 66 of file check_positive.hpp.

◆ check_positive_finite()

template<typename T_y >
void stan::math::check_positive_finite ( const char *  function,
const char *  name,
const T_y &  y 
)
inline

Check if y is positive and finite.

This function is vectorized and will check each element of y.

Template Parameters
T_yType of y
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVariable to check
Exceptions
<code>domain_error</code>if any element of y is not positive or if any element of y is NaN.

Definition at line 23 of file check_positive_finite.hpp.

◆ check_positive_ordered()

template<typename T_y >
void stan::math::check_positive_ordered ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &  y 
)

Check if the specified vector contains non-negative values and is sorted into strictly increasing order.

Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yVector to test
Exceptions
<code>std::domain_error</code>if the vector contains non-positive values, if the values are not ordered, if there are duplicated values, or if any element is NaN.

Definition at line 25 of file check_positive_ordered.hpp.

◆ check_range() [1/3]

void stan::math::check_range ( const char *  function,
const char *  name,
int  max,
int  index,
int  nested_level,
const char *  error_msg 
)
inline

Check if specified index is within range.

This check is 1-indexed by default. This behavior can be changed by setting stan::error_index::value.

Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
maxMaximum size of the variable
indexIndex to check
nested_levelNested level (for error messages)
error_msgAdditional error message (for error messages)
Exceptions
<code>std::out_of_range</code>if the index is not in range

Definition at line 24 of file check_range.hpp.

◆ check_range() [2/3]

void stan::math::check_range ( const char *  function,
const char *  name,
int  max,
int  index,
const char *  error_msg 
)
inline

Check if specified index is within range.

This check is 1-indexed by default. This behavior can be changed by setting stan::error_index::value.

Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
maxMaximum size of the variable
indexIndex to check
error_msgAdditional error message (for error messages)
Exceptions
<code>std::out_of_range</code>if the index is not in range

Definition at line 48 of file check_range.hpp.

◆ check_range() [3/3]

void stan::math::check_range ( const char *  function,
const char *  name,
int  max,
int  index 
)
inline

Check if specified index is within range.

This check is 1-indexed by default. This behavior can be changed by setting stan::error_index::value.

Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
maxMaximum size of the variable
indexIndex to check
Exceptions
<code>std::out_of_range</code>if the index is not in range

Definition at line 67 of file check_range.hpp.

◆ check_row_index()

template<typename T_y , int R, int C>
void stan::math::check_row_index ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, R, C > &  y,
size_t  i 
)
inline

Check if the specified index is a valid row of the matrix This check is 1-indexed by default.

This behavior can be changed by setting stan::error_index::value.

Template Parameters
TScalar type
RCompile time rows
CCompile time columns
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
iis index
Exceptions
<code>std::out_of_range</code>if the index is out of range.

Definition at line 27 of file check_row_index.hpp.

◆ check_simplex()

template<typename T_prob >
void stan::math::check_simplex ( const char *  function,
const char *  name,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)

Check if the specified vector is simplex.

To be a simplex, all values must be greater than or equal to 0 and the values must sum to 1. A valid simplex is one where the sum of hte elements is equal to 1. This function tests that the sum is within the tolerance specified by CONSTRAINT_TOLERANCE. This function only accepts Eigen vectors, statically typed vectors, not general matrices with 1 column.

Template Parameters
T_probScalar type of the vector
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
thetaVector to test.
Exceptions
<code>std::invalid_argument</code>if theta is a 0-vector.
<code>std::domain_error</code>if the vector is not a simplex or if any element is NaN.

Definition at line 34 of file check_simplex.hpp.

◆ check_size_match() [1/2]

template<typename T_size1 , typename T_size2 >
void stan::math::check_size_match ( const char *  function,
const char *  name_i,
T_size1  i,
const char *  name_j,
T_size2  j 
)
inline

Check if the provided sizes match.

Template Parameters
T_size1Type of size 1
T_size2Type of size 2
Parameters
functionFunction name (for error messages)
name_iVariable name 1 (for error messages)
iVariable size 1
name_jVariable name 2 (for error messages)
jVariable size 2
Exceptions
<code>std::invalid_argument</code>if the sizes do not match

Definition at line 24 of file check_size_match.hpp.

◆ check_size_match() [2/2]

template<typename T_size1 , typename T_size2 >
void stan::math::check_size_match ( const char *  function,
const char *  expr_i,
const char *  name_i,
T_size1  i,
const char *  expr_j,
const char *  name_j,
T_size2  j 
)
inline

Check if the provided sizes match.

Template Parameters
T_size1Type of size 1
T_size2Type of size 2
Parameters
functionFunction name (for error messages)
expr_iExpression for variable name 1 (for error messages)
name_iVariable name 1 (for error messages)
iVariable size 1
expr_jExpression for variable name 2 (for error messages)
name_jVariable name 2 (for error messages)
jVariable size 2
Exceptions
<code>std::invalid_argument</code>if the sizes do not match

Definition at line 49 of file check_size_match.hpp.

◆ check_spsd_matrix()

template<typename T_y >
void stan::math::check_spsd_matrix ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y 
)
inline

Check if the specified matrix is a square, symmetric, and positive semi-definite.

Template Parameters
TScalar type of the matrix
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
Exceptions
<code>std::invalid_argument</code>if the matrix is not square or if the matrix is 0x0
<code>std::domain_error</code>if the matrix is not symmetric or if the matrix is not positive semi-definite

Definition at line 26 of file check_spsd_matrix.hpp.

◆ check_square() [1/2]

void stan::math::check_square ( const char *  function,
const char *  name,
const matrix_cl y 
)
inline

Check if the matrix_cl is square.

Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
ymatrix_cl to test
Exceptions
<code>std::invalid_argument</code>if the matrix_cl is not square

Definition at line 19 of file check_square.hpp.

◆ check_square() [2/2]

template<typename T_y >
void stan::math::check_square ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y 
)
inline

Check if the specified matrix is square.

This check allows 0x0 matrices.

Template Parameters
TType of scalar
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
Exceptions
<code>std::invalid_argument</code>if the matrix is not square

Definition at line 21 of file check_square.hpp.

◆ check_std_vector_index()

template<typename T >
void stan::math::check_std_vector_index ( const char *  function,
const char *  name,
const std::vector< T > &  y,
int  i 
)
inline

Check if the specified index is valid in std vector This check is 1-indexed by default.

This behavior can be changed by setting stan::error_index::value.

Template Parameters
TScalar type
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
ystd::vector to test
iIndex
Exceptions
<code>std::out_of_range</code>if the index is out of range.

Definition at line 26 of file check_std_vector_index.hpp.

◆ check_symmetric() [1/2]

void stan::math::check_symmetric ( const char *  function,
const char *  name,
const matrix_cl y 
)
inline

Check if the matrix_cl is symmetric.

Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
ymatrix_cl to test
Exceptions
<code>std::domain_error</code>if the matrix is not symmetric.

Definition at line 24 of file check_symmetric.hpp.

◆ check_symmetric() [2/2]

template<typename T_y >
void stan::math::check_symmetric ( const char *  function,
const char *  name,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y 
)
inline

Check if the specified matrix is symmetric.

The error message is either 0 or 1 indexed, specified by stan::error_index::value.

Template Parameters
T_yType of scalar
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
yMatrix to test
Exceptions
<code>std::invalid_argument</code>if the matrix is not square.
<code>std::domain_error</code>if any element not on the main diagonal is NaN

Definition at line 29 of file check_symmetric.hpp.

◆ check_unit_vector()

template<typename T_prob >
void stan::math::check_unit_vector ( const char *  function,
const char *  name,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)

Check if the specified vector is unit vector.

A valid unit vector is one where the square of the elements summed is equal to 1. This function tests that the sum is within the tolerance specified by CONSTRAINT_TOLERANCE. This function only accepts Eigen vectors, statically typed vectors, not general matrices with 1 column.

Template Parameters
T_probScalar type of the vector
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
thetaVector to test
Exceptions
<code>std::invalid_argument</code>if theta is a 0-vector
<code>std::domain_error</code>if the vector is not a unit vector or if any element is NaN

Definition at line 32 of file check_unit_vector.hpp.

◆ check_vector()

template<typename T , int R, int C>
void stan::math::check_vector ( const char *  function,
const char *  name,
const Eigen::Matrix< T, R, C > &  x 
)
inline

Check if the matrix is either a row vector or column vector.

This function checks the runtime size of the matrix to check whether it is a row or column vector.

Template Parameters
TScalar type of the matrix
RCompile time rows of the matrix
CCompile time columns of the matrix
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
xMatrix
Exceptions
<code>std::invalid_argument</code>if x is not a row or column vector.

Definition at line 27 of file check_vector.hpp.

◆ chi_square_ccdf_log()

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::chi_square_ccdf_log ( const T_y &  y,
const T_dof &  nu 
)
Deprecated:
use chi_square_lccdf

Definition at line 14 of file chi_square_ccdf_log.hpp.

◆ chi_square_cdf()

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::chi_square_cdf ( const T_y &  y,
const T_dof &  nu 
)

Returns the chi square cumulative distribution function for the given variate and degrees of freedom.

If given containers of matching sizes, returns the product of probabilities.

Template Parameters
T_ytype of scalar parameter
T_doftype of degrees of freedom parameter
Parameters
yscalar parameter
nudegrees of freedom parameter
Returns
probability or product of probabilities
Exceptions
std::domain_errorif y is negative or nu is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 35 of file chi_square_cdf.hpp.

◆ chi_square_cdf_log()

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::chi_square_cdf_log ( const T_y &  y,
const T_dof &  nu 
)
Deprecated:
use chi_square_lcdf

Definition at line 14 of file chi_square_cdf_log.hpp.

◆ chi_square_lccdf()

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::chi_square_lccdf ( const T_y &  y,
const T_dof &  nu 
)

Returns the chi square log complementary cumulative distribution function for the given variate and degrees of freedom.

If given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ytype of scalar parameter
T_doftype of degrees of freedom parameter
Parameters
yscalar parameter
nudegrees of freedom parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif y is negative or nu is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 36 of file chi_square_lccdf.hpp.

◆ chi_square_lcdf()

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::chi_square_lcdf ( const T_y &  y,
const T_dof &  nu 
)

Returns the chi square log cumulative distribution function for the given variate and degrees of freedom.

If given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ytype of scalar parameter
T_doftype of degrees of freedom parameter
Parameters
yscalar parameter
nudegrees of freedom parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif y is negative or nu is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 36 of file chi_square_lcdf.hpp.

◆ chi_square_log() [1/2]

template<bool propto, typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::chi_square_log ( const T_y &  y,
const T_dof &  nu 
)

The log of a chi-squared density for y with the specified degrees of freedom parameter.

The degrees of freedom prarameter must be greater than 0. y must be greater than or equal to 0.

\begin{eqnarray*} y &\sim& \chi^2_\nu \\ \log (p (y \, |\, \nu)) &=& \log \left( \frac{2^{-\nu / 2}}{\Gamma (\nu / 2)} y^{\nu / 2 - 1} \exp^{- y / 2} \right) \\ &=& - \frac{\nu}{2} \log(2) - \log (\Gamma (\nu / 2)) + (\frac{\nu}{2} - 1) \log(y) - \frac{y}{2} \\ & & \mathrm{ where } \; y \ge 0 \end{eqnarray*}

Deprecated:
use chi_square_lpdf
Parameters
yA scalar variable.
nuDegrees of freedom.
Exceptions
std::domain_errorif nu is not greater than or equal to 0
std::domain_errorif y is not greater than or equal to 0.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.

Definition at line 32 of file chi_square_log.hpp.

◆ chi_square_log() [2/2]

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::chi_square_log ( const T_y &  y,
const T_dof &  nu 
)
inline
Deprecated:
use chi_square_lpdf

Definition at line 41 of file chi_square_log.hpp.

◆ chi_square_lpdf() [1/2]

template<bool propto, typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::chi_square_lpdf ( const T_y &  y,
const T_dof &  nu 
)

The log of a chi-squared density for y with the specified degrees of freedom parameter.

The degrees of freedom prarameter must be greater than 0. y must be greater than or equal to 0.

\begin{eqnarray*} y &\sim& \chi^2_\nu \\ \log (p (y \, |\, \nu)) &=& \log \left( \frac{2^{-\nu / 2}}{\Gamma (\nu / 2)} y^{\nu / 2 - 1} \exp^{- y / 2} \right) \\ &=& - \frac{\nu}{2} \log(2) - \log (\Gamma (\nu / 2)) + (\frac{\nu}{2} - 1) \log(y) - \frac{y}{2} \\ & & \mathrm{ where } \; y \ge 0 \end{eqnarray*}

Parameters
yA scalar variable.
nuDegrees of freedom.
Exceptions
std::domain_errorif nu is not greater than or equal to 0
std::domain_errorif y is not greater than or equal to 0.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.

Definition at line 39 of file chi_square_lpdf.hpp.

◆ chi_square_lpdf() [2/2]

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::chi_square_lpdf ( const T_y &  y,
const T_dof &  nu 
)
inline

Definition at line 121 of file chi_square_lpdf.hpp.

◆ chi_square_rng()

template<typename T_deg , class RNG >
VectorBuilder<true, double, T_deg>::type stan::math::chi_square_rng ( const T_deg &  nu,
RNG &  rng 
)
inline

Return a chi squared random variate with nu degrees of freedom using the specified random number generator.

nu can be a scalar or a one-dimensional container.

Template Parameters
T_degType of degrees of freedom parameter
RNGclass of random number generator
Parameters
nu(Sequence of) positive degrees of freedom parameter(s)
rngrandom number generator
Returns
(Sequence of) chi squared random variate(s)
Exceptions
std::domain_errorif nu is nonpositive

Definition at line 28 of file chi_square_rng.hpp.

◆ chol2inv()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::chol2inv ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  L)

Returns the inverse of the matrix whose Cholesky factor is L.

Template Parameters
TThe scalar type of the matrix
Parameters
LMatrix that is a Cholesky factor.
Returns
The matrix inverse of L * L'
Exceptions
std::domain_errorIf the input matrix is not square or lower triangular

Definition at line 24 of file chol2inv.hpp.

◆ cholesky_corr_constrain() [1/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::cholesky_corr_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  y,
int  K 
)

Definition at line 15 of file cholesky_corr_constrain.hpp.

◆ cholesky_corr_constrain() [2/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::cholesky_corr_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  y,
int  K,
T &  lp 
)

Definition at line 46 of file cholesky_corr_constrain.hpp.

◆ cholesky_corr_free()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::cholesky_corr_free ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  x)

Definition at line 14 of file cholesky_corr_free.hpp.

◆ cholesky_decompose() [1/4]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::cholesky_decompose ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)
inline

Return the lower-triangular Cholesky factor (i.e., matrix square root) of the specified square, symmetric matrix.

The return value $L$ will be a lower-traingular matrix such that the original matrix $A$ is given by

$A = L \times L^T$.

Parameters
mSymmetrix matrix.
Returns
Square root of matrix.
Note
Because OpenCL only works on doubles there are two cholesky_decompose functions. One that works on doubles and another that works on all other types (this one).
Exceptions
std::domain_errorif m is not a symmetric matrix or if m is not positive definite (if m has more than 0 elements)

Definition at line 35 of file cholesky_decompose.hpp.

◆ cholesky_decompose() [2/4]

void stan::math::cholesky_decompose ( matrix_cl A)
inline

Performs an in-place of the the lower-triangular Cholesky factor (i.e., matrix square root) of the specified square, symmetric matrix.

The return value $L$ will be a lower-traingular matrix such that the original matrix $A$ is given by

$A = L \times L^T$. The Cholesky decomposition is computed using an OpenCL kernel. This algorithm is recursive. The matrix is subset into a matrix of size A.rows() / 4, and if the submatrix size is less than 50 or min_block then the cholesky decomposition on the OpenCL device is computed using that submatrix. If the submatrix is greater than 50 or min_block then cholesky_decompose is run again on a submatrix with size equal to submat.rows() / 4. Once the Cholesky Decomposition is computed, the full matrix cholesky is created by propogating the cholesky forward as given in the reference report below.

For a full guide to how this works see the Cholesy decompostion chapter in the reference report here.

Exceptions
std::domain_errorif m is not positive definite (if m has more than 0 elements)

Definition at line 43 of file cholesky_decompose.hpp.

◆ cholesky_decompose() [3/4]

template<>
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> stan::math::cholesky_decompose ( const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &  m)
inline

Return the lower-triangular Cholesky factor (i.e., matrix square root) of the specified square, symmetric matrix.

The return value $L$ will be a lower-traingular matrix such that the original matrix $A$ is given by

$A = L \times L^T$.

Parameters
mSymmetrix matrix.
Returns
Square root of matrix.
Note
Because OpenCL only works on doubles there are two cholesky_decompose functions. One that works on doubles (this one) and another that works on all other types.
Exceptions
std::domain_errorif m is not a symmetric matrix or if m is not positive definite (if m has more than 0 elements)

Definition at line 60 of file cholesky_decompose.hpp.

◆ cholesky_decompose() [4/4]

Eigen::Matrix<var, -1, -1> stan::math::cholesky_decompose ( const Eigen::Matrix< var, -1, -1 > &  A)
inline

Reverse mode specialization of cholesky decomposition.

Internally calls Eigen::LLT rather than using stan::math::cholesky_decompose in order to use an inplace decomposition.

Note chainable stack varis are created below in Matrix<var, -1, -1>

Parameters
AMatrix
Returns
L cholesky factor of A

Definition at line 398 of file cholesky_decompose.hpp.

◆ cholesky_factor_constrain() [1/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::cholesky_factor_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
int  M,
int  N 
)

Return the Cholesky factor of the specified size read from the specified vector.

A total of (N choose 2) + N + (M - N) * N elements are required to read an M by N Cholesky factor.

Template Parameters
TType of scalars in matrix
Parameters
xVector of unconstrained values
MNumber of rows
NNumber of columns
Returns
Cholesky factor

Definition at line 27 of file cholesky_factor_constrain.hpp.

◆ cholesky_factor_constrain() [2/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::cholesky_factor_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
int  M,
int  N,
T &  lp 
)

Return the Cholesky factor of the specified size read from the specified vector and increment the specified log probability reference with the log Jacobian adjustment of the transform.

A total of (N choose 2) + N + N * (M - N) free parameters are required to read an M by N Cholesky factor.

Template Parameters
TType of scalars in matrix
Parameters
xVector of unconstrained values
MNumber of rows
NNumber of columns
lpLog probability that is incremented with the log Jacobian
Returns
Cholesky factor

Definition at line 69 of file cholesky_factor_constrain.hpp.

◆ cholesky_factor_free()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::cholesky_factor_free ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  y)

Return the unconstrained vector of parameters correspdonding to the specified Cholesky factor.

A Cholesky factor must be lower triangular and have positive diagonal elements.

Parameters
yCholesky factor.
Returns
Unconstrained parameters for Cholesky factor.
Exceptions
std::domain_errorIf the matrix is not a Cholesky factor.

Definition at line 22 of file cholesky_factor_free.hpp.

◆ choose()

int stan::math::choose ( int  n,
int  k 
)
inline

Return the binomial coefficient for the specified integer arguments.

The binomial coefficient, ${n \choose k}$, read "n choose k", is defined for $0 \leq k \leq n$ (otherwise return 0) by

${n \choose k} = \frac{n!}{k! (n-k)!}$.

Parameters
ntotal number of objects
knumber of objects chosen
Returns
n choose k or 0 iff k > n
Exceptions
std::domain_errorif either argument is negative or the result will not fit in an int type

Definition at line 29 of file choose.hpp.

◆ col()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::col ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m,
size_t  j 
)
inline

Return the specified column of the specified matrix using start-at-1 indexing.

This is equivalent to calling m.col(i - 1) and assigning the resulting template expression to a column vector.

Parameters
mMatrix.
jColumn index (count from 1).
Returns
Specified column of the matrix.
Exceptions
std::out_of_rangeif j is out of range.

Definition at line 23 of file col.hpp.

◆ cols()

template<typename T , int R, int C>
int stan::math::cols ( const Eigen::Matrix< T, R, C > &  m)
inline

Return the number of columns in the specified matrix, vector, or row vector.

Template Parameters
TType of matrix entries.
RRow type of matrix.
CColumn type of matrix.
Parameters
[in]mInput matrix, vector, or row vector.
Returns
Number of columns.

Definition at line 20 of file cols.hpp.

◆ columns_dot_product() [1/5]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, 1, C1> stan::math::columns_dot_product ( const Eigen::Matrix< fvar< T >, R1, C1 > &  v1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  v2 
)
inline

Definition at line 13 of file columns_dot_product.hpp.

◆ columns_dot_product() [2/5]

template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
std::enable_if<std::is_same<T1, var>::value || std::is_same<T2, var>::value, Eigen::Matrix<var, 1, C1> >::type stan::math::columns_dot_product ( const Eigen::Matrix< T1, R1, C1 > &  v1,
const Eigen::Matrix< T2, R2, C2 > &  v2 
)
inline

Definition at line 19 of file columns_dot_product.hpp.

◆ columns_dot_product() [3/5]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<double, 1, C1> stan::math::columns_dot_product ( const Eigen::Matrix< double, R1, C1 > &  v1,
const Eigen::Matrix< double, R2, C2 > &  v2 
)
inline

Returns the dot product of the specified vectors.

Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 20 of file columns_dot_product.hpp.

◆ columns_dot_product() [4/5]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, 1, C1> stan::math::columns_dot_product ( const Eigen::Matrix< fvar< T >, R1, C1 > &  v1,
const Eigen::Matrix< double, R2, C2 > &  v2 
)
inline

Definition at line 27 of file columns_dot_product.hpp.

◆ columns_dot_product() [5/5]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, 1, C1> stan::math::columns_dot_product ( const Eigen::Matrix< double, R1, C1 > &  v1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  v2 
)
inline

Definition at line 41 of file columns_dot_product.hpp.

◆ columns_dot_self() [1/3]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, 1, C> stan::math::columns_dot_self ( const Eigen::Matrix< fvar< T >, R, C > &  x)
inline

Definition at line 12 of file columns_dot_self.hpp.

◆ columns_dot_self() [2/3]

template<typename T , int R, int C>
Eigen::Matrix<T, 1, C> stan::math::columns_dot_self ( const Eigen::Matrix< T, R, C > &  x)
inline

Returns the dot product of each column of a matrix with itself.

Parameters
xMatrix.
Template Parameters
Tscalar type

Definition at line 15 of file columns_dot_self.hpp.

◆ columns_dot_self() [3/3]

template<int R, int C>
Eigen::Matrix<var, 1, C> stan::math::columns_dot_self ( const Eigen::Matrix< var, R, C > &  x)
inline

Returns the dot product of each column of a matrix with itself.

Parameters
xMatrix.
Template Parameters
Tscalar type

Definition at line 19 of file columns_dot_self.hpp.

◆ copy_cl()

matrix_cl stan::math::copy_cl ( const matrix_cl src)
inline

Copies the source matrix to the destination matrix.

Both matrices are stored on the OpenCL device.

Parameters
srcsource matrix
Returns
matrix_cl with copies of values in the source matrix
Exceptions
<code>std::invalid_argument</code>if the matrices do not have matching dimensions

Copies the contents of the src buffer to the dst buffer see the matrix_cl(matrix_cl&) constructor for explanation

Definition at line 183 of file copy.hpp.

◆ copy_triangular()

template<TriangularViewCL triangular_view = TriangularViewCL::Entire>
matrix_cl stan::math::copy_triangular ( const matrix_cl src)
inline

Copies the lower or upper triangular of the source matrix to the destination matrix.

Both matrices are stored on the OpenCL device.

Parameters
srcthe source matrix
Template Parameters
triangular_mapint to describe which part of the matrix to copy: TriangularViewCL::Lower - copies the lower triangular TriangularViewCL::Upper - copes the upper triangular
Returns
the matrix with the copied content

Definition at line 30 of file copy_triangular.hpp.

◆ corr_constrain() [1/2]

template<typename T >
T stan::math::corr_constrain ( const T &  x)
inline

Return the result of transforming the specified scalar to have a valid correlation value between -1 and 1 (inclusive).

The transform used is the hyperbolic tangent function,

$f(x) = \tanh x = \frac{\exp(2x) - 1}{\exp(2x) + 1}$.

Template Parameters
Ttype of value
Parameters
[in]xvalue
Returns
tanh transform of value

Definition at line 25 of file corr_constrain.hpp.

◆ corr_constrain() [2/2]

template<typename T >
T stan::math::corr_constrain ( const T &  x,
T &  lp 
)
inline

Return the result of transforming the specified scalar to have a valid correlation value between -1 and 1 (inclusive).

The transform used is as specified for corr_constrain(T). The log absolute Jacobian determinant is

$\log | \frac{d}{dx} \tanh x | = \log (1 - \tanh^2 x)$.

Template Parameters
TType of scalar.
Parameters
[in]xvalue
[in,out]lplog density accumulator

Definition at line 44 of file corr_constrain.hpp.

◆ corr_free()

template<typename T >
T stan::math::corr_free ( const T &  y)
inline

Return the unconstrained scalar that when transformed to a valid correlation produces the specified value.

This function inverts the transform defined for corr_constrain(T), which is the inverse hyperbolic tangent,

$ f^{-1}(y) = \mbox{atanh}\, y = \frac{1}{2} \log \frac{y + 1}{y - 1}$.

Template Parameters
TType of correlation
Parameters
[in]ycorrelation
Returns
free scalar that transforms to the specified input

Definition at line 28 of file corr_free.hpp.

◆ corr_matrix_constrain() [1/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::corr_matrix_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
typename math::index_type< Eigen::Matrix< T, Eigen::Dynamic, 1 > >::type  k 
)

Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values.

The input vector must be of length ${k \choose 2} = \frac{k(k-1)}{2}$. The values in the input vector represent unconstrained (partial) correlations among the dimensions.

The transform based on partial correlations is as specified in

  • Lewandowski, Daniel, Dorota Kurowicka, and Harry Joe. 2009. Generating random correlation matrices based on vines and extended onion method. Journal of Multivariate Analysis 100:1989–-2001.

The free vector entries are first constrained to be valid correlation values using corr_constrain(T).

Parameters
xVector of unconstrained partial correlations.
kDimensionality of returned correlation matrix.
Template Parameters
TType of scalar.
Exceptions
std::invalid_argumentif x is not a valid correlation matrix.

Definition at line 39 of file corr_matrix_constrain.hpp.

◆ corr_matrix_constrain() [2/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::corr_matrix_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
typename math::index_type< Eigen::Matrix< T, Eigen::Dynamic, 1 > >::type  k,
T &  lp 
)

Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values.

The input vector must be of length ${k \choose 2} = \frac{k(k-1)}{2}$. The values in the input vector represent unconstrained (partial) correlations among the dimensions.

The transform is as specified for corr_matrix_constrain(Matrix, size_t); the paper it cites also defines the Jacobians for correlation inputs, which are composed with the correlation constrained Jacobians defined in corr_constrain(T, double) for this function.

Parameters
xVector of unconstrained partial correlations.
kDimensionality of returned correlation matrix.
lpLog probability reference to increment.
Template Parameters
TType of scalar.

Definition at line 75 of file corr_matrix_constrain.hpp.

◆ corr_matrix_free()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::corr_matrix_free ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  y)

Return the vector of unconstrained partial correlations that define the specified correlation matrix when transformed.

The constraining transform is defined as for corr_matrix_constrain(Matrix, size_t). The inverse transform in this function is simpler in that it only needs to compute the $k \choose 2$ partial correlations and then free those.

Parameters
yThe correlation matrix to free.
Returns
Vector of unconstrained values that produce the specified correlation matrix when transformed.
Template Parameters
TType of scalar.
Exceptions
std::domain_errorif the correlation matrix has no elements or is not a square matrix.
std::runtime_errorif the correlation matrix cannot be factorized by factor_cov_matrix() or if the sds returned by factor_cov_matrix() on log scale are unconstrained.

Definition at line 37 of file corr_matrix_free.hpp.

◆ cos() [1/3]

template<typename T >
fvar<T> stan::math::cos ( const fvar< T > &  x)
inline

Definition at line 12 of file cos.hpp.

◆ cos() [2/3]

template<typename T >
apply_scalar_unary<cos_fun, T>::return_t stan::math::cos ( const T &  x)
inline

Vectorized version of cos().

Parameters
xContainer of angles in radians.
Template Parameters
TContainer type.
Returns
Cosine of each value in x.

Definition at line 31 of file cos.hpp.

◆ cos() [3/3]

var stan::math::cos ( const var a)
inline

Return the cosine of a radian-scaled variable (cmath).

The derivative is defined by

$\frac{d}{dx} \cos x = - \sin x$.

\[ \mbox{cos}(x) = \begin{cases} \cos(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{cos}(x)}{\partial x} = \begin{cases} -\sin(x) & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable for radians of angle.
Returns
Cosine of variable.

Definition at line 46 of file cos.hpp.

◆ cosh() [1/3]

template<typename T >
fvar<T> stan::math::cosh ( const fvar< T > &  x)
inline

Definition at line 12 of file cosh.hpp.

◆ cosh() [2/3]

template<typename T >
apply_scalar_unary<cosh_fun, T>::return_t stan::math::cosh ( const T &  x)
inline

Vectorized version of cosh().

Parameters
xAngle in radians.
Template Parameters
TVariable type.
Returns
Hyberbolic cosine of x.

Definition at line 31 of file cosh.hpp.

◆ cosh() [3/3]

var stan::math::cosh ( const var a)
inline

Return the hyperbolic cosine of the specified variable (cmath).

The derivative is defined by

$\frac{d}{dx} \cosh x = \sinh x$.

\[ \mbox{cosh}(x) = \begin{cases} \cosh(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{cosh}(x)}{\partial x} = \begin{cases} \sinh(x) & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable.
Returns
Hyperbolic cosine of variable.

Definition at line 46 of file cosh.hpp.

◆ cov_exp_quad() [1/6]

template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix<typename stan::return_type<T_x, T_sigma, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::cov_exp_quad ( const std::vector< T_x > &  x,
const T_sigma &  sigma,
const T_l &  length_scale 
)
inline
Deprecated:
use gp_exp_quad_cov

Definition at line 21 of file cov_exp_quad.hpp.

◆ cov_exp_quad() [2/6]

template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix<typename stan::return_type<T_x, T_sigma, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::cov_exp_quad ( const std::vector< T_x > &  x,
const T_sigma &  sigma,
const std::vector< T_l > &  length_scale 
)
inline
Deprecated:
use gp_exp_quad_cov

Definition at line 33 of file cov_exp_quad.hpp.

◆ cov_exp_quad() [3/6]

template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l >
Eigen::Matrix< typename stan::return_type<T_x1, T_x2, T_sigma, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::cov_exp_quad ( const std::vector< T_x1 > &  x1,
const std::vector< T_x2 > &  x2,
const T_sigma &  sigma,
const T_l &  length_scale 
)
inline
Deprecated:
use gp_exp_quad_cov

Definition at line 45 of file cov_exp_quad.hpp.

◆ cov_exp_quad() [4/6]

template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l >
Eigen::Matrix< typename stan::return_type<T_x1, T_x2, T_sigma, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::cov_exp_quad ( const std::vector< T_x1 > &  x1,
const std::vector< T_x2 > &  x2,
const T_sigma &  sigma,
const std::vector< T_l > &  length_scale 
)
inline
Deprecated:
use gp_exp_quad_cov

Definition at line 57 of file cov_exp_quad.hpp.

◆ cov_exp_quad() [5/6]

template<typename T_x >
std::enable_if< std::is_same<typename scalar_type<T_x>::type, double>::value, Eigen::Matrix<var, -1, -1> >::type stan::math::cov_exp_quad ( const std::vector< T_x > &  x,
const var sigma,
const var l 
)
inline
Deprecated:
use gp_exp_quad_cov_vari

Definition at line 154 of file cov_exp_quad.hpp.

◆ cov_exp_quad() [6/6]

template<typename T_x >
std::enable_if< std::is_same<typename scalar_type<T_x>::type, double>::value, Eigen::Matrix<var, -1, -1> >::type stan::math::cov_exp_quad ( const std::vector< T_x > &  x,
double  sigma,
const var l 
)
inline
Deprecated:
use gp_exp_quad_cov_vari

Definition at line 165 of file cov_exp_quad.hpp.

◆ cov_matrix_constrain() [1/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::cov_matrix_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
typename math::index_type< Eigen::Matrix< T, Eigen::Dynamic, 1 > >::type  K 
)

Return the symmetric, positive-definite matrix of dimensions K by K resulting from transforming the specified finite vector of size K plus (K choose 2).

See cov_matrix_free() for the inverse transform.

Parameters
xThe vector to convert to a covariance matrix.
KThe number of rows and columns of the resulting covariance matrix.
Exceptions
std::invalid_argumentif (x.size() != K + (K choose 2)).

Definition at line 28 of file cov_matrix_constrain.hpp.

◆ cov_matrix_constrain() [2/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::cov_matrix_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
typename math::index_type< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > >::type  K,
T &  lp 
)

Return the symmetric, positive-definite matrix of dimensions K by K resulting from transforming the specified finite vector of size K plus (K choose 2).

See cov_matrix_free() for the inverse transform.

Parameters
xThe vector to convert to a covariance matrix.
KThe dimensions of the resulting covariance matrix.
lpReference
Exceptions
std::domain_errorif (x.size() != K + (K choose 2)).

Definition at line 63 of file cov_matrix_constrain.hpp.

◆ cov_matrix_constrain_lkj() [1/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::cov_matrix_constrain_lkj ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
size_t  k 
)

Return the covariance matrix of the specified dimensionality derived from constraining the specified vector of unconstrained values.

The input vector must be of length $k \choose 2 + k$. The first $k \choose 2$ values in the input represent unconstrained (partial) correlations and the last $k$ are unconstrained standard deviations of the dimensions.

The transform scales the correlation matrix transform defined in corr_matrix_constrain(Matrix, size_t) with the constrained deviations.

Parameters
xInput vector of unconstrained partial correlations and standard deviations.
kDimensionality of returned covariance matrix.
Returns
Covariance matrix derived from the unconstrained partial correlations and deviations.
Template Parameters
TType of scalar.

Definition at line 32 of file cov_matrix_constrain_lkj.hpp.

◆ cov_matrix_constrain_lkj() [2/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::cov_matrix_constrain_lkj ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
size_t  k,
T &  lp 
)

Return the covariance matrix of the specified dimensionality derived from constraining the specified vector of unconstrained values and increment the specified log probability reference with the log absolute Jacobian determinant.

The transform is defined as for cov_matrix_constrain(Matrix, size_t).

The log absolute Jacobian determinant is derived by composing the log absolute Jacobian determinant for the underlying correlation matrix as defined in cov_matrix_constrain(Matrix, size_t, T&) with the Jacobian of the transfrom of the correlation matrix into a covariance matrix by scaling by standard deviations.

Parameters
xInput vector of unconstrained partial correlations and standard deviations.
kDimensionality of returned covariance matrix.
lpLog probability reference to increment.
Returns
Covariance matrix derived from the unconstrained partial correlations and deviations.
Template Parameters
TType of scalar.

Definition at line 70 of file cov_matrix_constrain_lkj.hpp.

◆ cov_matrix_free()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::cov_matrix_free ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  y)

The covariance matrix derived from the symmetric view of the lower-triangular view of the K by K specified matrix is freed to return a vector of size K + (K choose 2).

This is the inverse of the cov_matrix_constrain() function so that for any finite vector x of size K

  • (K choose 2),

x == cov_matrix_free(cov_matrix_constrain(x, K)).

In order for this round-trip to work (and really for this function to work), the symmetric view of its lower-triangular view must be positive definite.

Parameters
yMatrix of dimensions K by K such that he symmetric view of the lower-triangular view is positive definite.
Returns
Vector of size K plus (K choose 2) in (-inf, inf) that produces
Exceptions
std::domain_errorif y is not square, has zero dimensionality, or has a non-positive diagonal element.

Definition at line 37 of file cov_matrix_free.hpp.

◆ cov_matrix_free_lkj()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::cov_matrix_free_lkj ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  y)

Return the vector of unconstrained partial correlations and deviations that transform to the specified covariance matrix.

The constraining transform is defined as for cov_matrix_constrain(Matrix, size_t). The inverse first factors out the deviations, then applies the freeing transfrom of corr_matrix_free(Matrix&).

Parameters
yCovariance matrix to free.
Returns
Vector of unconstrained values that transforms to the specified covariance matrix.
Template Parameters
TType of scalar.
Exceptions
std::domain_errorif the correlation matrix has no elements or is not a square matrix.
std::runtime_errorif the correlation matrix cannot be factorized by factor_cov_matrix()

Definition at line 32 of file cov_matrix_free_lkj.hpp.

◆ crossprod() [1/3]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, C, C> stan::math::crossprod ( const Eigen::Matrix< fvar< T >, R, C > &  m)
inline

Definition at line 12 of file crossprod.hpp.

◆ crossprod() [2/3]

matrix_d stan::math::crossprod ( const matrix_d M)
inline

Returns the result of pre-multiplying a matrix by its own transpose.

Parameters
MMatrix to multiply.
Returns
Transpose of M times M

Definition at line 16 of file crossprod.hpp.

◆ crossprod() [3/3]

matrix_v stan::math::crossprod ( const matrix_v M)
inline

Returns the result of pre-multiplying a matrix by its own transpose.

Parameters
MMatrix to multiply.
Returns
Transpose of M times M

Definition at line 17 of file crossprod.hpp.

◆ csr_matrix_times_vector()

template<typename T1 , typename T2 >
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, Eigen::Dynamic, 1> stan::math::csr_matrix_times_vector ( int  m,
int  n,
const Eigen::Matrix< T1, Eigen::Dynamic, 1 > &  w,
const std::vector< int > &  v,
const std::vector< int > &  u,
const Eigen::Matrix< T2, Eigen::Dynamic, 1 > &  b 
)
inline

Definition at line 78 of file csr_matrix_times_vector.hpp.

◆ cumulative_sum() [1/2]

template<typename T >
std::vector<T> stan::math::cumulative_sum ( const std::vector< T > &  x)
inline

Return the cumulative sum of the specified vector.

The cumulative sum of a vector of values

is the
@code x[0], x[1] + x[2], ..., x[1] + , ..., + x[x.size()-1]
Template Parameters
TScalar type of vector.
Parameters
xVector of values.
Returns
Cumulative sum of values.

Definition at line 24 of file cumulative_sum.hpp.

◆ cumulative_sum() [2/2]

template<typename T , int R, int C>
Eigen::Matrix<T, R, C> stan::math::cumulative_sum ( const Eigen::Matrix< T, R, C > &  m)
inline

Return the cumulative sum of the specified matrix.

The cumulative sum is of the same type as the input and has values defined by

x(0), x(1) + x(2), ..., x(1) + , ..., + x(x.size()-1)
Template Parameters
TScalar type of matrix.
RRow type of matrix.
CColumn type of matrix.
Parameters
mMatrix of values.
Returns
Cumulative sum of values.

Definition at line 47 of file cumulative_sum.hpp.

◆ cvodes_check_flag()

void stan::math::cvodes_check_flag ( int  flag,
const char *  func_name 
)
inline

Definition at line 19 of file cvodes_utils.hpp.

◆ cvodes_set_options()

void stan::math::cvodes_set_options ( void *  cvodes_mem,
double  rel_tol,
double  abs_tol,
long int  max_num_steps 
)
inline

Definition at line 27 of file cvodes_utils.hpp.

◆ cvodes_silent_err_handler()

void stan::math::cvodes_silent_err_handler ( int  error_code,
const char *  module,
const char *  function,
char *  msg,
void *  eh_data 
)
inline

Definition at line 14 of file cvodes_utils.hpp.

◆ derivative()

template<typename T , typename F >
void stan::math::derivative ( const F &  f,
const T &  x,
T &  fx,
T &  dfx_dx 
)

Return the derivative of the specified univariate function at the specified argument.

Template Parameters
TArgument type
FFunction type
Parameters
[in]fFunction
[in]xArgument
[out]fxValue of function applied to argument
[out]dfx_dxValue of derivative

Definition at line 24 of file derivative.hpp.

◆ determinant() [1/3]

template<typename T , int R, int C>
fvar<T> stan::math::determinant ( const Eigen::Matrix< fvar< T >, R, C > &  m)
inline

Definition at line 12 of file determinant.hpp.

◆ determinant() [2/3]

template<typename T , int R, int C>
T stan::math::determinant ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the determinant of the specified square matrix.

Parameters
mSpecified matrix.
Returns
Determinant of the matrix.
Exceptions
std::domain_errorif matrix is not square.

Definition at line 18 of file determinant.hpp.

◆ determinant() [3/3]

template<int R, int C>
var stan::math::determinant ( const Eigen::Matrix< var, R, C > &  m)
inline

Definition at line 48 of file determinant.hpp.

◆ diag_matrix()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::diag_matrix ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  v)
inline

Return a square diagonal matrix with the specified vector of coefficients as the diagonal values.

Parameters
[in]vSpecified vector.
Returns
Diagonal matrix with vector as diagonal values.

Definition at line 16 of file diag_matrix.hpp.

◆ diag_post_multiply()

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C1> stan::math::diag_post_multiply ( const Eigen::Matrix< T1, R1, C1 > &  m1,
const Eigen::Matrix< T2, R2, C2 > &  m2 
)

Definition at line 14 of file diag_post_multiply.hpp.

◆ diag_pre_multiply()

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R2, C2> stan::math::diag_pre_multiply ( const Eigen::Matrix< T1, R1, C1 > &  m1,
const Eigen::Matrix< T2, R2, C2 > &  m2 
)

Definition at line 14 of file diag_pre_multiply.hpp.

◆ diagonal()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::diagonal ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)
inline

Return a column vector of the diagonal elements of the specified matrix.

The matrix is not required to be square.

Parameters
mSpecified matrix.
Returns
Diagonal of the matrix.

Definition at line 16 of file diagonal.hpp.

◆ diagonal_multiply()

matrix_cl stan::math::diagonal_multiply ( const matrix_cl A,
const double  scalar 
)
inline

Multiplies the diagonal of a matrix on the OpenCL device with the specified scalar.

Parameters
Ainput matrix
scalarscalar
Returns
copy of the input matrix with the diagonal multiplied by scalar

Definition at line 19 of file diagonal_multiply.hpp.

◆ digamma() [1/4]

var stan::math::digamma ( const var a)
inline

Definition at line 20 of file digamma.hpp.

◆ digamma() [2/4]

template<typename T >
fvar<T> stan::math::digamma ( const fvar< T > &  x)
inline

Return the derivative of the log gamma function at the specified argument.

Template Parameters
Tscalar type of autodiff variable
Parameters
[in]xargument
Returns
derivative of the log gamma function at the specified argument

Definition at line 23 of file digamma.hpp.

◆ digamma() [3/4]

template<typename T >
apply_scalar_unary<digamma_fun, T>::return_t stan::math::digamma ( const T &  x)
inline

Vectorized version of digamma().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Digamma function applied to each value in x.
Exceptions
std::domain_errorif any value is a negative integer or 0

Definition at line 33 of file digamma.hpp.

◆ digamma() [4/4]

double stan::math::digamma ( double  x)
inline

Return the derivative of the log gamma function at the specified value.

\[ \mbox{digamma}(x) = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \Psi(x) & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{digamma}(x)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \frac{\partial\, \Psi(x)}{\partial x} & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \Psi(x)=\frac{\Gamma'(x)}{\Gamma(x)} \]

\[ \frac{\partial \, \Psi(x)}{\partial x} = \frac{\Gamma''(x)\Gamma(x)-(\Gamma'(x))^2}{\Gamma^2(x)} \]

The design follows the standard C++ library in returning NaN rather than throwing exceptions.

Parameters
[in]xargument
Returns
derivative of log gamma function at argument

Definition at line 46 of file digamma.hpp.

◆ dims() [1/4]

template<typename T >
void stan::math::dims ( const T &  x,
std::vector< int > &  result 
)
inline

Definition at line 11 of file dims.hpp.

◆ dims() [2/4]

template<typename T , int R, int C>
void stan::math::dims ( const Eigen::Matrix< T, R, C > &  x,
std::vector< int > &  result 
)
inline

Definition at line 15 of file dims.hpp.

◆ dims() [3/4]

template<typename T >
void stan::math::dims ( const std::vector< T > &  x,
std::vector< int > &  result 
)
inline

Definition at line 20 of file dims.hpp.

◆ dims() [4/4]

template<typename T >
std::vector<int> stan::math::dims ( const T &  x)
inline

Definition at line 27 of file dims.hpp.

◆ dirichlet_log() [1/2]

template<bool propto, typename T_prob , typename T_prior_size >
return_type<T_prob, T_prior_size>::type stan::math::dirichlet_log ( const T_prob &  theta,
const T_prior_size &  alpha 
)

The log of the Dirichlet density for the given theta and a vector of prior sample sizes, alpha.

Each element of alpha must be greater than 0. Each element of theta must be greater than or 0. Theta sums to 1.

Deprecated:
use dirichlet_lpmf
Parameters
thetaA scalar vector.
alphaPrior sample sizes.
Returns
The log of the Dirichlet density.
Exceptions
std::domain_errorif any element of alpha is less than or equal to 0.
std::domain_errorif any element of theta is less than 0.
std::domain_errorif the sum of theta is not 1.
Template Parameters
T_probType of scalar.
T_prior_sizeType of prior sample sizes.

Definition at line 32 of file dirichlet_log.hpp.

◆ dirichlet_log() [2/2]

template<typename T_prob , typename T_prior_size >
return_type<T_prob, T_prior_size>::type stan::math::dirichlet_log ( const T_prob &  theta,
const T_prior_size &  alpha 
)
Deprecated:
use dirichlet_lpmf

Definition at line 41 of file dirichlet_log.hpp.

◆ dirichlet_lpmf() [1/2]

template<bool propto, typename T_prob , typename T_prior_size >
return_type<T_prob, T_prior_size>::type stan::math::dirichlet_lpmf ( const T_prob &  theta,
const T_prior_size &  alpha 
)

The log of the Dirichlet density for the given theta and a vector of prior sample sizes, alpha.

Each element of alpha must be greater than 0. Each element of theta must be greater than or 0. Theta sums to 1.

\[ \theta\sim\mbox{Dirichlet}(\alpha_1,\ldots,\alpha_k)\\ \log(p(\theta\,|\,\alpha_1,\ldots,\alpha_k))=\log\left(\frac{\Gamma(\alpha_1+\cdots+\alpha_k)}{\Gamma(\alpha_1)+\cdots+\Gamma(\alpha_k)}* \left(\theta_1^{\alpha_1-1}+\cdots+\theta_k^{\alpha_k-1}\right)\right)\\ =\log(\Gamma(\alpha_1+\cdots+\alpha_k))-\left(\log(\Gamma(\alpha_1))+\cdots+\log(\Gamma(\alpha_k))\right)+(\alpha_1-1)\log(\theta_1)+\cdots+(\alpha_k-1)\log(\theta_k) \]

\[ \frac{\partial }{\partial \theta_x}\log(p(\theta\,|\,\alpha_1,\ldots,\alpha_k))=\frac{\alpha_x-1}{\theta_x} \]

\[ \frac{\partial}{\partial\alpha_x}\log(p(\theta\,|\,\alpha_1,\ldots,\alpha_k))=\psi_{(0)}(\sum\alpha)-\psi_{(0)}(\alpha_x)+\log\theta_x \]

Parameters
thetaA scalar vector.
alphaPrior sample sizes.
Returns
The log of the Dirichlet density.
Exceptions
std::domain_errorif any element of alpha is less than or equal to 0.
std::domain_errorif any element of theta is less than 0.
std::domain_errorif the sum of theta is not 1.
Template Parameters
T_probType of scalar.
T_prior_sizeType of prior sample sizes.

Definition at line 49 of file dirichlet_lpmf.hpp.

◆ dirichlet_lpmf() [2/2]

template<typename T_prob , typename T_prior_size >
return_type<T_prob, T_prior_size>::type stan::math::dirichlet_lpmf ( const T_prob &  theta,
const T_prior_size &  alpha 
)

Definition at line 93 of file dirichlet_lpmf.hpp.

◆ dirichlet_rng()

template<class RNG >
Eigen::VectorXd stan::math::dirichlet_rng ( const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  alpha,
RNG &  rng 
)
inline

Return a draw from a Dirichlet distribution with specified parameters and pseudo-random number generator.

For prior counts greater than zero, the usual algorithm that draws gamma variates and normalizes is used.

For prior counts less than zero (i.e., parameters with value less than one), a log-scale version of the following algorithm is used to deal with underflow:

G. Marsaglia and W. Tsang. A simple method for generating gamma variables. ACM Transactions on Mathematical Software. 26(3):363–372, 2000.

Template Parameters
RNGType of pseudo-random number generator.
Parameters
alphaPrior count (plus 1) parameter for Dirichlet.
rngPseudo-random number generator.

Definition at line 37 of file dirichlet_rng.hpp.

◆ distance() [1/2]

template<typename T1 , typename T2 >
return_type<T1, T2>::type stan::math::distance ( const T1 &  x1,
const T2 &  x2 
)
inline

Returns the distance between two scalars.

Parameters
x1First scalar.
x2Second scalar.
Returns
Distance between two scalars
Exceptions
std::domain_errorIf the arguments are not finite.

Definition at line 20 of file distance.hpp.

◆ distance() [2/2]

template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
boost::math::tools::promote_args<T1, T2>::type stan::math::distance ( const Eigen::Matrix< T1, R1, C1 > &  v1,
const Eigen::Matrix< T2, R2, C2 > &  v2 
)
inline

Returns the distance between the specified vectors.

Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 23 of file distance.hpp.

◆ divide() [1/7]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, C> stan::math::divide ( const Eigen::Matrix< fvar< T >, R, C > &  v,
const fvar< T > &  c 
)
inline

Definition at line 11 of file divide.hpp.

◆ divide() [2/7]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<var, R, C> stan::math::divide ( const Eigen::Matrix< T1, R, C > &  v,
const T2 &  c 
)
inline

Return the division of the specified column vector by the specified scalar.

Parameters
[in]vSpecified vector.
[in]cSpecified scalar.
Returns
Vector divided by the scalar.

Definition at line 20 of file divide.hpp.

◆ divide() [3/7]

template<typename T1 , typename T2 >
stan::return_type<T1, T2>::type stan::math::divide ( const T1 &  x,
const T2 &  y 
)
inline

Return the division of the first scalar by the second scalar.

Parameters
[in]xSpecified vector.
[in]ySpecified scalar.
Returns
Vector divided by the scalar.

Definition at line 20 of file divide.hpp.

◆ divide() [4/7]

template<int R, int C, typename T >
std::enable_if<std::is_arithmetic<T>::value, Eigen::Matrix<double, R, C> >::type stan::math::divide ( const Eigen::Matrix< double, R, C > &  m,
c 
)
inline

Return specified matrix divided by specified scalar.

Template Parameters
RRow type for matrix.
CColumn type for matrix.
Parameters
mMatrix.
cScalar.
Returns
Matrix divided by scalar.

Definition at line 21 of file divide.hpp.

◆ divide() [5/7]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, C> stan::math::divide ( const Eigen::Matrix< fvar< T >, R, C > &  v,
double  c 
)
inline

Definition at line 22 of file divide.hpp.

◆ divide() [6/7]

int stan::math::divide ( int  x,
int  y 
)
inline

Definition at line 25 of file divide.hpp.

◆ divide() [7/7]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, C> stan::math::divide ( const Eigen::Matrix< double, R, C > &  v,
const fvar< T > &  c 
)
inline

Definition at line 33 of file divide.hpp.

◆ divide_columns()

template<typename T_x , typename T_v >
std::vector<Eigen::Matrix< typename return_type<T_x, T_v, double>::type, Eigen::Dynamic, 1> > stan::math::divide_columns ( const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 >> &  x,
const std::vector< T_v > &  vec 
)
inline

Takes Stan data type vector[n] x[D] and divides column vector in x element-wise by the values in vec.

Template Parameters
T_xType of dividend
T_vScalar type of divisor
RRow type of Eigen Matrices
CColumn type of Eigen Matrices
Parameters
xstd::vector of matrices
vecstd::vector of divisors
Exceptions
std::invalidargument if D != length of vector

Definition at line 28 of file divide_columns.hpp.

◆ do_lkj_constant()

template<typename T_shape >
boost::math::tools::promote_args<double, T_shape>::type stan::math::do_lkj_constant ( const T_shape &  eta,
const unsigned int &  K 
)

Definition at line 15 of file lkj_corr_lpdf.hpp.

◆ domain_error() [1/2]

template<typename T >
void stan::math::domain_error ( const char *  function,
const char *  name,
const T &  y,
const char *  msg1,
const char *  msg2 
)
inline

Throw a domain error with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing domain errors. This will allow us to change the behavior for all functions at once. The message is: "<function>: <name> <msg1><y><msg2>"

Template Parameters
TType of variable.
Parameters
[in]functionName of the function.
[in]nameName of the variable.
[in]yVariable.
[in]msg1Message to print before the variable.
[in]msg2Message to print after the variable.
Exceptions
std::domain_errorAlways.

Definition at line 27 of file domain_error.hpp.

◆ domain_error() [2/2]

template<typename T >
void stan::math::domain_error ( const char *  function,
const char *  name,
const T &  y,
const char *  msg1 
)
inline

Throw a domain error with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing domain errors. This will allow us to change the behavior for all functions at once. The message is: * "<function>: <name> <msg1><y>"

Template Parameters
TType of variable.
Parameters
[in]functionName of the function.
[in]nameName of the variable.
[in]yVariable.
[in]msg1Message to print before the variable.
Exceptions
std::domain_errorAlways.

Definition at line 50 of file domain_error.hpp.

◆ domain_error_vec() [1/2]

template<typename T >
void stan::math::domain_error_vec ( const char *  function,
const char *  name,
const T &  y,
size_t  i,
const char *  msg1,
const char *  msg2 
)
inline

Throw a domain error with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing domain errors. This will allow us to change the behavior for all functions at once. (We've already changed behavior mulitple times up to Stan v2.5.0.) The message is: "<function>: <name>[<i+error_index>] <msg1><y>" where error_index is the value of stan::error_index::value which indicates whether the message should be 0 or 1 indexed.

Template Parameters
TType of variable
Parameters
functionName of the function
nameName of the variable
yVariable
iIndex
msg1Message to print before the variable
msg2Message to print after the variable
Exceptions
std::domain_error

Definition at line 31 of file domain_error_vec.hpp.

◆ domain_error_vec() [2/2]

template<typename T >
void stan::math::domain_error_vec ( const char *  function,
const char *  name,
const T &  y,
size_t  i,
const char *  msg 
)
inline

Throw a domain error with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing domain errors. This will allow us to change the behavior for all functions at once. (We've already changed behavior mulitple times up to Stan v2.5.0.) The message is: "<function>: <name>[<i+error_index>] <msg1><y>" where error_index is the value of stan::error_index::value which indicates whether the message should be 0 or 1 indexed.

Template Parameters
TType of variable
Parameters
functionName of the function
nameName of the variable
yVariable
iIndex
msgMessage to print before the variable
Exceptions
std::domain_error

Definition at line 57 of file domain_error_vec.hpp.

◆ dot()

double stan::math::dot ( const std::vector< double > &  x,
const std::vector< double > &  y 
)
inline

Definition at line 11 of file dot.hpp.

◆ dot_product() [1/18]

template<typename T , int R1, int C1, int R2, int C2>
fvar<T> stan::math::dot_product ( const Eigen::Matrix< fvar< T >, R1, C1 > &  v1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  v2 
)
inline

Definition at line 14 of file dot_product.hpp.

◆ dot_product() [2/18]

template<int R1, int C1, int R2, int C2>
double stan::math::dot_product ( const Eigen::Matrix< double, R1, C1 > &  v1,
const Eigen::Matrix< double, R2, C2 > &  v2 
)
inline

Returns the dot product of the specified vectors.

Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 21 of file dot_product.hpp.

◆ dot_product() [3/18]

template<typename T , int R1, int C1, int R2, int C2>
fvar<T> stan::math::dot_product ( const Eigen::Matrix< fvar< T >, R1, C1 > &  v1,
const Eigen::Matrix< double, R2, C2 > &  v2 
)
inline

Definition at line 27 of file dot_product.hpp.

◆ dot_product() [4/18]

double stan::math::dot_product ( const double *  v1,
const double *  v2,
size_t  length 
)
inline

Returns the dot product of the specified arrays of doubles.

Parameters
v1First array.
v2Second array.
lengthLength of both arrays.

Definition at line 34 of file dot_product.hpp.

◆ dot_product() [5/18]

template<typename T , int R1, int C1, int R2, int C2>
fvar<T> stan::math::dot_product ( const Eigen::Matrix< double, R1, C1 > &  v1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  v2 
)
inline

Definition at line 40 of file dot_product.hpp.

◆ dot_product() [6/18]

double stan::math::dot_product ( const std::vector< double > &  v1,
const std::vector< double > &  v2 
)
inline

Returns the dot product of the specified arrays of doubles.

Parameters
v1First array.
v2Second array.
Exceptions
std::domain_errorif the vectors are not the same size.

Definition at line 46 of file dot_product.hpp.

◆ dot_product() [7/18]

template<typename T , int R1, int C1, int R2, int C2>
fvar<T> stan::math::dot_product ( const Eigen::Matrix< fvar< T >, R1, C1 > &  v1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  v2,
size_type length 
)
inline

Definition at line 53 of file dot_product.hpp.

◆ dot_product() [8/18]

template<typename T , int R1, int C1, int R2, int C2>
fvar<T> stan::math::dot_product ( const Eigen::Matrix< fvar< T >, R1, C1 > &  v1,
const Eigen::Matrix< double, R2, C2 > &  v2,
size_type length 
)
inline

Definition at line 66 of file dot_product.hpp.

◆ dot_product() [9/18]

template<typename T , int R1, int C1, int R2, int C2>
fvar<T> stan::math::dot_product ( const Eigen::Matrix< double, R1, C1 > &  v1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  v2,
size_type length 
)
inline

Definition at line 79 of file dot_product.hpp.

◆ dot_product() [10/18]

template<typename T >
fvar<T> stan::math::dot_product ( const std::vector< fvar< T > > &  v1,
const std::vector< fvar< T > > &  v2 
)
inline

Definition at line 92 of file dot_product.hpp.

◆ dot_product() [11/18]

template<typename T >
fvar<T> stan::math::dot_product ( const std::vector< double > &  v1,
const std::vector< fvar< T > > &  v2 
)
inline

Definition at line 102 of file dot_product.hpp.

◆ dot_product() [12/18]

template<typename T >
fvar<T> stan::math::dot_product ( const std::vector< fvar< T > > &  v1,
const std::vector< double > &  v2 
)
inline

Definition at line 112 of file dot_product.hpp.

◆ dot_product() [13/18]

template<typename T >
fvar<T> stan::math::dot_product ( const std::vector< fvar< T > > &  v1,
const std::vector< fvar< T > > &  v2,
size_type length 
)
inline

Definition at line 122 of file dot_product.hpp.

◆ dot_product() [14/18]

template<typename T >
fvar<T> stan::math::dot_product ( const std::vector< double > &  v1,
const std::vector< fvar< T > > &  v2,
size_type length 
)
inline

Definition at line 131 of file dot_product.hpp.

◆ dot_product() [15/18]

template<typename T >
fvar<T> stan::math::dot_product ( const std::vector< fvar< T > > &  v1,
const std::vector< double > &  v2,
size_type length 
)
inline

Definition at line 140 of file dot_product.hpp.

◆ dot_product() [16/18]

template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
std::enable_if< std::is_same<T1, var>::value || std::is_same<T2, var>::value, var>::type stan::math::dot_product ( const Eigen::Matrix< T1, R1, C1 > &  v1,
const Eigen::Matrix< T2, R2, C2 > &  v2 
)
inline

Returns the dot product.

Parameters
[in]v1First column vector.
[in]v2Second column vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorif length of v1 is not equal to length of v2.

Definition at line 199 of file dot_product.hpp.

◆ dot_product() [17/18]

template<typename T1 , typename T2 >
std::enable_if< std::is_same<T1, var>::value || std::is_same<T2, var>::value, var>::type stan::math::dot_product ( const T1 *  v1,
const T2 *  v2,
size_t  length 
)
inline

Returns the dot product.

Parameters
[in]v1First array.
[in]v2Second array.
[in]lengthLength of both arrays.
Returns
Dot product of the arrays.

Definition at line 217 of file dot_product.hpp.

◆ dot_product() [18/18]

template<typename T1 , typename T2 >
std::enable_if< std::is_same<T1, var>::value || std::is_same<T2, var>::value, var>::type stan::math::dot_product ( const std::vector< T1 > &  v1,
const std::vector< T2 > &  v2 
)
inline

Returns the dot product.

Parameters
[in]v1First vector.
[in]v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorif sizes of v1 and v2 do not match.

Definition at line 232 of file dot_product.hpp.

◆ dot_self() [1/4]

double stan::math::dot_self ( const std::vector< double > &  x)
inline

Definition at line 11 of file dot_self.hpp.

◆ dot_self() [2/4]

template<typename T , int R, int C>
fvar<T> stan::math::dot_self ( const Eigen::Matrix< fvar< T >, R, C > &  v)
inline

Definition at line 13 of file dot_self.hpp.

◆ dot_self() [3/4]

template<int R, int C>
double stan::math::dot_self ( const Eigen::Matrix< double, R, C > &  v)
inline

Returns the dot product of the specified vector with itself.

Parameters
vVector.
Template Parameters
Rnumber of rows or Eigen::Dynamic for dynamic
Cnumber of rows or Eigen::Dyanmic for dynamic
Exceptions
std::domain_errorIf v is not vector dimensioned.

Definition at line 18 of file dot_self.hpp.

◆ dot_self() [4/4]

template<int R, int C>
var stan::math::dot_self ( const Eigen::Matrix< var, R, C > &  v)
inline

Returns the dot product of a vector with itself.

Parameters
[in]vVector.
Returns
Dot product of the vector with itself.
Template Parameters
Rnumber of rows or Eigen::Dynamic for dynamic; one of R or C must be 1
Cnumber of rows or Eigen::Dyanmic for dynamic; one of R or C must be 1

Definition at line 76 of file dot_self.hpp.

◆ double_exponential_ccdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::double_exponential_ccdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use double_exponential_lccdf

Definition at line 14 of file double_exponential_ccdf_log.hpp.

◆ double_exponential_cdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::double_exponential_cdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Returns the double exponential cumulative density function.

Given containers of matching sizes, returns the product of probabilities.

Template Parameters
T_ytype of real parameter.
T_loctype of location parameter.
T_scaletype of scale parameter.
Parameters
yreal parameter
mulocation parameter
sigmascale parameter
Returns
probability or product of probabilities
Exceptions
std::domain_errorif y is nan, mu is infinite, or sigma is nonpositive

Definition at line 30 of file double_exponential_cdf.hpp.

◆ double_exponential_cdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::double_exponential_cdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use double_exponential_lcdf

Definition at line 14 of file double_exponential_cdf_log.hpp.

◆ double_exponential_lccdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::double_exponential_lccdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Returns the double exponential log complementary cumulative density function.

Given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ytype of real parameter.
T_loctype of location parameter.
T_scaletype of scale parameter.
Parameters
yreal parameter
mulocation parameter
sigmascale parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif y is nan, mu is infinite, or sigma is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 33 of file double_exponential_lccdf.hpp.

◆ double_exponential_lcdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::double_exponential_lcdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Returns the double exponential log cumulative density function.

Given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ytype of real parameter.
T_loctype of location parameter.
T_scaletype of scale parameter.
Parameters
yreal parameter
mulocation parameter
sigmascale parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif y is nan, mu is infinite, or sigma is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 32 of file double_exponential_lcdf.hpp.

◆ double_exponential_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::double_exponential_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use double_exponential_lpdf

Definition at line 14 of file double_exponential_log.hpp.

◆ double_exponential_log() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::double_exponential_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use double_exponential_lpdf

Definition at line 23 of file double_exponential_log.hpp.

◆ double_exponential_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::double_exponential_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Returns the double exponential log probability density function.

Given containers of matching sizes, returns the log sum of densities.

Template Parameters
T_ytype of real parameter.
T_loctype of location parameter.
T_scaletype of scale parameter.
Parameters
yreal parameter
mulocation parameter
sigmascale parameter
Returns
log probability density or log sum of probability densities
Exceptions
std::domain_errorif y is nan, mu is infinite, or sigma is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 32 of file double_exponential_lpdf.hpp.

◆ double_exponential_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::double_exponential_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 109 of file double_exponential_lpdf.hpp.

◆ double_exponential_rng()

template<typename T_loc , typename T_scale , class RNG >
VectorBuilder<true, double, T_loc, T_scale>::type stan::math::double_exponential_rng ( const T_loc &  mu,
const T_scale &  sigma,
RNG &  rng 
)
inline

Return a double exponential random variate with the given location and scale using the specified random number generator.

mu and sigma can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_locType of location parameter
T_scaleType of scale parameter
RNGclass of random number generator
Parameters
mu(Sequence of) location parameter(s)
sigma(Sequence of) scale parameter(s)
rngrandom number generator
Returns
(Sequence of) double exponential random variate(s)
Exceptions
std::domain_errorif mu is infinite or sigma is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 35 of file double_exponential_rng.hpp.

◆ e()

double stan::math::e ( )
inline

Return the base of the natural logarithm.

Returns
Base of natural logarithm.

Definition at line 87 of file constants.hpp.

◆ eigenvalues_sym()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::eigenvalues_sym ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)

Return the eigenvalues of the specified symmetric matrix in descending order of magnitude.

This function is more efficient than the general eigenvalues function for symmetric matrices.

See eigen_decompose() for more information.

Parameters
mSpecified matrix.
Returns
Eigenvalues of matrix.

Definition at line 21 of file eigenvalues_sym.hpp.

◆ eigenvectors_sym()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::eigenvectors_sym ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)

Definition at line 12 of file eigenvectors_sym.hpp.

◆ elt_divide() [1/3]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C> stan::math::elt_divide ( const Eigen::Matrix< T1, R, C > &  m1,
const Eigen::Matrix< T2, R, C > &  m2 
)

Return the elementwise division of the specified matrices.

Template Parameters
T1Type of scalars in first matrix.
T2Type of scalars in second matrix.
RRow type of both matrices.
CColumn type of both matrices.
Parameters
m1First matrix
m2Second matrix
Returns
Elementwise division of matrices.

Definition at line 24 of file elt_divide.hpp.

◆ elt_divide() [2/3]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C> stan::math::elt_divide ( const Eigen::Matrix< T1, R, C > &  m,
T2  s 
)

Return the elementwise division of the specified matrix by the specified scalar.

Template Parameters
T1Type of scalars in the matrix.
T2Type of the scalar.
RRow type of the matrix.
CColumn type of the matrix.
Parameters
mmatrix
sscalar
Returns
Elementwise division of a scalar by matrix.

Definition at line 45 of file elt_divide.hpp.

◆ elt_divide() [3/3]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C> stan::math::elt_divide ( T1  s,
const Eigen::Matrix< T2, R, C > &  m 
)

Return the elementwise division of the specified scalar by the specified matrix.

Template Parameters
T1Type of the scalar.
T2Type of scalars in the matrix.
RRow type of the matrix.
CColumn type of the matrix.
Parameters
sscalar
mmatrix
Returns
Elementwise division of a scalar by matrix.

Definition at line 63 of file elt_divide.hpp.

◆ elt_multiply()

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C> stan::math::elt_multiply ( const Eigen::Matrix< T1, R, C > &  m1,
const Eigen::Matrix< T2, R, C > &  m2 
)

Return the elementwise multiplication of the specified matrices.

Template Parameters
T1Type of scalars in first matrix.
T2Type of scalars in second matrix.
RRow type of both matrices.
CColumn type of both matrices.
Parameters
m1First matrix
m2Second matrix
Returns
Elementwise product of matrices.

Definition at line 25 of file elt_multiply.hpp.

◆ empty_nested()

static bool stan::math::empty_nested ( )
inlinestatic

Return true if there is no nested autodiff being executed.

Definition at line 12 of file empty_nested.hpp.

◆ erf() [1/5]

template<typename T >
fvar<T> stan::math::erf ( const fvar< T > &  x)
inline

Definition at line 15 of file erf.hpp.

◆ erf() [2/5]

double stan::math::erf ( double  x)
inline

Return the error function of the specified value.

\[ \mbox{erf}(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} dt \]

Parameters
[in]xArgument.
Returns
Error function of the argument.

Definition at line 20 of file erf.hpp.

◆ erf() [3/5]

double stan::math::erf ( int  x)
inline

Return the error function of the specified argument.

This version is required to disambiguate erf(int).

Parameters
[in]xArgument.
Returns
Error function of the argument.

Definition at line 29 of file erf.hpp.

◆ erf() [4/5]

template<typename T >
apply_scalar_unary<erf_fun, T>::return_t stan::math::erf ( const T &  x)
inline

Vectorized version of erf().

Template Parameters
TContainer type.
Parameters
xContainer.
Returns
Error function applied to each value in x.

Definition at line 32 of file erf.hpp.

◆ erf() [5/5]

var stan::math::erf ( const var a)
inline

The error function for variables (C99).

The derivative is

$\frac{d}{dx} \mbox{erf}(x) = \frac{2}{\sqrt{\pi}} \exp(-x^2)$.

\[ \mbox{erf}(x) = \begin{cases} \operatorname{erf}(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{erf}(x)}{\partial x} = \begin{cases} \frac{\partial\, \operatorname{erf}(x)}{\partial x} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \operatorname{erf}(x)=\frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2}dt \]

\[ \frac{\partial \, \operatorname{erf}(x)}{\partial x} = \frac{2}{\sqrt{\pi}} e^{-x^2} \]

Parameters
aThe variable.
Returns
Error function applied to the variable.

Definition at line 58 of file erf.hpp.

◆ erfc() [1/5]

template<typename T >
fvar<T> stan::math::erfc ( const fvar< T > &  x)
inline

Definition at line 15 of file erfc.hpp.

◆ erfc() [2/5]

double stan::math::erfc ( double  x)
inline

Return the complementary error function of the specified value.

\[ \mbox{erfc}(x) = 1 - \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} dt \]

Parameters
[in]xArgument.
Returns
Complementary error function of the argument.

Definition at line 20 of file erfc.hpp.

◆ erfc() [3/5]

double stan::math::erfc ( int  x)
inline

Return the error function of the specified argument.

This version is required to disambiguate erf(int).

Parameters
[in]xArgument.
Returns
Complementary error function value of the argument.

Definition at line 29 of file erfc.hpp.

◆ erfc() [4/5]

template<typename T >
apply_scalar_unary<erfc_fun, T>::return_t stan::math::erfc ( const T &  x)
inline

Vectorized version of erfc().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Complementary error function applied to each value in x.

Definition at line 30 of file erfc.hpp.

◆ erfc() [5/5]

var stan::math::erfc ( const var a)
inline

The complementary error function for variables (C99).

The derivative is

$\frac{d}{dx} \mbox{erfc}(x) = - \frac{2}{\sqrt{\pi}} \exp(-x^2)$.

\[ \mbox{erfc}(x) = \begin{cases} \operatorname{erfc}(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{erfc}(x)}{\partial x} = \begin{cases} \frac{\partial\, \operatorname{erfc}(x)}{\partial x} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \operatorname{erfc}(x)=\frac{2}{\sqrt{\pi}}\int_x^\infty e^{-t^2}dt \]

\[ \frac{\partial \, \operatorname{erfc}(x)}{\partial x} = -\frac{2}{\sqrt{\pi}} e^{-x^2} \]

Parameters
aThe variable.
Returns
Complementary error function applied to the variable.

Definition at line 59 of file erfc.hpp.

◆ exp() [1/4]

template<typename T >
fvar<T> stan::math::exp ( const fvar< T > &  x)
inline

Definition at line 11 of file exp.hpp.

◆ exp() [2/4]

double stan::math::exp ( int  x)
inline

Return the natural exponential of the specified argument.

This version is required to disambiguate exp(int).

Parameters
[in]xArgument.
Returns
Natural exponential of argument.

Definition at line 17 of file exp.hpp.

◆ exp() [3/4]

template<typename T >
apply_scalar_unary<exp_fun, T>::return_t stan::math::exp ( const T &  x)
inline

Return the elementwise exponentiation of the specified argument, which may be a scalar or any Stan container of numeric scalars.

The return type is the same as the argument type.

Template Parameters
TArgument type.
Parameters
[in]xArgument.
Returns
Elementwise application of exponentiation to the argument.

Definition at line 40 of file exp.hpp.

◆ exp() [4/4]

var stan::math::exp ( const var a)
inline

Return the exponentiation of the specified variable (cmath).

\[ \mbox{exp}(x) = \begin{cases} e^x & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{exp}(x)}{\partial x} = \begin{cases} e^x & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable to exponentiate.
Returns
Exponentiated variable.

Definition at line 41 of file exp.hpp.

◆ exp2() [1/5]

template<typename T >
fvar<T> stan::math::exp2 ( const fvar< T > &  x)
inline

Definition at line 14 of file exp2.hpp.

◆ exp2() [2/5]

double stan::math::exp2 ( double  y)
inline

Return the exponent base 2 of the specified argument (C99, C++11).

The exponent base 2 function is defined by

exp2(y) = pow(2.0, y).

Parameters
yargument.
Returns
exponent base 2 of argument.

Definition at line 21 of file exp2.hpp.

◆ exp2() [3/5]

double stan::math::exp2 ( int  y)
inline

Return the exponent base 2 of the specified argument (C99, C++11).

Parameters
yargument
Returns
exponent base 2 of argument

Definition at line 33 of file exp2.hpp.

◆ exp2() [4/5]

template<typename T >
apply_scalar_unary<exp2_fun, T>::return_t stan::math::exp2 ( const T &  x)
inline

Return the elementwise application of exp2() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
TContainer type.
Parameters
xContainer.
Returns
Elementwise exp2 of members of container.

Definition at line 38 of file exp2.hpp.

◆ exp2() [5/5]

var stan::math::exp2 ( const var a)
inline

Exponentiation base 2 function for variables (C99).

The derivative is

$\frac{d}{dx} 2^x = (\log 2) 2^x$.

\[ \mbox{exp2}(x) = \begin{cases} 2^x & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{exp2}(x)}{\partial x} = \begin{cases} 2^x\ln2 & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aThe variable.
Returns
Two to the power of the specified variable.

Definition at line 46 of file exp2.hpp.

◆ exp_mod_normal_ccdf_log()

template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type<T_y, T_loc, T_scale, T_inv_scale>::type stan::math::exp_mod_normal_ccdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_inv_scale &  lambda 
)
Deprecated:
use exp_mod_normal_lccdf

Definition at line 15 of file exp_mod_normal_ccdf_log.hpp.

◆ exp_mod_normal_cdf()

template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type<T_y, T_loc, T_scale, T_inv_scale>::type stan::math::exp_mod_normal_cdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_inv_scale &  lambda 
)

Definition at line 19 of file exp_mod_normal_cdf.hpp.

◆ exp_mod_normal_cdf_log()

template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type<T_y, T_loc, T_scale, T_inv_scale>::type stan::math::exp_mod_normal_cdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_inv_scale &  lambda 
)
Deprecated:
use exp_mod_normal_lcdf

Definition at line 15 of file exp_mod_normal_cdf_log.hpp.

◆ exp_mod_normal_lccdf()

template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type<T_y, T_loc, T_scale, T_inv_scale>::type stan::math::exp_mod_normal_lccdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_inv_scale &  lambda 
)

Definition at line 20 of file exp_mod_normal_lccdf.hpp.

◆ exp_mod_normal_lcdf()

template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type<T_y, T_loc, T_scale, T_inv_scale>::type stan::math::exp_mod_normal_lcdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_inv_scale &  lambda 
)

Definition at line 20 of file exp_mod_normal_lcdf.hpp.

◆ exp_mod_normal_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type<T_y, T_loc, T_scale, T_inv_scale>::type stan::math::exp_mod_normal_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_inv_scale &  lambda 
)
Deprecated:
use exp_mod_normal_lpdf

Definition at line 15 of file exp_mod_normal_log.hpp.

◆ exp_mod_normal_log() [2/2]

template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type<T_y, T_loc, T_scale, T_inv_scale>::type stan::math::exp_mod_normal_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_inv_scale &  lambda 
)
inline
Deprecated:
use exp_mod_normal_lpdf

Definition at line 27 of file exp_mod_normal_log.hpp.

◆ exp_mod_normal_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type<T_y, T_loc, T_scale, T_inv_scale>::type stan::math::exp_mod_normal_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_inv_scale &  lambda 
)

Definition at line 21 of file exp_mod_normal_lpdf.hpp.

◆ exp_mod_normal_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type<T_y, T_loc, T_scale, T_inv_scale>::type stan::math::exp_mod_normal_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_inv_scale &  lambda 
)
inline

Definition at line 107 of file exp_mod_normal_lpdf.hpp.

◆ exp_mod_normal_rng()

template<typename T_loc , typename T_scale , typename T_inv_scale , class RNG >
VectorBuilder<true, double, T_loc, T_scale, T_inv_scale>::type stan::math::exp_mod_normal_rng ( const T_loc &  mu,
const T_scale &  sigma,
const T_inv_scale &  lambda,
RNG &  rng 
)
inline

Return an exponentially modified normal random variate for the given location, scale, and inverse scale using the specified random number generator.

mu, sigma, and lambda can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_locType of location parameter
T_scaleType of scale parameter
T_inv_scaleType of inverse scale parameter
RNGtype of random number generator
Parameters
mu(Sequence of) location parameter(s)
sigma(Sequence of) scale parameter(s)
lambda(Sequence of) inverse scale parameter(s)
rngrandom number generator
Returns
(Sequence of) Exponentially modified normal random variate(s)
Exceptions
std::domain_errorif mu is infinite, sigma is nonpositive, or lambda is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 40 of file exp_mod_normal_rng.hpp.

◆ expm1() [1/5]

template<typename T >
fvar<T> stan::math::expm1 ( const fvar< T > &  x)
inline

Definition at line 13 of file expm1.hpp.

◆ expm1() [2/5]

double stan::math::expm1 ( double  x)
inline

Return the natural exponentiation of x minus one.

Returns infinity for infinity argument and -infinity for -infinity argument.

Parameters
[in]xArgument.
Returns
Natural exponentiation of argument minus one.

Definition at line 18 of file expm1.hpp.

◆ expm1() [3/5]

double stan::math::expm1 ( int  x)
inline

Integer version of expm1.

Parameters
[in]xArgument.
Returns
Natural exponentiation of argument minus one.

Definition at line 26 of file expm1.hpp.

◆ expm1() [4/5]

template<typename T >
apply_scalar_unary<expm1_fun, T>::return_t stan::math::expm1 ( const T &  x)
inline

Vectorized version of expm1().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Natural exponential of each value in x minus one.

Definition at line 30 of file expm1.hpp.

◆ expm1() [5/5]

var stan::math::expm1 ( const var a)
inline

The exponentiation of the specified variable minus 1 (C99).

The derivative is given by

$\frac{d}{dx} \exp(a) - 1 = \exp(a)$.

\[ \mbox{expm1}(x) = \begin{cases} e^x-1 & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{expm1}(x)}{\partial x} = \begin{cases} e^x & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aThe variable.
Returns
Two to the power of the specified variable.

Definition at line 46 of file expm1.hpp.

◆ exponential_ccdf_log()

template<typename T_y , typename T_inv_scale >
return_type<T_y, T_inv_scale>::type stan::math::exponential_ccdf_log ( const T_y &  y,
const T_inv_scale &  beta 
)
Deprecated:
use exponential_lccdf

Definition at line 14 of file exponential_ccdf_log.hpp.

◆ exponential_cdf()

template<typename T_y , typename T_inv_scale >
return_type<T_y, T_inv_scale>::type stan::math::exponential_cdf ( const T_y &  y,
const T_inv_scale &  beta 
)

Calculates the exponential cumulative distribution function for the given y and beta.

Inverse scale parameter must be greater than 0. y must be greater than or equal to 0.

Parameters
yA scalar variable.
betaInverse scale parameter.
Template Parameters
T_yType of scalar.
T_inv_scaleType of inverse scale.

Definition at line 28 of file exponential_cdf.hpp.

◆ exponential_cdf_log()

template<typename T_y , typename T_inv_scale >
return_type<T_y, T_inv_scale>::type stan::math::exponential_cdf_log ( const T_y &  y,
const T_inv_scale &  beta 
)
Deprecated:
use exponential_lcdf

Definition at line 14 of file exponential_cdf_log.hpp.

◆ exponential_lccdf()

template<typename T_y , typename T_inv_scale >
return_type<T_y, T_inv_scale>::type stan::math::exponential_lccdf ( const T_y &  y,
const T_inv_scale &  beta 
)

Definition at line 15 of file exponential_lccdf.hpp.

◆ exponential_lcdf()

template<typename T_y , typename T_inv_scale >
return_type<T_y, T_inv_scale>::type stan::math::exponential_lcdf ( const T_y &  y,
const T_inv_scale &  beta 
)

Definition at line 16 of file exponential_lcdf.hpp.

◆ exponential_log() [1/2]

template<bool propto, typename T_y , typename T_inv_scale >
return_type<T_y, T_inv_scale>::type stan::math::exponential_log ( const T_y &  y,
const T_inv_scale &  beta 
)

The log of an exponential density for y with the specified inverse scale parameter.

Inverse scale parameter must be greater than 0. y must be greater than or equal to 0.

\begin{eqnarray*} y &\sim& \mbox{\sf{Expon}}(\beta) \\ \log (p (y \, |\, \beta) ) &=& \log \left( \beta \exp^{-\beta y} \right) \\ &=& \log (\beta) - \beta y \\ & & \mathrm{where} \; y > 0 \end{eqnarray*}

Deprecated:
use exponential_lpdf
Parameters
yA scalar variable.
betaInverse scale parameter.
Exceptions
std::domain_errorif beta is not greater than 0.
std::domain_errorif y is not greater than or equal to 0.
Template Parameters
T_yType of scalar.
T_inv_scaleType of inverse scale.

Definition at line 39 of file exponential_log.hpp.

◆ exponential_log() [2/2]

template<typename T_y , typename T_inv_scale >
return_type<T_y, T_inv_scale>::type stan::math::exponential_log ( const T_y &  y,
const T_inv_scale &  beta 
)
inline
Deprecated:
use exponential_lpdf

Definition at line 48 of file exponential_log.hpp.

◆ exponential_lpdf() [1/2]

template<bool propto, typename T_y , typename T_inv_scale >
return_type<T_y, T_inv_scale>::type stan::math::exponential_lpdf ( const T_y &  y,
const T_inv_scale &  beta 
)

The log of an exponential density for y with the specified inverse scale parameter.

Inverse scale parameter must be greater than 0. y must be greater than or equal to 0.

\begin{eqnarray*} y &\sim& \mbox{\sf{Expon}}(\beta) \\ \log (p (y \, |\, \beta) ) &=& \log \left( \beta \exp^{-\beta y} \right) \\ &=& \log (\beta) - \beta y \\ & & \mathrm{where} \; y > 0 \end{eqnarray*}

Parameters
yA scalar variable.
betaInverse scale parameter.
Exceptions
std::domain_errorif beta is not greater than 0.
std::domain_errorif y is not greater than or equal to 0.
Template Parameters
T_yType of scalar.
T_inv_scaleType of inverse scale.

Definition at line 43 of file exponential_lpdf.hpp.

◆ exponential_lpdf() [2/2]

template<typename T_y , typename T_inv_scale >
return_type<T_y, T_inv_scale>::type stan::math::exponential_lpdf ( const T_y &  y,
const T_inv_scale &  beta 
)
inline

Definition at line 90 of file exponential_lpdf.hpp.

◆ exponential_rng()

template<typename T_inv , class RNG >
VectorBuilder<true, double, T_inv>::type stan::math::exponential_rng ( const T_inv &  beta,
RNG &  rng 
)
inline

Return a exponential random variate with inverse scale beta using the specified random number generator.

beta can be a scalar or a one-dimensional container.

Template Parameters
T_invType of inverse scale parameter
RNGclass of random number generator
Parameters
beta(Sequence of) positive inverse scale parameter(s)
rngrandom number generator
Returns
(Sequence of) exponential random variate(s)
Exceptions
std::domain_errorif beta is nonpositive

Definition at line 26 of file exponential_rng.hpp.

◆ F32()

template<typename T >
T stan::math::F32 ( const T &  a1,
const T &  a2,
const T &  a3,
const T &  b1,
const T &  b2,
const T &  z,
double  precision = 1e-6,
int  max_steps = 1e5 
)

Hypergeometric function (3F2).

Function reference: http://dlmf.nist.gov/16.2

\[ _3F_2 \left( \begin{matrix}a_1 a_2 a3 \\ b_1 b_2\end{matrix}; z \right) = \sum_k=0^\infty \frac{(a_1)_k(a_2)_k(a_3)_k}{(b_1)_k(b_2)_k}\frac{z^k}{k!} \]

Where _k$ is an upper shifted factorial.

Calculate the hypergeometric function (3F2) as the power series directly to within precision or until max_steps terms.

This function does not have a closed form but will converge if:

  • |z| is less than 1
  • |z| is equal to one and b1 + b2 < a1 + a2 + a3 This function is a rational polynomial if
  • a1, a2, or a3 is a non-positive integer This function can be treated as a rational polynomial if
  • b1 or b2 is a non-positive integer and the series is terminated prior to the final term.
Template Parameters
Ttype of arguments and result
Parameters
[in]a1a1 (always called with 1 from beta binomial cdfs)
[in]a2a2 (always called with a2 > 1)
[in]a3a3 (always called with int a3 <= 0)
[in]b1b1 (always called with int b1 < |a3|)
[in]b2b2 (always <= 1)
[in]zz (is always called with 1 from beta binomial cdfs)
[in]precisionprecision of the infinite sum. defaults to 1e-6
[in]max_stepsnumber of steps to take. defaults to 1e5

Definition at line 51 of file F32.hpp.

◆ fabs() [1/3]

template<typename T >
fvar<T> stan::math::fabs ( const fvar< T > &  x)
inline

Definition at line 15 of file fabs.hpp.

◆ fabs() [2/3]

template<typename T >
apply_scalar_unary<fabs_fun, T>::return_t stan::math::fabs ( const T &  x)
inline

Vectorized version of fabs().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Absolute value of each value in x.

Definition at line 33 of file fabs.hpp.

◆ fabs() [3/3]

var stan::math::fabs ( const var a)
inline

Return the absolute value of the variable (cmath).

Choosing an arbitrary value at the non-differentiable point 0,

$\frac{d}{dx}|x| = \mbox{sgn}(x)$.

where $\mbox{sgn}(x)$ is the signum function, taking values -1 if $x < 0$, 0 if $x == 0$, and 1 if $x == 1$.

The function abs() provides the same behavior, with abs() defined in stdlib.h and fabs() defined in cmath. The derivative is 0 if the input is 0.

Returns std::numeric_limits<double>::quiet_NaN() for NaN inputs.

\[ \mbox{fabs}(x) = \begin{cases} |x| & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fabs}(x)}{\partial x} = \begin{cases} -1 & \mbox{if } x < 0 \\ 0 & \mbox{if } x = 0 \\ 1 & \mbox{if } x > 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aInput variable.
Returns
Absolute value of variable.

Definition at line 50 of file fabs.hpp.

◆ factor_cov_matrix()

template<typename T >
bool stan::math::factor_cov_matrix ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  Sigma,
Eigen::Array< T, Eigen::Dynamic, 1 > &  CPCs,
Eigen::Array< T, Eigen::Dynamic, 1 > &  sds 
)

This function is intended to make starting values, given a covariance matrix Sigma.

The transformations are hard coded as log for standard deviations and Fisher transformations (atanh()) of CPCs

Parameters
[in]Sigmacovariance matrix
[out]CPCsfill this unbounded (does not resize)
[out]sdsfill this unbounded (does not resize)
Returns
false if any of the diagonals of Sigma are 0

Definition at line 24 of file factor_cov_matrix.hpp.

◆ factor_U()

template<typename T >
void stan::math::factor_U ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  U,
Eigen::Array< T, Eigen::Dynamic, 1 > &  CPCs 
)

This function is intended to make starting values, given a unit upper-triangular matrix U such that U'DU is a correlation matrix.

Parameters
USigma matrix
CPCsfill this unbounded

Definition at line 22 of file factor_U.hpp.

◆ falling_factorial() [1/3]

var stan::math::falling_factorial ( const var a,
int  b 
)
inline

Definition at line 25 of file falling_factorial.hpp.

◆ falling_factorial() [2/3]

template<typename T >
fvar<T> stan::math::falling_factorial ( const fvar< T > &  x,
int  n 
)
inline

Return autodiff variable with the gradient and result of the falling factorial function applied to the inputs.

Will throw for NaN x and for negative n, as implemented in primitive function.

Template Parameters
TScalar type of autodiff variable.
Parameters
xArgument.
nArgument
Returns
tangent of falling factorial at arguments.

Definition at line 27 of file falling_factorial.hpp.

◆ falling_factorial() [3/3]

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::falling_factorial ( const T &  x,
int  n 
)
inline

Return the falling factorial function evaluated at the inputs.

Will throw for NaN x and for negative n

Template Parameters
TType of x argument.
Parameters
xArgument.
nArgument
Returns
Result of falling factorial function.
Exceptions
std::domain_errorif x is NaN
std::domain_errorif n is negative

\[ \mbox{falling\_factorial}(x, n) = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ (x)_n & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{falling\_factorial}(x, n)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \frac{\partial\, (x)_n}{\partial x} & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{falling\_factorial}(x, n)}{\partial n} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \frac{\partial\, (x)_n}{\partial n} & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

\[ (x)_n=\frac{\Gamma(x+1)}{\Gamma(x-n+1)} \]

\[ \frac{\partial \, (x)_n}{\partial x} = (x)_n\Psi(x+1) \]

\[ \frac{\partial \, (x)_n}{\partial n} = -(x)_n\Psi(n+1) \]

Definition at line 65 of file falling_factorial.hpp.

◆ fdim() [1/7]

template<typename T >
fvar<T> stan::math::fdim ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Return the positive difference of the specified values (C++11).

Template Parameters
TScalar type of autodiff variables.
Parameters
xFirst argument.
ySecond argument.
Returns
Return the differences of the arguments if it is positive and 0 otherwise.

Definition at line 21 of file fdim.hpp.

◆ fdim() [2/7]

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2>::type stan::math::fdim ( T1  x,
T2  y 
)
inline

Return the positive difference of the specified values (C++11).

The function is defined by

fdim(x, y) = (x > y) ? (x - y) : 0.

Parameters
xFirst value.
ySecond value.
Returns
max(x- y, 0)

Definition at line 25 of file fdim.hpp.

◆ fdim() [3/7]

template<typename T >
fvar<T> stan::math::fdim ( const fvar< T > &  x,
double  y 
)
inline

Return the positive difference of the specified values (C++11).

Template Parameters
TScalar type of autodiff variables.
Parameters
xFirst argument.
ySecond argument.
Returns
Return the differences of the arguments if it is positive and 0 otherwise.

Definition at line 38 of file fdim.hpp.

◆ fdim() [4/7]

template<typename T >
fvar<T> stan::math::fdim ( double  x,
const fvar< T > &  y 
)
inline

Return the positive difference of the specified values (C++11).

Template Parameters
TScalar type of autodiff variables.
Parameters
xFirst argument.
ySecond argument.
Returns
Return the differences of the arguments if it is positive and 0 otherwise.

Definition at line 55 of file fdim.hpp.

◆ fdim() [5/7]

var stan::math::fdim ( const var a,
const var b 
)
inline

Return the positive difference between the first variable's the value and the second's (C99, C++11).

The function values and deriatives are defined by

\[ \mbox{fdim}(x, y) = \begin{cases} x-y & \mbox{if } x > y \\[6pt] 0 & \mbox{otherwise} \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fdim}(x, y)}{\partial x} = \begin{cases} 1 & \mbox{if } x > y \\[6pt] 0 & \mbox{otherwise} \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fdim}(x, y)}{\partial y} = \begin{cases} -1 & \mbox{if } x > y \\[6pt] 0 & \mbox{otherwise} \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable.
bSecond variable.
Returns
The positive difference between the first and second variable.

Definition at line 89 of file fdim.hpp.

◆ fdim() [6/7]

var stan::math::fdim ( double  a,
const var b 
)
inline

Return the positive difference between the first value and the value of the second variable (C99, C++11).

See fdim(var, var) for definitions of values and derivatives.

Parameters
aFirst value.
bSecond variable.
Returns
The positive difference between the first and second arguments.

Definition at line 108 of file fdim.hpp.

◆ fdim() [7/7]

var stan::math::fdim ( const var a,
double  b 
)
inline

Return the positive difference between the first variable's value and the second value (C99, C++11).

See fdim(var, var) for definitions of values and derivatives.

Parameters
aFirst value.
bSecond variable.
Returns
The positive difference between the first and second arguments.

Definition at line 125 of file fdim.hpp.

◆ fill() [1/3]

template<typename T , typename S >
void stan::math::fill ( T &  x,
const S &  y 
)

Fill the specified container with the specified value.

This base case simply assigns the value to the container.

Template Parameters
TType of reference container.
SType of value.
Parameters
xContainer.
yValue.

Definition at line 19 of file fill.hpp.

◆ fill() [2/3]

template<typename T , int R, int C, typename S >
void stan::math::fill ( Eigen::Matrix< T, R, C > &  x,
const S &  y 
)

Fill the specified container with the specified value.

The specified matrix is filled by element.

Template Parameters
TType of scalar for matrix container.
RRow type of matrix.
CColumn type of matrix.
SType of value.
Parameters
xContainer.
yValue.

Definition at line 22 of file fill.hpp.

◆ fill() [3/3]

template<typename T , typename S >
void stan::math::fill ( std::vector< T > &  x,
const S &  y 
)

Fill the specified container with the specified value.

Each container in the specified standard vector is filled recursively by calling fill.

Template Parameters
TType of container in vector.
SType of value.
Parameters
[in]xContainer.
[in,out]yValue.

Definition at line 23 of file fill.hpp.

◆ finite_diff_grad_hessian()

template<typename F >
void stan::math::finite_diff_grad_hessian ( const F &  f,
const Eigen::VectorXd &  x,
double &  fx,
Eigen::MatrixXd &  hess,
std::vector< Eigen::MatrixXd > &  grad_hess_fx,
double  epsilon = 1e-04 
)

Calculate the value and the gradient of the hessian of the specified function at the specified argument using second-order autodiff and first-order finite difference.

The functor must implement

double operator()(const Eigen::Matrix<double, Eigen::Dynamic, 1>&)

Reference:

De Levie: An improved numerical approximation for the first derivative, page 3

4 calls to the function, f.

Template Parameters
FType of function
Parameters
[in]fFunction
[in]xArgument to function
[out]fxFunction applied to argument
[out]hessHessian matrix
[out]grad_hess_fxgradient of Hessian of function at argument
[in]epsilonperturbation size

Definition at line 41 of file finite_diff_grad_hessian.hpp.

◆ finite_diff_grad_hessian_auto()

template<typename F >
void stan::math::finite_diff_grad_hessian_auto ( const F &  f,
const Eigen::VectorXd &  x,
double &  fx,
Eigen::MatrixXd &  hess,
std::vector< Eigen::MatrixXd > &  grad_hess_fx 
)

Calculate the value, Hessian, and the gradient of the Hessian of the specified function at the specified argument using second-order autodiff and first-order finite difference.

The functor must implement

double operator()(const Eigen::VectorXd&) const;

Reference for finite difference to compute gradient:


De Levie: An improved numerical approximation for the first derivative, page 3

Step size for dimension i is set automatically using stan::math::finite_diff_stepsize(H(i, j)); the nested finite differences are over entries in the Hessian.

Evaluating this function involves 6 calls to the Hessian autodiff function for each entry in the Hessian.

Template Parameters
FType of function
Parameters
[in]fFunction
[in]xArgument to function
[out]fxFunction applied to argument
[out]hessHessian matrix
[out]grad_hess_fxgradient of Hessian of function at argument

Definition at line 44 of file finite_diff_grad_hessian_auto.hpp.

◆ finite_diff_gradient()

template<typename F >
void stan::math::finite_diff_gradient ( const F &  f,
const Eigen::VectorXd &  x,
double &  fx,
Eigen::VectorXd &  grad_fx,
double  epsilon = 1e-03 
)

Calculate the value and the gradient of the specified function at the specified argument using finite difference.

The functor must implement

double operator()(const Eigen::Matrix<double, -1, 1>&) const;

If epsilon is chosen to be near the square root of the machine precision and the input vector elements are all roughly unit scale, and if the function has reasonable limits on variation, error should be on the order of epsilon^6.

The reference for the algorithm is:


Robert de Levie. 2009. An improved numerical approximation for the first derivative. Journal of Chemical Sciences 121(5), page 3.

Evaluating this function involves 6 calls to f for each dimension of the input.

Template Parameters
FType of function
Parameters
[in]fFunction
[in]xArgument to function
[out]fxFunction applied to argument
[out]grad_fxGradient of function at argument
[in]epsilonperturbation size

Definition at line 43 of file finite_diff_gradient.hpp.

◆ finite_diff_gradient_auto()

template<typename F >
void stan::math::finite_diff_gradient_auto ( const F &  f,
const Eigen::VectorXd &  x,
double &  fx,
Eigen::VectorXd &  grad_fx 
)

Calculate the value and the gradient of the specified function at the specified argument using finite difference.

The functor must implement

double operator()(const Eigen::Matrix<double, -, 1>&) const;

Error of derivative in dimension i should be on the should be on order of epsilon(i)^6, where epsilon(i) = sqrt(delta) * abs(x(i)) for input x at dimension i.

The reference for this algorithm is:


Robert de Levie. 2009. An improved numerical approximation for the first derivative. Journal of Chemical Sciences 121(5), page 3.

The reference for automatically setting the difference is this section of the Wikipedia,


Numerical differentiation: practical considerations using floating point arithmetic.

Evaluating this function involves 6 calls to the function being differentiated for each dimension in the input, plus one global evaluation. All evaluations will be for double-precision inputs.

Template Parameters
FType of function
Parameters
[in]ffunction
[in]xargument to function
[out]fxfunction applied to argument
[out]grad_fxgradient of function at argument

Definition at line 51 of file finite_diff_gradient_auto.hpp.

◆ finite_diff_hessian()

template<typename F >
void stan::math::finite_diff_hessian ( const F &  f,
const Eigen::VectorXd &  x,
double &  fx,
Eigen::VectorXd &  grad_fx,
Eigen::MatrixXd &  hess_fx,
double  epsilon = 1e-03 
)

Calculate the value and the Hessian of the specified function at the specified argument using second-order finite difference with the specified perturbation step size.

The functor must implement double operator()(const Eigen::VectorXd&) const;

For details of the algorithm, see
Eberly, D., 2008. Derivative approximation by finite differences. Magic Software, Inc., Page 6.

Template Parameters
FType of function
Parameters
[in]fFunction
[in]xArgument to function
[out]fxFunction applied to argument
[out]grad_fxGradient of function at argument
[out]hess_fxHessian of function at argument
[in]epsilonperturbation step size

Definition at line 36 of file finite_diff_hessian.hpp.

◆ finite_diff_hessian_auto()

template<typename F >
void stan::math::finite_diff_hessian_auto ( const F &  f,
const Eigen::VectorXd &  x,
double &  fx,
Eigen::VectorXd &  grad_fx,
Eigen::MatrixXd &  hess_fx 
)

Calculate the value and the Hessian of the specified function at the specified argument using second-order finite difference, automatically setting the stepsize between the function evaluations along a dimension.

The functor must implement

double operator()(const Eigen::VectorXd&)

For details of the algorithm, see
Eberly, D., 2008. Derivative approximation by finite differences. Magic Software, Inc., Page 6.

Step size for dimension i is set automatically using stan::math::finite_diff_stepsize(x(i)).

For each non-diagonal entry in the Hessian, the function is evaluated 16 times; the diagonal entries require 4 function evaluations.

Template Parameters
FType of function
Parameters
[in]fFunction
[in]xArgument to function
[out]fxFunction applied to argument
[out]grad_fxGradient of function at argument
[out]hess_fxHessian of function at argument

Definition at line 42 of file finite_diff_hessian_auto.hpp.

◆ finite_diff_hessian_helper()

template<typename F >
double stan::math::finite_diff_hessian_helper ( const F &  f,
const Eigen::VectorXd &  x,
int  i,
double  epsilon = 1e-03 
)

Return the subcalculation required by finite_diff_hessian and finite_diff_hessian_auto.

The calculation is like a partial derivative calculation, but returns different values. The only utility of this function is as a subroutine for the two Hessians.

The functor must implement double operator()(const Eigen::VectorXd&) const;

This function evaluations the functor four times.

Template Parameters
Ftype of function
Parameters
ffunction to differentiate
xargument to function
idimension of argument for derivative
epsilonstep size for finite differences
Returns
derivative of f(x) with respect to x(i)

Definition at line 30 of file finite_diff_hessian_helper.hpp.

◆ finite_diff_stepsize()

double stan::math::finite_diff_stepsize ( double  u)
inline

Return the stepsize for finite difference evaluations at the specified scalar.

The forumula used is stepsize(u) = cbrt(epsilon) * max(1, abs(u)).

Parameters
uinitial value to increment
Returns
stepsize away from u for finite differences

Definition at line 20 of file finite_diff_stepsize.hpp.

◆ floor() [1/3]

template<typename T >
fvar<T> stan::math::floor ( const fvar< T > &  x)
inline

Definition at line 12 of file floor.hpp.

◆ floor() [2/3]

template<typename T >
apply_scalar_unary<floor_fun, T>::return_t stan::math::floor ( const T &  x)
inline

Vectorized version of floor().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Greatest integer <= each value in x.

Definition at line 31 of file floor.hpp.

◆ floor() [3/3]

var stan::math::floor ( const var a)
inline

Return the floor of the specified variable (cmath).

The derivative of the floor function is defined and zero everywhere but at integers, so we set these derivatives to zero for convenience,

$\frac{d}{dx} {\lfloor x \rfloor} = 0$.

The floor function rounds down. For double values, this is the largest integral value that is not greater than the specified value. Although this function is not differentiable because it is discontinuous at integral values, its gradient is returned as zero everywhere.

\[ \mbox{floor}(x) = \begin{cases} \lfloor x \rfloor & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{floor}(x)}{\partial x} = \begin{cases} 0 & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aInput variable.
Returns
Floor of the variable.

Definition at line 58 of file floor.hpp.

◆ fma() [1/15]

template<typename T1 , typename T2 , typename T3 >
boost::math::tools::promote_args<T1, T2, T3>::type stan::math::fma ( const T1 &  x,
const T2 &  y,
const T3 &  z 
)
inline

Return the product of the first two arguments plus the third argument.

Warning: This does not delegate to the high-precision platform-specific fma() implementation.

Parameters
xFirst argument.
ySecond argument.
zThird argument.
Returns
The product of the first two arguments plus the third argument.

Definition at line 24 of file fma.hpp.

◆ fma() [2/15]

template<typename T1 , typename T2 , typename T3 >
fvar<typename stan::return_type<T1, T2, T3>::type> stan::math::fma ( const fvar< T1 > &  x1,
const fvar< T2 > &  x2,
const fvar< T3 > &  x3 
)
inline

The fused multiply-add operation (C99).

This double-based operation delegates to fma.

The function is defined by

fma(a, b, c) = (a * b) + c.

\[ \mbox{fma}(x, y, z) = \begin{cases} x\cdot y+z & \mbox{if } -\infty\leq x, y, z \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fma}(x, y, z)}{\partial x} = \begin{cases} y & \mbox{if } -\infty\leq x, y, z \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fma}(x, y, z)}{\partial y} = \begin{cases} x & \mbox{if } -\infty\leq x, y, z \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fma}(x, y, z)}{\partial z} = \begin{cases} 1 & \mbox{if } -\infty\leq x, y, z \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
x1First value.
x2Second value.
x3Third value.
Returns
Product of the first two values plus the third.

Definition at line 59 of file fma.hpp.

◆ fma() [3/15]

template<typename T1 , typename T2 , typename T3 >
fvar<typename stan::return_type<T1, T2, T3>::type> stan::math::fma ( const T1 &  x1,
const fvar< T2 > &  x2,
const fvar< T3 > &  x3 
)
inline

See all-var input signature for details on the function and derivatives.

Definition at line 70 of file fma.hpp.

◆ fma() [4/15]

template<typename T1 , typename T2 , typename T3 >
fvar<typename stan::return_type<T1, T2, T3>::type> stan::math::fma ( const fvar< T1 > &  x1,
const T2 &  x2,
const fvar< T3 > &  x3 
)
inline

See all-var input signature for details on the function and derivatives.

Definition at line 80 of file fma.hpp.

◆ fma() [5/15]

template<typename T1 , typename T2 , typename T3 >
fvar<typename stan::return_type<T1, T2, T3>::type> stan::math::fma ( const fvar< T1 > &  x1,
const fvar< T2 > &  x2,
const T3 &  x3 
)
inline

See all-var input signature for details on the function and derivatives.

Definition at line 90 of file fma.hpp.

◆ fma() [6/15]

template<typename T1 , typename T2 , typename T3 >
fvar<typename stan::return_type<T1, T2, T3>::type> stan::math::fma ( const T1 &  x1,
const T2 &  x2,
const fvar< T3 > &  x3 
)
inline

See all-var input signature for details on the function and derivatives.

Definition at line 100 of file fma.hpp.

◆ fma() [7/15]

var stan::math::fma ( const var a,
const var b,
const var c 
)
inline

The fused multiply-add function for three variables (C99).

This function returns the product of the first two arguments plus the third argument.

The partial derivatives are

$\frac{\partial}{\partial x} (x * y) + z = y$, and

$\frac{\partial}{\partial y} (x * y) + z = x$, and

$\frac{\partial}{\partial z} (x * y) + z = 1$.

Parameters
aFirst multiplicand.
bSecond multiplicand.
cSummand.
Returns
Product of the multiplicands plus the summand, ($a * $b) + $c.

Definition at line 104 of file fma.hpp.

◆ fma() [8/15]

template<typename T1 , typename T2 , typename T3 >
fvar<typename stan::return_type<T1, T2, T3>::type> stan::math::fma ( const fvar< T1 > &  x1,
const T2 &  x2,
const T3 &  x3 
)
inline

See all-var input signature for details on the function and derivatives.

Definition at line 110 of file fma.hpp.

◆ fma() [9/15]

template<typename T1 , typename T2 , typename T3 >
fvar<typename stan::return_type<T1, T2, T3>::type> stan::math::fma ( const T1 &  x1,
const fvar< T2 > &  x2,
const T3 &  x3 
)
inline

See all-var input signature for details on the function and derivatives.

Definition at line 120 of file fma.hpp.

◆ fma() [10/15]

var stan::math::fma ( const var a,
const var b,
double  c 
)
inline

The fused multiply-add function for two variables and a value (C99).

This function returns the product of the first two arguments plus the third argument.

The partial derivatives are

$\frac{\partial}{\partial x} (x * y) + c = y$, and

$\frac{\partial}{\partial y} (x * y) + c = x$.

Parameters
aFirst multiplicand.
bSecond multiplicand.
cSummand.
Returns
Product of the multiplicands plus the summand, ($a * $b) + $c.

Definition at line 124 of file fma.hpp.

◆ fma() [11/15]

var stan::math::fma ( const var a,
double  b,
const var c 
)
inline

The fused multiply-add function for a variable, value, and variable (C99).

This function returns the product of the first two arguments plus the third argument.

The partial derivatives are

$\frac{\partial}{\partial x} (x * c) + z = c$, and

$\frac{\partial}{\partial z} (x * c) + z = 1$.

Parameters
aFirst multiplicand.
bSecond multiplicand.
cSummand.
Returns
Product of the multiplicands plus the summand, ($a * $b) + $c.

Definition at line 144 of file fma.hpp.

◆ fma() [12/15]

var stan::math::fma ( const var a,
double  b,
double  c 
)
inline

The fused multiply-add function for a variable and two values (C99).

This function returns the product of the first two arguments plus the third argument.

The double-based version ::fma(double, double, double) is defined in <cmath>.

The derivative is

$\frac{d}{d x} (x * c) + d = c$.

Parameters
aFirst multiplicand.
bSecond multiplicand.
cSummand.
Returns
Product of the multiplicands plus the summand, ($a * $b) + $c.

Definition at line 166 of file fma.hpp.

◆ fma() [13/15]

var stan::math::fma ( double  a,
const var b,
double  c 
)
inline

The fused multiply-add function for a value, variable, and value (C99).

This function returns the product of the first two arguments plus the third argument.

The derivative is

$\frac{d}{d y} (c * y) + d = c$, and

Parameters
aFirst multiplicand.
bSecond multiplicand.
cSummand.
Returns
Product of the multiplicands plus the summand, ($a * $b) + $c.

Definition at line 184 of file fma.hpp.

◆ fma() [14/15]

var stan::math::fma ( double  a,
double  b,
const var c 
)
inline

The fused multiply-add function for two values and a variable, and value (C99).

This function returns the product of the first two arguments plus the third argument.

The derivative is

$\frac{\partial}{\partial z} (c * d) + z = 1$.

Parameters
aFirst multiplicand.
bSecond multiplicand.
cSummand.
Returns
Product of the multiplicands plus the summand, ($a * $b) + $c.

Definition at line 202 of file fma.hpp.

◆ fma() [15/15]

var stan::math::fma ( double  a,
const var b,
const var c 
)
inline

The fused multiply-add function for a value and two variables (C99).

This function returns the product of the first two arguments plus the third argument.

The partial derivaties are

$\frac{\partial}{\partial y} (c * y) + z = c$, and

$\frac{\partial}{\partial z} (c * y) + z = 1$.

Parameters
aFirst multiplicand.
bSecond multiplicand.
cSummand.
Returns
Product of the multiplicands plus the summand, ($a * $b) + $c.

Definition at line 222 of file fma.hpp.

◆ fmax() [1/7]

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2>::type stan::math::fmax ( const T1 &  x,
const T2 &  y 
)
inline

Return the greater of the two specified arguments.

If one is greater than the other, return not-a-number.

Parameters
xFirst argument.
ySecond argument.
Returns
maximum of x or y and if one is NaN return the other

Definition at line 20 of file fmax.hpp.

◆ fmax() [2/7]

template<typename T >
fvar<T> stan::math::fmax ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Return the greater of the two specified arguments.

If one is greater than the other, return not-a-number.

Parameters
x1First argument.
x2Second argument.
Returns
maximum of arguments, and if one is NaN return the other

Definition at line 22 of file fmax.hpp.

◆ fmax() [3/7]

template<typename T >
fvar<T> stan::math::fmax ( double  x1,
const fvar< T > &  x2 
)
inline

Return the greater of the two specified arguments.

If one is greater than the other, return not-a-number.

Parameters
x1First argument.
x2Second argument.
Returns
maximum of arguments, and if one is NaN return the other

Definition at line 48 of file fmax.hpp.

◆ fmax() [4/7]

var stan::math::fmax ( const var a,
const var b 
)
inline

Returns the maximum of the two variable arguments (C99).

No new variable implementations are created, with this function defined as if by

fmax(a, b) = a if a's value is greater than b's, and .

fmax(a, b) = b if b's value is greater than or equal to a's.

\[ \mbox{fmax}(x, y) = \begin{cases} x & \mbox{if } x \geq y \\ y & \mbox{if } x < y \\[6pt] x & \mbox{if } -\infty\leq x\leq \infty, y = \textrm{NaN}\\ y & \mbox{if } -\infty\leq y\leq \infty, x = \textrm{NaN}\\ \textrm{NaN} & \mbox{if } x, y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fmax}(x, y)}{\partial x} = \begin{cases} 1 & \mbox{if } x \geq y \\ 0 & \mbox{if } x < y \\[6pt] 1 & \mbox{if } -\infty\leq x\leq \infty, y = \textrm{NaN}\\ 0 & \mbox{if } -\infty\leq y\leq \infty, x = \textrm{NaN}\\ \textrm{NaN} & \mbox{if } x, y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fmax}(x, y)}{\partial y} = \begin{cases} 0 & \mbox{if } x \geq y \\ 1 & \mbox{if } x < y \\[6pt] 0 & \mbox{if } -\infty\leq x\leq \infty, y = \textrm{NaN}\\ 1 & \mbox{if } -\infty\leq y\leq \infty, x = \textrm{NaN}\\ \textrm{NaN} & \mbox{if } x, y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable.
bSecond variable.
Returns
If the first variable's value is larger than the second's, the first variable, otherwise the second variable.

Definition at line 61 of file fmax.hpp.

◆ fmax() [5/7]

template<typename T >
fvar<T> stan::math::fmax ( const fvar< T > &  x1,
double  x2 
)
inline

Return the greater of the two specified arguments.

If one is greater than the other, return not-a-number.

Parameters
x1First argument.
x2Second argument.
Returns
maximum of arguments, and if one is NaN return the other

Definition at line 74 of file fmax.hpp.

◆ fmax() [6/7]

var stan::math::fmax ( const var a,
double  b 
)
inline

Returns the maximum of the variable and scalar, promoting the scalar to a variable if it is larger (C99).

For fmax(a, b), if a's value is greater than b, then a is returned, otherwise a fesh variable implementation wrapping the value b is returned.

Parameters
aFirst variable.
bSecond value
Returns
If the first variable's value is larger than or equal to the second value, the first variable, otherwise the second value promoted to a fresh variable.

Definition at line 87 of file fmax.hpp.

◆ fmax() [7/7]

var stan::math::fmax ( double  a,
const var b 
)
inline

Returns the maximum of a scalar and variable, promoting the scalar to a variable if it is larger (C99).

For fmax(a, b), if a is greater than b's value, then a fresh variable implementation wrapping a is returned, otherwise b is returned.

Parameters
aFirst value.
bSecond variable.
Returns
If the first value is larger than the second variable's value, return the first value promoted to a variable, otherwise return the second variable.

Definition at line 112 of file fmax.hpp.

◆ fmin() [1/7]

template<typename T >
fvar<T> stan::math::fmin ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 14 of file fmin.hpp.

◆ fmin() [2/7]

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2>::type stan::math::fmin ( const T1 &  x,
const T2 &  y 
)
inline

Return the lesser of the two specified arguments.

If one is greater than the other, return not-a-number.

Parameters
xFirst argument.
ySecond argument.
Returns
Minimum of x or y and if one is NaN return the other

Definition at line 20 of file fmin.hpp.

◆ fmin() [3/7]

template<typename T >
fvar<T> stan::math::fmin ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 32 of file fmin.hpp.

◆ fmin() [4/7]

template<typename T >
fvar<T> stan::math::fmin ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 50 of file fmin.hpp.

◆ fmin() [5/7]

var stan::math::fmin ( const var a,
const var b 
)
inline

Returns the minimum of the two variable arguments (C99).

For fmin(a, b), if a's value is less than b's, then a is returned, otherwise b is returned.

\[ \mbox{fmin}(x, y) = \begin{cases} x & \mbox{if } x \leq y \\ y & \mbox{if } x > y \\[6pt] x & \mbox{if } -\infty\leq x\leq \infty, y = \textrm{NaN}\\ y & \mbox{if } -\infty\leq y\leq \infty, x = \textrm{NaN}\\ \textrm{NaN} & \mbox{if } x, y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fmin}(x, y)}{\partial x} = \begin{cases} 1 & \mbox{if } x \leq y \\ 0 & \mbox{if } x > y \\[6pt] 1 & \mbox{if } -\infty\leq x\leq \infty, y = \textrm{NaN}\\ 0 & \mbox{if } -\infty\leq y\leq \infty, x = \textrm{NaN}\\ \textrm{NaN} & \mbox{if } x, y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fmin}(x, y)}{\partial y} = \begin{cases} 0 & \mbox{if } x \leq y \\ 1 & \mbox{if } x > y \\[6pt] 0 & \mbox{if } -\infty\leq x\leq \infty, y = \textrm{NaN}\\ 1 & \mbox{if } -\infty\leq y\leq \infty, x = \textrm{NaN}\\ \textrm{NaN} & \mbox{if } x, y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable.
bSecond variable.
Returns
If the first variable's value is smaller than the second's, the first variable, otherwise the second variable.

Definition at line 57 of file fmin.hpp.

◆ fmin() [6/7]

var stan::math::fmin ( const var a,
double  b 
)
inline

Returns the minimum of the variable and scalar, promoting the scalar to a variable if it is larger (C99).

For fmin(a, b), if a's value is less than or equal to b, then a is returned, otherwise a fresh variable wrapping b is returned.

Parameters
aFirst variable.
bSecond value
Returns
If the first variable's value is less than or equal to the second value, the first variable, otherwise the second value promoted to a fresh variable.

Definition at line 83 of file fmin.hpp.

◆ fmin() [7/7]

var stan::math::fmin ( double  a,
const var b 
)
inline

Returns the minimum of a scalar and variable, promoting the scalar to a variable if it is larger (C99).

For fmin(a, b), if a is less than b's value, then a fresh variable implementation wrapping a is returned, otherwise b is returned.

Parameters
aFirst value.
bSecond variable.
Returns
If the first value is smaller than the second variable's value, return the first value promoted to a variable, otherwise return the second variable.

Definition at line 108 of file fmin.hpp.

◆ fmod() [1/6]

template<typename T >
fvar<T> stan::math::fmod ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 14 of file fmod.hpp.

◆ fmod() [2/6]

template<typename T >
fvar<T> stan::math::fmod ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 22 of file fmod.hpp.

◆ fmod() [3/6]

template<typename T >
fvar<T> stan::math::fmod ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 31 of file fmod.hpp.

◆ fmod() [4/6]

var stan::math::fmod ( const var a,
const var b 
)
inline

Return the floating point remainder after dividing the first variable by the second (cmath).

The partial derivatives with respect to the variables are defined everywhere but where $x = y$, but we set these to match other values, with

$\frac{\partial}{\partial x} \mbox{fmod}(x, y) = 1$, and

$\frac{\partial}{\partial y} \mbox{fmod}(x, y) = -\lfloor \frac{x}{y} \rfloor$.

\[ \mbox{fmod}(x, y) = \begin{cases} x - \lfloor \frac{x}{y}\rfloor y & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fmod}(x, y)}{\partial x} = \begin{cases} 1 & \mbox{if } -\infty\leq x, y\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fmod}(x, y)}{\partial y} = \begin{cases} -\lfloor \frac{x}{y}\rfloor & \mbox{if } -\infty\leq x, y\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable.
bSecond variable.
Returns
Floating pointer remainder of dividing the first variable by the second.

Definition at line 99 of file fmod.hpp.

◆ fmod() [5/6]

var stan::math::fmod ( const var a,
double  b 
)
inline

Return the floating point remainder after dividing the the first variable by the second scalar (cmath).

The derivative with respect to the variable is

$\frac{d}{d x} \mbox{fmod}(x, c) = \frac{1}{c}$.

Parameters
aFirst variable.
bSecond scalar.
Returns
Floating pointer remainder of dividing the first variable by the second scalar.

Definition at line 116 of file fmod.hpp.

◆ fmod() [6/6]

var stan::math::fmod ( double  a,
const var b 
)
inline

Return the floating point remainder after dividing the first scalar by the second variable (cmath).

The derivative with respect to the variable is

$\frac{d}{d y} \mbox{fmod}(c, y) = -\lfloor \frac{c}{y} \rfloor$.

Parameters
aFirst scalar.
bSecond variable.
Returns
Floating pointer remainder of dividing first scalar by the second variable.

Definition at line 133 of file fmod.hpp.

◆ frechet_ccdf_log()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::frechet_ccdf_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)
Deprecated:
use frechet_lccdf

Definition at line 14 of file frechet_ccdf_log.hpp.

◆ frechet_cdf()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::frechet_cdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)

Definition at line 23 of file frechet_cdf.hpp.

◆ frechet_cdf_log()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::frechet_cdf_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)
Deprecated:
use frechet_lcdf

Definition at line 14 of file frechet_cdf_log.hpp.

◆ frechet_lccdf()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::frechet_lccdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)

Definition at line 23 of file frechet_lccdf.hpp.

◆ frechet_lcdf()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::frechet_lcdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)

Definition at line 23 of file frechet_lcdf.hpp.

◆ frechet_log() [1/2]

template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::frechet_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)
Deprecated:
use frechet_lpdf

Definition at line 14 of file frechet_log.hpp.

◆ frechet_log() [2/2]

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::frechet_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)
inline
Deprecated:
use frechet_lpdf

Definition at line 23 of file frechet_log.hpp.

◆ frechet_lpdf() [1/2]

template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::frechet_lpdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)

Definition at line 25 of file frechet_lpdf.hpp.

◆ frechet_lpdf() [2/2]

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::frechet_lpdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)
inline

Definition at line 117 of file frechet_lpdf.hpp.

◆ frechet_rng()

template<typename T_shape , typename T_scale , class RNG >
VectorBuilder<true, double, T_shape, T_scale>::type stan::math::frechet_rng ( const T_shape &  alpha,
const T_scale &  sigma,
RNG &  rng 
)
inline

Return a pseudorandom Frechet variate for the given shape and scale parameters using the specified random number generator.

alpha and sigma can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_shapeType of shape parameter
T_scaleType of scale parameter
RNGtype of random number generator
Parameters
alpha(Sequence of) positive shape parameter(s)
sigma(Sequence of) positive scale parameter(s)
rngrandom number generator
Returns
(Sequence of) Frechet random variate(s)
Exceptions
std::domain_errorif alpha is nonpositive or sigma is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 31 of file frechet_rng.hpp.

◆ from_matrix_cl()

T stan::math::from_matrix_cl ( const matrix_cl src)
inline

Copies the source matrix that is stored on the OpenCL device to the destination Eigen matrix.

Copy A 1 by 1 source matrix from the Device to the host.

Parameters
srcsource matrix on the OpenCL device
Returns
Eigen matrix with a copy of the data in the source matrix
Template Parameters
TAn arithmetic type to pass the value from the OpenCL matrix to.
Parameters
srcA 1x1 matrix on the device.
Returns
dst Arithmetic to receive the matrix_cl value.

Reads the contents of the OpenCL buffer starting at the offset 0 to the Eigen matrix CL_TRUE denotes that the call is blocking We do not want to pass data back to the CPU until all of the jobs called on the source matrix are finished.

Definition at line 70 of file copy.hpp.

◆ gamma_ccdf_log()

template<typename T_y , typename T_shape , typename T_inv_scale >
return_type<T_y, T_shape, T_inv_scale>::type stan::math::gamma_ccdf_log ( const T_y &  y,
const T_shape &  alpha,
const T_inv_scale &  beta 
)
Deprecated:
use gamma_lccdf

Definition at line 14 of file gamma_ccdf_log.hpp.

◆ gamma_cdf()

template<typename T_y , typename T_shape , typename T_inv_scale >
return_type<T_y, T_shape, T_inv_scale>::type stan::math::gamma_cdf ( const T_y &  y,
const T_shape &  alpha,
const T_inv_scale &  beta 
)

The cumulative density function for a gamma distribution for y with the specified shape and inverse scale parameters.

Parameters
yA scalar variable.
alphaShape parameter.
betaInverse scale parameter.
Exceptions
std::domain_errorif alpha is not greater than 0.
std::domain_errorif beta is not greater than 0.
std::domain_errorif y is not greater than or equal to 0.
Template Parameters
T_yType of scalar.
T_shapeType of shape.
T_inv_scaleType of inverse scale.

Definition at line 42 of file gamma_cdf.hpp.

◆ gamma_cdf_log()

template<typename T_y , typename T_shape , typename T_inv_scale >
return_type<T_y, T_shape, T_inv_scale>::type stan::math::gamma_cdf_log ( const T_y &  y,
const T_shape &  alpha,
const T_inv_scale &  beta 
)
Deprecated:
use gamma_lcdf

Definition at line 14 of file gamma_cdf_log.hpp.

◆ gamma_lccdf()

template<typename T_y , typename T_shape , typename T_inv_scale >
return_type<T_y, T_shape, T_inv_scale>::type stan::math::gamma_lccdf ( const T_y &  y,
const T_shape &  alpha,
const T_inv_scale &  beta 
)

Definition at line 23 of file gamma_lccdf.hpp.

◆ gamma_lcdf()

template<typename T_y , typename T_shape , typename T_inv_scale >
return_type<T_y, T_shape, T_inv_scale>::type stan::math::gamma_lcdf ( const T_y &  y,
const T_shape &  alpha,
const T_inv_scale &  beta 
)

Definition at line 23 of file gamma_lcdf.hpp.

◆ gamma_log() [1/2]

template<bool propto, typename T_y , typename T_shape , typename T_inv_scale >
return_type<T_y, T_shape, T_inv_scale>::type stan::math::gamma_log ( const T_y &  y,
const T_shape &  alpha,
const T_inv_scale &  beta 
)

The log of a gamma density for y with the specified shape and inverse scale parameters.

Shape and inverse scale parameters must be greater than 0. y must be greater than or equal to 0.

\begin{eqnarray*} y &\sim& \mbox{\sf{Gamma}}(\alpha, \beta) \\ \log (p (y \, |\, \alpha, \beta) ) &=& \log \left( \frac{\beta^\alpha}{\Gamma(\alpha)} y^{\alpha - 1} \exp^{- \beta y} \right) \\ &=& \alpha \log(\beta) - \log(\Gamma(\alpha)) + (\alpha - 1) \log(y) - \beta y\\ & & \mathrm{where} \; y > 0 \end{eqnarray*}

Deprecated:
use gamma_lpdf
Parameters
yA scalar variable.
alphaShape parameter.
betaInverse scale parameter.
Exceptions
std::domain_errorif alpha is not greater than 0.
std::domain_errorif beta is not greater than 0.
std::domain_errorif y is not greater than or equal to 0.
Template Parameters
T_yType of scalar.
T_shapeType of shape.
T_inv_scaleType of inverse scale.

Definition at line 36 of file gamma_log.hpp.

◆ gamma_log() [2/2]

template<typename T_y , typename T_shape , typename T_inv_scale >
return_type<T_y, T_shape, T_inv_scale>::type stan::math::gamma_log ( const T_y &  y,
const T_shape &  alpha,
const T_inv_scale &  beta 
)
inline
Deprecated:
use gamma_lpdf

Definition at line 45 of file gamma_log.hpp.

◆ gamma_lpdf() [1/2]

template<bool propto, typename T_y , typename T_shape , typename T_inv_scale >
return_type<T_y, T_shape, T_inv_scale>::type stan::math::gamma_lpdf ( const T_y &  y,
const T_shape &  alpha,
const T_inv_scale &  beta 
)

The log of a gamma density for y with the specified shape and inverse scale parameters.

Shape and inverse scale parameters must be greater than 0. y must be greater than or equal to 0.

\begin{eqnarray*} y &\sim& \mbox{\sf{Gamma}}(\alpha, \beta) \\ \log (p (y \, |\, \alpha, \beta) ) &=& \log \left( \frac{\beta^\alpha}{\Gamma(\alpha)} y^{\alpha - 1} \exp^{- \beta y} \right) \\ &=& \alpha \log(\beta) - \log(\Gamma(\alpha)) + (\alpha - 1) \log(y) - \beta y\\ & & \mathrm{where} \; y > 0 \end{eqnarray*}

Parameters
yA scalar variable.
alphaShape parameter.
betaInverse scale parameter.
Exceptions
std::domain_errorif alpha is not greater than 0.
std::domain_errorif beta is not greater than 0.
std::domain_errorif y is not greater than or equal to 0.
Template Parameters
T_yType of scalar.
T_shapeType of shape.
T_inv_scaleType of inverse scale.

Definition at line 42 of file gamma_lpdf.hpp.

◆ gamma_lpdf() [2/2]

template<typename T_y , typename T_shape , typename T_inv_scale >
return_type<T_y, T_shape, T_inv_scale>::type stan::math::gamma_lpdf ( const T_y &  y,
const T_shape &  alpha,
const T_inv_scale &  beta 
)
inline

Definition at line 133 of file gamma_lpdf.hpp.

◆ gamma_p() [1/7]

template<typename T >
fvar<T> stan::math::gamma_p ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 15 of file gamma_p.hpp.

◆ gamma_p() [2/7]

template<typename T >
fvar<T> stan::math::gamma_p ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 32 of file gamma_p.hpp.

◆ gamma_p() [3/7]

template<typename T >
fvar<T> stan::math::gamma_p ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 45 of file gamma_p.hpp.

◆ gamma_p() [4/7]

double stan::math::gamma_p ( double  x,
double  a 
)
inline

\[ \mbox{gamma\_p}(a, z) = \begin{cases} \textrm{error} & \mbox{if } a\leq 0 \textrm{ or } z < 0\\ P(a, z) & \mbox{if } a > 0, z \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } a = \textrm{NaN or } z = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{gamma\_p}(a, z)}{\partial a} = \begin{cases} \textrm{error} & \mbox{if } a\leq 0 \textrm{ or } z < 0\\ \frac{\partial\, P(a, z)}{\partial a} & \mbox{if } a > 0, z \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } a = \textrm{NaN or } z = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{gamma\_p}(a, z)}{\partial z} = \begin{cases} \textrm{error} & \mbox{if } a\leq 0 \textrm{ or } z < 0\\ \frac{\partial\, P(a, z)}{\partial z} & \mbox{if } a > 0, z \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } a = \textrm{NaN or } z = \textrm{NaN} \end{cases} \]

\[ P(a, z)=\frac{1}{\Gamma(a)}\int_0^zt^{a-1}e^{-t}dt \]

\[ \frac{\partial \, P(a, z)}{\partial a} = -\frac{\Psi(a)}{\Gamma^2(a)}\int_0^zt^{a-1}e^{-t}dt + \frac{1}{\Gamma(a)}\int_0^z (a-1)t^{a-2}e^{-t}dt \]

\[ \frac{\partial \, P(a, z)}{\partial z} = \frac{z^{a-1}e^{-z}}{\Gamma(a)} \]

Exceptions
domain_errorif x is at pole

Definition at line 55 of file gamma_p.hpp.

◆ gamma_p() [5/7]

var stan::math::gamma_p ( const var a,
const var b 
)
inline

Definition at line 98 of file gamma_p.hpp.

◆ gamma_p() [6/7]

var stan::math::gamma_p ( const var a,
double  b 
)
inline

Definition at line 102 of file gamma_p.hpp.

◆ gamma_p() [7/7]

var stan::math::gamma_p ( double  a,
const var b 
)
inline

Definition at line 106 of file gamma_p.hpp.

◆ gamma_q() [1/7]

template<typename T >
fvar<T> stan::math::gamma_q ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 13 of file gamma_q.hpp.

◆ gamma_q() [2/7]

template<typename T >
fvar<T> stan::math::gamma_q ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 45 of file gamma_q.hpp.

◆ gamma_q() [3/7]

var stan::math::gamma_q ( const var a,
const var b 
)
inline

Definition at line 50 of file gamma_q.hpp.

◆ gamma_q() [4/7]

var stan::math::gamma_q ( const var a,
double  b 
)
inline

Definition at line 54 of file gamma_q.hpp.

◆ gamma_q() [5/7]

double stan::math::gamma_q ( double  x,
double  a 
)
inline

\[ \mbox{gamma\_q}(a, z) = \begin{cases} \textrm{error} & \mbox{if } a\leq 0 \textrm{ or } z < 0\\ Q(a, z) & \mbox{if } a > 0, z \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } a = \textrm{NaN or } z = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{gamma\_q}(a, z)}{\partial a} = \begin{cases} \textrm{error} & \mbox{if } a\leq 0 \textrm{ or } z < 0\\ \frac{\partial\, Q(a, z)}{\partial a} & \mbox{if } a > 0, z \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } a = \textrm{NaN or } z = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{gamma\_q}(a, z)}{\partial z} = \begin{cases} \textrm{error} & \mbox{if } a\leq 0 \textrm{ or } z < 0\\ \frac{\partial\, Q(a, z)}{\partial z} & \mbox{if } a > 0, z \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } a = \textrm{NaN or } z = \textrm{NaN} \end{cases} \]

\[ Q(a, z)=\frac{1}{\Gamma(a)}\int_z^\infty t^{a-1}e^{-t}dt \]

\[ \frac{\partial \, Q(a, z)}{\partial a} = -\frac{\Psi(a)}{\Gamma^2(a)}\int_z^\infty t^{a-1}e^{-t}dt + \frac{1}{\Gamma(a)}\int_z^\infty (a-1)t^{a-2}e^{-t}dt \]

\[ \frac{\partial \, Q(a, z)}{\partial z} = -\frac{z^{a-1}e^{-z}}{\Gamma(a)} \]

Exceptions
domain_errorif x is at pole

Definition at line 54 of file gamma_q.hpp.

◆ gamma_q() [6/7]

var stan::math::gamma_q ( double  a,
const var b 
)
inline

Definition at line 58 of file gamma_q.hpp.

◆ gamma_q() [7/7]

template<typename T >
fvar<T> stan::math::gamma_q ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 76 of file gamma_q.hpp.

◆ gamma_rng()

template<typename T_shape , typename T_inv , class RNG >
VectorBuilder<true, double, T_shape, T_inv>::type stan::math::gamma_rng ( const T_shape &  alpha,
const T_inv &  beta,
RNG &  rng 
)
inline

Return a gamma random variate for the given shape and inverse scale parameters using the specified random number generator.

alpha and beta can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_shapeType of shape parameter
T_invType of inverse scale parameter
RNGtype of random number generator
Parameters
alpha(Sequence of) positive shape parameter(s)
beta(Sequence of) positive inverse scale parameter(s)
rngrandom number generator
Returns
(Sequence of) gamma random variate(s)
Exceptions
std::domain_errorif alpha or beta are nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 33 of file gamma_rng.hpp.

◆ gaussian_dlm_obs_log() [1/4]

template<bool propto, typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type<T_F, T_G, T_V, T_W, T_m0, T_C0>::type>::type stan::math::gaussian_dlm_obs_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &  F,
const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &  G,
const Eigen::Matrix< T_V, Eigen::Dynamic, Eigen::Dynamic > &  V,
const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &  W,
const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &  m0,
const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &  C0 
)

The log of a Gaussian dynamic linear model (GDLM).

This distribution is equivalent to, for $t = 1:T$,

\begin{eqnarray*} y_t & \sim N(F' \theta_t, V) \\ \theta_t & \sim N(G \theta_{t-1}, W) \\ \theta_0 & \sim N(m_0, C_0) \end{eqnarray*}

If V is a vector, then the Kalman filter is applied sequentially.

Deprecated:
use gaussian_dlm_obs_lpdf
Parameters
yA r x T matrix of observations. Rows are variables, columns are observations.
FA n x r matrix. The design matrix.
GA n x n matrix. The transition matrix.
VA r x r matrix. The observation covariance matrix.
WA n x n matrix. The state covariance matrix.
m0A n x 1 matrix. The mean vector of the distribution of the initial state.
C0A n x n matrix. The covariance matrix of the distribution of the initial state.
Returns
The log of the joint density of the GDLM.
Exceptions
std::domain_errorif a matrix in the Kalman filter is not positive semi-definite.
Template Parameters
T_yType of scalar.
T_FType of design matrix.
T_GType of transition matrix.
T_VType of observation covariance matrix.
T_WType of state covariance matrix.
T_m0Type of initial state mean vector.
T_C0Type of initial state covariance matrix.

Definition at line 49 of file gaussian_dlm_obs_log.hpp.

◆ gaussian_dlm_obs_log() [2/4]

template<typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type<T_F, T_G, T_V, T_W, T_m0, T_C0>::type>::type stan::math::gaussian_dlm_obs_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &  F,
const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &  G,
const Eigen::Matrix< T_V, Eigen::Dynamic, Eigen::Dynamic > &  V,
const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &  W,
const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &  m0,
const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &  C0 
)
inline
Deprecated:
use gaussian_dlm_obs_lpdf

Definition at line 68 of file gaussian_dlm_obs_log.hpp.

◆ gaussian_dlm_obs_log() [3/4]

template<bool propto, typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type<T_F, T_G, T_V, T_W, T_m0, T_C0>::type>::type stan::math::gaussian_dlm_obs_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &  F,
const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &  G,
const Eigen::Matrix< T_V, Eigen::Dynamic, 1 > &  V,
const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &  W,
const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &  m0,
const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &  C0 
)

The log of a Gaussian dynamic linear model (GDLM) with uncorrelated observation disturbances.

This distribution is equivalent to, for $t = 1:T$,

\begin{eqnarray*} y_t & \sim N(F' \theta_t, diag(V)) \\ \theta_t & \sim N(G \theta_{t-1}, W) \\ \theta_0 & \sim N(m_0, C_0) \end{eqnarray*}

If V is a vector, then the Kalman filter is applied sequentially.

Deprecated:
use gaussian_dlm_obs_lpdf
Parameters
yA r x T matrix of observations. Rows are variables, columns are observations.
FA n x r matrix. The design matrix.
GA n x n matrix. The transition matrix.
VA size r vector. The diagonal of the observation covariance matrix.
WA n x n matrix. The state covariance matrix.
m0A n x 1 matrix. The mean vector of the distribution of the initial state.
C0A n x n matrix. The covariance matrix of the distribution of the initial state.
Returns
The log of the joint density of the GDLM.
Exceptions
std::domain_errorif a matrix in the Kalman filter is not semi-positive definite.
Template Parameters
T_yType of scalar.
T_FType of design matrix.
T_GType of transition matrix.
T_VType of observation variances
T_WType of state covariance matrix.
T_m0Type of initial state mean vector.
T_C0Type of initial state covariance matrix.

Definition at line 121 of file gaussian_dlm_obs_log.hpp.

◆ gaussian_dlm_obs_log() [4/4]

template<typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type<T_F, T_G, T_V, T_W, T_m0, T_C0>::type>::type stan::math::gaussian_dlm_obs_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &  F,
const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &  G,
const Eigen::Matrix< T_V, Eigen::Dynamic, 1 > &  V,
const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &  W,
const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &  m0,
const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &  C0 
)
inline
Deprecated:
use gaussian_dlm_obs_lpdf

Definition at line 140 of file gaussian_dlm_obs_log.hpp.

◆ gaussian_dlm_obs_lpdf() [1/4]

template<bool propto, typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type<T_F, T_G, T_V, T_W, T_m0, T_C0>::type>::type stan::math::gaussian_dlm_obs_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &  F,
const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &  G,
const Eigen::Matrix< T_V, Eigen::Dynamic, Eigen::Dynamic > &  V,
const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &  W,
const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &  m0,
const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &  C0 
)

The log of a Gaussian dynamic linear model (GDLM).

This distribution is equivalent to, for $t = 1:T$,

\begin{eqnarray*} y_t & \sim N(F' \theta_t, V) \\ \theta_t & \sim N(G \theta_{t-1}, W) \\ \theta_0 & \sim N(m_0, C_0) \end{eqnarray*}

If V is a vector, then the Kalman filter is applied sequentially.

Parameters
yA r x T matrix of observations. Rows are variables, columns are observations.
FA n x r matrix. The design matrix.
GA n x n matrix. The transition matrix.
VA r x r matrix. The observation covariance matrix.
WA n x n matrix. The state covariance matrix.
m0A n x 1 matrix. The mean vector of the distribution of the initial state.
C0A n x n matrix. The covariance matrix of the distribution of the initial state.
Returns
The log of the joint density of the GDLM.
Exceptions
std::domain_errorif a matrix in the Kalman filter is not positive semi-definite.
Template Parameters
T_yType of scalar.
T_FType of design matrix.
T_GType of transition matrix.
T_VType of observation covariance matrix.
T_WType of state covariance matrix.
T_m0Type of initial state mean vector.
T_C0Type of initial state covariance matrix.

Definition at line 70 of file gaussian_dlm_obs_lpdf.hpp.

◆ gaussian_dlm_obs_lpdf() [2/4]

template<typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type<T_F, T_G, T_V, T_W, T_m0, T_C0>::type>::type stan::math::gaussian_dlm_obs_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &  F,
const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &  G,
const Eigen::Matrix< T_V, Eigen::Dynamic, Eigen::Dynamic > &  V,
const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &  W,
const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &  m0,
const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &  C0 
)
inline

Definition at line 170 of file gaussian_dlm_obs_lpdf.hpp.

◆ gaussian_dlm_obs_lpdf() [3/4]

template<bool propto, typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type<T_F, T_G, T_V, T_W, T_m0, T_C0>::type>::type stan::math::gaussian_dlm_obs_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &  F,
const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &  G,
const Eigen::Matrix< T_V, Eigen::Dynamic, 1 > &  V,
const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &  W,
const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &  m0,
const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &  C0 
)

The log of a Gaussian dynamic linear model (GDLM) with uncorrelated observation disturbances.

This distribution is equivalent to, for $t = 1:T$,

\begin{eqnarray*} y_t & \sim N(F' \theta_t, diag(V)) \\ \theta_t & \sim N(G \theta_{t-1}, W) \\ \theta_0 & \sim N(m_0, C_0) \end{eqnarray*}

If V is a vector, then the Kalman filter is applied sequentially.

Parameters
yA r x T matrix of observations. Rows are variables, columns are observations.
FA n x r matrix. The design matrix.
GA n x n matrix. The transition matrix.
VA size r vector. The diagonal of the observation covariance matrix.
WA n x n matrix. The state covariance matrix.
m0A n x 1 matrix. The mean vector of the distribution of the initial state.
C0A n x n matrix. The covariance matrix of the distribution of the initial state.
Returns
The log of the joint density of the GDLM.
Exceptions
std::domain_errorif a matrix in the Kalman filter is not semi-positive definite.
Template Parameters
T_yType of scalar.
T_FType of design matrix.
T_GType of transition matrix.
T_VType of observation variances
T_WType of state covariance matrix.
T_m0Type of initial state mean vector.
T_C0Type of initial state covariance matrix.

Definition at line 220 of file gaussian_dlm_obs_lpdf.hpp.

◆ gaussian_dlm_obs_lpdf() [4/4]

template<typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type< T_y, typename return_type<T_F, T_G, T_V, T_W, T_m0, T_C0>::type>::type stan::math::gaussian_dlm_obs_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_F, Eigen::Dynamic, Eigen::Dynamic > &  F,
const Eigen::Matrix< T_G, Eigen::Dynamic, Eigen::Dynamic > &  G,
const Eigen::Matrix< T_V, Eigen::Dynamic, 1 > &  V,
const Eigen::Matrix< T_W, Eigen::Dynamic, Eigen::Dynamic > &  W,
const Eigen::Matrix< T_m0, Eigen::Dynamic, 1 > &  m0,
const Eigen::Matrix< T_C0, Eigen::Dynamic, Eigen::Dynamic > &  C0 
)
inline

Definition at line 332 of file gaussian_dlm_obs_lpdf.hpp.

◆ gaussian_dlm_obs_rng() [1/2]

template<class RNG >
Eigen::MatrixXd stan::math::gaussian_dlm_obs_rng ( const Eigen::MatrixXd &  F,
const Eigen::MatrixXd &  G,
const Eigen::MatrixXd &  V,
const Eigen::MatrixXd &  W,
const Eigen::VectorXd &  m0,
const Eigen::MatrixXd &  C0,
const int  T,
RNG &  rng 
)
inline

Simulate random draw from Gaussian dynamic linear model (GDLM).

This distribution is equivalent to, for $t = 1:T$,

\begin{eqnarray*} y_t & \sim N(F' \theta_t, V) \\ \theta_t & \sim N(G \theta_{t-1}, W) \\ \theta_0 & \sim N(m_0, C_0) \end{eqnarray*}

Template Parameters
RNGType of pseudo-random number generator.
Parameters
FA n x r matrix. The design matrix.
GA n x n matrix. The transition matrix.
VA r x r matrix. The observation covariance matrix.
WA n x n matrix. The state covariance matrix.
m0A n x 1 matrix. The mean vector of the distribution of the initial state.
C0A n x n matrix. The covariance matrix of the distribution of the initial state.
Ta positive integer, how many timesteps to simulate.
rngPseudo-random number generator.
Returns
A r x T matrix of simulated observations. Rows are variables, columns are observations. First column is the state after the first transition. Last column is the state after the last transition. Initial state not returned.
Exceptions
std::domain_errorif a matrix is not symmetric or not positive semi-definite. Or throw std::invalid_argument if a size is wrong or any input is NaN or non-finite, or if T is not positive. Require C0 in particular to be strictly positive definite. V and W can be semidefinite.

Definition at line 126 of file gaussian_dlm_obs_rng.hpp.

◆ gaussian_dlm_obs_rng() [2/2]

template<class RNG >
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> stan::math::gaussian_dlm_obs_rng ( const Eigen::MatrixXd &  F,
const Eigen::MatrixXd &  G,
const Eigen::VectorXd &  V,
const Eigen::MatrixXd &  W,
const Eigen::VectorXd &  m0,
const Eigen::MatrixXd &  C0,
const int  T,
RNG &  rng 
)
inline

Definition at line 181 of file gaussian_dlm_obs_rng.hpp.

◆ get_base1() [1/12]

template<typename T >
const T& stan::math::get_base1 ( const std::vector< T > &  x,
size_t  i,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one index.

If the index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
iIndex into vector plus 1.
error_msgError message if the index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at i - 1
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 27 of file get_base1.hpp.

◆ get_base1() [2/12]

template<typename T >
const T& stan::math::get_base1 ( const std::vector< std::vector< T > > &  x,
size_t  i1,
size_t  i2,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 50 of file get_base1.hpp.

◆ get_base1() [3/12]

template<typename T >
const T& stan::math::get_base1 ( const std::vector< std::vector< std::vector< T > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 74 of file get_base1.hpp.

◆ get_base1() [4/12]

template<typename T >
const T& stan::math::get_base1 ( const std::vector< std::vector< std::vector< std::vector< T > > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
i4Fourth index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 100 of file get_base1.hpp.

◆ get_base1() [5/12]

template<typename T >
const T& stan::math::get_base1 ( const std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
i4Fourth index plus 1.
i5Fifth index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 128 of file get_base1.hpp.

◆ get_base1() [6/12]

template<typename T >
const T& stan::math::get_base1 ( const std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5,
size_t  i6,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
i4Fourth index plus 1.
i5Fifth index plus 1.
i6Sixth index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 158 of file get_base1.hpp.

◆ get_base1() [7/12]

template<typename T >
const T& stan::math::get_base1 ( const std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5,
size_t  i6,
size_t  i7,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
i4Fourth index plus 1.
i5Fifth index plus 1.
i6Sixth index plus 1.
i7Seventh index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 189 of file get_base1.hpp.

◆ get_base1() [8/12]

template<typename T >
const T& stan::math::get_base1 ( const std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5,
size_t  i6,
size_t  i7,
size_t  i8,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
i4Fourth index plus 1.
i5Fifth index plus 1.
i6Sixth index plus 1.
i7Seventh index plus 1.
i8Eigth index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 221 of file get_base1.hpp.

◆ get_base1() [9/12]

template<typename T >
Eigen::Matrix<T, 1, Eigen::Dynamic> stan::math::get_base1 ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  x,
size_t  m,
const char *  error_msg,
size_t  idx 
)
inline

Return a copy of the row of the specified vector at the specified base-one row index.

If the index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Warning: Because a copy is involved, it is inefficient to access element of matrices by first using this method to get a row then using a second call to get the value at a specified column.

Parameters
xMatrix from which to get a row
mIndex into matrix plus 1.
error_msgError message if the index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Row of matrix at i - 1.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 251 of file get_base1.hpp.

◆ get_base1() [10/12]

template<typename T >
const T& stan::math::get_base1 ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  x,
size_t  m,
size_t  n,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified matrix at the specified base-one row and column indexes.

If either index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xMatrix from which to get a row
mRow index plus 1.
nColumn index plus 1.
error_msgError message if either index is out of range.
idxNested index level to report in error message if either index is out of range.
Returns
Value of matrix at row m - 1 and column n - 1.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 276 of file get_base1.hpp.

◆ get_base1() [11/12]

template<typename T >
const T& stan::math::get_base1 ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
size_t  m,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified column vector at the specified base-one index.

If the index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xColumn vector from which to get a value.
mRow index plus 1.
error_msgError message if the index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of column vector at row m - 1.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 300 of file get_base1.hpp.

◆ get_base1() [12/12]

template<typename T >
const T& stan::math::get_base1 ( const Eigen::Matrix< T, 1, Eigen::Dynamic > &  x,
size_t  n,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified row vector at the specified base-one index.

If the index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xRow vector from which to get a value.
nColumn index plus 1.
error_msgError message if the index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of row vector at column n - 1.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 322 of file get_base1.hpp.

◆ get_base1_lhs() [1/12]

template<typename T >
T& stan::math::get_base1_lhs ( std::vector< T > &  x,
size_t  i,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one index.

If the index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
iIndex into vector plus 1.
error_msgError message if the index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at i - 1
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 27 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [2/12]

template<typename T >
T& stan::math::get_base1_lhs ( std::vector< std::vector< T > > &  x,
size_t  i1,
size_t  i2,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 50 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [3/12]

template<typename T >
T& stan::math::get_base1_lhs ( std::vector< std::vector< std::vector< T > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 74 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [4/12]

template<typename T >
T& stan::math::get_base1_lhs ( std::vector< std::vector< std::vector< std::vector< T > > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
i4Fourth index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 100 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [5/12]

template<typename T >
T& stan::math::get_base1_lhs ( std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
i4Fourth index plus 1.
i5Fifth index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 127 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [6/12]

template<typename T >
T& stan::math::get_base1_lhs ( std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5,
size_t  i6,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
i4Fourth index plus 1.
i5Fifth index plus 1.
i6Sixth index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 156 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [7/12]

template<typename T >
T& stan::math::get_base1_lhs ( std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5,
size_t  i6,
size_t  i7,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
i4Fourth index plus 1.
i5Fifth index plus 1.
i6Sixth index plus 1.
i7Seventh index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 187 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [8/12]

template<typename T >
T& stan::math::get_base1_lhs ( std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > > &  x,
size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5,
size_t  i6,
size_t  i7,
size_t  i8,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified vector at the specified base-one indexes.

If an index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xVector from which to get a value.
i1First index plus 1.
i2Second index plus 1.
i3Third index plus 1.
i4Fourth index plus 1.
i5Fifth index plus 1.
i6Sixth index plus 1.
i7Seventh index plus 1.
i8Eigth index plus 1.
error_msgError message if an index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of vector at indexes.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 219 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [9/12]

template<typename T >
Eigen::Block<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> > stan::math::get_base1_lhs ( Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  x,
size_t  m,
const char *  error_msg,
size_t  idx 
)
inline

Return a copy of the row of the specified vector at the specified base-one row index.

If the index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Warning: Because a copy is involved, it is inefficient to access element of matrices by first using this method to get a row then using a second call to get the value at a specified column.

Parameters
xMatrix from which to get a row
mIndex into matrix plus 1.
error_msgError message if the index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Row of matrix at i - 1.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 251 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [10/12]

template<typename T >
T& stan::math::get_base1_lhs ( Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  x,
size_t  m,
size_t  n,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified matrix at the specified base-one row and column indexes.

If either index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xMatrix from which to get a row
mRow index plus 1.
nColumn index plus 1.
error_msgError message if either index is out of range.
idxNested index level to report in error message if either index is out of range.
Returns
Value of matrix at row m - 1 and column n - 1.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 275 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [11/12]

template<typename T >
T& stan::math::get_base1_lhs ( Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
size_t  m,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified column vector at the specified base-one index.

If the index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xColumn vector from which to get a value.
mRow index plus 1.
error_msgError message if the index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of column vector at row m - 1.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 298 of file get_base1_lhs.hpp.

◆ get_base1_lhs() [12/12]

template<typename T >
T& stan::math::get_base1_lhs ( Eigen::Matrix< T, 1, Eigen::Dynamic > &  x,
size_t  n,
const char *  error_msg,
size_t  idx 
)
inline

Return a reference to the value of the specified row vector at the specified base-one index.

If the index is out of range, throw a std::out_of_range exception with the specified error message and index indicated.

Parameters
xRow vector from which to get a value.
nColumn index plus 1.
error_msgError message if the index is out of range.
idxNested index level to report in error message if the index is out of range.
Returns
Value of row vector at column n - 1.
Template Parameters
Ttype of value.
Exceptions
std::out_of_rangeif idx is out of range.

Definition at line 320 of file get_base1_lhs.hpp.

◆ get_lp()

template<typename T_lp , typename T_lp_accum >
boost::math::tools::promote_args<T_lp, T_lp_accum>::type stan::math::get_lp ( const T_lp &  lp,
const accumulator< T_lp_accum > &  lp_accum 
)
inline

Definition at line 11 of file get_lp.hpp.

◆ gp_dot_prod_cov() [1/4]

template<typename T_x , typename T_sigma >
Eigen::Matrix<typename return_type<T_x, T_sigma>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_dot_prod_cov ( const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 >> &  x,
const T_sigma &  sigma 
)

Returns a dot product covariance matrix.

A member of Stan's Gaussian Process Library.

$k(x,x') = \sigma^2 + x \cdot x'$

A dot product covariance matrix is the same covariance matrix as in bayesian regression with $N(0,1)$ priors on regression coefficients and a $N(0,\sigma^2)$ prior on the constant function. See Rasmussen and Williams et al 2006, Chapter 4.

Template Parameters
T_xtype of std::vector of elements
T_sigmatype of sigma
Parameters
xstd::vector of elements that can be used in dot product. This function assumes each element of x is the same size.
sigmaconstant function that can be used in stan::math::square
Returns
dot product covariance matrix that is positive semi-definite
Exceptions
std::domain_errorif sigma < 0, nan, inf or x is nan or infinite

Definition at line 41 of file gp_dot_prod_cov.hpp.

◆ gp_dot_prod_cov() [2/4]

template<typename T_x , typename T_sigma >
Eigen::Matrix<typename return_type<T_x, T_sigma>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_dot_prod_cov ( const std::vector< T_x > &  x,
const T_sigma &  sigma 
)

Returns a dot product covariance matrix.

A member of Stan's Gaussian Process Library.

$k(x,x') = \sigma^2 + x \cdot x'$

A dot product covariance matrix is the same covariance matrix as in bayesian regression with $N(0,1)$ priors on regression coefficients and a $N(0,\sigma^2)$ prior on the constant function. See Rasmussen and Williams et al 2006, Chapter 4.

Template Parameters
T_xtype of std::vector of double
T_sigmatype of sigma
Parameters
xstd::vector of elements that can be used in transpose and multiply This function assumes each element of x is the same size.
sigmaconstant function that can be used in stan::math::square
Returns
dot product covariance matrix that is positive semi-definite
Exceptions
std::domain_errorif sigma < 0, nan, inf or x is nan or infinite

Definition at line 97 of file gp_dot_prod_cov.hpp.

◆ gp_dot_prod_cov() [3/4]

template<typename T_x1 , typename T_x2 , typename T_sigma >
Eigen::Matrix<typename return_type<T_x1, T_x2, T_sigma>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_dot_prod_cov ( const std::vector< Eigen::Matrix< T_x1, Eigen::Dynamic, 1 >> &  x1,
const std::vector< Eigen::Matrix< T_x2, Eigen::Dynamic, 1 >> &  x2,
const T_sigma &  sigma 
)

Returns a dot product covariance matrix of differing x's.

A member of Stan's Gaussian Process Library.

$k(x,x') = \sigma^2 + x \cdot x'$

A dot product covariance matrix is the same covariance matrix as in bayesian regression with $N(0,1)$ priors on regression coefficients and a $N(0,\sigma^2)$ prior on the constant function. See Rasmussen and Williams et al 2006, Chapter 4.

Template Parameters
T_x1type of first std::vector of elements
T_x2type of second std::vector of elements
T_sigmatype of sigma
Parameters
x1std::vector of elements that can be used in dot_product
x2std::vector of elements that can be used in dot_product
sigmaconstant function that can be used in stan::math::square
Returns
dot product covariance matrix that is not always symmetric
Exceptions
std::domain_errorif sigma < 0, nan or inf or if x1 or x2 are nan or inf

Definition at line 150 of file gp_dot_prod_cov.hpp.

◆ gp_dot_prod_cov() [4/4]

template<typename T_x1 , typename T_x2 , typename T_sigma >
Eigen::Matrix<typename return_type<T_x1, T_x2, T_sigma>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_dot_prod_cov ( const std::vector< T_x1 > &  x1,
const std::vector< T_x2 > &  x2,
const T_sigma &  sigma 
)

Returns a dot product covariance matrix of differing x's.

A member of Stan's Gaussian Process Library.

$k(x,x') = \sigma^2 + x \cdot x'$

A dot product covariance matrix is the same covariance matrix as in bayesian regression with $N(0,1)$ priors on regression coefficients and a $N(0,\sigma^2)$ prior on the constant function. See Rasmussen and Williams et al 2006, Chapter 4.

Template Parameters
T_x1type of first std::vector of double
T_x2type of second std::vector of double
T_sigmatype of sigma
Parameters
x1std::vector of elements that can be used in dot_product
x2std::vector of elements that can be used in dot_product
sigmais the constant function that can be used in stan::math::square
Returns
dot product covariance matrix that is not always symmetric
Exceptions
std::domain_errorif sigma < 0, nan or inf or if x1 or x2 are nan or inf

Definition at line 209 of file gp_dot_prod_cov.hpp.

◆ gp_exp_quad_cov() [1/6]

template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix<typename stan::return_type<T_x, T_sigma, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_exp_quad_cov ( const std::vector< T_x > &  x,
const T_sigma &  sigma,
const T_l &  length_scale 
)
inline

Returns a squared exponential kernel.

Template Parameters
T_xtype for each scalar
T_sigmatype of parameter sigma
T_ltype of parameter length scale
Parameters
xstd::vector of scalars that can be used in square distance. This function assumes each element of x is the same size.
sigmamarginal standard deviation or magnitude
length_scalelength scale
Returns
squared distance
Exceptions
std::domain_errorif sigma <= 0, l <= 0, or x is nan or infinite

Definition at line 38 of file gp_exp_quad_cov.hpp.

◆ gp_exp_quad_cov() [2/6]

template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix<typename stan::return_type<T_x, T_sigma, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_exp_quad_cov ( const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 >> &  x,
const T_sigma &  sigma,
const std::vector< T_l > &  length_scale 
)
inline

Returns a squared exponential kernel.

Template Parameters
T_xtype for each scalar
T_sigmatype of parameter sigma
T_ltype of each length scale parameter
Parameters
xstd::vector of Eigen vectors of scalars.
sigmamarginal standard deviation or magnitude
length_scalestd::vector length scale
Returns
squared distance
Exceptions
std::domain_errorif sigma <= 0, l <= 0, or x is nan or infinite

Definition at line 87 of file gp_exp_quad_cov.hpp.

◆ gp_exp_quad_cov() [3/6]

template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l >
Eigen::Matrix< typename stan::return_type<T_x1, T_x2, T_sigma, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_exp_quad_cov ( const std::vector< T_x1 > &  x1,
const std::vector< T_x2 > &  x2,
const T_sigma &  sigma,
const T_l &  length_scale 
)
inline

Returns a squared exponential kernel.

This function is for the cross covariance matrix needed to compute posterior predictive density.

Template Parameters
T_x1type of first std::vector of scalars
T_x2type of second std::vector of scalars This function assumes each element of x1 and x2 are the same size.
T_sigmatype of sigma
T_ltype of of length scale
Parameters
x1std::vector of elements that can be used in square distance
x2std::vector of elements that can be used in square distance
sigmastandard deviation
length_scalelength scale
Returns
squared distance
Exceptions
std::domain_errorif sigma <= 0, l <= 0, or x is nan or infinite

Definition at line 145 of file gp_exp_quad_cov.hpp.

◆ gp_exp_quad_cov() [4/6]

template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< typename stan::return_type<T_x1, T_x2, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_exp_quad_cov ( const std::vector< Eigen::Matrix< T_x1, Eigen::Dynamic, 1 >> &  x1,
const std::vector< Eigen::Matrix< T_x2, Eigen::Dynamic, 1 >> &  x2,
const T_s &  sigma,
const std::vector< T_l > &  length_scale 
)
inline

Returns a squared exponential kernel.

This function is for the cross covariance matrix needed to compute the posterior predictive density.

Template Parameters
T_x1type of first std::vector of elements
T_x2type of second std::vector of elements
T_stype of sigma
T_ltype of length scale
Parameters
x1std::vector of Eigen vectors of scalars.
x2std::vector of Eigen vectors of scalars.
sigmastandard deviation
length_scalestd::vector of length scale
Returns
squared distance
Exceptions
std::domain_errorif sigma <= 0, l <= 0, or x is nan or infinite

Definition at line 201 of file gp_exp_quad_cov.hpp.

◆ gp_exp_quad_cov() [5/6]

template<typename T_x >
std::enable_if< std::is_same<typename scalar_type<T_x>::type, double>::value, Eigen::Matrix<var, -1, -1> >::type stan::math::gp_exp_quad_cov ( const std::vector< T_x > &  x,
const var sigma,
const var length_scale 
)
inline

Returns a squared exponential kernel.

Parameters
xstd::vector input that can be used in square distance Assumes each element of x is the same size
sigmastandard deviation
length_scalelength scale
Returns
squared distance
Exceptions
std::domain_errorif sigma <= 0, l <= 0, or x is nan or infinite

Definition at line 213 of file gp_exp_quad_cov.hpp.

◆ gp_exp_quad_cov() [6/6]

template<typename T_x >
std::enable_if< std::is_same<typename scalar_type<T_x>::type, double>::value, Eigen::Matrix<var, -1, -1> >::type stan::math::gp_exp_quad_cov ( const std::vector< T_x > &  x,
double  sigma,
const var length_scale 
)
inline

Returns a squared exponential kernel.

Parameters
xstd::vector input that can be used in square distance Assumes each element of x is the same size
sigmastandard deviation
length_scalelength scale
Returns
squared distance
Exceptions
std::domain_errorif sigma <= 0, l <= 0, or x is nan or infinite

Definition at line 256 of file gp_exp_quad_cov.hpp.

◆ gp_exponential_cov() [1/4]

template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix<typename stan::return_type<T_x, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_exponential_cov ( const std::vector< T_x > &  x,
const T_s &  sigma,
const T_l &  length_scale 
)
inline

Returns a Matern exponential covariance Matrix.

\[ k(x, x') = \sigma^2 exp(-\frac{d(x, x')^2}{2l^2}) \]

where d(x, x') is the Euclidean distance.

Template Parameters
T_xtype for each scalar
T_stype of parameter sigma
T_ltype of parameter length scale
Parameters
xstd::vector of scalars that can be used in stan::math::distance
sigmastandard deviation or magnitude
length_scalelength scale
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x is nan or inf

Definition at line 37 of file gp_exponential_cov.hpp.

◆ gp_exponential_cov() [2/4]

template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix<typename stan::return_type<T_x, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_exponential_cov ( const std::vector< Eigen::Matrix< T_x, -1, 1 >> &  x,
const T_s &  sigma,
const std::vector< T_l > &  length_scale 
)
inline

Returns a Matern exponential covariance matrix.

\[ k(x, x') = \sigma^2 exp(-\sum_{k=1}^K\frac{d(x, x')}{l_k}) \]

where d(x, x') is the Euclidean distance.

Template Parameters
T_xtype for each scalar
T_stype for each parameter sigma
T_ltype for each length scale parameter
Parameters
xstd::vector of Eigen::vectors of scalars
sigmastandard deviation that can be used in stan::math::square
length_scalestd::vector of length scales
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x is nan or inf

Definition at line 93 of file gp_exponential_cov.hpp.

◆ gp_exponential_cov() [3/4]

template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< typename stan::return_type<T_x1, T_x2, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_exponential_cov ( const std::vector< T_x1 > &  x1,
const std::vector< T_x2 > &  x2,
const T_s &  sigma,
const T_l &  length_scale 
)
inline

Returns a Matern exponential cross covariance matrix.

\[ k(x, x') = \sigma^2 exp(-\frac{d(x, x')}{l}) \]

where d(x, x') is the Euclidean distance This function is for the cross covariance matrix needed to compute the posterior predictive distribution

Template Parameters
T_x1first type of scalars contained in vector x1
T_x2second type of scalars contained in vector x2
T_stype of parameter sigma, marginal standard deviation
T_ltype of parameter length scale
Parameters
x1std::vector of scalars that can be used in squared_distance
x2std::vector of scalars that can be used in squared_distance
length_scalelength scale
sigmastandard deviation that can be used in stan::math::square
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x1, x2 are nan or inf

Definition at line 155 of file gp_exponential_cov.hpp.

◆ gp_exponential_cov() [4/4]

template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix<typename return_type<T_x1, T_x2, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_exponential_cov ( const std::vector< Eigen::Matrix< T_x1, -1, 1 >> &  x1,
const std::vector< Eigen::Matrix< T_x2, -1, 1 >> &  x2,
const T_s &  sigma,
const std::vector< T_l > &  length_scale 
)
inline

Returns a Matern exponential cross covariance matrix.

\[ k(x, x') = \sigma^2 exp(-\sum_{k=1}^K\frac{d(x, x')}{l_k}) \]

where $d(x, x')$ is the Euclidean distance

This function is for the cross covariance matrix neededed to compute the posterior predictive density.

Template Parameters
T_x1first type of std::vector of scalars
T_x2second type of std::vector of scalars
T_stype of parameter sigma, marginal standard deviation
T_ltype of parameter length scale
Parameters
x1std::vector of Eigen vectors of scalars
x2std::vector of Eigen vectors of scalars
length_scaleparameter length scale
sigmastandard deviation that can be used in stan::math::square
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x1, x2 are nan or inf

Definition at line 219 of file gp_exponential_cov.hpp.

◆ gp_matern32_cov() [1/4]

template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix<typename return_type<T_x, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_matern32_cov ( const std::vector< T_x > &  x,
const T_s &  sigma,
const T_l &  length_scale 
)
inline

Returns a Matern 3/2 covariance matrix.

\[ k(x, x') = \sigma^2(1 + \frac{\sqrt{3}d(x, x')}{l})exp(-\frac{\sqrt{3}d(x, x')}{l}) \]

where $ d(x, x') $ is the Euclidean distance.

Template Parameters
T_xtype for each scalar
T_stype of parameter of sigma
T_ltype of parameter length scale
Parameters
xstd::vector of scalars that can be used in squared distance
length_scalelength scale
sigmamarginal standard deviation or magnitude
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x is nan or inf

Definition at line 42 of file gp_matern32_cov.hpp.

◆ gp_matern32_cov() [2/4]

template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix<typename return_type<T_x, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_matern32_cov ( const std::vector< Eigen::Matrix< T_x, -1, 1 >> &  x,
const T_s &  sigma,
const std::vector< T_l > &  length_scale 
)
inline

Returns a Matern 3/2 covariance matrix.

\[ k(x, x') = \sigma^2(1 + \sqrt{3} \sqrt{\sum_{k=1}^{K}\frac{d(x, x')^2}{l_k^2}}) exp(-\sqrt{3}\sqrt{\sum_{k=1}^{K}\frac{d(x, x')^2}{l_k^2}}) \]

where $d(x, x')$ is the Euclidean distance.

Template Parameters
T_xtype for each scalar
T_stype of element of parameter sigma
T_ltype of each length scale parameter
Parameters
xstd::vector of Eigen vectors of scalars.
length_scalestd::vector of length scales
sigmastandard deviation that can be used in stan::math::square
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x is nan or inf

Definition at line 104 of file gp_matern32_cov.hpp.

◆ gp_matern32_cov() [3/4]

template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix<typename return_type<T_x1, T_x2, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_matern32_cov ( const std::vector< T_x1 > &  x1,
const std::vector< T_x2 > &  x2,
const T_s &  sigma,
const T_l &  length_scale 
)
inline

Returns a Matern 3/2 cross covariance matrix.

\[ k(x, x') = \sigma^2(1 + \frac{\sqrt{3}d(x, x')}{l})exp(-\sqrt{3}\frac{d(x, x')}{l}) \]

where $d(x, x')$ is the Euclidean distance.

This function is for the cross covariance matrix neededed to compute the posterior predictive density.

Template Parameters
T_x1first type of scalars contained in vector x1
T_x2second type of scalars contained in vector x2
T_stype of parameter sigma, marginal standard deviation
T_ltype of parameter length scale
Parameters
x1std::vector of scalars that can be used in squared_distance
x2std::vector of scalars that can be used in squared_distance
length_scalelength scale
sigmastandard deviation that can be used in stan::math::square
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x1, x2 are nan or inf

Definition at line 173 of file gp_matern32_cov.hpp.

◆ gp_matern32_cov() [4/4]

template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix<typename return_type<T_x1, T_x2, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_matern32_cov ( const std::vector< Eigen::Matrix< T_x1, -1, 1 >> &  x1,
const std::vector< Eigen::Matrix< T_x2, -1, 1 >> &  x2,
const T_s &  sigma,
const std::vector< T_l > &  length_scale 
)
inline

Returns a Matern 3/2 cross covariance matrix.

\[ k(x, x') = \sigma^2(1 + \sqrt{3} \sqrt{\sum_{k=1}^{K}\frac{d(x, x')^2}{l_k^2}}) exp(-\sqrt{3}\sqrt{\sum_{k=1}^{K}\frac{d(x, x')^2}{l_k^2}}) \]

where $d(x, x')$ is the Euclidean distance

This function is for the cross covariance matrix neededed to compute the posterior predictive density.

Template Parameters
T_x1first type of std::vector of scalars
T_x2second type of std::vector of scalars
T_stype of parameter sigma, marginal standard deviation
T_ltype of parameter length scale
Parameters
x1std::vector of Eigen vectors of scalars
x2std::vector of Eigen vectors of scalars
length_scaleparameter length scale
sigmastandard deviation that can be used in stan::math::square
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x1, x2 are nan or inf

Definition at line 244 of file gp_matern32_cov.hpp.

◆ gp_matern52_cov() [1/4]

template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix<typename return_type<T_x, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_matern52_cov ( const std::vector< T_x > &  x,
const T_s &  sigma,
const T_l &  length_scale 
)
inline

Returns a Matern 5/2 covariance matrix with one input vector.

\[ k(x, x') = \sigma^2\bigg(1 + \frac{\sqrt{5}d(x, x')}{l} + \frac{5d(x, x')^2}{3l^2}\bigg) exp\bigg(-\frac{5 d(x, x')}{l}\bigg) \]

where $ d(x, x') $ is the Euclidean distance.

Template Parameters
T_xtype of elements contained in vector x
T_stype of element of sigma, the magnitude
T_ltype of elements of length scale
Parameters
xstd::vector of elements that can be used in stan::math::distance
length_scalelength scale
sigmastandard deviation that can be used in stan::math::square
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x is nan or inf

Definition at line 44 of file gp_matern52_cov.hpp.

◆ gp_matern52_cov() [2/4]

template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix<typename return_type<T_x, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_matern52_cov ( const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 >> &  x,
const T_s &  sigma,
const std::vector< T_l > &  length_scale 
)
inline

Returns a Matern 5/2 covariance matrix with one input vector with automatic relevance determination (ARD).

\[ k(x, x') = \sigma^2\bigg(1 + \sqrt{5}\sqrt{\sum_{k=1}^{K}\frac{d(x, x')^2}{l_k^2}} + \frac{5}{3} \sqrt{\sum_{k=1}^{K}\frac{d(x, x')^2}{l_k^2}}\bigg) exp\bigg(-\frac{5}{3}\bigg(\sqrt{\sum_{k=1}^K{\frac{d(x, x')^2}{l_k^2}} }\bigg)\bigg) \]

where $ d(x, x') $ is the Euclidean distance.

Template Parameters
T_xtype of elements contained in vector x
T_stype of element of sigma, the magnitude
T_ltype of elements in vector of length scale
Parameters
xstd::vector of elements that can be used in stan::math::distance
length_scalelength scale
sigmastandard deviation that can be used in stan::math::square
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x is nan or inf
std::invalid_argumentif length scale size != dimension of x

Definition at line 108 of file gp_matern52_cov.hpp.

◆ gp_matern52_cov() [3/4]

template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix<typename return_type<T_x1, T_x2, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_matern52_cov ( const std::vector< T_x1 > &  x1,
const std::vector< T_x2 > &  x2,
const T_s &  sigma,
const T_l &  length_scale 
)
inline

Returns a Matern 5/2 covariance matrix with two different input vectors.

\[ k(x, x') = \sigma^2\bigg(1 + \frac{\sqrt{5}d(x, x')}{l} + \frac{5d(x, x')^2}{3l^2}\bigg) exp\bigg(-\frac{5 d(x, x')}{l}\bigg) \]

where $ d(x, x') $ is the Euclidean distance.

Template Parameters
T_x1type of elements contained in vector x1
T_x2type of elements contained in vector x2
T_stype of element of sigma, the magnitude
T_ltype of elements of length scale
Parameters
x1std::vector of elements that can be used in stan::math::distance
x2std::vector of elements that can be used in stan::math::distance
length_scalelength scale
sigmastandard deviation that can be used in stan::math::square
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x is nan or inf

Definition at line 175 of file gp_matern52_cov.hpp.

◆ gp_matern52_cov() [4/4]

template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< typename stan::return_type<T_x1, T_x2, T_s, T_l>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_matern52_cov ( const std::vector< Eigen::Matrix< T_x1, Eigen::Dynamic, 1 >> &  x1,
const std::vector< Eigen::Matrix< T_x2, Eigen::Dynamic, 1 >> &  x2,
const T_s &  sigma,
const std::vector< T_l > &  length_scale 
)
inline

Returns a Matern 5/2 covariance matrix with two input vectors with automatic relevance determination (ARD).

\[ k(x, x') = \sigma^2\bigg(1 + \sqrt{5}\sqrt{\sum_{k=1}^{K}\frac{d(x, x')^2}{l_k^2}} + \frac{5}{3} \sqrt{\sum_{k=1}^{K}\frac{d(x, x')^2}{l_k^2}}\bigg) exp\bigg(-\frac{5}{3}\bigg(\sqrt{\sum_{k=1}^K{\frac{d(x, x')^2}{l_k^2}} }\bigg)\bigg) \]

where $ d(x, x') $ is the Euclidean distance.

Template Parameters
T_x1type of elements contained in vector x1
T_x2type of elements contained in vector x2
T_stype of element of sigma, the magnitude
T_ltype of elements in vector of length scale
Parameters
x1std::vector of elements that can be used in stan::math::distance
x2std::vector of elements that can be used in stan::math::distance
length_scalelength scale
sigmastandard deviation that can be used in stan::math::square
Exceptions
std::domainerror if sigma <= 0, l <= 0, or x is nan or inf
std::invalid_argumentif length scale size != dimension of x1 or x2

Definition at line 244 of file gp_matern52_cov.hpp.

◆ gp_periodic_cov() [1/4]

template<typename T_x , typename T_sigma , typename T_l , typename T_p >
Eigen::Matrix< typename stan::return_type<T_x, T_sigma, T_l, T_p>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_periodic_cov ( const std::vector< T_x > &  x,
const T_sigma &  sigma,
const T_l &  l,
const T_p &  p 
)
inline

Returns a periodic covariance matrix $ \mathbf{K} $ using the input $ \mathbf{X} $.

The elements of $ \mathbf{K} $ are defined as $ \mathbf{K}_{ij} = k(\mathbf{X}_i,\mathbf{X}_j), $ where $ \mathbf{X}_i $ is the $i$-th row of $ \mathbf{X} $ and
$ k(\mathbf{x},\mathbf{x}^\prime) = \sigma^2 \exp\left(-\frac{2\sin^2(\pi |\mathbf{x}-\mathbf{x}^\prime|/p)}{\ell^2}\right), $
where $ \sigma^2 $, $ \ell $ and $ p $ are the signal variance, length-scale and period.

Template Parameters
T_xtype of std::vector elements of x. T_x can be a scalar, an Eigen::Vector, or an Eigen::RowVector.
T_sigmatype of sigma
T_ltype of length-scale
T_ptype of period
Parameters
xstd::vector of input elements. This function assumes that all elements of x have the same size.
sigmastandard deviation of the signal
llength-scale
pperiod
Returns
periodic covariance matrix
Exceptions
std::domain_errorif sigma <= 0, l <= 0, p <= 0 or x is nan or infinite

Definition at line 52 of file gp_periodic_cov.hpp.

◆ gp_periodic_cov() [2/4]

template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l , typename T_p >
Eigen::Matrix< typename stan::return_type<T_x1, T_x2, T_sigma, T_l, T_p>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::gp_periodic_cov ( const std::vector< T_x1 > &  x1,
const std::vector< T_x2 > &  x2,
const T_sigma &  sigma,
const T_l &  l,
const T_p &  p 
)
inline

Returns a periodic covariance matrix $ \mathbf{K} $ using inputs $ \mathbf{X}_1 $ and $ \mathbf{X}_2 $.

The elements of $ \mathbf{K} $ are defined as $ \mathbf{K}_{ij} = k(\mathbf{X}_{1_i},\mathbf{X}_{2_j}), $ where $ \mathbf{X}_{1_i} $ and $ \mathbf{X}_{2_j} $ are the $i$-th and $j$-th rows of $ \mathbf{X}_1 $ and $ \mathbf{X}_2 $ and
$ k(\mathbf{x},\mathbf{x}^\prime) = \sigma^2 \exp\left(-\frac{2\sin^2(\pi |\mathbf{x}-\mathbf{x}^\prime|/p)}{\ell^2}\right), $
where $ \sigma^2 $, $ \ell $ and $ p $ are the signal variance, length-scale and period.

Template Parameters
T_x1type of std::vector elements of x1 T_x1 can be a scalar, an Eigen::Vector, or an Eigen::RowVector.
T_x2type of std::vector elements of x2 T_x2 can be a scalar, an Eigen::Vector, or an Eigen::RowVector.
T_sigmatype of sigma
T_ltype of length-scale
T_ptype of period
Parameters
x1std::vector of first input elements
x2std::vector of second input elements. This function assumes that all the elements of x1 and x2 have the same sizes.
sigmastandard deviation of the signal
llength-scale
pperiod
Returns
periodic covariance matrix
Exceptions
std::domain_errorif sigma <= 0, l <= 0, p <= 0 , x1 or x2 is nan or infinite

Definition at line 122 of file gp_periodic_cov.hpp.

◆ gp_periodic_cov() [3/4]

template<typename T_x >
std::enable_if< std::is_same<typename scalar_type<T_x>::type, double>::value, Eigen::Matrix<var, Eigen::Dynamic, Eigen::Dynamic> >::type stan::math::gp_periodic_cov ( const std::vector< T_x > &  x,
const var sigma,
const var l,
const var p 
)
inline

Returns a periodic covariance matrix $ \mathbf{K} $ using the input $ \mathbf{X} $.

The elements of $ \mathbf{K} $ are defined as $ \mathbf{K}_{ij} = k(\mathbf{X}_i,\mathbf{X}_j), $ where $ \mathbf{X}_i $ is the $i$-th row of $ \mathbf{X} $ and
$ k(\mathbf{x},\mathbf{x}^\prime) = \sigma^2 \exp\left(-\frac{2\sin^2(\pi |\mathbf{x}-\mathbf{x}^\prime|/p)}{\ell^2}\right), $
where $ \sigma^2 $, $ \ell $ and $ p $ are the signal variance, length-scale and period.

Parameters
xstd::vector of input elements. Assumes that all elements of x have the same size.
sigmastandard deviation of the signal
llength-scale
pperiod
Returns
periodic covariance matrix
Exceptions
std::domain_errorif sigma <= 0, l <= 0, p <= 0, or x is nan or infinite

Definition at line 304 of file gp_periodic_cov.hpp.

◆ gp_periodic_cov() [4/4]

template<typename T_x >
std::enable_if< std::is_same<typename scalar_type<T_x>::type, double>::value, Eigen::Matrix<var, Eigen::Dynamic, Eigen::Dynamic> >::type stan::math::gp_periodic_cov ( const std::vector< T_x > &  x,
double  sigma,
const var l,
const var p 
)
inline

Returns a periodic covariance matrix $ \mathbf{K} $ using the input $ \mathbf{X} $.

The elements of $ \mathbf{K} $ are defined as $ \mathbf{K}_{ij} = k(\mathbf{X}_i,\mathbf{X}_j), $ where $ \mathbf{X}_i $ is the $i$-th row of $ \mathbf{X} $ and
$ k(\mathbf{x},\mathbf{x}^\prime) = \sigma^2 \exp\left(-\frac{2\sin^2(\pi |\mathbf{x}-\mathbf{x}^\prime|/p)}{\ell^2}\right), $
where $ \sigma^2 $, $ \ell $ and $ p $ are the signal variance, length-scale and period.

Parameters
xstd::vector of input elements. Assumes that all elements of x have the same size.
sigmastandard deviation of the signal
llength-scale
pperiod
Returns
periodic covariance matrix
Exceptions
std::domain_errorif sigma <= 0, l <= 0, p <= 0, or x is nan or infinite

Definition at line 356 of file gp_periodic_cov.hpp.

◆ grad() [1/3]

static void stan::math::grad ( vari vi)
static

◆ grad() [2/3]

void stan::math::grad ( var v,
Eigen::Matrix< var, Eigen::Dynamic, 1 > &  x,
Eigen::VectorXd &  g 
)
inline

Propagate chain rule to calculate gradients starting from the specified variable.

Resizes the input vector to be the correct size.

The grad() function does not itself recover any memory. use recover_memory() or recover_memory_nested() to recover memory.

Parameters
[in]vValue of function being differentiated
[in]xVariables being differentiated with respect to
[out]gGradient, d/dx v, evaluated at x.

Definition at line 25 of file grad.hpp.

◆ grad() [3/3]

static void stan::math::grad ( vari vi)
static

Compute the gradient for all variables starting from the specified root variable implementation.

Does not recover memory. This chainable variable's adjoint is initialized using the method init_dependent() and then the chain rule is applied working down the stack from this vari and calling each vari's chain() method in turn.

This function computes a nested gradient only going back as far as the last nesting.

This function does not recover any memory from the computation.

Parameters
viVariable implementation for root of partial derivative propagation.

Definition at line 30 of file grad.hpp.

◆ grad_2F1()

template<typename T >
void stan::math::grad_2F1 ( T &  g_a1,
T &  g_b1,
const T &  a1,
const T &  a2,
const T &  b1,
const T &  z,
const T &  precision = 1e-10,
int  max_steps = 1e5 
)

Gradients of the hypergeometric function, 2F1.

Calculate the gradients of the hypergeometric function (2F1) as the power series stopping when the series converges to within precision or throwing when the function takes max_steps steps.

This power-series representation converges for all gradients under the same conditions as the 2F1 function itself.

Template Parameters
Ttype of arguments and result
Parameters
[out]g_a1g_a1 pointer to array of six values of type T, result.
[out]g_b1g_b1 pointer to array of six values of type T, result.
[in]a1a1 see generalized hypergeometric function definition.
[in]a2a2 see generalized hypergeometric function definition.
[in]b1b1 see generalized hypergeometric function definition.
[in]zz see generalized hypergeometric function definition.
[in]precisionprecision of the infinite sum.
[in]max_stepsnumber of steps to take.

Definition at line 36 of file grad_2F1.hpp.

◆ grad_F32()

template<typename T >
void stan::math::grad_F32 ( T *  g,
const T &  a1,
const T &  a2,
const T &  a3,
const T &  b1,
const T &  b2,
const T &  z,
const T &  precision = 1e-6,
int  max_steps = 1e5 
)

Gradients of the hypergeometric function, 3F2.

Calculate the gradients of the hypergeometric function (3F2) as the power series stopping when the series converges to within precision or throwing when the function takes max_steps steps.

This power-series representation converges for all gradients under the same conditions as the 3F2 function itself.

Template Parameters
Ttype of arguments and result
Parameters
[out]gg pointer to array of six values of type T, result.
[in]a1a1 see generalized hypergeometric function definition.
[in]a2a2 see generalized hypergeometric function definition.
[in]a3a3 see generalized hypergeometric function definition.
[in]b1b1 see generalized hypergeometric function definition.
[in]b2b2 see generalized hypergeometric function definition.
[in]zz see generalized hypergeometric function definition.
[in]precisionprecision of the infinite sum
[in]max_stepsnumber of steps to take

Definition at line 38 of file grad_F32.hpp.

◆ grad_hessian()

template<typename F >
void stan::math::grad_hessian ( const F &  f,
const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  x,
double &  fx,
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &  H,
std::vector< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > > &  grad_H 
)

Calculate the value, the Hessian, and the gradient of the Hessian of the specified function at the specified argument.

The functor must implement

fvar<fvar<var> > operator()(const Eigen::Matrix<fvar<fvar<var> >, Eigen::Dynamic, 1>&)

using only operations that are defined for fvar and var.

This latter constraint usually requires the functions to be defined in terms of the libraries defined in Stan or in terms of functions with appropriately general namespace imports that eventually depend on functions defined in Stan.

Template Parameters
FType of function
Parameters
[in]fFunction
[in]xArgument to function
[out]fxFunction applied to argument
[out]HHessian of function at argument
[out]grad_HGradient of the Hessian of function at argument

Definition at line 42 of file grad_hessian.hpp.

◆ grad_inc_beta() [1/3]

void stan::math::grad_inc_beta ( double &  g1,
double &  g2,
double  a,
double  b,
double  z 
)
inline

Definition at line 19 of file grad_inc_beta.hpp.

◆ grad_inc_beta() [2/3]

template<typename T >
void stan::math::grad_inc_beta ( fvar< T > &  g1,
fvar< T > &  g2,
fvar< T >  a,
fvar< T >  b,
fvar< T >  z 
)

Gradient of the incomplete beta function beta(a, b, z) with respect to the first two arguments.

Uses the equivalence to a hypergeometric function. See http://dlmf.nist.gov/8.17#ii

Template Parameters
Ttype of fvar
Parameters
[out]g1d/da
[out]g2d/db
[in]aa
[in]bb
[in]zz

Definition at line 34 of file grad_inc_beta.hpp.

◆ grad_inc_beta() [3/3]

void stan::math::grad_inc_beta ( var g1,
var g2,
const var a,
const var b,
const var z 
)
inline

Gradient of the incomplete beta function beta(a, b, z) with respect to the first two arguments.

Uses the equivalence to a hypergeometric function. See http://dlmf.nist.gov/8.17#ii

Parameters
[out]g1d/da
[out]g2d/db
[in]aa
[in]bb
[in]zz

Definition at line 36 of file grad_inc_beta.hpp.

◆ grad_reg_inc_beta()

template<typename T >
void stan::math::grad_reg_inc_beta ( T &  g1,
T &  g2,
const T &  a,
const T &  b,
const T &  z,
const T &  digammaA,
const T &  digammaB,
const T &  digammaSum,
const T &  betaAB 
)

Computes the gradients of the regularized incomplete beta function.

Specifically, this function computes gradients of ibeta(a, b, z), with respect to the arguments a and b.

Template Parameters
Ttype of arguments
Parameters
[out]g1partial derivative of ibeta(a, b, z) with respect to a
[out]g2partial derivative of ibeta(a, b, z) with respect to b
[in]aa
[in]bb
[in]zz
[in]digammaAthe value of digamma(a)
[in]digammaBthe value of digamma(b)
[in]digammaSumthe value of digamma(a + b)
[in]betaABthe value of beta(a, b)

Definition at line 33 of file grad_reg_inc_beta.hpp.

◆ grad_reg_inc_gamma()

template<typename T1 , typename T2 >
return_type<T1, T2>::type stan::math::grad_reg_inc_gamma ( T1  a,
T2  z,
T1  g,
T1  dig,
double  precision = 1e-6,
int  max_steps = 1e5 
)

Gradient of the regularized incomplete gamma functions igamma(a, z)

For small z, the gradient is computed via the series expansion; for large z, the series is numerically inaccurate due to cancellation and the asymptotic expansion is used.

Parameters
ashape parameter, a > 0
zlocation z >= 0
gstan::math::tgamma(a) (precomputed value)
digboost::math::digamma(a) (precomputed value)
precisionrequired precision; applies to series expansion only
max_stepsnumber of steps to take.
Exceptions
throwsstd::domain_error if not converged after max_steps or increment overflows to inf.

For the asymptotic expansion, the gradient is given by:

\[ \begin{array}{rcl} \Gamma(a, z) & = & z^{a-1}e^{-z} \sum_{k=0}^N \frac{(a-1)_k}{z^k} \qquad , z \gg a\\ Q(a, z) & = & \frac{z^{a-1}e^{-z}}{\Gamma(a)} \sum_{k=0}^N \frac{(a-1)_k}{z^k}\\ (a)_k & = & (a)_{k-1}(a-k)\\ \frac{d}{da} (a)_k & = & (a)_{k-1} + (a-k)\frac{d}{da} (a)_{k-1}\\ \frac{d}{da}Q(a, z) & = & (log(z) - \psi(a)) Q(a, z)\\ && + \frac{z^{a-1}e^{-z}}{\Gamma(a)} \sum_{k=0}^N \left(\frac{d}{da} (a-1)_k\right) \frac{1}{z^k} \end{array} \]

Definition at line 49 of file grad_reg_inc_gamma.hpp.

◆ grad_reg_lower_inc_gamma()

template<typename T1 , typename T2 >
return_type<T1, T2>::type stan::math::grad_reg_lower_inc_gamma ( const T1 &  a,
const T2 &  z,
double  precision = 1e-10,
int  max_steps = 1e5 
)

Computes the gradient of the lower regularized incomplete gamma function.

The lower incomlete gamma function derivative w.r.t it's first parameter (a) seems to have no standard source. It also appears to have no widely known approximate implementation. Gautschi (1979) has a thorough discussion of the calculation of the lower regularized incomplete gamma function itself and some stability issues.

Reference: Gautschi, Walter (1979) ACM Transactions on mathematical software. 5(4):466-481

We implemented calculations for d(gamma_p)/da by taking derivatives of formulas suggested by Gauschi and others and testing them against an outside source (Mathematica). We took three implementations which can cover the range {a:[0,20], z:[0,30]} with absolute error < 1e-10 with the exception of values near (0,0) where the error is near 1e-5. Relative error is also <<1e-6 except for regions where the gradient approaches zero.

Gautschi suggests calculating the lower incomplete gamma function for small to moderate values of $z$ using the approximation:

\[ \frac{\gamma(a,z)}{\Gamma(a)}=z^a e^-z \sum_n=0^\infty \frac{z^n}{\Gamma(a+n+1)} \]

We write the derivative in the form:

\[ \frac{d\gamma(a,z)\Gamma(a)}{da} = \frac{\log z}{e^z} \sum_n=0^\infty \frac{z^{a+n}}{\Gamma(a+n+1)} - \frac{1}{e^z} \sum_n=0^\infty \frac{z^{a+n}}{\Gamma(a+n+1)}\psi^0(a+n+1) \]

This caclulation is sufficiently accurate for small $a$ and small $z$. For larger values and $a$ and $z$ we use it in its log form:

\[ \frac{d \gamma(a,z)\Gamma(a)}{da} = \frac{\log z}{e^z} \sum_n=0^\infty \exp[(a+n)\log z - \log\Gamma(a+n+1)] - \sum_n=0^\infty \exp[(a+n)\log z - \log\Gamma(a+n+1) + \log\psi^0(a+n+1)] \]

For large $z$, Gauschi recommends using the upper incomplete Gamma instead and the negative of its derivative turns out to be more stable and accurate for larger $z$ and for some combinations of $a$ and $z$. This is a log-scale implementation of the derivative of the formulation suggested by Gauschi (1979). For some values it defers to the negative of the gradient for the gamma_q function. This is based on the suggestion by Gauschi (1979) that for large values of $z$ it is better to carry out calculations using the upper incomplete Gamma function.

Branching for choice of implementation for the lower incomplete regularized gamma function gradient. The derivative based on Gautschi's formulation appears to be sufficiently accurate everywhere except for large z and small to moderate a. The intersection between the two regions is a radius 12 quarter circle centered at a=0, z=30 although both implementations are satisfactory near the intersection.

Some limits that could be treated, e.g., infinite z should return tgamma(a) * digamma(a), throw instead to match the behavior of, e.g., boost::math::gamma_p

Template Parameters
T1type of a
T2type of z
Parameters
[in]ashared with complete Gamma
[in]zvalue to integrate up to
[in]precisionseries terminates when increment falls below this value.
[in]max_stepsnumber of terms to sum before throwing
Exceptions
std::domain_errorif the series does not converge to requested precision before max_steps.

Definition at line 106 of file grad_reg_lower_inc_gamma.hpp.

◆ grad_tr_mat_times_hessian()

template<typename F >
void stan::math::grad_tr_mat_times_hessian ( const F &  f,
const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  x,
const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &  M,
Eigen::Matrix< double, Eigen::Dynamic, 1 > &  grad_tr_MH 
)

Definition at line 15 of file grad_tr_mat_times_hessian.hpp.

◆ gradient() [1/2]

template<typename T , typename F >
void stan::math::gradient ( const F &  f,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
T &  fx,
Eigen::Matrix< T, Eigen::Dynamic, 1 > &  grad_fx 
)

Calculate the value and the gradient of the specified function at the specified argument.

The functor must implement

fvar<T> operator()(const Eigen::Matrix<T, Eigen::Dynamic, 1>&)

using only operations that are defined for fvar. This latter constraint usually requires the functions to be defined in terms of the libraries defined in Stan or in terms of functions with appropriately general namespace imports that eventually depend on functions defined in Stan.

Time and memory usage is on the order of the size of the fully unfolded expression for the function applied to the argument, independently of dimension.

Template Parameters
FType of function
Parameters
[in]fFunction
[in]xArgument to function
[out]fxFunction applied to argument
[out]grad_fxGradient of function at argument

Definition at line 39 of file gradient.hpp.

◆ gradient() [2/2]

template<typename F >
void stan::math::gradient ( const F &  f,
const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  x,
double &  fx,
Eigen::Matrix< double, Eigen::Dynamic, 1 > &  grad_fx 
)

Calculate the value and the gradient of the specified function at the specified argument.

The functor must implement

var operator()(const Eigen::Matrix<var, Eigen::Dynamic, 1>&)

using only operations that are defined for var. This latter constraint usually requires the functions to be defined in terms of the libraries defined in Stan or in terms of functions with appropriately general namespace imports that eventually depend on functions defined in Stan.

Time and memory usage is on the order of the size of the fully unfolded expression for the function applied to the argument, independently of dimension.

Template Parameters
FType of function
Parameters
[in]fFunction
[in]xArgument to function
[out]fxFunction applied to argument
[out]grad_fxGradient of function at argument

Definition at line 42 of file gradient.hpp.

◆ gradient_dot_vector()

template<typename T1 , typename T2 , typename F >
void stan::math::gradient_dot_vector ( const F &  f,
const Eigen::Matrix< T1, Eigen::Dynamic, 1 > &  x,
const Eigen::Matrix< T2, Eigen::Dynamic, 1 > &  v,
T1 &  fx,
T1 &  grad_fx_dot_v 
)

Definition at line 13 of file gradient_dot_vector.hpp.

◆ gradient_of_f()

template<typename F >
double stan::math::gradient_of_f ( const F &  f,
const double &  x,
const double &  xc,
const std::vector< double > &  theta_vals,
const std::vector< double > &  x_r,
const std::vector< int > &  x_i,
size_t  n,
std::ostream &  msgs 
)
inline

Calculate first derivative of f(x, param, std::ostream&) with respect to the nth parameter.

Uses nested reverse mode autodiff

Gradients that evaluate to NaN are set to zero if the function itself evaluates to zero. If the function is not zero and the gradient evaluates to NaN, a std::domain_error is thrown

Definition at line 30 of file integrate_1d.hpp.

◆ gumbel_ccdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::gumbel_ccdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  beta 
)
Deprecated:
use gumbel_lccdf

Definition at line 14 of file gumbel_ccdf_log.hpp.

◆ gumbel_cdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::gumbel_cdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  beta 
)

Returns the Gumbel distribution cumulative distribution for the given location and scale.

Given containers of matching sizes, returns the product of probabilities.

Template Parameters
T_ytype of real parameter
T_loctype of location parameter
T_scaletype of scale parameter
Parameters
yreal parameter
mulocation parameter
betascale parameter
Returns
probability or product of probabilities
Exceptions
std::domain_errorif y is nan, mu is infinite, or beta is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 32 of file gumbel_cdf.hpp.

◆ gumbel_cdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::gumbel_cdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  beta 
)
Deprecated:
use gumbel_lcdf

Definition at line 14 of file gumbel_cdf_log.hpp.

◆ gumbel_lccdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::gumbel_lccdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  beta 
)

Returns the Gumbel log complementary cumulative distribution for the given location and scale.

Given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ytype of real parameter
T_loctype of location parameter
T_scaletype of scale parameter
Parameters
yreal parameter
mulocation parameter
betascale parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif y is nan, mu is infinite, or beta is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 32 of file gumbel_lccdf.hpp.

◆ gumbel_lcdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::gumbel_lcdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  beta 
)

Returns the Gumbel log cumulative distribution for the given location and scale.

Given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ytype of real parameter
T_loctype of location parameter
T_scaletype of scale parameter
Parameters
yreal parameter
mulocation parameter
betascale parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif y is nan, mu is infinite, or beta is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 32 of file gumbel_lcdf.hpp.

◆ gumbel_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::gumbel_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  beta 
)
Deprecated:
use gumbel_lpdf

Definition at line 14 of file gumbel_log.hpp.

◆ gumbel_log() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::gumbel_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  beta 
)
inline
Deprecated:
use gumbel_lpdf

Definition at line 23 of file gumbel_log.hpp.

◆ gumbel_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::gumbel_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  beta 
)

Returns the Gumbel log probability density for the given location and scale.

Given containers of matching sizes, returns the log sum of densities.

Template Parameters
T_ytype of real parameter
T_loctype of location parameter
T_scaletype of scale parameter
Parameters
yreal parameter
mulocation parameter
betascale parameter
Returns
log probability density or log sum of probability densities
Exceptions
std::domain_errorif y is nan, mu is infinite, or beta is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 32 of file gumbel_lpdf.hpp.

◆ gumbel_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::gumbel_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  beta 
)
inline

Definition at line 98 of file gumbel_lpdf.hpp.

◆ gumbel_rng()

template<typename T_loc , typename T_scale , class RNG >
VectorBuilder<true, double, T_loc, T_scale>::type stan::math::gumbel_rng ( const T_loc &  mu,
const T_scale &  beta,
RNG &  rng 
)
inline

Return a Gumbel random variate with the given location and scale using the specified random number generator.

mu and beta can each be a scalar or a vector. Any non-scalar inputs must be the same length.

Template Parameters
T_locType of location parameter
T_scaleType of scale parameter
RNGtype of random number generator
Parameters
mu(Sequence of) location parameter(s)
beta(Sequence of) scale parameter(s)
rngrandom number generator
Returns
(Sequence of) Gumbel random variate(s)
Exceptions
std::domain_errorif mu is infinite or beta is nonpositive.
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 33 of file gumbel_rng.hpp.

◆ head() [1/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::head ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  v,
size_t  n 
)
inline

Return the specified number of elements as a vector from the front of the specified vector.

Template Parameters
TType of value in vector.
Parameters
vVector input.
nSize of return.
Returns
The first n elements of v.
Exceptions
std::out_of_rangeif n is out of range.

Definition at line 24 of file head.hpp.

◆ head() [2/3]

template<typename T >
Eigen::Matrix<T, 1, Eigen::Dynamic> stan::math::head ( const Eigen::Matrix< T, 1, Eigen::Dynamic > &  rv,
size_t  n 
)
inline

Return the specified number of elements as a row vector from the front of the specified row vector.

Template Parameters
TType of value in vector.
Parameters
rvRow vector.
nSize of return row vector.
Returns
The first n elements of rv.
Exceptions
std::out_of_rangeif n is out of range.

Definition at line 42 of file head.hpp.

◆ head() [3/3]

template<typename T >
std::vector<T> stan::math::head ( const std::vector< T > &  sv,
size_t  n 
)

Return the specified number of elements as a standard vector from the front of the specified standard vector.

Template Parameters
TType of value in vector.
Parameters
svStandard vector.
nSize of return.
Returns
The first n elements of sv.
Exceptions
std::out_of_rangeif n is out of range.

Definition at line 60 of file head.hpp.

◆ hessian() [1/2]

template<typename T , typename F >
void stan::math::hessian ( const F &  f,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
T &  fx,
Eigen::Matrix< T, Eigen::Dynamic, 1 > &  grad,
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  H 
)

Calculate the value, the gradient, and the Hessian, of the specified function at the specified argument in time O(N^3) time and O(N^2) space.

The advantage over the mixed definition, which is faster for Hessians, is that this version is itself differentiable.

The functor must implement

fvar<fvar<T> > operator()(const Eigen::Matrix<fvar<fvar<T> >, Eigen::Dynamic, 1>&)

using only operations that are defined for the argument type.

This latter constraint usually requires the functions to be defined in terms of the libraries defined in Stan or in terms of functions with appropriately general namespace imports that eventually depend on functions defined in Stan.

Template Parameters
TType of underlying scalar
FType of function
Parameters
[in]fFunction
[in]xArgument to function
[out]fxFunction applied to argument
[out]gradgradient of function at argument
[out]HHessian of function at argument

Definition at line 41 of file hessian.hpp.

◆ hessian() [2/2]

template<typename F >
void stan::math::hessian ( const F &  f,
const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  x,
double &  fx,
Eigen::Matrix< double, Eigen::Dynamic, 1 > &  grad,
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &  H 
)

Calculate the value, the gradient, and the Hessian, of the specified function at the specified argument in O(N^2) time and O(N^2) space.

The functor must implement

fvar<var> operator()(const Eigen::Matrix<fvar<var>, Eigen::Dynamic, 1>&)

using only operations that are defined for fvar and var.

This latter constraint usually requires the functions to be defined in terms of the libraries defined in Stan or in terms of functions with appropriately general namespace imports that eventually depend on functions defined in Stan.

Template Parameters
FType of function
Parameters
[in]fFunction
[in]xArgument to function
[out]fxFunction applied to argument
[out]gradgradient of function at argument
[out]HHessian of function at argument

Definition at line 42 of file hessian.hpp.

◆ hessian_times_vector() [1/2]

template<typename F >
void stan::math::hessian_times_vector ( const F &  f,
const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  x,
const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  v,
double &  fx,
Eigen::Matrix< double, Eigen::Dynamic, 1 > &  Hv 
)

Definition at line 14 of file hessian_times_vector.hpp.

◆ hessian_times_vector() [2/2]

template<typename T , typename F >
void stan::math::hessian_times_vector ( const F &  f,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  v,
T &  fx,
Eigen::Matrix< T, Eigen::Dynamic, 1 > &  Hv 
)

Definition at line 40 of file hessian_times_vector.hpp.

◆ hypergeometric_log() [1/2]

template<bool propto, typename T_n , typename T_N , typename T_a , typename T_b >
double stan::math::hypergeometric_log ( const T_n &  n,
const T_N &  N,
const T_a &  a,
const T_b &  b 
)
Deprecated:
use hypergeometric_lpmf

Definition at line 14 of file hypergeometric_log.hpp.

◆ hypergeometric_log() [2/2]

template<typename T_n , typename T_N , typename T_a , typename T_b >
double stan::math::hypergeometric_log ( const T_n &  n,
const T_N &  N,
const T_a &  a,
const T_b &  b 
)
inline
Deprecated:
use hypergeometric_lpmf

Definition at line 23 of file hypergeometric_log.hpp.

◆ hypergeometric_lpmf() [1/2]

template<bool propto, typename T_n , typename T_N , typename T_a , typename T_b >
double stan::math::hypergeometric_lpmf ( const T_n &  n,
const T_N &  N,
const T_a &  a,
const T_b &  b 
)

Definition at line 18 of file hypergeometric_lpmf.hpp.

◆ hypergeometric_lpmf() [2/2]

template<typename T_n , typename T_N , typename T_a , typename T_b >
double stan::math::hypergeometric_lpmf ( const T_n &  n,
const T_N &  N,
const T_a &  a,
const T_b &  b 
)
inline

Definition at line 55 of file hypergeometric_lpmf.hpp.

◆ hypergeometric_rng()

template<class RNG >
int stan::math::hypergeometric_rng ( int  N,
int  a,
int  b,
RNG &  rng 
)
inline

Definition at line 15 of file hypergeometric_rng.hpp.

◆ hypot() [1/7]

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2>::type stan::math::hypot ( const T1 &  x,
const T2 &  y 
)
inline

Return the length of the hypoteneuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11).

In symbols, if the arguments are x and y, the result is sqrt(x * x + y * y).

Parameters
xFirst argument.
ySecond argument.
Returns
Length of hypoteneuse of right triangle with opposite and adjacent side lengths x and y.

Definition at line 25 of file hypot.hpp.

◆ hypot() [2/7]

template<typename T >
fvar<T> stan::math::hypot ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Return the length of the hypoteneuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11).

In symbols, if the arguments are 1 and x2, the result is sqrt(x1 * x1 + x2 * x2).

Template Parameters
TScalar type of autodiff variables.
Parameters
x1First argument.
x2Second argument.
Returns
Length of hypoteneuse of right triangle with opposite and adjacent side lengths x1 and x2.

Definition at line 26 of file hypot.hpp.

◆ hypot() [3/7]

var stan::math::hypot ( const var a,
const var b 
)
inline

Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99).

The partial derivatives are given by

$\frac{\partial}{\partial x} \sqrt{x^2 + y^2} = \frac{x}{\sqrt{x^2 + y^2}}$, and

$\frac{\partial}{\partial y} \sqrt{x^2 + y^2} = \frac{y}{\sqrt{x^2 + y^2}}$.

Parameters
[in]aLength of first side.
[in]bLength of second side.
Returns
Length of hypoteneuse.

Definition at line 45 of file hypot.hpp.

◆ hypot() [4/7]

template<typename T >
fvar<T> stan::math::hypot ( const fvar< T > &  x1,
double  x2 
)
inline

Return the length of the hypoteneuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11).

In symbols, if the arguments are 1 and x2, the result is sqrt(x1 * x1 + x2 * x2).

Template Parameters
TScalar type of autodiff variable.
Parameters
x1First argument.
x2Second argument.
Returns
Length of hypoteneuse of right triangle with opposite and adjacent side lengths x1 and x2.

Definition at line 46 of file hypot.hpp.

◆ hypot() [5/7]

var stan::math::hypot ( const var a,
double  b 
)
inline

Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99).

The derivative is

$\frac{d}{d x} \sqrt{x^2 + c^2} = \frac{x}{\sqrt{x^2 + c^2}}$.

Parameters
[in]aLength of first side.
[in]bLength of second side.
Returns
Length of hypoteneuse.

Definition at line 61 of file hypot.hpp.

◆ hypot() [6/7]

template<typename T >
fvar<T> stan::math::hypot ( double  x1,
const fvar< T > &  x2 
)
inline

Return the length of the hypoteneuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11).

In symbols, if the arguments are 1 and x2, the result is sqrt(x1 * x1 + x2 * x2).

Template Parameters
TScalar type of autodiff variable.
Parameters
x1First argument.
x2Second argument.
Returns
Length of hypoteneuse of right triangle with opposite and adjacent side lengths x1 and x2.

Definition at line 66 of file hypot.hpp.

◆ hypot() [7/7]

var stan::math::hypot ( double  a,
const var b 
)
inline

Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99).

The derivative is

$\frac{d}{d y} \sqrt{c^2 + y^2} = \frac{y}{\sqrt{c^2 + y^2}}$.

\[ \mbox{hypot}(x, y) = \begin{cases} \textrm{NaN} & \mbox{if } x < 0 \text{ or } y < 0 \\ \sqrt{x^2+y^2} & \mbox{if } x, y\geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{hypot}(x, y)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x < 0 \text{ or } y < 0 \\ \frac{x}{\sqrt{x^2+y^2}} & \mbox{if } x, y\geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{hypot}(x, y)}{\partial y} = \begin{cases} \textrm{NaN} & \mbox{if } x < 0 \text{ or } y < 0 \\ \frac{y}{\sqrt{x^2+y^2}} & \mbox{if } x, y\geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
[in]aLength of first side.
[in]bLength of second side.
Returns
Length of hypoteneuse.

Definition at line 104 of file hypot.hpp.

◆ ibeta() [1/2]

double stan::math::ibeta ( double  a,
double  b,
double  x 
)
inline

The normalized incomplete beta function of a, b, and x.

Used to compute the cumulative density function for the beta distribution.

Parameters
aShape parameter a <= 0; a and b can't both be 0
bShape parameter b <= 0
xRandom variate. 0 <= x <= 1
Exceptions
ifconstraints are violated or if any argument is NaN
Returns
The normalized incomplete beta function.

Definition at line 24 of file ibeta.hpp.

◆ ibeta() [2/2]

var stan::math::ibeta ( const var a,
const var b,
const var x 
)
inline

The normalized incomplete beta function of a, b, and x.

Used to compute the cumulative density function for the beta distribution.

Partial derivatives are those specified by wolfram alpha. The values were checked using both finite differences and by independent code for calculating the derivatives found in JSS (paper by Boik and Robison-Cox).

Parameters
aShape parameter.
bShape parameter.
xRandom variate.
Returns
The normalized incomplete beta function.
Exceptions
ifany argument is NaN.

Definition at line 208 of file ibeta.hpp.

◆ identity()

matrix_cl stan::math::identity ( int  rows_cols)
inline

Returns the identity matrix stored on the OpenCL device.

Parameters
rows_colsthe number of rows and columns
Returns
the identity matrix

Definition at line 20 of file identity.hpp.

◆ identity_constrain() [1/2]

template<typename T >
T stan::math::identity_constrain ( const T &  x)
inline

Returns the result of applying the identity constraint transform to the input.

This method is effectively a no-op and is mainly useful as a placeholder in auto-generated code.

Template Parameters
TType of scalar.
Parameters
[in]xfree scalar
Returns
transformed input

Definition at line 20 of file identity_constrain.hpp.

◆ identity_constrain() [2/2]

template<typename T >
T stan::math::identity_constrain ( const T &  x,
T &   
)
inline

Returns the result of applying the identity constraint transform to the input and increments the log probability reference with the log absolute Jacobian determinant.

This method is effectively a no-op and mainly useful as a placeholder in auto-generated code.

Template Parameters
Ttype of scalar.
Parameters
[in]xscalar
Returns
transformed input

Definition at line 37 of file identity_constrain.hpp.

◆ identity_free()

template<typename T >
T stan::math::identity_free ( const T &  y)
inline

Returns the result of applying the inverse of the identity constraint transform to the input.

This function is a no-op and mainly useful as a placeholder in auto-generated code.

Template Parameters
Ttype of value
Parameters
[in]yvalue
Returns
value

Definition at line 20 of file identity_free.hpp.

◆ if_else() [1/4]

var stan::math::if_else ( bool  c,
const var y_true,
const var y_false 
)
inline

If the specified condition is true, return the first variable, otherwise return the second variable.

Parameters
cBoolean condition.
y_trueVariable to return if condition is true.
y_falseVariable to return if condition is false.

Definition at line 18 of file if_else.hpp.

◆ if_else() [2/4]

template<typename T_true , typename T_false >
boost::math::tools::promote_args<T_true, T_false>::type stan::math::if_else ( const bool  c,
const T_true  y_true,
const T_false  y_false 
)
inline

Return the second argument if the first argument is true and otherwise return the second argument.

This is just a convenience method to provide a function with the same behavior as the built-in ternary operator. In general, this function behaves as if defined by

if_else(c, y1, y0) = c ? y1 : y0.

Parameters
cBoolean condition value.
y_trueValue to return if condition is true.
y_falseValue to return if condition is false.

Definition at line 25 of file if_else.hpp.

◆ if_else() [3/4]

var stan::math::if_else ( bool  c,
double  y_true,
const var y_false 
)
inline

If the specified condition is true, return a new variable constructed from the first scalar, otherwise return the second variable.

Parameters
cBoolean condition.
y_trueValue to promote to variable and return if condition is true.
y_falseVariable to return if condition is false.

Definition at line 30 of file if_else.hpp.

◆ if_else() [4/4]

var stan::math::if_else ( bool  c,
const var y_true,
double  y_false 
)
inline

If the specified condition is true, return the first variable, otherwise return a new variable constructed from the second scalar.

Parameters
cBoolean condition.
y_trueVariable to return if condition is true.
y_falseValue to promote to variable and return if condition is false.

Definition at line 45 of file if_else.hpp.

◆ inc_beta() [1/3]

double stan::math::inc_beta ( double  a,
double  b,
double  x 
)
inline

Definition at line 10 of file inc_beta.hpp.

◆ inc_beta() [2/3]

template<typename T >
fvar<T> stan::math::inc_beta ( const fvar< T > &  a,
const fvar< T > &  b,
const fvar< T > &  x 
)
inline

Definition at line 18 of file inc_beta.hpp.

◆ inc_beta() [3/3]

var stan::math::inc_beta ( const var a,
const var b,
const var c 
)
inline

Definition at line 37 of file inc_beta.hpp.

◆ inc_beta_dda()

template<typename T >
T stan::math::inc_beta_dda ( a,
b,
z,
digamma_a,
digamma_ab 
)

Returns the partial derivative of the regularized incomplete beta function, I_{z}(a, b) with respect to a.

The power series used to compute the deriative tends to converge slowly when a and b are large, especially if z approaches 1. The implementation will throw an exception if the series have not converged within 100,000 iterations. The current implementation has been tested for values of a and b up to 12500 and z = 0.999.

Template Parameters
Tscalar types of arguments
Parameters
aa
bb
zupper bound of the integral
digamma_avalue of digamma(a)
digamma_abvalue of digamma(b)
Returns
partial derivative of the incomplete beta with respect to a
Precondition
a >= 0
b >= 0
0 <= z <= 1

Definition at line 36 of file inc_beta_dda.hpp.

◆ inc_beta_ddb()

template<typename T >
T stan::math::inc_beta_ddb ( a,
b,
z,
digamma_b,
digamma_ab 
)

Returns the partial derivative of the regularized incomplete beta function, I_{z}(a, b) with respect to b.

The power series used to compute the deriative tends to converge slowly when a and b are large, especailly if z approaches 1. The implementation will throw an exception if the series have not converged within 100,000 iterations. The current implementation has been tested for values of a and b up to 12500 and z = 0.999.

Template Parameters
Tscalar types of arguments
Parameters
aa
bb
zupper bound of the integral
digamma_bvalue of digamma(b)
digamma_abvalue of digamma(b)
Returns
partial derivative of the incomplete beta with respect to b
Precondition
a >= 0
b >= 0
0 <= z <= 1

Definition at line 39 of file inc_beta_ddb.hpp.

◆ inc_beta_ddz() [1/2]

template<typename T >
T stan::math::inc_beta_ddz ( a,
b,
z 
)

Returns the partial derivative of the regularized incomplete beta function, I_{z}(a, b) with respect to z.

Template Parameters
Tscalar types of arguments
Parameters
aa
bb
zupper bound of the integral
Returns
partial derivative of the incomplete beta with respect to z
Precondition
a > 0
b > 0
0 < z <= 1

Definition at line 27 of file inc_beta_ddz.hpp.

◆ inc_beta_ddz() [2/2]

template<>
double stan::math::inc_beta_ddz ( double  a,
double  b,
double  z 
)
inline

Definition at line 35 of file inc_beta_ddz.hpp.

◆ initialize() [1/4]

template<typename T >
void stan::math::initialize ( T &  x,
const T &  v 
)
inline

Definition at line 15 of file initialize.hpp.

◆ initialize() [2/4]

template<typename T , typename V >
std::enable_if<std::is_arithmetic<V>::value, void>::type stan::math::initialize ( T &  x,
v 
)
inline

Definition at line 20 of file initialize.hpp.

◆ initialize() [3/4]

template<typename T , int R, int C, typename V >
void stan::math::initialize ( Eigen::Matrix< T, R, C > &  x,
const V &  v 
)
inline

Definition at line 24 of file initialize.hpp.

◆ initialize() [4/4]

template<typename T , typename V >
void stan::math::initialize ( std::vector< T > &  x,
const V &  v 
)
inline

Definition at line 29 of file initialize.hpp.

◆ initialize_variable() [1/3]

void stan::math::initialize_variable ( var variable,
const var value 
)
inline

Initialize variable to value.

(Function may look pointless, but its needed to bottom out recursion.)

Definition at line 16 of file initialize_variable.hpp.

◆ initialize_variable() [2/3]

template<int R, int C>
void stan::math::initialize_variable ( Eigen::Matrix< var, R, C > &  matrix,
const var value 
)
inline

Initialize every cell in the matrix to the specified value.

Definition at line 25 of file initialize_variable.hpp.

◆ initialize_variable() [3/3]

template<typename T >
void stan::math::initialize_variable ( std::vector< T > &  variables,
const var value 
)
inline

Initialize the variables in the standard vector recursively.

Definition at line 35 of file initialize_variable.hpp.

◆ int_step()

template<typename T >
int stan::math::int_step ( const T &  y)
inline

The integer step, or Heaviside, function.

For double NaN input, int_step(NaN) returns 0.

\[ \mbox{int\_step}(x) = \begin{cases} 0 & \mbox{if } x \leq 0 \\ 1 & \mbox{if } x > 0 \\[6pt] 0 & \mbox{if } x = \textrm{NaN} \end{cases} \]

Template Parameters
Tvalue type
Parameters
[in]yvalue
Returns
1 if value is greater than 0 and 0 otherwise

Definition at line 27 of file int_step.hpp.

◆ integrate()

template<typename F >
double stan::math::integrate ( const F &  f,
double  a,
double  b,
double  relative_tolerance 
)
inline

Integrate a single variable function f from a to b to within a specified relative tolerance.

This function assumes a is less than b.

The signature for f should be: double f(double x, double xc)

It should return the value of the function evaluated at x.

Depending on whether or not a is finite or negative infinity and b is finite or positive infinity, a different version of the 1d quadrature algorithm from the Boost quadrature library is chosen.

Integrals that cross zero are broken into two, and the separate integrals are each integrated to the given relative tolerance.

For integrals with finite limits, the xc argument is the distance to the nearest boundary. So for a > 0, b > 0, it will be a - x for x closer to a, and b - x for x closer to b. xc is computed in a way that avoids the precision loss of computing a - x or b - x manually. For integrals that cross zero, xc can take values a - x, -x, or b - x depending on which integration limit it is nearest.

If either limit is infinite, xc is set to NaN

Template Parameters
TType of f
Parameters
fthe function to be integrated
alower limit of integration
bupper limit of integration
relative_tolerancetarget relative tolerance passed to Boost quadrature
Returns
numeric integral of function f

If the integral crosses zero, break it into two (advice from the Boost implementation: https://www.boost.org/doc/libs/1_66_0/libs/math/doc/html/math_toolkit/double_exponential/de_caveats.html)

Definition at line 51 of file integrate_1d.hpp.

◆ integrate_1d() [1/2]

template<typename F , typename T_a , typename T_b , typename T_theta >
std::enable_if<std::is_same<T_a, var>::value || std::is_same<T_b, var>::value || std::is_same<T_theta, var>::value, var>::type stan::math::integrate_1d ( const F &  f,
const T_a &  a,
const T_b &  b,
const std::vector< T_theta > &  theta,
const std::vector< double > &  x_r,
const std::vector< int > &  x_i,
std::ostream &  msgs,
const double  relative_tolerance = std::sqrt(std::numeric_limits<double>::epsilon()) 
)
inline

Compute the integral of the single variable function f from a to b to within a specified relative tolerance.

a and b can be finite or infinite.

f should be compatible with reverse mode autodiff and have the signature: var f(double x, double xc, const std::vector<var>& theta, const std::vector<double>& x_r, const std::vector<int> &x_i, std::ostream* msgs)

It should return the value of the function evaluated at x. Any errors should be printed to the msgs stream.

Integrals that cross zero are broken into two, and the separate integrals are each integrated to the given relative tolerance.

For integrals with finite limits, the xc argument is the distance to the nearest boundary. So for a > 0, b > 0, it will be a - x for x closer to a, and b - x for x closer to b. xc is computed in a way that avoids the precision loss of computing a - x or b - x manually. For integrals that cross zero, xc can take values a - x, -x, or b - x depending on which integration limit it is nearest.

If either limit is infinite, xc is set to NaN

The integration algorithm terminates when

\[ \frac{{|I_{n + 1} - I_n|}}{{|I|_{n + 1}}} < \text{relative tolerance} \]

where $I_{n}$ is the nth estimate of the integral and $|I|_{n}$ is the nth estimate of the norm of the integral.

Integrals that cross zero are split into two. In this case, each integral is separately integrated to the given relative_tolerance.

Gradients of f that evaluate to NaN when the function evaluates to zero are set to zero themselves. This is due to the autodiff easily overflowing to NaN when evaluating gradients near the maximum and minimum floating point values (where the function should be zero anyway for the integral to exist)

Template Parameters
T_atype of first limit
T_btype of second limit
T_thetatype of parameters
TType of f
Parameters
fthe functor to integrate
alower limit of integration
bupper limit of integration
thetaadditional parameters to be passed to f
x_radditional data to be passed to f
x_iadditional integer data to be passed to f
[in,out]msgsthe print stream for warning messages
relative_tolerancerelative tolerance passed to Boost quadrature
Returns
numeric integral of function f

Definition at line 120 of file integrate_1d.hpp.

◆ integrate_1d() [2/2]

template<typename F >
double stan::math::integrate_1d ( const F &  f,
const double  a,
const double  b,
const std::vector< double > &  theta,
const std::vector< double > &  x_r,
const std::vector< int > &  x_i,
std::ostream &  msgs,
const double  relative_tolerance = std::sqrt(std::numeric_limits<double>::epsilon()) 
)
inline

Compute the integral of the single variable function f from a to b to within a specified relative tolerance.

a and b can be finite or infinite.

The signature for f should be: double f(double x, double xc, const std::vector<double>& theta, const std::vector<double>& x_r, const std::vector<int>& x_i, std::ostream* msgs)

It should return the value of the function evaluated at x. Any errors should be printed to the msgs stream.

Integrals that cross zero are broken into two, and the separate integrals are each integrated to the given relative tolerance.

For integrals with finite limits, the xc argument is the distance to the nearest boundary. So for a > 0, b > 0, it will be a - x for x closer to a, and b - x for x closer to b. xc is computed in a way that avoids the precision loss of computing a - x or b - x manually. For integrals that cross zero, xc can take values a - x, -x, or b - x depending on which integration limit it is nearest.

If either limit is infinite, xc is set to NaN

The integration algorithm terminates when

\[ \frac{{|I_{n + 1} - I_n|}}{{|I|_{n + 1}}} < \text{relative tolerance} \]

where $I_{n}$ is the nth estimate of the integral and $|I|_{n}$ is the nth estimate of the norm of the integral.

Integrals that cross zero are split into two. In this case, each integral is separately integrated to the given relative_tolerance.

Template Parameters
TType of f
Parameters
fthe function to be integrated
alower limit of integration
bupper limit of integration
thetaadditional parameters to be passed to f
x_radditional data to be passed to f
x_iadditional integer data to be passed to f
[in,out]msgsthe print stream for warning messages
relative_tolerancetolerance passed to Boost quadrature
Returns
numeric integral of function f

Definition at line 195 of file integrate_1d.hpp.

◆ integrate_dae()

template<typename F , typename Tpar >
std::vector<std::vector<Tpar> > stan::math::integrate_dae ( const F &  f,
const std::vector< double > &  yy0,
const std::vector< double > &  yp0,
double  t0,
const std::vector< double > &  ts,
const std::vector< Tpar > &  theta,
const std::vector< double > &  x_r,
const std::vector< int > &  x_i,
const double  rtol,
const double  atol,
const int64_t  max_num_steps = idas_integrator::IDAS_MAX_STEPS,
std::ostream *  msgs = nullptr 
)

Return the solutions for a semi-explicit DAE system with residual specified by functor F, given the specified consistent initial state yy0 and yp0.

Template Parameters
DAEtype of DAE system
Tparscalar type of parameter theta
Parameters
[in]ffunctor for the base ordinary differential equation
[in]yy0initial state
[in]yp0initial derivative state
[in]t0initial time
[in]tstimes of the desired solutions, in strictly increasing order, all greater than the initial time
[in]thetaparameters
[in]x_rreal data
[in]x_iint data
[in]rtolrelative tolerance passed to IDAS, requred <10^-3
[in]atolabsolute tolerance passed to IDAS, problem-dependent
[in]max_num_stepsmaximal number of admissable steps between time-points
[in]msgsmessage
Returns
a vector of states, each state being a vector of the same size as the state variable, corresponding to a time in ts.

Definition at line 37 of file integrate_dae.hpp.

◆ integrate_ode_adams()

template<typename F , typename T_initial , typename T_param , typename T_t0 , typename T_ts >
std::vector<std::vector< typename stan::return_type<T_initial, T_param, T_t0, T_ts>::type> > stan::math::integrate_ode_adams ( const F &  f,
const std::vector< T_initial > &  y0,
const T_t0 &  t0,
const std::vector< T_ts > &  ts,
const std::vector< T_param > &  theta,
const std::vector< double > &  x,
const std::vector< int > &  x_int,
std::ostream *  msgs = nullptr,
double  relative_tolerance = 1e-10,
double  absolute_tolerance = 1e-10,
long int  max_num_steps = 1e8 
)

Definition at line 16 of file integrate_ode_adams.hpp.

◆ integrate_ode_bdf()

template<typename F , typename T_initial , typename T_param , typename T_t0 , typename T_ts >
std::vector<std::vector< typename stan::return_type<T_initial, T_param, T_t0, T_ts>::type> > stan::math::integrate_ode_bdf ( const F &  f,
const std::vector< T_initial > &  y0,
const T_t0 &  t0,
const std::vector< T_ts > &  ts,
const std::vector< T_param > &  theta,
const std::vector< double > &  x,
const std::vector< int > &  x_int,
std::ostream *  msgs = nullptr,
double  relative_tolerance = 1e-10,
double  absolute_tolerance = 1e-10,
long int  max_num_steps = 1e8 
)

Definition at line 16 of file integrate_ode_bdf.hpp.

◆ integrate_ode_rk45()

template<typename F , typename T1 , typename T2 , typename T_t0 , typename T_ts >
std::vector<std::vector<typename stan::return_type<T1, T2, T_t0, T_ts>::type> > stan::math::integrate_ode_rk45 ( const F &  f,
const std::vector< T1 > &  y0,
const T_t0 &  t0,
const std::vector< T_ts > &  ts,
const std::vector< T2 > &  theta,
const std::vector< double > &  x,
const std::vector< int > &  x_int,
std::ostream *  msgs = nullptr,
double  relative_tolerance = 1e-6,
double  absolute_tolerance = 1e-6,
int  max_num_steps = 1E6 
)

Return the solutions for the specified system of ordinary differential equations given the specified initial state, initial times, times of desired solution, and parameters and data, writing error and warning messages to the specified stream.

Warning: If the system of equations is stiff, roughly defined by having varying time scales across dimensions, then this solver is likely to be slow.

This function is templated to allow the initial times to be either data or autodiff variables and the parameters to be data or autodiff variables. The autodiff-based implementation for reverse-mode are defined in namespace stan::math and may be invoked via argument-dependent lookup by including their headers.

This function uses the Dormand-Prince method as implemented in Boost's boost::numeric::odeint::runge_kutta_dopri5 integrator.

Template Parameters
Ftype of ODE system function.
T1type of scalars for initial values.
T2type of scalars for parameters.
T_t0type of scalar of initial time point.
T_tstype of time-points where ODE solution is returned.
Parameters
[in]ffunctor for the base ordinary differential equation.
[in]y0initial state.
[in]t0initial time.
[in]tstimes of the desired solutions, in strictly increasing order, all greater than the initial time.
[in]thetaparameter vector for the ODE.
[in]xcontinuous data vector for the ODE.
[in]x_intinteger data vector for the ODE.
[out]msgsthe print stream for warning messages.
[in]relative_tolerancerelative tolerance parameter for Boost's ode solver. Defaults to 1e-6.
[in]absolute_toleranceabsolute tolerance parameter for Boost's ode solver. Defaults to 1e-6.
[in]max_num_stepsmaximum number of steps to take within the Boost ode solver.
Returns
a vector of states, each state being a vector of the same size as the state variable, corresponding to a time in ts.

Definition at line 75 of file integrate_ode_rk45.hpp.

◆ inv() [1/4]

double stan::math::inv ( double  x)
inline

Definition at line 8 of file inv.hpp.

◆ inv() [2/4]

template<typename T >
fvar<T> stan::math::inv ( const fvar< T > &  x)
inline

Definition at line 12 of file inv.hpp.

◆ inv() [3/4]

template<typename T >
apply_scalar_unary<inv_fun, T>::return_t stan::math::inv ( const T &  x)
inline

Vectorized version of inv().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
1 divided by each value in x.

Definition at line 30 of file inv.hpp.

◆ inv() [4/4]

var stan::math::inv ( const var a)
inline

\[ \mbox{inv}(x) = \begin{cases} \frac{1}{x} & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{inv}(x)}{\partial x} = \begin{cases} -\frac{1}{x^2} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Definition at line 38 of file inv.hpp.

◆ inv_chi_square_ccdf_log()

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::inv_chi_square_ccdf_log ( const T_y &  y,
const T_dof &  nu 
)
Deprecated:
use inv_chi_square_lccdf

Definition at line 14 of file inv_chi_square_ccdf_log.hpp.

◆ inv_chi_square_cdf()

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::inv_chi_square_cdf ( const T_y &  y,
const T_dof &  nu 
)

Returns the inverse chi square cumulative distribution function for the given variate and degrees of freedom.

If given containers of matching sizes, returns the product of probabilities.

Template Parameters
T_ytype of scalar parameter
T_doftype of degrees of freedom parameter
Parameters
yscalar parameter
nudegrees of freedom parameter
Returns
probability or product of probabilities
Exceptions
std::domain_errorif y is negative or nu is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 35 of file inv_chi_square_cdf.hpp.

◆ inv_chi_square_cdf_log()

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::inv_chi_square_cdf_log ( const T_y &  y,
const T_dof &  nu 
)
Deprecated:
use inv_chi_square_lcdf

Definition at line 14 of file inv_chi_square_cdf_log.hpp.

◆ inv_chi_square_lccdf()

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::inv_chi_square_lccdf ( const T_y &  y,
const T_dof &  nu 
)

Returns the inverse chi square log complementary cumulative distribution function for the given variate and degrees of freedom.

If given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ytype of scalar parameter
T_doftype of degrees of freedom parameter
Parameters
yscalar parameter
nudegrees of freedom parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif y is negative or nu is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 36 of file inv_chi_square_lccdf.hpp.

◆ inv_chi_square_lcdf()

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::inv_chi_square_lcdf ( const T_y &  y,
const T_dof &  nu 
)

Returns the inverse chi square log cumulative distribution function for the given variate and degrees of freedom.

If given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ytype of scalar parameter
T_doftype of degrees of freedom parameter
Parameters
yscalar parameter
nudegrees of freedom parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif y is negative or nu is nonpositive
std::invalid_argumentif container sizes mismatch

Definition at line 36 of file inv_chi_square_lcdf.hpp.

◆ inv_chi_square_log() [1/2]

template<bool propto, typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::inv_chi_square_log ( const T_y &  y,
const T_dof &  nu 
)

The log of an inverse chi-squared density for y with the specified degrees of freedom parameter.

The degrees of freedom prarameter must be greater than 0. y must be greater than 0.

\begin{eqnarray*} y &\sim& \mbox{\sf{Inv-}}\chi^2_\nu \\ \log (p (y \, |\, \nu)) &=& \log \left( \frac{2^{-\nu / 2}}{\Gamma (\nu / 2)} y^{- (\nu / 2 + 1)} \exp^{-1 / (2y)} \right) \\ &=& - \frac{\nu}{2} \log(2) - \log (\Gamma (\nu / 2)) - (\frac{\nu}{2} + 1) \log(y) - \frac{1}{2y} \\ & & \mathrm{ where } \; y > 0 \end{eqnarray*}

Deprecated:
use inv_chi_square_lpdf
Parameters
yA scalar variable.
nuDegrees of freedom.
Exceptions
std::domain_errorif nu is not greater than or equal to 0
std::domain_errorif y is not greater than or equal to 0.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.

Definition at line 33 of file inv_chi_square_log.hpp.

◆ inv_chi_square_log() [2/2]

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::inv_chi_square_log ( const T_y &  y,
const T_dof &  nu 
)
inline
Deprecated:
use inv_chi_square_lpdf

Definition at line 42 of file inv_chi_square_log.hpp.

◆ inv_chi_square_lpdf() [1/2]

template<bool propto, typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::inv_chi_square_lpdf ( const T_y &  y,
const T_dof &  nu 
)

The log of an inverse chi-squared density for y with the specified degrees of freedom parameter.

The degrees of freedom prarameter must be greater than 0. y must be greater than 0.

\begin{eqnarray*} y &\sim& \mbox{\sf{Inv-}}\chi^2_\nu \\ \log (p (y \, |\, \nu)) &=& \log \left( \frac{2^{-\nu / 2}}{\Gamma (\nu / 2)} y^{- (\nu / 2 + 1)} \exp^{-1 / (2y)} \right) \\ &=& - \frac{\nu}{2} \log(2) - \log (\Gamma (\nu / 2)) - (\frac{\nu}{2} + 1) \log(y) - \frac{1}{2y} \\ & & \mathrm{ where } \; y > 0 \end{eqnarray*}

Parameters
yA scalar variable.
nuDegrees of freedom.
Exceptions
std::domain_errorif nu is not greater than or equal to 0
std::domain_errorif y is not greater than or equal to 0.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.

Definition at line 39 of file inv_chi_square_lpdf.hpp.

◆ inv_chi_square_lpdf() [2/2]

template<typename T_y , typename T_dof >
return_type<T_y, T_dof>::type stan::math::inv_chi_square_lpdf ( const T_y &  y,
const T_dof &  nu 
)
inline

Definition at line 115 of file inv_chi_square_lpdf.hpp.

◆ inv_chi_square_rng()

template<typename T_deg , class RNG >
VectorBuilder<true, double, T_deg>::type stan::math::inv_chi_square_rng ( const T_deg &  nu,
RNG &  rng 
)
inline

Return a pseudorandom inverse chi squared variate with the nu degrees of freedom using the specified random number generator.

nu can be a scalar or a one-dimensional container.

Template Parameters
T_degType of degrees of freedom parameter
RNGclass of random number generator
Parameters
nu(Sequence of) positive degrees of freedom parameter(s)
rngrandom number generator
Returns
(Sequence of) inverse chi squared random variate(s)
Exceptions
std::domain_errorif nu is nonpositive

Definition at line 27 of file inv_chi_square_rng.hpp.

◆ inv_cloglog() [1/4]

template<typename T >
fvar<T> stan::math::inv_cloglog ( const fvar< T > &  x)
inline

Definition at line 12 of file inv_cloglog.hpp.

◆ inv_cloglog() [2/4]

template<typename T >
apply_scalar_unary<inv_cloglog_fun, T>::return_t stan::math::inv_cloglog ( const T &  x)
inline

Vectorized version of inv_cloglog().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
1 - exp(-exp()) applied to each value in x.

Definition at line 30 of file inv_cloglog.hpp.

◆ inv_cloglog() [3/4]

var stan::math::inv_cloglog ( const var a)
inline

Return the inverse complementary log-log function applied specified variable (stan).

See inv_cloglog() for the double-based version.

The derivative is given by

$\frac{d}{dx} \mbox{cloglog}^{-1}(x) = \exp (x - \exp (x))$.

Parameters
aVariable argument.
Returns
The inverse complementary log-log of the specified argument.

Definition at line 36 of file inv_cloglog.hpp.

◆ inv_cloglog() [4/4]

double stan::math::inv_cloglog ( double  x)
inline

The inverse complementary log-log function.

The function is defined by

inv_cloglog(x) = 1 - exp(-exp(x)).

This function can be used to implement the inverse link function for complementary-log-log regression.

\[ \mbox{inv\_cloglog}(y) = \begin{cases} \mbox{cloglog}^{-1}(y) & \mbox{if } -\infty\leq y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{inv\_cloglog}(y)}{\partial y} = \begin{cases} \frac{\partial\, \mbox{cloglog}^{-1}(y)}{\partial y} & \mbox{if } -\infty\leq y\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } y = \textrm{NaN} \end{cases} \]

\[ \mbox{cloglog}^{-1}(y) = 1 - \exp \left( - \exp(y) \right) \]

\[ \frac{\partial \, \mbox{cloglog}^{-1}(y)}{\partial y} = \exp(y-\exp(y)) \]

Parameters
xArgument.
Returns
Inverse complementary log-log of the argument.

Definition at line 48 of file inv_cloglog.hpp.

◆ inv_gamma_ccdf_log()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::inv_gamma_ccdf_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  beta 
)
Deprecated:
use inv_gamma_lccdf

Definition at line 14 of file inv_gamma_ccdf_log.hpp.

◆ inv_gamma_cdf()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::inv_gamma_cdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  beta 
)

The CDF of an inverse gamma density for y with the specified shape and scale parameters.

y, shape, and scale parameters must be greater than 0.

Parameters
yA scalar variable.
alphaShape parameter.
betaScale parameter.
Exceptions
std::domain_errorif alpha is not greater than 0.
std::domain_errorif beta is not greater than 0.
std::domain_errorif y is not greater than 0.
Template Parameters
T_yType of scalar.
T_shapeType of shape.
T_scaleType of scale.

Definition at line 38 of file inv_gamma_cdf.hpp.

◆ inv_gamma_cdf_log()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::inv_gamma_cdf_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  beta 
)
Deprecated:
use inv_gamma_lcdf

Definition at line 14 of file inv_gamma_cdf_log.hpp.

◆ inv_gamma_lccdf()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::inv_gamma_lccdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  beta 
)

Definition at line 23 of file inv_gamma_lccdf.hpp.

◆ inv_gamma_lcdf()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::inv_gamma_lcdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  beta 
)

Definition at line 23 of file inv_gamma_lcdf.hpp.

◆ inv_gamma_log() [1/2]

template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::inv_gamma_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  beta 
)

The log of an inverse gamma density for y with the specified shape and scale parameters.

Shape and scale parameters must be greater than 0. y must be greater than 0.

Deprecated:
use inv_gamma_lpdf
Parameters
yA scalar variable.
alphaShape parameter.
betaScale parameter.
Exceptions
std::domain_errorif alpha is not greater than 0.
std::domain_errorif beta is not greater than 0.
std::domain_errorif y is not greater than 0.
Template Parameters
T_yType of scalar.
T_shapeType of shape.
T_scaleType of scale.

Definition at line 29 of file inv_gamma_log.hpp.

◆ inv_gamma_log() [2/2]

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::inv_gamma_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  beta 
)
inline
Deprecated:
use inv_gamma_lpdf

Definition at line 38 of file inv_gamma_log.hpp.

◆ inv_gamma_lpdf() [1/2]

template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::inv_gamma_lpdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  beta 
)

The log of an inverse gamma density for y with the specified shape and scale parameters.

Shape and scale parameters must be greater than 0. y must be greater than 0.

Parameters
yA scalar variable.
alphaShape parameter.
betaScale parameter.
Exceptions
std::domain_errorif alpha is not greater than 0.
std::domain_errorif beta is not greater than 0.
std::domain_errorif y is not greater than 0.
Template Parameters
T_yType of scalar.
T_shapeType of shape.
T_scaleType of scale.

Definition at line 35 of file inv_gamma_lpdf.hpp.

◆ inv_gamma_lpdf() [2/2]

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::inv_gamma_lpdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  beta 
)
inline

Definition at line 128 of file inv_gamma_lpdf.hpp.

◆ inv_gamma_rng()

template<typename T_shape , typename T_scale , class RNG >
VectorBuilder<true, double, T_shape, T_scale>::type stan::math::inv_gamma_rng ( const T_shape &  alpha,
const T_scale &  beta,
RNG &  rng 
)
inline

Return a pseudorandom inverse gamma variate for the given shape and scale parameters using the specified random number generator.

alpha and beta can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_shapeType of shape parameter
T_scaleType of scale parameter
RNGtype of random number generator
Parameters
alpha(Sequence of) positive shape parameter(s)
beta(Sequence of) positive scale parameter(s)
rngrandom number generator
Returns
(Sequence of) inverse gamma random variate(s)
Exceptions
std::domain_errorif alpha or beta are nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 33 of file inv_gamma_rng.hpp.

◆ inv_logit() [1/4]

template<typename T >
fvar<T> stan::math::inv_logit ( const fvar< T > &  x)
inline

Returns the inverse logit function applied to the argument.

Template Parameters
Tscalar type of forward-mode autodiff variable argument.
Parameters
xargument
Returns
inverse logit of argument

Definition at line 20 of file inv_logit.hpp.

◆ inv_logit() [2/4]

template<typename T >
apply_scalar_unary<inv_logit_fun, T>::return_t stan::math::inv_logit ( const T &  x)
inline

Vectorized version of inv_logit().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Inverse logit applied to each value in x.

Definition at line 30 of file inv_logit.hpp.

◆ inv_logit() [3/4]

var stan::math::inv_logit ( const var a)
inline

The inverse logit function for variables (stan).

See inv_logit() for the double-based version.

The derivative of inverse logit is

$\frac{d}{dx} \mbox{logit}^{-1}(x) = \mbox{logit}^{-1}(x) (1 - \mbox{logit}^{-1}(x))$.

Parameters
aArgument variable.
Returns
Inverse logit of argument.

Definition at line 32 of file inv_logit.hpp.

◆ inv_logit() [4/4]

double stan::math::inv_logit ( double  a)
inline

Returns the inverse logit function applied to the argument.

The inverse logit function is defined by

$\mbox{logit}^{-1}(x) = \frac{1}{1 + \exp(-x)}$.

This function can be used to implement the inverse link function for logistic regression.

The inverse to this function is logit.

\[ \mbox{inv\_logit}(y) = \begin{cases} \mbox{logit}^{-1}(y) & \mbox{if } -\infty\leq y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{inv\_logit}(y)}{\partial y} = \begin{cases} \frac{\partial\, \mbox{logit}^{-1}(y)}{\partial y} & \mbox{if } -\infty\leq y\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } y = \textrm{NaN} \end{cases} \]

\[ \mbox{logit}^{-1}(y) = \frac{1}{1 + \exp(-y)} \]

\[ \frac{\partial \, \mbox{logit}^{-1}(y)}{\partial y} = \frac{\exp(y)}{(\exp(y)+1)^2} \]

Parameters
aArgument.
Returns
Inverse logit of argument.

Definition at line 49 of file inv_logit.hpp.

◆ inv_Phi() [1/4]

template<typename T >
fvar<T> stan::math::inv_Phi ( const fvar< T > &  p)
inline

Definition at line 14 of file inv_Phi.hpp.

◆ inv_Phi() [2/4]

double stan::math::inv_Phi ( double  p)
inline

The inverse of the unit normal cumulative distribution function.

The return value for a specified input probability, $p$, is the unit normal variate, $x$, such that

$\Phi(x) = \int_{-\infty}^x \mbox{\sf Norm}(x|0, 1) \ dx = p$

Algorithm first derived in 2003 by Peter Jon Aklam at http://home.online.no/~pjacklam/notes/invnorm/

Parameters
pArgument between 0 and 1.
Returns
Real number

Definition at line 28 of file inv_Phi.hpp.

◆ inv_Phi() [3/4]

template<typename T >
apply_scalar_unary<inv_Phi_fun, T>::return_t stan::math::inv_Phi ( const T &  x)
inline

Vectorized version of inv_Phi().

Parameters
xContainer of variables in range [0, 1].
Template Parameters
TContainer type.
Returns
Inverse unit normal CDF of each value in x.
Exceptions
std::domain_errorif any value is not between 0 and 1.

Definition at line 32 of file inv_Phi.hpp.

◆ inv_Phi() [4/4]

var stan::math::inv_Phi ( const var p)
inline

The inverse of unit normal cumulative density function.

See inv_Phi() for the double-based version.

The derivative is the reciprocal of unit normal density function,

Parameters
pProbability
Returns
The unit normal inverse cdf evaluated at p

Definition at line 34 of file inv_Phi.hpp.

◆ inv_sqrt() [1/4]

template<typename T >
fvar<T> stan::math::inv_sqrt ( const fvar< T > &  x)
inline

Definition at line 11 of file inv_sqrt.hpp.

◆ inv_sqrt() [2/4]

double stan::math::inv_sqrt ( double  x)
inline

Definition at line 11 of file inv_sqrt.hpp.

◆ inv_sqrt() [3/4]

template<typename T >
apply_scalar_unary<inv_sqrt_fun, T>::return_t stan::math::inv_sqrt ( const T &  x)
inline

Vectorized version of inv_sqrt().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
1 / sqrt of each value in x.

Definition at line 30 of file inv_sqrt.hpp.

◆ inv_sqrt() [4/4]

var stan::math::inv_sqrt ( const var a)
inline

\[ \mbox{inv\_sqrt}(x) = \begin{cases} \frac{1}{\sqrt{x}} & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{inv\_sqrt}(x)}{\partial x} = \begin{cases} -\frac{1}{2\sqrt{x^3}} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Definition at line 40 of file inv_sqrt.hpp.

◆ inv_square() [1/4]

double stan::math::inv_square ( double  x)
inline

Definition at line 10 of file inv_square.hpp.

◆ inv_square() [2/4]

template<typename T >
fvar<T> stan::math::inv_square ( const fvar< T > &  x)
inline

Definition at line 12 of file inv_square.hpp.

◆ inv_square() [3/4]

template<typename T >
apply_scalar_unary<inv_square_fun, T>::return_t stan::math::inv_square ( const T &  x)
inline

Vectorized version of inv_square().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
1 / the square of each value in x.

Definition at line 30 of file inv_square.hpp.

◆ inv_square() [4/4]

var stan::math::inv_square ( const var a)
inline

\[ \mbox{inv\_square}(x) = \begin{cases} \frac{1}{x^2} & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{inv\_square}(x)}{\partial x} = \begin{cases} -\frac{2}{x^3} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Definition at line 40 of file inv_square.hpp.

◆ inv_wishart_log() [1/2]

template<bool propto, typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args<T_y, T_dof, T_scale>::type stan::math::inv_wishart_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  W,
const T_dof &  nu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &  S 
)

The log of the Inverse-Wishart density for the given W, degrees of freedom, and scale matrix.

The scale matrix, S, must be k x k, symmetric, and semi-positive definite.

Deprecated:
use inverse_wishart_lpdf
Parameters
WA scalar matrix
nuDegrees of freedom
SThe scale matrix
Returns
The log of the Inverse-Wishart density at W given nu and S.
Exceptions
std::domain_errorif nu is not greater than k-1
std::domain_errorif S is not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.
T_scaleType of scale.

Definition at line 34 of file inv_wishart_log.hpp.

◆ inv_wishart_log() [2/2]

template<typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args<T_y, T_dof, T_scale>::type stan::math::inv_wishart_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  W,
const T_dof &  nu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &  S 
)
inline
Deprecated:
use inverse_wishart_lpdf

Definition at line 46 of file inv_wishart_log.hpp.

◆ inv_wishart_lpdf() [1/2]

template<bool propto, typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args<T_y, T_dof, T_scale>::type stan::math::inv_wishart_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  W,
const T_dof &  nu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &  S 
)

The log of the Inverse-Wishart density for the given W, degrees of freedom, and scale matrix.

The scale matrix, S, must be k x k, symmetric, and semi-positive definite.

\begin{eqnarray*} W &\sim& \mbox{\sf{Inv-Wishart}}_{\nu} (S) \\ \log (p (W \, |\, \nu, S) ) &=& \log \left( \left(2^{\nu k/2} \pi^{k (k-1) /4} \prod_{i=1}^k{\Gamma (\frac{\nu + 1 - i}{2})} \right)^{-1} \times \left| S \right|^{\nu/2} \left| W \right|^{-(\nu + k + 1) / 2} \times \exp (-\frac{1}{2} \mbox{tr} (S W^{-1})) \right) \\ &=& -\frac{\nu k}{2}\log(2) - \frac{k (k-1)}{4} \log(\pi) - \sum_{i=1}^{k}{\log (\Gamma (\frac{\nu+1-i}{2}))} +\frac{\nu}{2} \log(\det(S)) - \frac{\nu+k+1}{2}\log (\det(W)) - \frac{1}{2} \mbox{tr}(S W^{-1}) \end{eqnarray*}

Parameters
WA scalar matrix
nuDegrees of freedom
SThe scale matrix
Returns
The log of the Inverse-Wishart density at W given nu and S.
Exceptions
std::domain_errorif nu is not greater than k-1
std::domain_errorif S is not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.
T_scaleType of scale.

Definition at line 48 of file inv_wishart_lpdf.hpp.

◆ inv_wishart_lpdf() [2/2]

template<typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args<T_y, T_dof, T_scale>::type stan::math::inv_wishart_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  W,
const T_dof &  nu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &  S 
)
inline

Definition at line 105 of file inv_wishart_lpdf.hpp.

◆ inv_wishart_rng()

template<class RNG >
Eigen::MatrixXd stan::math::inv_wishart_rng ( double  nu,
const Eigen::MatrixXd &  S,
RNG &  rng 
)
inline

Definition at line 14 of file inv_wishart_rng.hpp.

◆ invalid_argument() [1/2]

template<typename T >
void stan::math::invalid_argument ( const char *  function,
const char *  name,
const T &  y,
const char *  msg1,
const char *  msg2 
)
inline

Throw an invalid_argument exception with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing invalid argument. This will allow us to change the behavior for all functions at once. The message is: "<function>: <name> <msg1><y><msg2>"

Template Parameters
TType of variable
Parameters
functionName of the function
nameName of the variable
yVariable
msg1Message to print before the variable
msg2Message to print after the variable
Exceptions
std::invalid_argument

Definition at line 27 of file invalid_argument.hpp.

◆ invalid_argument() [2/2]

template<typename T >
void stan::math::invalid_argument ( const char *  function,
const char *  name,
const T &  y,
const char *  msg1 
)
inline

Throw an invalid_argument exception with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing invalid argument. This will allow us to change the behavior for all functions at once. (We've already changed behavior mulitple times up to Stan v2.5.0.) The message is: "<function>: <name> <msg1><y>"

Template Parameters
TType of variable
Parameters
functionName of the function
nameName of the variable
yVariable
msg1Message to print before the variable
Exceptions
std::invalid_argument

Definition at line 49 of file invalid_argument.hpp.

◆ invalid_argument_vec() [1/2]

template<typename T >
void stan::math::invalid_argument_vec ( const char *  function,
const char *  name,
const T &  y,
size_t  i,
const char *  msg1,
const char *  msg2 
)
inline

Throw an invalid argument exception with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing invalid arguments. This will allow us to change the behavior for all functions at once. (We've already changed behavior mulitple times up to Stan v2.5.0.) The message is: "<function>: <name>[<i+error_index>] <msg1><y>" where error_index is the value of stan::error_index::value which indicates whether the message should be 0 or 1 indexed.

Template Parameters
TType of variable
Parameters
functionName of the function
nameName of the variable
yVariable
iIndex
msg1Message to print before the variable
msg2Message to print after the variable
Exceptions
std::invalid_argument

Definition at line 32 of file invalid_argument_vec.hpp.

◆ invalid_argument_vec() [2/2]

template<typename T >
void stan::math::invalid_argument_vec ( const char *  function,
const char *  name,
const T &  y,
size_t  i,
const char *  msg 
)
inline

Throw an invalid argument exception with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing invalid arguments. This will allow us to change the behavior for all functions at once. (We've already changed behavior mulitple times up to Stan v2.5.0.) The message is: "<function>: <name>[<i+error_index>] <msg1><y>" where error_index is the value of stan::error_index::value which indicates whether the message should be 0 or 1 indexed.

Template Parameters
TType of variable
Parameters
functionName of the function
nameName of the variable
yVariable
iIndex
msgMessage to print before the variable
Exceptions
std::invalid_argument

Definition at line 60 of file invalid_argument_vec.hpp.

◆ inverse() [1/2]

template<typename T , int R, int C>
Eigen::Matrix<T, R, C> stan::math::inverse ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the inverse of the specified matrix.

Parameters
mSpecified matrix.
Returns
Inverse of the matrix.

Definition at line 16 of file inverse.hpp.

◆ inverse() [2/2]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, C> stan::math::inverse ( const Eigen::Matrix< fvar< T >, R, C > &  m)
inline

Definition at line 16 of file inverse.hpp.

◆ inverse_softmax()

template<typename Vector >
void stan::math::inverse_softmax ( const Vector &  simplex,
Vector &  y 
)

Writes the inverse softmax of the simplex argument into the second argument.

See softmax for the inverse function and a definition of the relation.

The inverse softmax function is defined by

$\mbox{inverse\_softmax}(x)[i] = \log x[i]$.

This function defines the inverse of softmax up to a scaling factor.

Because of the definition, values of 0.0 in the simplex are converted to negative infinity, and values of 1.0 are converted to 0.0.

There is no check that the input vector is a valid simplex vector.

Parameters
simplexSimplex vector input.
yVector into which the inverse softmax is written.
Exceptions
std::invalid_argumentif size of the input and output vectors differ.

Definition at line 35 of file inverse_softmax.hpp.

◆ inverse_spd()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::inverse_spd ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)
inline

Returns the inverse of the specified symmetric, pos/neg-definite matrix.

Parameters
mSpecified matrix.
Returns
Inverse of the matrix.

Definition at line 18 of file inverse_spd.hpp.

◆ is_aligned()

template<typename T >
bool stan::math::is_aligned ( T *  ptr,
unsigned int  bytes_aligned 
)

Return true if the specified pointer is aligned on the number of bytes.

This doesn't really make sense other than for powers of 2.

Parameters
ptrPointer to test.
bytes_alignedNumber of bytes of alignment required.
Returns
true if pointer is aligned.
Template Parameters
Typeof object to which pointer points.

Definition at line 29 of file stack_alloc.hpp.

◆ is_any_nan() [1/2]

template<typename T >
bool stan::math::is_any_nan ( const T &  x)
inline

Returns true if the input is NaN and false otherwise.

Delegates to stan::math::is_nan so that appropriate specializations can be loaded for autodiff types.

Parameters
xValue to test.
Returns
true if the value is NaN.

Definition at line 21 of file is_any_nan.hpp.

◆ is_any_nan() [2/2]

template<typename T , typename... Ts>
bool stan::math::is_any_nan ( const T &  x,
const Ts &...  xs 
)
inline

Returns true if any input is NaN and false otherwise.

Delegates to stan::math::is_nan.

Parameters
xfirst argument
xsparameter pack of remaining arguments to forward to function
Returns
true if any value is NaN

Definition at line 35 of file is_any_nan.hpp.

◆ is_cholesky_factor()

template<typename T_y >
bool stan::math::is_cholesky_factor ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y)
inline

Return true if y is a valid Choleksy factor, if number of rows is not less than the number of columns, if there are no 0 columns, and no element in matrix is NaN.

A Cholesky factor is a lower triangular matrix whose diagonal elements are all positive. Note that Cholesky factors need not be square, but requires at least as many rows M as columns N (i.e., M >= N).

Template Parameters
T_yType of elements of Cholesky factor, requires class method .rows(), .cols(), and .diagonal()
Parameters
yMatrix to test
Returns
true if y is a valid Choleksy factor, if number of rows is not less than the number of columns, if there are no 0 columns, and no element in matrix is NaN

Definition at line 29 of file is_cholesky_factor.hpp.

◆ is_cholesky_factor_corr()

template<typename T_y >
bool stan::math::is_cholesky_factor_corr ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y)
inline

Return true if y is a valid Cholesky factor, if the number of rows is not less than the number of columns, if there are no zero columns, and no element in matrix is NaN.

A Cholesky factor is a lower triangular matrix whose diagonal elements are all positive. This definition does not require a square matrix.

Template Parameters
T_yType of elements of Cholesky factor, requires class methods .rows(), .row(), and .transpose()
Parameters
yMatrix to test
Returns
true if y is a valid Cholesky factor, if the number of rows is not less than the number of columns, if there are no 0 columns, and no element in matrix is NaN

Definition at line 26 of file is_cholesky_factor_corr.hpp.

◆ is_column_index()

template<typename T_y , int R, int C>
bool stan::math::is_column_index ( const Eigen::Matrix< T_y, R, C > &  y,
size_t  i 
)
inline

Return true no index is invalid column.

By default this is a 1-indexed check (as opposed to zero-indexed). Behavior can be changed by setting stan::error_index::value.

Template Parameters
T_yType of scalar, requires class method .cols()
RNumber of rows of the matrix
CNumber of columns of the matrix
Parameters
yMatrix to test
iIndex to check
Returns
true no index is invalid column

Definition at line 22 of file is_column_index.hpp.

◆ is_corr_matrix()

template<typename T_y >
bool stan::math::is_corr_matrix ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y)
inline

Return true if the matrix is square and not 0x0, if the matrix is symmetric, diagonals are near 1, positive definite, and no elements are NaN A valid correlation matrix is symmetric, has a unit diagonal (all 1 values), and has all values between -1 and 1 (inclusive).

Template Parameters
T_yType of scalar, requires class method .rows() and .cols()
Parameters
yMatrix to test
Returns
true if the matrix is square and not 0x0, if the matrix is symmetric, diagonals are near 1, positive definite, and no elements are NaN

Definition at line 29 of file is_corr_matrix.hpp.

◆ is_inf() [1/3]

bool stan::math::is_inf ( double  x)
inline

Returns true if the input is infinite and false otherwise.

Delegates to std::isinf.

Parameters
xValue to test.
Returns
true if the value is infinite.

Definition at line 18 of file is_inf.hpp.

◆ is_inf() [2/3]

int stan::math::is_inf ( const var v)
inline

Returns 1 if the input's value is infinite and 0 otherwise.

Delegates to is_inf.

Parameters
vValue to test.
Returns
1 if the value is infinite and 0 otherwise.

Definition at line 20 of file is_inf.hpp.

◆ is_inf() [3/3]

template<typename T >
int stan::math::is_inf ( const fvar< T > &  x)
inline

Returns 1 if the input's value is infinite and 0 otherwise.

Delegates to is_inf.

Parameters
xValue to test.
Returns
1 if the value is infinite and 0 otherwise.

Definition at line 20 of file is_inf.hpp.

◆ is_integer()

template<typename T >
bool stan::math::is_integer ( x)
inline

Returns true if the input is an integer and false otherwise.

Parameters
xValue to test.
Returns
true if the value is an integer

Definition at line 17 of file is_integer.hpp.

◆ is_ldlt_factor()

template<typename T , int R, int C>
bool stan::math::is_ldlt_factor ( LDLT_factor< T, R, C > &  A)
inline

Return true if the specified LDLT factor is invalid.

An LDLT_factor is invalid if it was constructed from a matrix that is not positive definite. The check is that the .success() method returns true.

Template Parameters
TType of scalar, requires class access to .success()
RRows of the matrix
CColumns of the matrix
Parameters
AThe LDLT factor to check for validity
Returns
true if the LDLT factor is valid

Definition at line 23 of file is_ldlt_factor.hpp.

◆ is_less_or_equal()

template<typename T_y , typename T_high >
bool stan::math::is_less_or_equal ( const T_y &  y,
const T_high &  high 
)
inline

Return true if y is less or equal to high.

This function is vectorized and will check each element of y against each element of high.

Template Parameters
T_yType of y
T_highType of upper bound
Parameters
yVariable to check
highUpper bound
Returns
true if y is less than or equal to low and if and element of y or high is NaN

Definition at line 22 of file is_less_or_equal.hpp.

◆ is_lower_triangular()

template<typename T_y >
bool stan::math::is_lower_triangular ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y)
inline

Return true is matrix is lower triangular.

A matrix x is not lower triangular if there is a non-zero entry x[m, n] with m < n. This function only inspect the upper and triangular portion of the matrix, not including the diagonal.

Template Parameters
TType of scalar of the matrix
Parameters
yMatrix to test
Returns
true is matrix is lower triangular

Definition at line 24 of file is_lower_triangular.hpp.

◆ is_mat_finite()

template<typename T , int R, int C>
bool stan::math::is_mat_finite ( const Eigen::Matrix< T, R, C > &  y)
inline

Return true is the specified matrix is finite.

Template Parameters
TScalar type of the matrix, requires class method .allFinite()
RCompile time rows of the matrix
CCompile time columns of the matrix
Parameters
yMatrix to test
Returns
true if the matrix is finite

Definition at line 20 of file is_mat_finite.hpp.

◆ is_matching_dims() [1/2]

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
bool stan::math::is_matching_dims ( const Eigen::Matrix< T1, R1, C1 > &  y1,
const Eigen::Matrix< T2, R2, C2 > &  y2 
)
inline

Return true if the two matrices are of the same size.

This function checks the runtime sizes only.

Template Parameters
T1Scalar type of the first matrix, requires class method .size()
T2Scalar type of the second matrix, requires class method .size()
R1Rows specified at compile time of the first matrix
C1Columns specified at compile time of the first matrix
R2Rows specified at compile time of the second matrix
C2Columns specified at compile time of the second matrix
Parameters
y1First matrix to test,
y2Second matrix to test
Returns
true if the dimensions of the matrices match

Definition at line 27 of file is_matching_dims.hpp.

◆ is_matching_dims() [2/2]

template<bool check_compile, typename T1 , typename T2 , int R1, int C1, int R2, int C2>
bool stan::math::is_matching_dims ( const Eigen::Matrix< T1, R1, C1 > &  y1,
const Eigen::Matrix< T2, R2, C2 > &  y2 
)
inline

Return true if the two matrices are of the same size.

This function checks the runtime sizes and can also check the static sizes as well. For example, a 4x1 matrix is not the same as a vector with 4 elements.

Template Parameters
check_compileWhether to check the static sizes
T1Scalar type of the first matrix
T2Scalar type of the second matrix
R1Rows specified at compile time of the first matrix
C1Columns specified at compile time of the first matrix
R2Rows specified at compile time of the second matrix
C2Columns specified at compile time of the second matrix
Parameters
y1First matrix to test
y2Second matrix to test
Returns
true if the dimensions of the matrices match

Definition at line 51 of file is_matching_dims.hpp.

◆ is_matching_size()

template<typename T_y1 , typename T_y2 >
bool stan::math::is_matching_size ( const T_y1 &  y1,
const T_y2 &  y2 
)
inline

Return true if two structures are the same size.

This is a top-level sizing function for std::vector where a 2x3 vector returns 2,and a total sizing function for Eigen::Matrix where a 2x3 matrix will return 6.

Template Parameters
T_y1Type of the first variable, requires class method .size()
T_y2Type of the second variable, requires class method .size()
Parameters
y1First variable
y2Second variable
Returns
true if the variable sizes match

Definition at line 24 of file is_matching_size.hpp.

◆ is_nan() [1/3]

template<typename T >
std::enable_if_t<std::is_arithmetic<T>::value, bool> stan::math::is_nan ( x)
inline

Returns true if the input is NaN and false otherwise.

Delegates to std::isnan.

Parameters
xValue to test.
Returns
true if the value is NaN.

Definition at line 19 of file is_nan.hpp.

◆ is_nan() [2/3]

template<typename T >
int stan::math::is_nan ( const fvar< T > &  x)
inline

Returns 1 if the input's value is NaN and 0 otherwise.

Delegates to is_nan.

Parameters
xValue to test.
Returns
1 if the value is NaN and 0 otherwise.

Definition at line 20 of file is_nan.hpp.

◆ is_nan() [3/3]

bool stan::math::is_nan ( const var v)
inline

Returns 1 if the input's value is NaN and 0 otherwise.

Delegates to is_nan(double).

Parameters
vValue to test.
Returns
1 if the value is NaN and 0 otherwise.

Definition at line 20 of file is_nan.hpp.

◆ is_nonpositive_integer()

template<typename T >
bool stan::math::is_nonpositive_integer ( x)
inline

Returns true if the input is a nonpositive integer and false otherwise.

Parameters
xValue to test.
Returns
true if the value is an integer

Definition at line 17 of file is_nonpositive_integer.hpp.

◆ is_nonzero_size()

template<typename T_y >
bool stan::math::is_nonzero_size ( const T_y &  y)
inline

Returns true if the specified matrix/vector is size nonzero.

Template Parameters
T_yType of container, requires class method .size()
Parameters
yContainer to test – matrix/vector
Returns
true if container has size zero

Definition at line 15 of file is_nonzero_size.hpp.

◆ is_not_nan()

template<typename T_y >
bool stan::math::is_not_nan ( const T_y &  y)
inline

Return true if y is not NaN.

This function is vectorized and will check each element of y. If no element is NaN, this function will return true.

Template Parameters
T_yType of y
Parameters
yVariable to check
Returns
true if no element of y is NaN

Definition at line 21 of file is_not_nan.hpp.

◆ is_ordered()

template<typename T_y >
bool stan::math::is_ordered ( const std::vector< T_y > &  y)
inline

Return true if the vector is sorted into strictly increasing order.

Template Parameters
T_yType of scalar, requires class method .size()
Parameters
ystd::vector to test
Returns
true if vector is sorted in ascending order

Definition at line 19 of file is_ordered.hpp.

◆ is_pos_definite() [1/3]

template<typename T_y >
bool stan::math::is_pos_definite ( const Eigen::Matrix< T_y, -1, -1 > &  y)
inline

Return true if the matrix is square or if the matrix has non-zero size, or if the matrix is symmetric, or if it is positive definite, or if no element is NaN.

Template Parameters
T_yType of scalar of the matrix, requires class method .rows()
Parameters
yMatrix to test
Returns
true if the matrix is square or if the matrix has non-0 size, or if the matrix is symmetric, or if it is positive definite, or if no element is NaN

Definition at line 27 of file is_pos_definite.hpp.

◆ is_pos_definite() [2/3]

template<typename Derived >
bool stan::math::is_pos_definite ( const Eigen::LDLT< Derived > &  cholesky)
inline

Return true if the matrix is positive definite.

Template Parameters
DerivedDerived type of the Eigen::LDLT transform, requires class method .info() and .isPositive() and .vectorD().array()
Parameters
choleskyEigen::LDLT to test, whose progenitor must not have any NaN elements
Returns
true if the matrix is positive definite

Definition at line 51 of file is_pos_definite.hpp.

◆ is_pos_definite() [3/3]

template<typename Derived >
bool stan::math::is_pos_definite ( const Eigen::LLT< Derived > &  cholesky)
inline

Return true if diagonal of the L matrix is positive.

Template Parameters
DerivedDerived type of the Eigen::LLT transform, requires class method .info() and .matrixLLT().diagonal().array()
Parameters
choleskyEigen::LLT to test, whose progenitor must not have any NaN elements
Returns
true if diagonal of the L matrix is positive

Definition at line 66 of file is_pos_definite.hpp.

◆ is_positive() [1/2]

template<typename T_y >
bool stan::math::is_positive ( const T_y &  y)
inline

Return true if y is positive.

This function is vectorized and will check each element of y.

Template Parameters
T_yType of y
Parameters
yVariable to check
Returns
true if vector contains only positive elements

Definition at line 18 of file is_positive.hpp.

◆ is_positive() [2/2]

bool stan::math::is_positive ( int  size)
inline

Return true if size is positive.

Parameters
sizeSize value to check
Returns
true if size is not zero or negative

Definition at line 31 of file is_positive.hpp.

◆ is_scal_finite()

template<typename T_y >
bool stan::math::is_scal_finite ( const T_y &  y)
inline

Return true if y is finite.

This function is vectorized and will check each element of y.

Template Parameters
T_yType of y
Parameters
yVariable to check
Exceptions
<code>true</code>if y is not infinity, -infinity, or NaN

Definition at line 20 of file is_scal_finite.hpp.

◆ is_size_match()

template<typename T_size1 , typename T_size2 >
bool stan::math::is_size_match ( T_size1  i,
T_size2  j 
)
inline

Return true if the provided sizes match.

Template Parameters
T_size1Type of size 1
T_size2Type of size 2
Parameters
iSize of variable 1
jSize of variable 2
Returns
true if provided dimensions match

Definition at line 17 of file is_size_match.hpp.

◆ is_square()

template<typename T_y >
bool stan::math::is_square ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y)
inline

Return true if the matrix is square.

This check allows 0x0 matrices.

Template Parameters
TType of scalar, requires class method .rows() and .cols()
Parameters
yMatrix to test
Returns
true if matrix is square

Definition at line 20 of file is_square.hpp.

◆ is_symmetric()

template<typename T_y >
bool stan::math::is_symmetric ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y)
inline

Return true if the matrix is square, and no element not on the main diagonal is NaN.

Template Parameters
T_yType of scalar, requires class method .rows()
Parameters
yMatrix to test
Returns
true if the matrix is square, and no element not on the main diagonal is NaN

Definition at line 21 of file is_symmetric.hpp.

◆ is_uninitialized() [1/2]

template<typename T >
bool stan::math::is_uninitialized ( x)
inline

Returns true if the specified variable is uninitialized.

Arithmetic types are always initialized by definition (the value is not specified).

Template Parameters
TType of object to test.
Parameters
xObject to test.
Returns
true if the specified object is uninitialized.
false if input is NaN.

Definition at line 19 of file is_uninitialized.hpp.

◆ is_uninitialized() [2/2]

bool stan::math::is_uninitialized ( var  x)
inline

Returns true if the specified variable is uninitialized.

This overload of the is_uninitialized() function delegates the return to the is_uninitialized() method on the specified variable.

Parameters
xObject to test.
Returns
true if the specified object is uninitialized.

Definition at line 23 of file is_uninitialized.hpp.

◆ is_unit_vector()

template<typename T_prob >
bool stan::math::is_unit_vector ( const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta)
inline

Return true if the vector is not a unit vector or if any element is NaN.

A valid unit vector is one where the square elements summed is equal to 1. This function tests that the sum is within the tolerance specified by CONSTRAINT_TOLERANCE. This function only accpets Eigen::Matrix vectors, statically typed vectors, not general matrices with 1 column.

Template Parameters
T_probScalar type of the vector, reqires class method .squaredNorm()
Parameters
thetaEigen vector to test
Returns
true if the vector is not a unit vector or if any element is NaN

Definition at line 26 of file is_unit_vector.hpp.

◆ jacobian() [1/2]

template<typename T , typename F >
void stan::math::jacobian ( const F &  f,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
Eigen::Matrix< T, Eigen::Dynamic, 1 > &  fx,
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  J 
)

Definition at line 11 of file jacobian.hpp.

◆ jacobian() [2/2]

template<typename F >
void stan::math::jacobian ( const F &  f,
const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  x,
Eigen::Matrix< double, Eigen::Dynamic, 1 > &  fx,
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &  J 
)

Definition at line 14 of file jacobian.hpp.

◆ lb_constrain() [1/2]

template<typename T , typename L >
boost::math::tools::promote_args<T, L>::type stan::math::lb_constrain ( const T &  x,
const L &  lb 
)
inline

Return the lower-bounded value for the specified unconstrained input and specified lower bound.

The transform applied is

$f(x) = \exp(x) + L$

where $L$ is the constant lower bound.

If the lower bound is negative infinity, this function reduces to identity_constrain(x).

Template Parameters
Ttype of scalar
Ltype of lower bound
Parameters
[in]xUnconstrained scalar input
[in]lblower bound on constrained ouptut
Returns
lower bound constrained value correspdonding to inputs

Definition at line 33 of file lb_constrain.hpp.

◆ lb_constrain() [2/2]

template<typename T , typename L >
boost::math::tools::promote_args<T, L>::type stan::math::lb_constrain ( const T &  x,
const L &  lb,
T &  lp 
)
inline

Return the lower-bounded value for the speicifed unconstrained input and specified lower bound, incrementing the specified reference with the log absolute Jacobian determinant of the transform.

If the lower bound is negative infinity, this function reduces to identity_constraint(x, lp).

Template Parameters
Ttype of scalar.
Ltype of lower bound.
Parameters
[in]xunconstrained scalar input
[in]lblower bound on output
[in,out]lpReference to log probability to increment.
Returns
lower-bound constrained value corresponding to inputs

Definition at line 58 of file lb_constrain.hpp.

◆ lb_free()

template<typename T , typename L >
boost::math::tools::promote_args<T, L>::type stan::math::lb_free ( const T &  y,
const L &  lb 
)
inline

Return the unconstrained value that produces the specified lower-bound constrained value.

If the lower bound is negative infinity, it is ignored and the function reduces to identity_free(y).

Template Parameters
Ttype of scalar
Ltype of lower bound
Parameters
[in]yinput scalar
[in]lblower bound
Returns
unconstrained value that produces the input when constrained
Exceptions
std::domain_errorif y is lower than the lower bound

Definition at line 30 of file lb_free.hpp.

◆ lbeta() [1/7]

template<typename T >
fvar<T> stan::math::lbeta ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 14 of file lbeta.hpp.

◆ lbeta() [2/7]

template<typename T >
fvar<T> stan::math::lbeta ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 22 of file lbeta.hpp.

◆ lbeta() [3/7]

template<typename T >
fvar<T> stan::math::lbeta ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 29 of file lbeta.hpp.

◆ lbeta() [4/7]

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2>::type stan::math::lbeta ( const T1  a,
const T2  b 
)
inline

Return the log of the beta function applied to the specified arguments.

The beta function is defined for $a > 0$ and $b > 0$ by

$\mbox{B}(a, b) = \frac{\Gamma(a) \Gamma(b)}{\Gamma(a+b)}$.

This function returns its log,

$\log \mbox{B}(a, b) = \log \Gamma(a) + \log \Gamma(b) - \log \Gamma(a+b)$.

See stan::math::lgamma() for the double-based and stan::math for the variable-based log Gamma function.

\[ \mbox{lbeta}(\alpha, \beta) = \begin{cases} \ln\int_0^1 u^{\alpha - 1} (1 - u)^{\beta - 1} \, du & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{lbeta}(\alpha, \beta)}{\partial \alpha} = \begin{cases} \Psi(\alpha)-\Psi(\alpha+\beta) & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{lbeta}(\alpha, \beta)}{\partial \beta} = \begin{cases} \Psi(\beta)-\Psi(\alpha+\beta) & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

Parameters
aFirst value
bSecond value
Returns
Log of the beta function applied to the two values.
Template Parameters
T1Type of first value.
T2Type of second value.

Definition at line 58 of file lbeta.hpp.

◆ lbeta() [5/7]

var stan::math::lbeta ( const var a,
const var b 
)
inline

Definition at line 64 of file lbeta.hpp.

◆ lbeta() [6/7]

var stan::math::lbeta ( const var a,
double  b 
)
inline

Definition at line 83 of file lbeta.hpp.

◆ lbeta() [7/7]

var stan::math::lbeta ( double  a,
const var b 
)
inline

Definition at line 102 of file lbeta.hpp.

◆ ldexp()

template<typename T >
T stan::math::ldexp ( const T &  a,
int  b 
)
inline

Returns the product of a (the significand) and 2 to power b (the exponent).

Template Parameters
TScalar type of significand
Parameters
[in]athe significand
[in]ban integer that is the exponent
Returns
product of a times 2 to the power b

Definition at line 20 of file ldexp.hpp.

◆ lgamma() [1/5]

template<typename T >
fvar<T> stan::math::lgamma ( const fvar< T > &  x)
inline

Return the natural logarithm of the gamma function applied to the specified argument.

Template Parameters
TScalar type of autodiff variable.
Parameters
xArgument.
Returns
natural logarithm of the gamma function of argument.

Definition at line 21 of file lgamma.hpp.

◆ lgamma() [2/5]

var stan::math::lgamma ( const var a)
inline

The log gamma function for variables (C99).

The derivatie is the digamma function,

$\frac{d}{dx} \Gamma(x) = \psi^{(0)}(x)$.

Parameters
aThe variable.
Returns
Log gamma of the variable.

Definition at line 30 of file lgamma.hpp.

◆ lgamma() [3/5]

template<typename T >
apply_scalar_unary<lgamma_fun, T>::return_t stan::math::lgamma ( const T &  x)
inline

Vectorized version of lgamma().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Natural log of the gamma function applied to each value in x.
Exceptions
std::domain_errorif any value is a negative integer or 0.

Definition at line 33 of file lgamma.hpp.

◆ lgamma() [4/5]

double stan::math::lgamma ( double  x)
inline

Return the natural logarithm of the gamma function applied to the specified argument.

\[ \mbox{lgamma}(x) = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \ln\Gamma(x) & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{lgamma}(x)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \Psi(x) & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
xargument
Returns
natural logarithm of the gamma function applied to argument

Definition at line 36 of file lgamma.hpp.

◆ lgamma() [5/5]

double stan::math::lgamma ( int  x)
inline

Return the natural logarithm of the gamma function applied to the specified argument.

Parameters
xargument
Returns
natural logarithm of the gamma function applied to argument

Definition at line 46 of file lgamma.hpp.

◆ lkj_corr_cholesky_log() [1/2]

template<bool propto, typename T_covar , typename T_shape >
boost::math::tools::promote_args<T_covar, T_shape>::type stan::math::lkj_corr_cholesky_log ( const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  L,
const T_shape &  eta 
)
Deprecated:
use lkj_corr_cholesky_lpdf

Definition at line 17 of file lkj_corr_cholesky_log.hpp.

◆ lkj_corr_cholesky_log() [2/2]

template<typename T_covar , typename T_shape >
boost::math::tools::promote_args<T_covar, T_shape>::type stan::math::lkj_corr_cholesky_log ( const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  L,
const T_shape &  eta 
)
inline
Deprecated:
use lkj_corr_cholesky_lpdf

Definition at line 28 of file lkj_corr_cholesky_log.hpp.

◆ lkj_corr_cholesky_lpdf() [1/2]

template<bool propto, typename T_covar , typename T_shape >
boost::math::tools::promote_args<T_covar, T_shape>::type stan::math::lkj_corr_cholesky_lpdf ( const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  L,
const T_shape &  eta 
)

Definition at line 17 of file lkj_corr_cholesky_lpdf.hpp.

◆ lkj_corr_cholesky_lpdf() [2/2]

template<typename T_covar , typename T_shape >
boost::math::tools::promote_args<T_covar, T_shape>::type stan::math::lkj_corr_cholesky_lpdf ( const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  L,
const T_shape &  eta 
)
inline

Definition at line 56 of file lkj_corr_cholesky_lpdf.hpp.

◆ lkj_corr_cholesky_rng()

template<class RNG >
Eigen::MatrixXd stan::math::lkj_corr_cholesky_rng ( size_t  K,
double  eta,
RNG &  rng 
)
inline

Definition at line 13 of file lkj_corr_cholesky_rng.hpp.

◆ lkj_corr_log() [1/2]

template<bool propto, typename T_y , typename T_shape >
boost::math::tools::promote_args<T_y, T_shape>::type stan::math::lkj_corr_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const T_shape &  eta 
)
Deprecated:
use lkj_corr_lpdf

Definition at line 16 of file lkj_corr_log.hpp.

◆ lkj_corr_log() [2/2]

template<typename T_y , typename T_shape >
boost::math::tools::promote_args<T_y, T_shape>::type stan::math::lkj_corr_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const T_shape &  eta 
)
inline
Deprecated:
use lkj_corr_lpdf

Definition at line 27 of file lkj_corr_log.hpp.

◆ lkj_corr_lpdf() [1/2]

template<bool propto, typename T_y , typename T_shape >
boost::math::tools::promote_args<T_y, T_shape>::type stan::math::lkj_corr_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const T_shape &  eta 
)

Definition at line 44 of file lkj_corr_lpdf.hpp.

◆ lkj_corr_lpdf() [2/2]

template<typename T_y , typename T_shape >
boost::math::tools::promote_args<T_y, T_shape>::type stan::math::lkj_corr_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const T_shape &  eta 
)
inline

Definition at line 77 of file lkj_corr_lpdf.hpp.

◆ lkj_corr_rng()

template<class RNG >
Eigen::MatrixXd stan::math::lkj_corr_rng ( size_t  K,
double  eta,
RNG &  rng 
)
inline

Return a random correlation matrix (symmetric, positive definite, unit diagonal) of the specified dimensionality drawn from the LKJ distribution with the specified degrees of freedom using the specified random number generator.

Template Parameters
RNGRandom number generator type.
Parameters
[in]KNumber of rows and columns of generated matrix.
[in]etaDegrees of freedom for LKJ distribution.
[in,out]rngRandom-number generator to use.
Returns
Random variate with specified distribution.
Exceptions
std::domain_errorIf the shape parameter is not positive.

Definition at line 26 of file lkj_corr_rng.hpp.

◆ lkj_cov_log() [1/4]

template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args<T_y, T_loc, T_scale, T_shape>::type stan::math::lkj_cov_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &  mu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, 1 > &  sigma,
const T_shape &  eta 
)
Deprecated:
use lkj_cov_lpdf

Definition at line 18 of file lkj_cov_log.hpp.

◆ lkj_cov_log() [2/4]

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args<T_y, T_loc, T_scale, T_shape>::type stan::math::lkj_cov_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &  mu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, 1 > &  sigma,
const T_shape &  eta 
)
inline
Deprecated:
use lkj_cov_lpdf

Definition at line 31 of file lkj_cov_log.hpp.

◆ lkj_cov_log() [3/4]

template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args<T_y, T_loc, T_scale, T_shape>::type stan::math::lkj_cov_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  eta 
)
Deprecated:
use lkj_cov_lpdf

Definition at line 44 of file lkj_cov_log.hpp.

◆ lkj_cov_log() [4/4]

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args<T_y, T_loc, T_scale, T_shape>::type stan::math::lkj_cov_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  eta 
)
inline
Deprecated:
use lkj_cov_lpdf

Definition at line 55 of file lkj_cov_log.hpp.

◆ lkj_cov_lpdf() [1/4]

template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args<T_y, T_loc, T_scale, T_shape>::type stan::math::lkj_cov_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &  mu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, 1 > &  sigma,
const T_shape &  eta 
)

Definition at line 20 of file lkj_cov_lpdf.hpp.

◆ lkj_cov_lpdf() [2/4]

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args<T_y, T_loc, T_scale, T_shape>::type stan::math::lkj_cov_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &  mu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, 1 > &  sigma,
const T_shape &  eta 
)
inline

Definition at line 61 of file lkj_cov_lpdf.hpp.

◆ lkj_cov_lpdf() [3/4]

template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args<T_y, T_loc, T_scale, T_shape>::type stan::math::lkj_cov_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  eta 
)

Definition at line 73 of file lkj_cov_lpdf.hpp.

◆ lkj_cov_lpdf() [4/4]

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
boost::math::tools::promote_args<T_y, T_loc, T_scale, T_shape>::type stan::math::lkj_cov_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  eta 
)
inline

Definition at line 104 of file lkj_cov_lpdf.hpp.

◆ lmgamma() [1/3]

template<typename T >
fvar<typename stan::return_type<T, int>::type> stan::math::lmgamma ( int  x1,
const fvar< T > &  x2 
)
inline

Definition at line 13 of file lmgamma.hpp.

◆ lmgamma() [2/3]

var stan::math::lmgamma ( int  a,
const var b 
)
inline

Definition at line 26 of file lmgamma.hpp.

◆ lmgamma() [3/3]

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::lmgamma ( int  k,
x 
)
inline

Return the natural logarithm of the multivariate gamma function with the speciifed dimensions and argument.

The multivariate gamma function $\Gamma_k(x)$ for dimensionality $k$ and argument $x$ is defined by

$\Gamma_k(x) = \pi^{k(k-1)/4} \, \prod_{j=1}^k \Gamma(x + (1 - j)/2)$,

where $\Gamma()$ is the gamma function.

\[ \mbox{lmgamma}(n, x) = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \ln\Gamma_n(x) & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{lmgamma}(n, x)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \frac{\partial\, \ln\Gamma_n(x)}{\partial x} & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \ln\Gamma_n(x) = \pi^{n(n-1)/4} \, \prod_{j=1}^n \Gamma(x + (1 - j)/2) \]

\[ \frac{\partial \, \ln\Gamma_n(x)}{\partial x} = \sum_{j=1}^n \Psi(x + (1 - j) / 2) \]

Parameters
kNumber of dimensions.
xFunction argument.
Returns
Natural log of the multivariate gamma function.
Template Parameters
TType of scalar.

Definition at line 55 of file lmgamma.hpp.

◆ locscale_constrain() [1/2]

template<typename T , typename M , typename S >
boost::math::tools::promote_args<T, M, S>::type stan::math::locscale_constrain ( const T &  x,
const M &  mu,
const S &  sigma 
)
inline

Return the linearly transformed value for the specified unconstrained input and specified location and scale.

The transform applied is

$f(x) = mu + sigma * x$

where mu is the location and sigma is the scale.

If the location is zero and the scale is one this reduces to identity_constrain(x).

Template Parameters
Ttype of scalar
Mtype of mean
Stype of scale
Parameters
[in]xUnconstrained scalar input
[in]mulocation of constrained output
[in]sigmascale of constrained output
Returns
linear transformed value correspdonding to inputs
Exceptions
std::domain_errorif sigma <= 0
std::domain_errorif mu is not finite

Definition at line 40 of file locscale_constrain.hpp.

◆ locscale_constrain() [2/2]

template<typename T , typename M , typename S >
boost::math::tools::promote_args<T, M, S>::type stan::math::locscale_constrain ( const T &  x,
const M &  mu,
const S &  sigma,
T &  lp 
)
inline

Return the linearly transformed value for the specified unconstrained input and specified location and scale, incrementing the specified reference with the log absolute Jacobian determinant of the transform.

The transform applied is

$f(x) = mu + sigma * x$

where mu is the location and sigma is the scale.

If the location is zero and scale is one, this function reduces to identity_constraint(x, lp).

Template Parameters
Ttype of scalar
Mtype of mean
Stype of scale
Parameters
[in]xUnconstrained scalar input
[in]mulocation of constrained output
[in]sigmascale of constrained output
[in,out]lpReference to log probability to increment.
Returns
linear transformed value corresponding to inputs
Exceptions
std::domain_errorif sigma <= 0
std::domain_errorif mu is not finite

Definition at line 79 of file locscale_constrain.hpp.

◆ locscale_free()

template<typename T , typename L , typename S >
boost::math::tools::promote_args<T, L, S>::type stan::math::locscale_free ( const T &  y,
const L &  mu,
const S &  sigma 
)
inline

Return the unconstrained scalar that transforms to the specified location and scale constrained scalar given the specified location and scale.

The transfrom in locscale_constrain(T, double, double), is reversed by the reverse affine transformation,

$f^{-1}(y) = \frac{y - L}{S}$

where $L$ and $S$ are the location and scale.

If the location is zero and scale is one, this function reduces to identity_free(y).

Template Parameters
Ttype of scalar
Ltype of location
Stype of scale
Parameters
yconstrained value
[in]mulocation of constrained output
[in]sigmascale of constrained output
Returns
the free scalar that transforms to the input scalar given the location and scale
Exceptions
std::domain_errorif sigma <= 0
std::domain_errorif mu is not finite

Definition at line 42 of file locscale_free.hpp.

◆ log() [1/4]

template<typename T >
fvar<T> stan::math::log ( const fvar< T > &  x)
inline

Definition at line 12 of file log.hpp.

◆ log() [2/4]

double stan::math::log ( int  x)
inline

Return the natural log of the specified argument.

This version is required to disambiguate log(int).

Parameters
[in]xArgument.
Returns
Natural log of argument.

Definition at line 17 of file log.hpp.

◆ log() [3/4]

template<typename T >
apply_scalar_unary<log_fun, T>::return_t stan::math::log ( const T &  x)
inline

Return the elementwise natural log of the specified argument, which may be a scalar or any Stan container of numeric scalars.

The return type is the same as the argument type.

Template Parameters
TArgument type.
Parameters
[in]xArgument.
Returns
Elementwise application of natural log to the argument.

Definition at line 39 of file log.hpp.

◆ log() [4/4]

var stan::math::log ( const var a)
inline

Return the natural log of the specified variable (cmath).

The derivative is defined by

$\frac{d}{dx} \log x = \frac{1}{x}$.

\[ \mbox{log}(x) = \begin{cases} \textrm{NaN} & \mbox{if } x < 0\\ \ln(x) & \mbox{if } x \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log}(x)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x < 0\\ \frac{1}{x} & \mbox{if } x\geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable whose log is taken.
Returns
Natural log of variable.

Definition at line 47 of file log.hpp.

◆ log10() [1/4]

template<typename T >
fvar<T> stan::math::log10 ( const fvar< T > &  x)
inline

Definition at line 12 of file log10.hpp.

◆ log10() [2/4]

template<typename T >
apply_scalar_unary<log10_fun, T>::return_t stan::math::log10 ( const T &  x)
inline

Vectorized version of log10().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Log base-10 applied to each value in x.

Definition at line 31 of file log10.hpp.

◆ log10() [3/4]

var stan::math::log10 ( const var a)
inline

Return the base 10 log of the specified variable (cmath).

The derivative is defined by

$\frac{d}{dx} \log_{10} x = \frac{1}{x \log 10}$.

\[ \mbox{log10}(x) = \begin{cases} \textrm{NaN} & \mbox{if } x < 0\\ \log_{10}(x) & \mbox{if } x \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log10}(x)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x < 0\\ \frac{1}{x \ln10} & \mbox{if } x\geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable whose log is taken.
Returns
Base 10 log of variable.

Definition at line 51 of file log10.hpp.

◆ log10() [4/4]

double stan::math::log10 ( )
inline

Return natural logarithm of ten.

Returns
Natural logarithm of ten.

Definition at line 101 of file constants.hpp.

◆ log1m() [1/4]

template<typename T >
fvar<T> stan::math::log1m ( const fvar< T > &  x)
inline

Definition at line 12 of file log1m.hpp.

◆ log1m() [2/4]

var stan::math::log1m ( const var a)
inline

The log (1 - x) function for variables.

The derivative is given by

$\frac{d}{dx} \log (1 - x) = -\frac{1}{1 - x}$.

Parameters
aThe variable.
Returns
The variable representing log of 1 minus the variable.

Definition at line 29 of file log1m.hpp.

◆ log1m() [3/4]

template<typename T >
apply_scalar_unary<log1m_fun, T>::return_t stan::math::log1m ( const T &  x)
inline

Vectorized version of log1m().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Natural log of 1 minus each value in x.

Definition at line 30 of file log1m.hpp.

◆ log1m() [4/4]

double stan::math::log1m ( double  x)
inline

Return the natural logarithm of one minus the specified value.

The main use of this function is to cut down on intermediate values during algorithmic differentiation.

\[ \mbox{log1m}(x) = \begin{cases} \ln(1-x) & \mbox{if } x \leq 1 \\ \textrm{NaN} & \mbox{if } x > 1\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log1m}(x)}{\partial x} = \begin{cases} -\frac{1}{1-x} & \mbox{if } x \leq 1 \\ \textrm{NaN} & \mbox{if } x > 1\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
[in]xArgument.
Returns
Natural log of one minus the argument.
Exceptions
<code>std::domain_error</code>If the argument is greater than 1.
<code>std::overflow_error</code>If the computation overflows.

Definition at line 42 of file log1m.hpp.

◆ log1m_exp() [1/4]

template<typename T >
fvar<T> stan::math::log1m_exp ( const fvar< T > &  x)
inline

Return the natural logarithm of one minus the exponentiation of the specified argument.

Template Parameters
TScalar type of autodiff variable.
Parameters
xArgument.
Returns
log of one minus the exponentiation of the argument.

Definition at line 23 of file log1m_exp.hpp.

◆ log1m_exp() [2/4]

template<typename T >
apply_scalar_unary<log1m_exp_fun, T>::return_t stan::math::log1m_exp ( const T &  x)
inline

Vectorized version of log1m_exp().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Natural log of (1 - exp()) applied to each value in x.

Definition at line 30 of file log1m_exp.hpp.

◆ log1m_exp() [3/4]

var stan::math::log1m_exp ( const var x)
inline

Return the log of 1 minus the exponential of the specified variable.

The deriative of log(1 - exp(x)) with respect to x is -1 / expm1(-x).

Parameters
[in]xArgument.
Returns
Natural logarithm of one minus the exponential of the argument.

Definition at line 32 of file log1m_exp.hpp.

◆ log1m_exp() [4/4]

double stan::math::log1m_exp ( double  a)
inline

Calculates the natural logarithm of one minus the exponential of the specified value without overflow,.

log1m_exp(x) = log(1-exp(x))

This function is only defined for x < 0

\[ \mbox{log1m\_exp}(x) = \begin{cases} \ln(1-\exp(x)) & \mbox{if } x < 0 \\ \textrm{NaN} & \mbox{if } x \geq 0\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{asinh}(x)}{\partial x} = \begin{cases} -\frac{\exp(x)}{1-\exp(x)} & \mbox{if } x < 0 \\ \textrm{NaN} & \mbox{if } x \geq 0\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
[in]aArgument.
Returns
natural logarithm of one minus the exponential of the argument.

Definition at line 46 of file log1m_exp.hpp.

◆ log1m_inv_logit() [1/5]

var stan::math::log1m_inv_logit ( const var u)
inline

Return the natural logarithm of one minus the inverse logit of the specified argument.

Parameters
uargument
Returns
log of one minus the inverse logit of the argument

Definition at line 20 of file log1m_inv_logit.hpp.

◆ log1m_inv_logit() [2/5]

template<typename T >
fvar<T> stan::math::log1m_inv_logit ( const fvar< T > &  x)
inline

Return the natural logarithm of one minus the inverse logit of the specified argument.

Template Parameters
Tscalar type of forward-mode autodiff variable argument.
Parameters
xargument
Returns
log of one minus the inverse logit of the argument

Definition at line 22 of file log1m_inv_logit.hpp.

◆ log1m_inv_logit() [3/5]

double stan::math::log1m_inv_logit ( double  u)
inline

Returns the natural logarithm of 1 minus the inverse logit of the specified argument.

\[ \mbox{log1m\_inv\_logit}(x) = \begin{cases} -\ln(\exp(x)+1) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log1m\_inv\_logit}(x)}{\partial x} = \begin{cases} -\frac{\exp(x)}{\exp(x)+1} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
uargument
Returns
log of one minus the inverse logit of the argument

Definition at line 35 of file log1m_inv_logit.hpp.

◆ log1m_inv_logit() [4/5]

template<typename T >
apply_scalar_unary<log1m_inv_logit_fun, T>::return_t stan::math::log1m_inv_logit ( const T &  x)
inline

Return the elementwise application of log1m_inv_logit() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
TContainer type.
Parameters
xContainer.
Returns
Elementwise log1m_inv_logit of members of container.

Definition at line 40 of file log1m_inv_logit.hpp.

◆ log1m_inv_logit() [5/5]

double stan::math::log1m_inv_logit ( int  u)
inline

Return the natural logarithm of one minus the inverse logit of the specified argument.

Parameters
uargument
Returns
log of one minus the inverse logit of the argument

Definition at line 49 of file log1m_inv_logit.hpp.

◆ log1p() [1/5]

template<typename T >
fvar<T> stan::math::log1p ( const fvar< T > &  x)
inline

Definition at line 12 of file log1p.hpp.

◆ log1p() [2/5]

double stan::math::log1p ( double  x)
inline

Return the natural logarithm of one plus the specified value.

\[ \mbox{log1p}(x) = \log(1 + x) \]

This version is more stable for arguments near zero than the direct definition. If log1p(x) is defined to be negative infinity.

Parameters
[in]xArgument.
Returns
Natural log of one plus the argument.
Exceptions
std::domain_errorIf argument is less than -1.

Definition at line 27 of file log1p.hpp.

◆ log1p() [3/5]

var stan::math::log1p ( const var a)
inline

The log (1 + x) function for variables (C99).

The derivative is given by

$\frac{d}{dx} \log (1 + x) = \frac{1}{1 + x}$.

Parameters
aThe variable.
Returns
The log of 1 plus the variable.

Definition at line 29 of file log1p.hpp.

◆ log1p() [4/5]

template<typename T >
apply_scalar_unary<log1p_fun, T>::return_t stan::math::log1p ( const T &  x)
inline

Return the elementwise application of log1p() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
TContainer type.
Parameters
xContainer.
Returns
Elementwise log1p of members of container.

Definition at line 38 of file log1p.hpp.

◆ log1p() [5/5]

double stan::math::log1p ( int  x)
inline

Return the natural logarithm of one plus the specified argument.

This version is required to disambiguate log1p(int).

Parameters
[in]xArgument.
Returns
Natural logarithm of one plus the argument.
Exceptions
std::domain_errorIf argument is less than -1.

Definition at line 45 of file log1p.hpp.

◆ log1p_exp() [1/4]

template<typename T >
fvar<T> stan::math::log1p_exp ( const fvar< T > &  x)
inline

Definition at line 12 of file log1p_exp.hpp.

◆ log1p_exp() [2/4]

var stan::math::log1p_exp ( const var a)
inline

Return the log of 1 plus the exponential of the specified variable.

Definition at line 24 of file log1p_exp.hpp.

◆ log1p_exp() [3/4]

template<typename T >
apply_scalar_unary<log1p_exp_fun, T>::return_t stan::math::log1p_exp ( const T &  x)
inline

Vectorized version of log1m_exp().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Natural log of (1 + exp()) applied to each value in x.

Definition at line 30 of file log1p_exp.hpp.

◆ log1p_exp() [4/4]

double stan::math::log1p_exp ( double  a)
inline

Calculates the log of 1 plus the exponential of the specified value without overflow.

This function is related to other special functions by:

log1p_exp(x)

= log1p(exp(a))

= log(1 + exp(x))

= log_sum_exp(0, x).

\[ \mbox{log1p\_exp}(x) = \begin{cases} \ln(1+\exp(x)) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log1p\_exp}(x)}{\partial x} = \begin{cases} \frac{\exp(x)}{1+\exp(x)} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Definition at line 43 of file log1p_exp.hpp.

◆ log2() [1/6]

template<typename T >
fvar<T> stan::math::log2 ( const fvar< T > &  x)
inline

Return the base two logarithm of the specified argument.

Template Parameters
Tscalar type
Parameters
xargument
Returns
base two logarithm of argument

Definition at line 20 of file log2.hpp.

◆ log2() [2/6]

double stan::math::log2 ( double  u)
inline

Returns the base two logarithm of the argument (C99, C++11).

The function is defined by:

log2(a) = log(a) / std::log(2.0).

Parameters
[in]uargument
Returns
base two logarithm of argument

Definition at line 21 of file log2.hpp.

◆ log2() [3/6]

double stan::math::log2 ( int  u)
inline

Return the base two logarithm of the specified argument.

This version is required to disambiguate log2(int).

Parameters
[in]uargument
Returns
base two logarithm of argument

Definition at line 33 of file log2.hpp.

◆ log2() [4/6]

template<typename T >
apply_scalar_unary<log2_fun, T>::return_t stan::math::log2 ( const T &  x)
inline

Return the elementwise application of log2() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
Tcontainer type
Parameters
xcontainer
Returns
elementwise log2 of container elements

Definition at line 38 of file log2.hpp.

◆ log2() [5/6]

double stan::math::log2 ( )
inline

Return natural logarithm of two.

Returns
Natural logarithm of two.

Definition at line 40 of file log2.hpp.

◆ log2() [6/6]

var stan::math::log2 ( const var a)
inline

Returns the base 2 logarithm of the specified variable (C99).

See log2() for the double-based version.

The derivative is

$\frac{d}{dx} \log_2 x = \frac{1}{x \log 2}$.

\[ \mbox{log2}(x) = \begin{cases} \textrm{NaN} & \mbox{if } x < 0 \\ \log_2(x) & \mbox{if } x\geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log2}(x)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x < 0 \\ \frac{1}{x\ln2} & \mbox{if } x\geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aSpecified variable.
Returns
Base 2 logarithm of the variable.

Definition at line 50 of file log2.hpp.

◆ log_determinant() [1/3]

template<int R, int C>
var stan::math::log_determinant ( const Eigen::Matrix< var, R, C > &  m)
inline

Definition at line 13 of file log_determinant.hpp.

◆ log_determinant() [2/3]

template<typename T , int R, int C>
fvar<T> stan::math::log_determinant ( const Eigen::Matrix< fvar< T >, R, C > &  m)
inline

Definition at line 15 of file log_determinant.hpp.

◆ log_determinant() [3/3]

template<typename T , int R, int C>
T stan::math::log_determinant ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the log absolute determinant of the specified square matrix.

Parameters
mSpecified matrix.
Returns
log absolute determinant of the matrix.
Exceptions
std::domain_errorif matrix is not square.

Definition at line 18 of file log_determinant.hpp.

◆ log_determinant_ldlt() [1/2]

template<int R, int C, typename T >
T stan::math::log_determinant_ldlt ( LDLT_factor< T, R, C > &  A)
inline

Definition at line 11 of file log_determinant_ldlt.hpp.

◆ log_determinant_ldlt() [2/2]

template<int R, int C>
var stan::math::log_determinant_ldlt ( LDLT_factor< var, R, C > &  A)

Definition at line 48 of file log_determinant_ldlt.hpp.

◆ log_determinant_spd() [1/2]

template<int R, int C>
var stan::math::log_determinant_spd ( const Eigen::Matrix< var, R, C > &  m)
inline

Definition at line 15 of file log_determinant_spd.hpp.

◆ log_determinant_spd() [2/2]

template<typename T , int R, int C>
T stan::math::log_determinant_spd ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the log absolute determinant of the specified square matrix.

Parameters
mSpecified matrix.
Returns
log absolute determinant of the matrix.
Exceptions
std::domain_errorif matrix is not square.

Definition at line 19 of file log_determinant_spd.hpp.

◆ log_diff_exp() [1/7]

template<typename T >
fvar<T> stan::math::log_diff_exp ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 14 of file log_diff_exp.hpp.

◆ log_diff_exp() [2/7]

template<typename T1 , typename T2 >
fvar<T2> stan::math::log_diff_exp ( const T1 &  x1,
const fvar< T2 > &  x2 
)
inline

Definition at line 24 of file log_diff_exp.hpp.

◆ log_diff_exp() [3/7]

template<typename T1 , typename T2 >
fvar<T1> stan::math::log_diff_exp ( const fvar< T1 > &  x1,
const T2 &  x2 
)
inline

Definition at line 32 of file log_diff_exp.hpp.

◆ log_diff_exp() [4/7]

var stan::math::log_diff_exp ( const var a,
const var b 
)
inline

Returns the log difference of the exponentiated arguments.

Parameters
[in]aFirst argument.
[in]bSecond argument.
Returns
Log difference of the expnoentiated arguments.

Definition at line 44 of file log_diff_exp.hpp.

◆ log_diff_exp() [5/7]

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2>::type stan::math::log_diff_exp ( const T1  x,
const T2  y 
)
inline

The natural logarithm of the difference of the natural exponentiation of x1 and the natural exponentiation of x2.

This function is only defined for x<0

\[ \mbox{log\_diff\_exp}(x, y) = \begin{cases} \textrm{NaN} & \mbox{if } x \leq y\\ \ln(\exp(x)-\exp(y)) & \mbox{if } x > y \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log\_diff\_exp}(x, y)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x \leq y\\ \frac{\exp(x)}{\exp(x)-\exp(y)} & \mbox{if } x > y \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log\_diff\_exp}(x, y)}{\partial y} = \begin{cases} \textrm{NaN} & \mbox{if } x \leq y\\ -\frac{\exp(y)}{\exp(x)-\exp(y)} & \mbox{if } x > y \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Definition at line 48 of file log_diff_exp.hpp.

◆ log_diff_exp() [6/7]

var stan::math::log_diff_exp ( const var a,
double  b 
)
inline

Returns the log difference of the exponentiated arguments.

Parameters
[in]aFirst argument.
[in]bSecond argument.
Returns
Log difference of the expnoentiated arguments.

Definition at line 55 of file log_diff_exp.hpp.

◆ log_diff_exp() [7/7]

var stan::math::log_diff_exp ( double  a,
const var b 
)
inline

Returns the log difference of the exponentiated arguments.

Parameters
[in]aFirst argument.
[in]bSecond argument.
Returns
Log difference of the expnoentiated arguments.

Definition at line 66 of file log_diff_exp.hpp.

◆ log_falling_factorial() [1/7]

template<typename T >
fvar<T> stan::math::log_falling_factorial ( const fvar< T > &  x,
const fvar< T > &  n 
)
inline

Definition at line 14 of file log_falling_factorial.hpp.

◆ log_falling_factorial() [2/7]

template<typename T >
fvar<T> stan::math::log_falling_factorial ( double  x,
const fvar< T > &  n 
)
inline

Definition at line 23 of file log_falling_factorial.hpp.

◆ log_falling_factorial() [3/7]

template<typename T >
fvar<T> stan::math::log_falling_factorial ( const fvar< T > &  x,
double  n 
)
inline

Definition at line 31 of file log_falling_factorial.hpp.

◆ log_falling_factorial() [4/7]

template<typename T1 , typename T2 >
return_type<T1, T2>::type stan::math::log_falling_factorial ( const T1  x,
const T2  n 
)
inline

Return the natural log of the falling factorial of the specified arguments.

\[ \mbox{log\_falling\_factorial}(x, n) = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \ln (x)_n & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log\_falling\_factorial}(x, n)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \Psi(x) & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log\_falling\_factorial}(x, n)}{\partial n} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ -\Psi(n) & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

Template Parameters
T1type of first argument
T2type of second argument
Parameters
[in]xFirst argument
[in]nSecond argument
Returns
log of falling factorial of arguments
Exceptions
std::domain_errorif the first argument is not positive

Definition at line 55 of file log_falling_factorial.hpp.

◆ log_falling_factorial() [5/7]

var stan::math::log_falling_factorial ( const var a,
double  b 
)
inline

Definition at line 59 of file log_falling_factorial.hpp.

◆ log_falling_factorial() [6/7]

var stan::math::log_falling_factorial ( const var a,
const var b 
)
inline

Definition at line 63 of file log_falling_factorial.hpp.

◆ log_falling_factorial() [7/7]

var stan::math::log_falling_factorial ( double  a,
const var b 
)
inline

Definition at line 67 of file log_falling_factorial.hpp.

◆ log_inv_logit() [1/5]

template<typename T >
fvar<T> stan::math::log_inv_logit ( const fvar< T > &  x)
inline

Definition at line 12 of file log_inv_logit.hpp.

◆ log_inv_logit() [2/5]

var stan::math::log_inv_logit ( const var u)
inline

Return the natural logarithm of the inverse logit of the specified argument.

Parameters
uargument
Returns
log inverse logit of the argument

Definition at line 20 of file log_inv_logit.hpp.

◆ log_inv_logit() [3/5]

double stan::math::log_inv_logit ( double  u)
inline

Returns the natural logarithm of the inverse logit of the specified argument.

\[ \mbox{log\_inv\_logit}(x) = \begin{cases} \ln\left(\frac{1}{1+\exp(-x)}\right)& \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log\_inv\_logit}(x)}{\partial x} = \begin{cases} \frac{1}{1+\exp(x)} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
uargument
Returns
log of the inverse logit of argument

Definition at line 32 of file log_inv_logit.hpp.

◆ log_inv_logit() [4/5]

template<typename T >
apply_scalar_unary<log_inv_logit_fun, T>::return_t stan::math::log_inv_logit ( const T &  x)
inline

Return the elementwise application of log_inv_logit() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
Tcontainer type
Parameters
xcontainer
Returns
elementwise log_inv_logit of members of container

Definition at line 40 of file log_inv_logit.hpp.

◆ log_inv_logit() [5/5]

double stan::math::log_inv_logit ( int  u)
inline

Returns the natural logarithm of the inverse logit of the specified argument.

Parameters
uargument
Returns
log of the inverse logit of argument

Definition at line 46 of file log_inv_logit.hpp.

◆ log_inv_logit_diff() [1/7]

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2>::type stan::math::log_inv_logit_diff ( const T1 &  x,
const T2 &  y 
)
inline

Returns the natural logarithm of the difference of the inverse logits of the specified arguments.

\[ \mathrm{log\_inv\_logit\_diff}(x,y) = \ln\left(\frac{1}{1+\exp(-x)}-\frac{1}{1+\exp(-y)}\right) \]

\[ \frac{\partial }{\partial x} = -\frac{e^x}{e^y-e^x}-\frac{e^x}{e^x+1} \]

\[ \frac{\partial }{\partial x} = -\frac{e^y}{e^x-e^y}-\frac{e^y}{e^y+1} \]

Template Parameters
T1Type of x argument.
T2Type of y argument.
Parameters
xArgument.
yArgument.
Returns
Result of log difference of inverse logits of arguments.

Definition at line 37 of file log_inv_logit_diff.hpp.

◆ log_inv_logit_diff() [2/7]

template<typename T >
fvar<T> stan::math::log_inv_logit_diff ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Returns fvar with the natural logarithm of the difference of the inverse logits of the specified arguments and its gradients.

\[ \mathrm{log\_inv\_logit\_diff}(x,y) = \ln\left(\frac{1}{1+\exp(-x)}-\frac{1}{1+\exp(-y)}\right) \]

\[ \frac{\partial }{\partial x} = -\frac{e^x}{e^y-e^x}-\frac{e^x}{e^x+1} \]

\[ \frac{\partial }{\partial x} = -\frac{e^y}{e^x-e^y}-\frac{e^y}{e^y+1} \]

Template Parameters
T1Type of x argument.
T2Type of y argument.
Parameters
xArgument.
yArgument.
Returns
Fvar with result of log difference of inverse logits of arguments and gradients.

Definition at line 39 of file log_inv_logit_diff.hpp.

◆ log_inv_logit_diff() [3/7]

template<typename T >
fvar<T> stan::math::log_inv_logit_diff ( const fvar< T > &  x,
double  y 
)
inline

Definition at line 47 of file log_inv_logit_diff.hpp.

◆ log_inv_logit_diff() [4/7]

template<typename T >
fvar<T> stan::math::log_inv_logit_diff ( double  x,
const fvar< T > &  y 
)
inline

Definition at line 53 of file log_inv_logit_diff.hpp.

◆ log_inv_logit_diff() [5/7]

var stan::math::log_inv_logit_diff ( const var a,
double  b 
)
inline

Definition at line 71 of file log_inv_logit_diff.hpp.

◆ log_inv_logit_diff() [6/7]

var stan::math::log_inv_logit_diff ( const var a,
const var b 
)
inline

Definition at line 75 of file log_inv_logit_diff.hpp.

◆ log_inv_logit_diff() [7/7]

var stan::math::log_inv_logit_diff ( double  a,
const var b 
)
inline

Definition at line 79 of file log_inv_logit_diff.hpp.

◆ log_mix() [1/12]

template<typename T_theta , typename T_lam >
return_type<T_theta, T_lam>::type stan::math::log_mix ( const T_theta &  theta,
const T_lam &  lambda 
)

Return the log mixture density with specified mixing proportions and log densities.

\[ \frac{\partial }{\partial p_x} \log\left(\exp^{\log\left(p_1\right)+d_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+d_n}\right) =\frac{e^{d_x}}{e^{d_1}p_1+\cdot\cdot\cdot+e^{d_m}p_m} \]

\[ \frac{\partial }{\partial d_x} \log\left(\exp^{\log\left(p_1\right)+d_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+d_n}\right) =\frac{e^{d_x}p_x}{e^{d_1}p_1+\cdot\cdot\cdot+e^{d_m}p_m} \]

Parameters
thetavector of mixing proportions in [0, 1].
lambdavector of log densities.
Returns
log mixture of densities in specified proportion

Definition at line 41 of file log_mix.hpp.

◆ log_mix() [2/12]

double stan::math::log_mix ( double  theta,
double  lambda1,
double  lambda2 
)
inline

Return the log mixture density with specified mixing proportion and log densities.

\[ \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \log \left( \theta \lambda_1 + (1 - \theta) \lambda_2 \right). \]

\[ \frac{\partial}{\partial \theta} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = FIXME \]

\[ \frac{\partial}{\partial \lambda_1} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = FIXME \]

\[ \frac{\partial}{\partial \lambda_2} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = FIXME \]

Parameters
[in]thetamixing proportion in [0, 1].
lambda1first log density.
lambda2second log density.
Returns
log mixture of densities in specified proportion

Definition at line 46 of file log_mix.hpp.

◆ log_mix() [3/12]

template<typename T_theta , typename T_lambda1 , typename T_lambda2 >
return_type<T_theta, T_lambda1, T_lambda2>::type stan::math::log_mix ( const T_theta &  theta,
const T_lambda1 &  lambda1,
const T_lambda2 &  lambda2 
)
inline

Return the log mixture density with specified mixing proportion and log densities and its derivative at each.

\[ \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \log \left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right). \]

\[ \frac{\partial}{\partial \theta} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \dfrac{\exp(\lambda_1) - \exp(\lambda_2)} {\left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right)} \]

\[ \frac{\partial}{\partial \lambda_1} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \dfrac{\theta \exp(\lambda_1)} {\left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right)} \]

\[ \frac{\partial}{\partial \lambda_2} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \dfrac{\theta \exp(\lambda_2)} {\left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right)} \]

Template Parameters
T_thetatheta scalar type.
T_lambda1lambda1 scalar type.
T_lambda2lambda2 scalar type.
Parameters
[in]thetamixing proportion in [0, 1].
[in]lambda1first log density.
[in]lambda2second log density.
Returns
log mixture of densities in specified proportion

Definition at line 77 of file log_mix.hpp.

◆ log_mix() [4/12]

template<typename T >
fvar<T> stan::math::log_mix ( const fvar< T > &  theta,
const fvar< T > &  lambda1,
const fvar< T > &  lambda2 
)
inline

Return the log mixture density with specified mixing proportion and log densities and its derivative at each.

\[ \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \log \left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right). \]

\[ \frac{\partial}{\partial \theta} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \dfrac{\exp(\lambda_1) - \exp(\lambda_2)} {\left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right)} \]

\[ \frac{\partial}{\partial \lambda_1} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \dfrac{\theta \exp(\lambda_1)} {\left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right)} \]

\[ \frac{\partial}{\partial \lambda_2} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \dfrac{\theta \exp(\lambda_2)} {\left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right)} \]

Template Parameters
Tscalar type.
Parameters
[in]thetamixing proportion in [0, 1].
[in]lambda1first log density.
[in]lambda2second log density.
Returns
log mixture of densities in specified proportion

Definition at line 107 of file log_mix.hpp.

◆ log_mix() [5/12]

template<typename T_theta , typename T_lam , int R, int C>
return_type<T_theta, std::vector<Eigen::Matrix<T_lam, R, C> > >::type stan::math::log_mix ( const T_theta &  theta,
const std::vector< Eigen::Matrix< T_lam, R, C > > &  lambda 
)

Return the log mixture density given specified mixing proportions and array of log density vectors.

\[ \frac{\partial }{\partial p_x}\left[ \log\left(\exp^{\log\left(p_1\right)+d_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+d_n}\right)+ \log\left(\exp^{\log\left(p_1\right)+f_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+f_n}\right)\right] =\frac{e^{d_x}}{e^{d_1}p_1+\cdot\cdot\cdot+e^{d_m}p_m}+ \frac{e^{f_x}}{e^{f_1}p_1+\cdot\cdot\cdot+e^{f_m}p_m} \]

\[ \frac{\partial }{\partial d_x}\left[ \log\left(\exp^{\log\left(p_1\right)+d_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+d_n}\right) +\log\left(\exp^{\log\left(p_1\right)+f_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+f_n}\right)\right] =\frac{e^{d_x}p_x}{e^{d_1}p_1+\cdot\cdot\cdot+e^{d_m}p_m} \]

Parameters
thetavector of mixing proportions in [0, 1].
lambdaarray containing vectors of log densities.
Returns
log mixture of densities in specified proportion

Definition at line 118 of file log_mix.hpp.

◆ log_mix() [6/12]

template<typename T >
fvar<T> stan::math::log_mix ( const fvar< T > &  theta,
const fvar< T > &  lambda1,
double  lambda2 
)
inline

Definition at line 127 of file log_mix.hpp.

◆ log_mix() [7/12]

template<typename T >
fvar<T> stan::math::log_mix ( const fvar< T > &  theta,
double  lambda1,
const fvar< T > &  lambda2 
)
inline

Definition at line 145 of file log_mix.hpp.

◆ log_mix() [8/12]

template<typename T >
fvar<T> stan::math::log_mix ( double  theta,
const fvar< T > &  lambda1,
const fvar< T > &  lambda2 
)
inline

Definition at line 163 of file log_mix.hpp.

◆ log_mix() [9/12]

template<typename T >
fvar<T> stan::math::log_mix ( const fvar< T > &  theta,
double  lambda1,
double  lambda2 
)
inline

Definition at line 181 of file log_mix.hpp.

◆ log_mix() [10/12]

template<typename T >
fvar<T> stan::math::log_mix ( double  theta,
const fvar< T > &  lambda1,
double  lambda2 
)
inline

Definition at line 196 of file log_mix.hpp.

◆ log_mix() [11/12]

template<typename T_theta , typename T_lam >
return_type<T_theta, std::vector<std::vector<T_lam> > >::type stan::math::log_mix ( const T_theta &  theta,
const std::vector< std::vector< T_lam > > &  lambda 
)

Return the log mixture density given specified mixing proportions and array of log density arrays.

\[ \frac{\partial }{\partial p_x}\left[ \log\left(\exp^{\log\left(p_1\right)+d_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+d_n}\right)+ \log\left(\exp^{\log\left(p_1\right)+f_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+f_n}\right)\right] =\frac{e^{d_x}}{e^{d_1}p_1+\cdot\cdot\cdot+e^{d_m}p_m}+ \frac{e^{f_x}}{e^{f_1}p_1+\cdot\cdot\cdot+e^{f_m}p_m} \]

\[ \frac{\partial }{\partial d_x}\left[ \log\left(\exp^{\log\left(p_1\right)+d_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+d_n}\right) +\log\left(\exp^{\log\left(p_1\right)+f_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+f_n}\right)\right] =\frac{e^{d_x}p_x}{e^{d_1}p_1+\cdot\cdot\cdot+e^{d_m}p_m} \]

Parameters
thetavector of mixing proportions in [0, 1].
lambdaarray containing arrays of log densities.
Returns
log mixture of densities in specified proportion

Definition at line 207 of file log_mix.hpp.

◆ log_mix() [12/12]

template<typename T >
fvar<T> stan::math::log_mix ( double  theta,
double  lambda1,
const fvar< T > &  lambda2 
)
inline

Definition at line 211 of file log_mix.hpp.

◆ log_mix_partial_helper() [1/2]

void stan::math::log_mix_partial_helper ( double  theta_val,
double  lambda1_val,
double  lambda2_val,
double &  one_m_exp_lam2_m_lam1,
double &  one_m_t_prod_exp_lam2_m_lam1,
double &  one_d_t_plus_one_m_t_prod_exp_lam2_m_lam1 
)
inline

Definition at line 23 of file log_mix.hpp.

◆ log_mix_partial_helper() [2/2]

template<typename T_theta , typename T_lambda1 , typename T_lambda2 , int N>
void stan::math::log_mix_partial_helper ( const T_theta &  theta,
const T_lambda1 &  lambda1,
const T_lambda2 &  lambda2,
typename boost::math::tools::promote_args< T_theta, T_lambda1, T_lambda2 >::type(&)  partials_array[N] 
)
inline

Definition at line 29 of file log_mix.hpp.

◆ log_modified_bessel_first_kind()

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2, double>::type stan::math::log_modified_bessel_first_kind ( const T1  v,
const T2  z 
)
inline

Definition at line 40 of file log_modified_bessel_first_kind.hpp.

◆ log_rising_factorial() [1/7]

template<typename T >
fvar<T> stan::math::log_rising_factorial ( const fvar< T > &  x,
const fvar< T > &  n 
)
inline

Definition at line 13 of file log_rising_factorial.hpp.

◆ log_rising_factorial() [2/7]

template<typename T >
fvar<T> stan::math::log_rising_factorial ( const fvar< T > &  x,
double  n 
)
inline

Definition at line 20 of file log_rising_factorial.hpp.

◆ log_rising_factorial() [3/7]

template<typename T >
fvar<T> stan::math::log_rising_factorial ( double  x,
const fvar< T > &  n 
)
inline

Definition at line 26 of file log_rising_factorial.hpp.

◆ log_rising_factorial() [4/7]

var stan::math::log_rising_factorial ( const var a,
double  b 
)
inline

Definition at line 43 of file log_rising_factorial.hpp.

◆ log_rising_factorial() [5/7]

var stan::math::log_rising_factorial ( const var a,
const var b 
)
inline

Definition at line 47 of file log_rising_factorial.hpp.

◆ log_rising_factorial() [6/7]

var stan::math::log_rising_factorial ( double  a,
const var b 
)
inline

Definition at line 51 of file log_rising_factorial.hpp.

◆ log_rising_factorial() [7/7]

template<typename T1 , typename T2 >
return_type<T1, T2>::type stan::math::log_rising_factorial ( const T1 &  x,
const T2 &  n 
)
inline

Return the natural logarithm of the rising factorial from the first specified argument to the second.

\[ \mbox{log\_rising\_factorial}(x, n) = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \ln x^{(n)} & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log\_rising\_factorial}(x, n)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \Psi(x+n) - \Psi(x) & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log\_rising\_factorial}(x, n)}{\partial n} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \Psi(x+n) & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

Template Parameters
T1type of first argument x
T2type of second argument n
Parameters
[in]xfirst argument
[in]nsecond argument
Returns
natural logarithm of the rising factorial from x to n
Exceptions
std::domain_errorif the first argument is not positive

Definition at line 53 of file log_rising_factorial.hpp.

◆ log_softmax() [1/3]

template<typename T >
Eigen::Matrix<fvar<T>, Eigen::Dynamic, 1> stan::math::log_softmax ( const Eigen::Matrix< fvar< T >, Eigen::Dynamic, 1 > &  alpha)
inline

Definition at line 14 of file log_softmax.hpp.

◆ log_softmax() [2/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::log_softmax ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  v)
inline

Return the natural logarithm of the softmax of the specified vector.

$ \log \mbox{softmax}(y) \ = \ y - \log \sum_{k=1}^K \exp(y_k) \ = \ y - \mbox{log\_sum\_exp}(y). $

For the log softmax function, the entries in the Jacobian are $ \frac{\partial}{\partial y_m} \mbox{softmax}(y)[k] = \left\{ \begin{array}{ll} 1 - \mbox{softmax}(y)[m] & \mbox{ if } m = k, \mbox{ and} \\[6pt] \mbox{softmax}(y)[m] & \mbox{ if } m \neq k. \end{array} \right. $

Template Parameters
TScalar type of values in vector.
Parameters
[in]vVector to transform.
Returns
Unit simplex result of the softmax transform of the vector.

Definition at line 40 of file log_softmax.hpp.

◆ log_softmax() [3/3]

Eigen::Matrix<var, Eigen::Dynamic, 1> stan::math::log_softmax ( const Eigen::Matrix< var, Eigen::Dynamic, 1 > &  alpha)
inline

Return the softmax of the specified Eigen vector.

Softmax is guaranteed to return a simplex.

The gradient calculations are unfolded.

Parameters
alphaUnconstrained input vector.
Returns
Softmax of the input.
Exceptions
std::domain_errorIf the input vector is size 0.

Definition at line 55 of file log_softmax.hpp.

◆ log_sum_exp() [1/13]

template<typename T , int R, int C>
fvar<T> stan::math::log_sum_exp ( const Eigen::Matrix< fvar< T >, R, C > &  v)

Definition at line 12 of file log_sum_exp.hpp.

◆ log_sum_exp() [2/13]

template<typename T >
fvar<T> stan::math::log_sum_exp ( const std::vector< fvar< T > > &  v)

Definition at line 12 of file log_sum_exp.hpp.

◆ log_sum_exp() [3/13]

template<typename T >
fvar<T> stan::math::log_sum_exp ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 12 of file log_sum_exp.hpp.

◆ log_sum_exp() [4/13]

template<typename T >
fvar<T> stan::math::log_sum_exp ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 20 of file log_sum_exp.hpp.

◆ log_sum_exp() [5/13]

template<int R, int C>
double stan::math::log_sum_exp ( const Eigen::Matrix< double, R, C > &  x)

Return the log of the sum of the exponentiated values of the specified matrix of values.

The matrix may be a full matrix, a vector, or a row vector.

The function is defined as follows to prevent overflow in exponential calculations.

$\log \sum_{n=1}^N \exp(x_n) = \max(x) + \log \sum_{n=1}^N \exp(x_n - \max(x))$.

Parameters
[in]xMatrix of specified values
Returns
The log of the sum of the exponentiated vector values.

Definition at line 26 of file log_sum_exp.hpp.

◆ log_sum_exp() [6/13]

double stan::math::log_sum_exp ( const std::vector< double > &  x)
inline

Return the log of the sum of the exponentiated values of the specified sequence of values.

The function is defined as follows to prevent overflow in exponential calculations.

$\log \sum_{n=1}^N \exp(x_n) = \max(x) + \log \sum_{n=1}^N \exp(x_n - \max(x))$.

Parameters
[in]xarray of specified values
Returns
The log of the sum of the exponentiated vector values.

Definition at line 26 of file log_sum_exp.hpp.

◆ log_sum_exp() [7/13]

template<typename T >
fvar<T> stan::math::log_sum_exp ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 26 of file log_sum_exp.hpp.

◆ log_sum_exp() [8/13]

var stan::math::log_sum_exp ( const var a,
const var b 
)
inline

Returns the log sum of exponentials.

Definition at line 41 of file log_sum_exp.hpp.

◆ log_sum_exp() [9/13]

template<int R, int C>
var stan::math::log_sum_exp ( const Eigen::Matrix< var, R, C > &  x)
inline

Returns the log sum of exponentials.

Parameters
xmatrix

Definition at line 43 of file log_sum_exp.hpp.

◆ log_sum_exp() [10/13]

var stan::math::log_sum_exp ( const std::vector< var > &  x)
inline

Returns the log sum of exponentials.

Definition at line 44 of file log_sum_exp.hpp.

◆ log_sum_exp() [11/13]

var stan::math::log_sum_exp ( const var a,
double  b 
)
inline

Returns the log sum of exponentials.

Definition at line 47 of file log_sum_exp.hpp.

◆ log_sum_exp() [12/13]

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2>::type stan::math::log_sum_exp ( const T2 &  a,
const T1 &  b 
)
inline

Calculates the log sum of exponetials without overflow.

$\log (\exp(a) + \exp(b)) = m + \log(\exp(a-m) + \exp(b-m))$,

where $m = max(a, b)$.

\[ \mbox{log\_sum\_exp}(x, y) = \begin{cases} \ln(\exp(x)+\exp(y)) & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log\_sum\_exp}(x, y)}{\partial x} = \begin{cases} \frac{\exp(x)}{\exp(x)+\exp(y)} & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log\_sum\_exp}(x, y)}{\partial y} = \begin{cases} \frac{\exp(y)}{\exp(x)+\exp(y)} & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
athe first variable
bthe second variable

Definition at line 48 of file log_sum_exp.hpp.

◆ log_sum_exp() [13/13]

var stan::math::log_sum_exp ( double  a,
const var b 
)
inline

Returns the log sum of exponentials.

Definition at line 53 of file log_sum_exp.hpp.

◆ logical_and()

template<typename T1 , typename T2 >
int stan::math::logical_and ( const T1  x1,
const T2  x2 
)
inline

The logical and function which returns 1 if both arguments are unequal to zero and 0 otherwise.

Equivalent to x1 != 0 && x2 != 0.

\[ \mbox{operator\&\&}(x, y) = \begin{cases} 0 & \mbox{if } x = 0 \textrm{ or } y=0 \\ 1 & \mbox{if } x, y \neq 0 \\[6pt] 1 & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Template Parameters
T1Type of first argument.
T2Type of second argument.
Parameters
x1First argument
x2Second argument
Returns
true if both x1 and x2 are not equal to 0.

Definition at line 30 of file logical_and.hpp.

◆ logical_eq()

template<typename T1 , typename T2 >
int stan::math::logical_eq ( const T1  x1,
const T2  x2 
)
inline

Return 1 if the first argument is equal to the second.

Equivalent to x1 == x2.

Template Parameters
T1Type of first argument.
T2Type of second argument.
Parameters
x1First argument
x2Second argument
Returns
true iff x1 == x2

Definition at line 19 of file logical_eq.hpp.

◆ logical_gt()

template<typename T1 , typename T2 >
int stan::math::logical_gt ( const T1  x1,
const T2  x2 
)
inline

Return 1 if the first argument is strictly greater than the second.

Equivalent to x1 < x2.

Template Parameters
T1Type of first argument.
T2Type of second argument.
Parameters
x1First argument
x2Second argument
Returns
true iff x1 > x2

Definition at line 19 of file logical_gt.hpp.

◆ logical_gte()

template<typename T1 , typename T2 >
int stan::math::logical_gte ( const T1  x1,
const T2  x2 
)
inline

Return 1 if the first argument is greater than or equal to the second.

Equivalent to x1 >= x2.

Template Parameters
T1Type of first argument.
T2Type of second argument.
Parameters
x1First argument
x2Second argument
Returns
true iff x1 >= x2

Definition at line 19 of file logical_gte.hpp.

◆ logical_lt()

template<typename T1 , typename T2 >
int stan::math::logical_lt ( T1  x1,
T2  x2 
)
inline

Return 1 if the first argument is strictly less than the second.

Equivalent to x1 < x2.

Template Parameters
T1Type of first argument.
T2Type of second argument.
Parameters
x1First argument
x2Second argument
Returns
true iff x1 < x2

Definition at line 19 of file logical_lt.hpp.

◆ logical_lte()

template<typename T1 , typename T2 >
int stan::math::logical_lte ( const T1  x1,
const T2  x2 
)
inline

Return 1 if the first argument is less than or equal to the second.

Equivalent to x1 <= x2.

Template Parameters
T1Type of first argument.
T2Type of second argument.
Parameters
x1First argument
x2Second argument
Returns
true iff x1 <= x2

Definition at line 19 of file logical_lte.hpp.

◆ logical_negation()

template<typename T >
int stan::math::logical_negation ( const T &  x)
inline

The logical negation function which returns one if the input is equal to zero and zero otherwise.

Template Parameters
Ttype of value
Parameters
xvalue
Returns
1 if value is zero and 0 otherwise

Definition at line 17 of file logical_negation.hpp.

◆ logical_neq()

template<typename T1 , typename T2 >
int stan::math::logical_neq ( const T1  x1,
const T2  x2 
)
inline

Return 1 if the first argument is unequal to the second.

Equivalent to x1 != x2.

Template Parameters
T1Type of first argument.
T2Type of second argument.
Parameters
x1First argument
x2Second argument
Returns
true iff x1 != x2

Definition at line 19 of file logical_neq.hpp.

◆ logical_or()

template<typename T1 , typename T2 >
int stan::math::logical_or ( T1  x1,
T2  x2 
)
inline

The logical or function which returns 1 if either argument is unequal to zero and 0 otherwise.

Equivalent to x1 != 0 || x2 != 0.

\[ \mbox{operator||}(x, y) = \begin{cases} 0 & \mbox{if } x, y=0 \\ 1 & \mbox{if } x \neq 0 \textrm{ or } y\neq0\\[6pt] 1 & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Template Parameters
T1Type of first argument.
T2Type of second argument.
Parameters
x1First argument
x2Second argument
Returns
true if either x1 or x2 is not equal to 0.

Definition at line 29 of file logical_or.hpp.

◆ logistic_ccdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::logistic_ccdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use logistic_lccdf

Definition at line 14 of file logistic_ccdf_log.hpp.

◆ logistic_cdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::logistic_cdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 20 of file logistic_cdf.hpp.

◆ logistic_cdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::logistic_cdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use logistic_lcdf

Definition at line 14 of file logistic_cdf_log.hpp.

◆ logistic_lccdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::logistic_lccdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 20 of file logistic_lccdf.hpp.

◆ logistic_lcdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::logistic_lcdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 19 of file logistic_lcdf.hpp.

◆ logistic_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::logistic_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use logistic_lpdf

Definition at line 14 of file logistic_log.hpp.

◆ logistic_log() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::logistic_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
inline
Deprecated:
use logistic_lpdf

Definition at line 23 of file logistic_log.hpp.

◆ logistic_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::logistic_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 18 of file logistic_lpdf.hpp.

◆ logistic_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::logistic_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
inline

Definition at line 110 of file logistic_lpdf.hpp.

◆ logistic_rng()

template<typename T_loc , typename T_scale , class RNG >
VectorBuilder<true, double, T_loc, T_scale>::type stan::math::logistic_rng ( const T_loc &  mu,
const T_scale &  sigma,
RNG &  rng 
)
inline

Return a Logistic random variate for the given location and scale using the specified random number generator.

mu and sigma can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_locType of location parameter
T_scaleType of scale parameter
RNGtype of random number generator
Parameters
mu(Sequence of) location parameter(s)
sigma(Sequence of) scale parameter(s)
rngrandom number generator
Returns
(Sequence of) Logistic random variate(s)
Exceptions
std::domain_errorif mu is infinite or sigma is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 33 of file logistic_rng.hpp.

◆ logit() [1/5]

template<typename T >
fvar<T> stan::math::logit ( const fvar< T > &  x)
inline

Definition at line 14 of file logit.hpp.

◆ logit() [2/5]

var stan::math::logit ( const var u)
inline

Return the log odds of the specified argument.

Parameters
uargument
Returns
log odds of argument

Definition at line 18 of file logit.hpp.

◆ logit() [3/5]

template<typename T >
apply_scalar_unary<logit_fun, T>::return_t stan::math::logit ( const T &  x)
inline

Return the elementwise application of logit() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
Tcontainer type
Parameters
xcontainer
Returns
elementwise logit of container elements

Definition at line 38 of file logit.hpp.

◆ logit() [4/5]

double stan::math::logit ( double  u)
inline

Return the log odds of the argument.

The logit function is defined as for $x \in [0, 1]$ by returning the log odds of $x$ treated as a probability,

$\mbox{logit}(x) = \log \left( \frac{x}{1 - x} \right)$.

The inverse to this function is inv_logit.

\[ \mbox{logit}(x) = \begin{cases} \textrm{NaN}& \mbox{if } x < 0 \textrm{ or } x > 1\\ \ln\frac{x}{1-x} & \mbox{if } 0\leq x \leq 1 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{logit}(x)}{\partial x} = \begin{cases} \textrm{NaN}& \mbox{if } x < 0 \textrm{ or } x > 1\\ \frac{1}{x-x^2}& \mbox{if } 0\leq x\leq 1 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
uargument
Returns
log odds of argument

Definition at line 42 of file logit.hpp.

◆ logit() [5/5]

double stan::math::logit ( int  u)
inline

Return the log odds of the argument.

Parameters
uargument
Returns
log odds of argument

Definition at line 53 of file logit.hpp.

◆ lognormal_ccdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::lognormal_ccdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use lognormal_lccdf

Definition at line 14 of file lognormal_ccdf_log.hpp.

◆ lognormal_cdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::lognormal_cdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 18 of file lognormal_cdf.hpp.

◆ lognormal_cdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::lognormal_cdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use lognormal_lcdf

Definition at line 14 of file lognormal_cdf_log.hpp.

◆ lognormal_lccdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::lognormal_lccdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 18 of file lognormal_lccdf.hpp.

◆ lognormal_lcdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::lognormal_lcdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 18 of file lognormal_lcdf.hpp.

◆ lognormal_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::lognormal_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use lognormal_lpdf

Definition at line 14 of file lognormal_log.hpp.

◆ lognormal_log() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::lognormal_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
inline
Deprecated:
use lognormal_lpdf

Definition at line 23 of file lognormal_log.hpp.

◆ lognormal_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::lognormal_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 20 of file lognormal_lpdf.hpp.

◆ lognormal_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::lognormal_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
inline

Definition at line 122 of file lognormal_lpdf.hpp.

◆ lognormal_rng()

template<typename T_loc , typename T_scale , class RNG >
VectorBuilder<true, double, T_loc, T_scale>::type stan::math::lognormal_rng ( const T_loc &  mu,
const T_scale &  sigma,
RNG &  rng 
)
inline

Return a lognormal random variate for the given location and scale using the specified random number generator.

mu and sigma can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_locType of location parameter
T_scaleType of scale parameter
RNGtype of random number generator
Parameters
mu(Sequence of) location parameter(s)
sigma(Sequence of) positive scale parameter(s)
rngrandom number generator
Returns
(Sequence of) Normal random variate(s)
Exceptions
std::domain_errorif mu is infinite or sigma is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 33 of file lognormal_rng.hpp.

◆ lub_constrain() [1/2]

template<typename T , typename L , typename U >
boost::math::tools::promote_args<T, L, U>::type stan::math::lub_constrain ( const T &  x,
const L &  lb,
const U &  ub 
)
inline

Return the lower- and upper-bounded scalar derived by transforming the specified free scalar given the specified lower and upper bounds.

The transform is the transformed and scaled inverse logit,

$f(x) = L + (U - L) \mbox{logit}^{-1}(x)$

If the lower bound is negative infinity and upper bound finite, this function reduces to ub_constrain(x, ub). If the upper bound is positive infinity and the lower bound finite, this function reduces to lb_constrain(x, lb). If the upper bound is positive infinity and the lower bound negative infinity, this function reduces to identity_constrain(x).

Template Parameters
TType of scalar.
LType of lower bound.
UType of upper bound.
Parameters
[in]xFree scalar to transform.
[in]lbLower bound.
[in]ubUpper bound.
Returns
Lower- and upper-bounded scalar derived from transforming the free scalar.
Exceptions
std::domain_errorif ub <= lb

Definition at line 44 of file lub_constrain.hpp.

◆ lub_constrain() [2/2]

template<typename T , typename L , typename U >
boost::math::tools::promote_args<T, L, U>::type stan::math::lub_constrain ( const T &  x,
const L &  lb,
const U &  ub,
T &  lp 
)
inline

Return the lower- and upper-bounded scalar derived by transforming the specified free scalar given the specified lower and upper bounds and increment the specified log probability with the log absolute Jacobian determinant.

The transform is as defined in lub_constrain(T, double, double). The log absolute Jacobian determinant is given by

$\log \left| \frac{d}{dx} \left( L + (U-L) \mbox{logit}^{-1}(x) \right) \right|$

$ {} = \log | (U-L) \, (\mbox{logit}^{-1}(x)) \, (1 - \mbox{logit}^{-1}(x)) |$

$ {} = \log (U - L) + \log (\mbox{logit}^{-1}(x)) + \log (1 - \mbox{logit}^{-1}(x))$

If the lower bound is negative infinity and upper bound finite, this function reduces to ub_constrain(x, ub, lp). If the upper bound is positive infinity and the lower bound finite, this function reduces to lb_constrain(x, lb, lp). If the upper bound is positive infinity and the lower bound negative infinity, this function reduces to identity_constrain(x, lp).

Template Parameters
TType of scalar.
LType of lower bound.
UType of upper bound.
Parameters
[in]xFree scalar to transform.
[in]lbLower bound.
[in]ubUpper bound.
[in,out]lpLog probability scalar reference.
Returns
Lower- and upper-bounded scalar derived from transforming the free scalar.
Exceptions
std::domain_errorif ub <= lb

Definition at line 110 of file lub_constrain.hpp.

◆ lub_free()

template<typename T , typename L , typename U >
boost::math::tools::promote_args<T, L, U>::type stan::math::lub_free ( const T &  y,
const L &  lb,
const U &  ub 
)
inline

Return the unconstrained scalar that transforms to the specified lower- and upper-bounded scalar given the specified bounds.

The transfrom in lub_constrain(T, double, double), is reversed by a transformed and scaled logit,

$f^{-1}(y) = \mbox{logit}(\frac{y - L}{U - L})$

where $U$ and $L$ are the lower and upper bounds.

If the lower bound is negative infinity and upper bound finite, this function reduces to ub_free(y, ub). If the upper bound is positive infinity and the lower bound finite, this function reduces to lb_free(x, lb). If the upper bound is positive infinity and the lower bound negative infinity, this function reduces to identity_free(y).

Template Parameters
Ttype of scalar
Ltype of lower bound
Utype of upper bound
Parameters
yconstrained value
lblower bound
ubupper bound
Returns
the free scalar that transforms to the input scalar given the bounds
Exceptions
std::invalid_argumentif the lower bound is greater than the upper bound, y is less than the lower bound, or y is greater than the upper bound

Definition at line 47 of file lub_free.hpp.

◆ machine_precision()

double stan::math::machine_precision ( )
inline

Returns the difference between 1.0 and the next value representable.

Returns
Minimum positive number.

Definition at line 130 of file constants.hpp.

◆ make_nu()

template<typename T >
Eigen::Array<T, Eigen::Dynamic, 1> stan::math::make_nu ( const T &  eta,
size_t  K 
)

Return the degrees of freedom for the t distribution that corresponds to the shape parameter in the LKJ distribution.

Parameters
etaLKJ distribution parameter in (0, inf)
Knumber of variables in correlation matrix

Definition at line 18 of file make_nu.hpp.

◆ map_rect()

template<int call_id, typename F , typename T_shared_param , typename T_job_param >
Eigen::Matrix<typename stan::return_type<T_shared_param, T_job_param>::type, Eigen::Dynamic, 1> stan::math::map_rect ( const Eigen::Matrix< T_shared_param, Eigen::Dynamic, 1 > &  shared_params,
const std::vector< Eigen::Matrix< T_job_param, Eigen::Dynamic, 1 >> &  job_params,
const std::vector< std::vector< double >> &  x_r,
const std::vector< std::vector< int >> &  x_i,
std::ostream *  msgs = nullptr 
)

Map N function evaluations to parameters and data which are in rectangular format.

Each function evaluation may return a column vector of different sizes and the output is the concatenated vector from all evaluations.

In addition to job specific parameters, real and int data, a shared parameter vector is repeated in all evaluations. All input parameters are stored as vectors whereas data is stored as arrays.

For N jobs the output of this function is

[ f(shared_params, job_params[1], x_r[1], x_i[1]), f(shared_params, job_params[2], x_r[2], x_i[2]), ... ]'.

The function is implemented with serial execution and with parallelism using threading or MPI (TODO). The threading version is used if the compiler flag STAN_THREADS is set during compilation while the MPI version is only available if STAN_MPI is defined. The MPI parallelism takes precedence over serial or threading execution of the function.

For the threaded parallelism the N jobs are chunked into T blocks which are executed asynchronously using the async C++11 facility. This ensure that at most T threads are used, but the actual number of threads is controlled by the implementation of async provided by the compiler. Note that nested calls of map_rect will lead to a multiplicative increase in the number of job chunks generated. The number of threads T is controlled at runtime via the STAN_NUM_threads environment variable, see the get_num_threads function for details.

For the MPI version to work this function has these special non-standard conventions:

  • The call_id template parameter is considered as a label for the functor F and data combination. Since MPI communication is expensive, the real and int data is transmitted only a single time per functor F / call_id combination to the workers.
  • The MPI implementation requires that the functor type fully specifies the functor and hence requires a default constructible function object. This choice reduces the need for communication across MPI as the type is sufficient and the state of the functor is not necessary to transmit. Thus, the functor is specified as template argument only.
  • The size of the returned vector of each job must stay consistent when performing repeated calls to map_rect (which usually vary the values of the parameters).
  • To achieve the exact same results between the serial and the MPI evaluation scheme both variants work in exactly the same way which is to use nested AD calls and pre-computing all gradients when the function gets called. The usual evaluation scheme would build an AD graph instead of doing on-the-spot gradient evaluation. For large problems this results in speedups for the serial version even on a single core due to smaller AD graph sizes.
  • In MPI operation mode, no outputs from the workers are streamed back to the root.
  • Finally, each map_rect call must be registered with the STAN_REGISTER_MAP_RECT macro. This is required to enable communication between processes for the MPI case. The macro definition is empty if MPI is not enabled.

The functor F is expected to have the usual operator() function with signature

template <typename T1, typename T2> Eigen::Matrix<typename stan::return_type<T1, T2>::type, Eigen::Dynamic, 1> operator()(const Eigen::Matrix<T1, Eigen::Dynamic, 1>& eta, const Eigen::Matrix<T2, Eigen::Dynamic, 1>& theta, const std::vector<double>& x_r, const std::vector<int>& x_i, std::ostream* msgs = 0) const { ... }

WARNING: For the MPI case, the data arguments are NOT checked if they are unchanged between repeated evaluations for a given call_id/functor F pair. This is silently assumed to be immutable between evaluations.

Template Parameters
T_shared_paramType of shared parameters.
T_job_paramType of job specific parameters.
Parameters
shared_paramsshared parameter vector passed as first argument to functor for all jobs
job_paramsArray of job specific parameter vectors. All job specific parameters must have matching sizes.
x_rArray of real arrays for each job. The first dimension must match the number of jobs (which is determined by the first dimension of job_params) and each entry must have the same size.
x_iArray of int data with the same conventions as x_r.
msgsOutput stream for messages.
Template Parameters
call_idLabel for functor/data combination. See above for details.
FFunctor which is applied to all job specific parameters with conventions described.
Returns
concatenated results from all jobs

Definition at line 124 of file map_rect.hpp.

◆ matrix_exp() [1/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::matrix_exp ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  A)
inline

Return the matrix exponential of the input matrix.

Template Parameters
Ttype of scalar of the elements of input matrix.
Parameters
[in]AMatrix to exponentiate.
Returns
Matrix exponential, dynacally-sized.

Definition at line 20 of file matrix_exp.hpp.

◆ matrix_exp() [2/3]

template<typename T , int N>
Eigen::Matrix<T, N, N> stan::math::matrix_exp ( const Eigen::Matrix< T, N, N > &  A)
inline

Return the matrix exponential of the input statically-sized matrix.

Template Parameters
Ttype of scalar of the elements of input matrix.
Nsize of the input square matrix.
Parameters
[in]AMatrix to exponentiate.
Returns
Matrix exponential, statically-sized.

Definition at line 44 of file matrix_exp.hpp.

◆ matrix_exp() [3/3]

template<typename T >
Eigen::Matrix<T, 1, 1> stan::math::matrix_exp ( const Eigen::Matrix< T, 1, 1 > &  A)
inline

Return the exponential of the input scalar when it's in the form of Eigen matrix.

Template Parameters
Ttype of scalar of the elements of input matrix.
Returns
1x1 Matrix exponential, statically-sized.

Definition at line 64 of file matrix_exp.hpp.

◆ matrix_exp_2x2()

template<typename Mtype >
Mtype stan::math::matrix_exp_2x2 ( const Mtype &  A)

Return the matrix exponential of a 2x2 matrix.

Reference for algorithm: http://mathworld.wolfram.com/MatrixExponential.html Note: algorithm only works if delta > 0;

Template Parameters
Ttype of scalar of the elements of input matrix.
Parameters
[in]A2x2 matrix to exponentiate.
Returns
Matrix exponential of A.

Definition at line 19 of file matrix_exp_2x2.hpp.

◆ matrix_exp_multiply() [1/2]

template<int Cb>
Eigen::Matrix<double, -1, Cb> stan::math::matrix_exp_multiply ( const Eigen::MatrixXd &  A,
const Eigen::Matrix< double, -1, Cb > &  B 
)
inline

Return product of exp(A) and B, where A is a NxN double matrix, B is a NxCb double matrix, and t is a double.

Template Parameters
CbColumns matrix B
Parameters
[in]AMatrix
[in]BMatrix
Returns
exponential of A multiplies B

Definition at line 19 of file matrix_exp_multiply.hpp.

◆ matrix_exp_multiply() [2/2]

template<typename Ta , typename Tb , int Cb>
Eigen::Matrix<typename stan::return_type<Ta, Tb>::type, -1, Cb> stan::math::matrix_exp_multiply ( const Eigen::Matrix< Ta, -1, -1 > &  A,
const Eigen::Matrix< Tb, -1, Cb > &  B 
)
inline

Wrapper of matrix_exp_action function for a more literal name.

Template Parameters
Tascalar type matrix A
Tbscalar type matrix B
CbColumns matrix B
Parameters
[in]AMatrix
[in]BMatrix
Returns
exponential of A multiplies B

Definition at line 27 of file matrix_exp_multiply.hpp.

◆ matrix_exp_pade()

template<typename MatrixType >
MatrixType stan::math::matrix_exp_pade ( const MatrixType &  arg)

Computes the matrix exponential, using a Pade approximation, coupled with scaling and squaring.

Template Parameters
MatrixTypescalar type of the elements in the input matrix.
Parameters
[in]argmatrix to exponentiate.
Returns
Matrix exponential of input matrix.

Definition at line 20 of file matrix_exp_pade.hpp.

◆ matrix_normal_prec_log() [1/2]

template<bool propto, typename T_y , typename T_Mu , typename T_Sigma , typename T_D >
boost::math::tools::promote_args<T_y, T_Mu, T_Sigma, T_D>::type stan::math::matrix_normal_prec_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_Mu, Eigen::Dynamic, Eigen::Dynamic > &  Mu,
const Eigen::Matrix< T_Sigma, Eigen::Dynamic, Eigen::Dynamic > &  Sigma,
const Eigen::Matrix< T_D, Eigen::Dynamic, Eigen::Dynamic > &  D 
)

The log of the matrix normal density for the given y, mu, Sigma and D where Sigma and D are given as precision matrices, not covariance matrices.

Deprecated:
use matrix_normal_prec_lpdf
Parameters
yAn mxn matrix.
MuThe mean matrix.
SigmaThe mxm inverse covariance matrix (i.e., the precision matrix) of the rows of y.
DThe nxn inverse covariance matrix (i.e., the precision matrix) of the columns of y.
Returns
The log of the matrix normal density.
Exceptions
std::domain_errorif Sigma or D are not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_MuType of location.
T_SigmaType of Sigma.
T_DType of D.

Definition at line 35 of file matrix_normal_prec_log.hpp.

◆ matrix_normal_prec_log() [2/2]

template<typename T_y , typename T_Mu , typename T_Sigma , typename T_D >
boost::math::tools::promote_args<T_y, T_Mu, T_Sigma, T_D>::type stan::math::matrix_normal_prec_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_Mu, Eigen::Dynamic, Eigen::Dynamic > &  Mu,
const Eigen::Matrix< T_Sigma, Eigen::Dynamic, Eigen::Dynamic > &  Sigma,
const Eigen::Matrix< T_D, Eigen::Dynamic, Eigen::Dynamic > &  D 
)
Deprecated:
use matrix_normal_prec_lpdf

Definition at line 49 of file matrix_normal_prec_log.hpp.

◆ matrix_normal_prec_lpdf() [1/2]

template<bool propto, typename T_y , typename T_Mu , typename T_Sigma , typename T_D >
boost::math::tools::promote_args<T_y, T_Mu, T_Sigma, T_D>::type stan::math::matrix_normal_prec_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_Mu, Eigen::Dynamic, Eigen::Dynamic > &  Mu,
const Eigen::Matrix< T_Sigma, Eigen::Dynamic, Eigen::Dynamic > &  Sigma,
const Eigen::Matrix< T_D, Eigen::Dynamic, Eigen::Dynamic > &  D 
)

The log of the matrix normal density for the given y, mu, Sigma and D where Sigma and D are given as precision matrices, not covariance matrices.

Parameters
yAn mxn matrix.
MuThe mean matrix.
SigmaThe mxm inverse covariance matrix (i.e., the precision matrix) of the rows of y.
DThe nxn inverse covariance matrix (i.e., the precision matrix) of the columns of y.
Returns
The log of the matrix normal density.
Exceptions
std::domain_errorif Sigma or D are not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_MuType of location.
T_SigmaType of Sigma.
T_DType of D.

Definition at line 38 of file matrix_normal_prec_lpdf.hpp.

◆ matrix_normal_prec_lpdf() [2/2]

template<typename T_y , typename T_Mu , typename T_Sigma , typename T_D >
boost::math::tools::promote_args<T_y, T_Mu, T_Sigma, T_D>::type stan::math::matrix_normal_prec_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_Mu, Eigen::Dynamic, Eigen::Dynamic > &  Mu,
const Eigen::Matrix< T_Sigma, Eigen::Dynamic, Eigen::Dynamic > &  Sigma,
const Eigen::Matrix< T_D, Eigen::Dynamic, Eigen::Dynamic > &  D 
)

Definition at line 89 of file matrix_normal_prec_lpdf.hpp.

◆ matrix_normal_prec_rng()

template<class RNG >
Eigen::MatrixXd stan::math::matrix_normal_prec_rng ( const Eigen::MatrixXd &  Mu,
const Eigen::MatrixXd &  Sigma,
const Eigen::MatrixXd &  D,
RNG &  rng 
)
inline

Sample from the the matrix normal distribution for the given Mu, Sigma and D where Sigma and D are given as precision matrices, not covariance matrices.

Parameters
MuThe mean matrix.
SigmaThe mxm inverse covariance matrix (i.e., the precision matrix) of the rows of y.
DThe nxn inverse covariance matrix (i.e., the precision matrix) of the columns of y.
rngPseudo-random number generator.
Returns
A sample from the distribution, of type Matrix<double, Dynamic, Dynamic>.
Exceptions
std::invalid_argumentif Sigma or D are not square.
std::domain_errorif Sigma or D are not symmetric, not semi-positive definite, or if they contain infinities or NaNs.
Template Parameters
RNGType of pseudo-random number generator.

Definition at line 36 of file matrix_normal_prec_rng.hpp.

◆ max() [1/3]

int stan::math::max ( const std::vector< int > &  x)
inline

Returns the maximum coefficient in the specified column vector.

Parameters
xSpecified vector.
Returns
Maximum coefficient value in the vector.
Template Parameters
Typeof values being compared and returned
Exceptions
std::domain_errorIf the size of the vector is zero.

Definition at line 21 of file max.hpp.

◆ max() [2/3]

template<typename T >
T stan::math::max ( const std::vector< T > &  x)
inline

Returns the maximum coefficient in the specified column vector.

Parameters
xSpecified vector.
Returns
Maximum coefficient value in the vector.
Template Parameters
TType of values being compared and returned

Definition at line 35 of file max.hpp.

◆ max() [3/3]

template<typename T , int R, int C>
T stan::math::max ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the maximum coefficient in the specified vector, row vector, or matrix.

Parameters
mSpecified vector, row vector, or matrix.
Returns
Maximum coefficient value in the vector.

Definition at line 49 of file max.hpp.

◆ mdivide_left() [1/7]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::mdivide_left ( const Eigen::Matrix< fvar< T >, R1, C1 > &  A,
const Eigen::Matrix< fvar< T >, R2, C2 > &  b 
)
inline

Definition at line 19 of file mdivide_left.hpp.

◆ mdivide_left() [2/7]

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C2> stan::math::mdivide_left ( const Eigen::Matrix< T1, R1, C1 > &  A,
const Eigen::Matrix< T2, R2, C2 > &  b 
)
inline

Returns the solution of the system Ax=b.

Parameters
AMatrix.
bRight hand side matrix or vector.
Returns
x = A^-1 b, solution of the linear system.
Exceptions
std::domain_errorif A is not square or the rows of b don't match the size of A.

Definition at line 24 of file mdivide_left.hpp.

◆ mdivide_left() [3/7]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::mdivide_left ( const Eigen::Matrix< double, R1, C1 > &  A,
const Eigen::Matrix< fvar< T >, R2, C2 > &  b 
)
inline

Definition at line 58 of file mdivide_left.hpp.

◆ mdivide_left() [4/7]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::mdivide_left ( const Eigen::Matrix< fvar< T >, R1, C1 > &  A,
const Eigen::Matrix< double, R2, C2 > &  b 
)
inline

Definition at line 78 of file mdivide_left.hpp.

◆ mdivide_left() [5/7]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left ( const Eigen::Matrix< var, R1, C1 > &  A,
const Eigen::Matrix< var, R2, C2 > &  b 
)
inline

Definition at line 273 of file mdivide_left.hpp.

◆ mdivide_left() [6/7]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left ( const Eigen::Matrix< var, R1, C1 > &  A,
const Eigen::Matrix< double, R2, C2 > &  b 
)
inline

Definition at line 296 of file mdivide_left.hpp.

◆ mdivide_left() [7/7]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left ( const Eigen::Matrix< double, R1, C1 > &  A,
const Eigen::Matrix< var, R2, C2 > &  b 
)
inline

Definition at line 320 of file mdivide_left.hpp.

◆ mdivide_left_ldlt() [1/5]

template<int R1, int C1, int R2, int C2, typename T2 >
Eigen::Matrix<fvar<T2>, R1, C2> stan::math::mdivide_left_ldlt ( const LDLT_factor< double, R1, C1 > &  A,
const Eigen::Matrix< fvar< T2 >, R2, C2 > &  b 
)
inline

Returns the solution of the system Ax=b given an LDLT_factor of A.

Parameters
ALDLT_factor
bRight hand side matrix or vector.
Returns
x = b A^-1, solution of the linear system.
Exceptions
std::domain_errorif rows of b don't match the size of A.

Definition at line 22 of file mdivide_left_ldlt.hpp.

◆ mdivide_left_ldlt() [2/5]

template<int R1, int C1, int R2, int C2, typename T1 , typename T2 >
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C2> stan::math::mdivide_left_ldlt ( const LDLT_factor< T1, R1, C1 > &  A,
const Eigen::Matrix< T2, R2, C2 > &  b 
)
inline

Returns the solution of the system Ax=b given an LDLT_factor of A.

Parameters
ALDLT_factor
bRight hand side matrix or vector.
Returns
x = b A^-1, solution of the linear system.
Exceptions
std::domain_errorif rows of b don't match the size of A.

Definition at line 25 of file mdivide_left_ldlt.hpp.

◆ mdivide_left_ldlt() [3/5]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left_ldlt ( const LDLT_factor< var, R1, C1 > &  A,
const Eigen::Matrix< var, R2, C2 > &  b 
)
inline

Returns the solution of the system Ax=b given an LDLT_factor of A.

Parameters
ALDLT_factor
bRight hand side matrix or vector.
Returns
x = b A^-1, solution of the linear system.
Exceptions
std::domain_errorif rows of b don't match the size of A.

Definition at line 245 of file mdivide_left_ldlt.hpp.

◆ mdivide_left_ldlt() [4/5]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left_ldlt ( const LDLT_factor< var, R1, C1 > &  A,
const Eigen::Matrix< double, R2, C2 > &  b 
)
inline

Returns the solution of the system Ax=b given an LDLT_factor of A.

Parameters
ALDLT_factor
bRight hand side matrix or vector.
Returns
x = b A^-1, solution of the linear system.
Exceptions
std::domain_errorif rows of b don't match the size of A.

Definition at line 270 of file mdivide_left_ldlt.hpp.

◆ mdivide_left_ldlt() [5/5]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left_ldlt ( const LDLT_factor< double, R1, C1 > &  A,
const Eigen::Matrix< var, R2, C2 > &  b 
)
inline

Returns the solution of the system Ax=b given an LDLT_factor of A.

Parameters
ALDLT_factor
bRight hand side matrix or vector.
Returns
x = b A^-1, solution of the linear system.
Exceptions
std::domain_errorif rows of b don't match the size of A.

Definition at line 295 of file mdivide_left_ldlt.hpp.

◆ mdivide_left_spd() [1/4]

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C2> stan::math::mdivide_left_spd ( const Eigen::Matrix< T1, R1, C1 > &  A,
const Eigen::Matrix< T2, R2, C2 > &  b 
)
inline

Returns the solution of the system Ax=b where A is symmetric positive definite.

Parameters
AMatrix.
bRight hand side matrix or vector.
Returns
x = A^-1 b, solution of the linear system.
Exceptions
std::domain_errorif A is not square or the rows of b don't match the size of A.

Definition at line 27 of file mdivide_left_spd.hpp.

◆ mdivide_left_spd() [2/4]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left_spd ( const Eigen::Matrix< var, R1, C1 > &  A,
const Eigen::Matrix< var, R2, C2 > &  b 
)
inline

Definition at line 246 of file mdivide_left_spd.hpp.

◆ mdivide_left_spd() [3/4]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left_spd ( const Eigen::Matrix< var, R1, C1 > &  A,
const Eigen::Matrix< double, R2, C2 > &  b 
)
inline

Definition at line 269 of file mdivide_left_spd.hpp.

◆ mdivide_left_spd() [4/4]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left_spd ( const Eigen::Matrix< double, R1, C1 > &  A,
const Eigen::Matrix< var, R2, C2 > &  b 
)
inline

Definition at line 293 of file mdivide_left_spd.hpp.

◆ mdivide_left_tri() [1/7]

template<int TriView, typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C2> stan::math::mdivide_left_tri ( const Eigen::Matrix< T1, R1, C1 > &  A,
const Eigen::Matrix< T2, R2, C2 > &  b 
)
inline

Returns the solution of the system Ax=b when A is triangular.

Template Parameters
TriViewSpecifies whether A is upper (Eigen::Upper) or lower triangular (Eigen::Lower).
T1type of elements in A
T2type of elements in b
R1number of rows in A
C1number of columns in A
R2number of rows in b
C2number of columns in b
Parameters
ATriangular matrix.
bRight hand side matrix or vector.
Returns
x = A^-1 b, solution of the linear system.
Exceptions
std::domain_errorif A is not square or the rows of b don't match the size of A.

Definition at line 38 of file mdivide_left_tri.hpp.

◆ mdivide_left_tri() [2/7]

template<int TriView, typename T , int R1, int C1>
Eigen::Matrix<T, R1, C1> stan::math::mdivide_left_tri ( const Eigen::Matrix< T, R1, C1 > &  A)
inline

Returns the solution of the system Ax=b when A is triangular and b=I.

Template Parameters
Ttype of elements in A
R1number of rows in A
C1number of columns in A
Parameters
ATriangular matrix.
Returns
x = A^-1 .
Exceptions
std::domain_errorif A is not square

Definition at line 60 of file mdivide_left_tri.hpp.

◆ mdivide_left_tri() [3/7]

template<int TriView, int R1, int C1, int R2, int C2>
Eigen::Matrix<double, R1, C2> stan::math::mdivide_left_tri ( const Eigen::Matrix< double, R1, C1 > &  A,
const Eigen::Matrix< double, R2, C2 > &  b 
)
inline

Returns the solution of the system Ax=b when A is triangular and A and b are matrices of doubles.

Template Parameters
TriViewSpecifies whether A is upper (Eigen::Upper) or lower triangular (Eigen::Lower).
R1number of rows in A
C1number of columns in A
R2number of rows in b
C2number of columns in b
Parameters
ATriangular matrix.
bRight hand side matrix or vector.
Returns
x = A^-1 b, solution of the linear system.
Exceptions
std::domain_errorif A is not square or the rows of b don't match the size of A.

Definition at line 86 of file mdivide_left_tri.hpp.

◆ mdivide_left_tri() [4/7]

template<int TriView, int R1, int C1>
Eigen::Matrix<double, R1, C1> stan::math::mdivide_left_tri ( const Eigen::Matrix< double, R1, C1 > &  A)
inline

Returns the solution of the system Ax=b when A is triangular, b=I and both are matrices of doubles.

Template Parameters
TriViewSpecifies whether A is upper (Eigen::Upper) or lower triangular (Eigen::Lower).
R1number of rows in A
C1number of columns in A
Parameters
ATriangular matrix.
Returns
x = A^-1 .
Exceptions
std::domain_errorif A is not square

Definition at line 124 of file mdivide_left_tri.hpp.

◆ mdivide_left_tri() [5/7]

template<int TriView, int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left_tri ( const Eigen::Matrix< var, R1, C1 > &  A,
const Eigen::Matrix< var, R2, C2 > &  b 
)
inline

Definition at line 310 of file mdivide_left_tri.hpp.

◆ mdivide_left_tri() [6/7]

template<int TriView, int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left_tri ( const Eigen::Matrix< double, R1, C1 > &  A,
const Eigen::Matrix< var, R2, C2 > &  b 
)
inline

Definition at line 332 of file mdivide_left_tri.hpp.

◆ mdivide_left_tri() [7/7]

template<int TriView, int R1, int C1, int R2, int C2>
Eigen::Matrix<var, R1, C2> stan::math::mdivide_left_tri ( const Eigen::Matrix< var, R1, C1 > &  A,
const Eigen::Matrix< double, R2, C2 > &  b 
)
inline

Definition at line 355 of file mdivide_left_tri.hpp.

◆ mdivide_left_tri_low() [1/5]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C1> stan::math::mdivide_left_tri_low ( const Eigen::Matrix< fvar< T >, R1, C1 > &  A,
const Eigen::Matrix< fvar< T >, R2, C2 > &  b 
)
inline

Definition at line 17 of file mdivide_left_tri_low.hpp.

◆ mdivide_left_tri_low() [2/5]

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C2> stan::math::mdivide_left_tri_low ( const Eigen::Matrix< T1, R1, C1 > &  A,
const Eigen::Matrix< T2, R2, C2 > &  b 
)
inline

Return the result of left dividing the second argument by the first argument.

Calling mdivide_left_tri_low(A, b) with divisor A and dividend b is more arithmetically stable than calling inv(A) * b.

Template Parameters
T1type of divisor matrix
T2type of dividend matrix
R1rows of divisor matrix
C1columns of divisor matrix
R2rows of dividen matrix
C2rows of divisor matrix
Parameters
Adivisor, an invertible square matrix
bdividend, a matrix or vector with the same number of rows as the divisor has columns
Returns
left division of b by A
Exceptions
std::invalid_argumentif the divisor is not square or the dividend does not have the same number of rows as the divisor has columns.

Definition at line 37 of file mdivide_left_tri_low.hpp.

◆ mdivide_left_tri_low() [3/5]

template<typename T , int R1, int C1>
Eigen::Matrix<T, R1, C1> stan::math::mdivide_left_tri_low ( const Eigen::Matrix< T, R1, C1 > &  A)
inline

Definition at line 45 of file mdivide_left_tri_low.hpp.

◆ mdivide_left_tri_low() [4/5]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C1> stan::math::mdivide_left_tri_low ( const Eigen::Matrix< double, R1, C1 > &  A,
const Eigen::Matrix< fvar< T >, R2, C2 > &  b 
)
inline

Definition at line 58 of file mdivide_left_tri_low.hpp.

◆ mdivide_left_tri_low() [5/5]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C1> stan::math::mdivide_left_tri_low ( const Eigen::Matrix< fvar< T >, R1, C1 > &  A,
const Eigen::Matrix< double, R2, C2 > &  b 
)
inline

Definition at line 94 of file mdivide_left_tri_low.hpp.

◆ mdivide_right() [1/4]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::mdivide_right ( const Eigen::Matrix< fvar< T >, R1, C1 > &  A,
const Eigen::Matrix< fvar< T >, R2, C2 > &  b 
)
inline

Definition at line 19 of file mdivide_right.hpp.

◆ mdivide_right() [2/4]

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C2> stan::math::mdivide_right ( const Eigen::Matrix< T1, R1, C1 > &  b,
const Eigen::Matrix< T2, R2, C2 > &  A 
)
inline

Returns the solution of the system Ax=b.

Parameters
AMatrix.
bRight hand side matrix or vector.
Returns
x = b A^-1, solution of the linear system.
Exceptions
std::domain_errorif A is not square or the rows of b don't match the size of A.

Definition at line 24 of file mdivide_right.hpp.

◆ mdivide_right() [3/4]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::mdivide_right ( const Eigen::Matrix< fvar< T >, R1, C1 > &  A,
const Eigen::Matrix< double, R2, C2 > &  b 
)
inline

Definition at line 58 of file mdivide_right.hpp.

◆ mdivide_right() [4/4]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::mdivide_right ( const Eigen::Matrix< double, R1, C1 > &  A,
const Eigen::Matrix< fvar< T >, R2, C2 > &  b 
)
inline

Definition at line 79 of file mdivide_right.hpp.

◆ mdivide_right_ldlt() [1/2]

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C2> stan::math::mdivide_right_ldlt ( const Eigen::Matrix< T1, R1, C1 > &  b,
const LDLT_factor< T2, R2, C2 > &  A 
)
inline

Returns the solution of the system xA=b given an LDLT_factor of A.

Parameters
ALDLT_factor
bRight hand side matrix or vector.
Returns
x = A^-1 b, solution of the linear system.
Exceptions
std::domain_errorif rows of b don't match the size of A.

Definition at line 25 of file mdivide_right_ldlt.hpp.

◆ mdivide_right_ldlt() [2/2]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<double, R1, C2> stan::math::mdivide_right_ldlt ( const Eigen::Matrix< double, R1, C1 > &  b,
const LDLT_factor< double, R2, C2 > &  A 
)
inline

Definition at line 33 of file mdivide_right_ldlt.hpp.

◆ mdivide_right_spd()

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C2> stan::math::mdivide_right_spd ( const Eigen::Matrix< T1, R1, C1 > &  b,
const Eigen::Matrix< T2, R2, C2 > &  A 
)
inline

Returns the solution of the system Ax=b where A is symmetric positive definite.

Parameters
AMatrix.
bRight hand side matrix or vector.
Returns
x = b A^-1, solution of the linear system.
Exceptions
std::domain_errorif A is not square or the rows of b don't match the size of A.

Definition at line 28 of file mdivide_right_spd.hpp.

◆ mdivide_right_tri()

template<int TriView, typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C2> stan::math::mdivide_right_tri ( const Eigen::Matrix< T1, R1, C1 > &  b,
const Eigen::Matrix< T2, R2, C2 > &  A 
)
inline

Returns the solution of the system Ax=b when A is triangular.

Parameters
ATriangular matrix. Specify upper or lower with TriView being Eigen::Upper or Eigen::Lower.
bRight hand side matrix or vector.
Returns
x = b A^-1, solution of the linear system.
Exceptions
std::domain_errorif A is not square or the rows of b don't match the size of A.

Definition at line 28 of file mdivide_right_tri.hpp.

◆ mdivide_right_tri_low() [1/4]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C1> stan::math::mdivide_right_tri_low ( const Eigen::Matrix< fvar< T >, R1, C1 > &  A,
const Eigen::Matrix< fvar< T >, R2, C2 > &  b 
)
inline

Definition at line 16 of file mdivide_right_tri_low.hpp.

◆ mdivide_right_tri_low() [2/4]

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R1, C2> stan::math::mdivide_right_tri_low ( const Eigen::Matrix< T1, R1, C1 > &  b,
const Eigen::Matrix< T2, R2, C2 > &  A 
)
inline

Returns the solution of the system tri(A)x=b when tri(A) is a lower triangular view of the matrix A.

Parameters
AMatrix.
bRight hand side matrix or vector.
Returns
x = b * tri(A)^-1, solution of the linear system.
Exceptions
std::domain_errorif A is not square or the rows of b don't match the size of A.

Definition at line 24 of file mdivide_right_tri_low.hpp.

◆ mdivide_right_tri_low() [3/4]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::mdivide_right_tri_low ( const Eigen::Matrix< fvar< T >, R1, C1 > &  A,
const Eigen::Matrix< double, R2, C2 > &  b 
)
inline

Definition at line 57 of file mdivide_right_tri_low.hpp.

◆ mdivide_right_tri_low() [4/4]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::mdivide_right_tri_low ( const Eigen::Matrix< double, R1, C1 > &  A,
const Eigen::Matrix< fvar< T >, R2, C2 > &  b 
)
inline

Definition at line 86 of file mdivide_right_tri_low.hpp.

◆ mean() [1/2]

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::mean ( const std::vector< T > &  v)
inline

Returns the sample mean (i.e., average) of the coefficients in the specified standard vector.

Parameters
vSpecified vector.
Returns
Sample mean of vector coefficients.
Exceptions
std::domain_errorif the size of the vector is less than 1.

Definition at line 21 of file mean.hpp.

◆ mean() [2/2]

template<typename T , int R, int C>
boost::math::tools::promote_args<T>::type stan::math::mean ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the sample mean (i.e., average) of the coefficients in the specified vector, row vector, or matrix.

Parameters
mSpecified vector, row vector, or matrix.
Returns
Sample mean of vector coefficients.

Definition at line 35 of file mean.hpp.

◆ min() [1/3]

int stan::math::min ( const std::vector< int > &  x)
inline

Returns the minimum coefficient in the specified column vector.

Parameters
xSpecified vector.
Returns
Minimum coefficient value in the vector.
Template Parameters
Typeof values being compared and returned

Definition at line 20 of file min.hpp.

◆ min() [2/3]

template<typename T >
T stan::math::min ( const std::vector< T > &  x)
inline

Returns the minimum coefficient in the specified column vector.

Parameters
xSpecified vector.
Returns
Minimum coefficient value in the vector.
Template Parameters
Typeof values being compared and returned

Definition at line 34 of file min.hpp.

◆ min() [3/3]

template<typename T , int R, int C>
T stan::math::min ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the minimum coefficient in the specified matrix, vector, or row vector.

Parameters
mSpecified matrix, vector, or row vector.
Returns
Minimum coefficient value in the vector.

Definition at line 48 of file min.hpp.

◆ minus()

template<typename T >
T stan::math::minus ( const T &  x)
inline

Returns the negation of the specified scalar or matrix.

Template Parameters
TType of subtrahend.
Parameters
xSubtrahend.
Returns
Negation of subtrahend.

Definition at line 15 of file minus.hpp.

◆ modified_bessel_first_kind() [1/3]

template<typename T >
fvar<T> stan::math::modified_bessel_first_kind ( int  v,
const fvar< T > &  z 
)
inline

Definition at line 12 of file modified_bessel_first_kind.hpp.

◆ modified_bessel_first_kind() [2/3]

var stan::math::modified_bessel_first_kind ( int  v,
const var a 
)
inline

Definition at line 26 of file modified_bessel_first_kind.hpp.

◆ modified_bessel_first_kind() [3/3]

template<typename T2 >
T2 stan::math::modified_bessel_first_kind ( int  v,
const T2  z 
)
inline

\[ \mbox{modified\_bessel\_first\_kind}(v, z) = \begin{cases} I_v(z) & \mbox{if } -\infty\leq z \leq \infty \\[6pt] \textrm{error} & \mbox{if } z = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{modified\_bessel\_first\_kind}(v, z)}{\partial z} = \begin{cases} \frac{\partial\, I_v(z)}{\partial z} & \mbox{if } -\infty\leq z\leq \infty \\[6pt] \textrm{error} & \mbox{if } z = \textrm{NaN} \end{cases} \]

\[ {I_v}(z) = \left(\frac{1}{2}z\right)^v\sum_{k=0}^\infty \frac{\left(\frac{1}{4}z^2\right)^k}{k!\Gamma(v+k+1)} \]

\[ \frac{\partial \, I_v(z)}{\partial z} = I_{v-1}(z)-\frac{v}{z}I_v(z) \]

Definition at line 37 of file modified_bessel_first_kind.hpp.

◆ modified_bessel_second_kind() [1/3]

template<typename T >
fvar<T> stan::math::modified_bessel_second_kind ( int  v,
const fvar< T > &  z 
)
inline

Definition at line 12 of file modified_bessel_second_kind.hpp.

◆ modified_bessel_second_kind() [2/3]

var stan::math::modified_bessel_second_kind ( int  v,
const var a 
)
inline

Definition at line 26 of file modified_bessel_second_kind.hpp.

◆ modified_bessel_second_kind() [3/3]

template<typename T2 >
T2 stan::math::modified_bessel_second_kind ( int  v,
const T2  z 
)
inline

\[ \mbox{modified\_bessel\_second\_kind}(v, z) = \begin{cases} \textrm{error} & \mbox{if } z \leq 0 \\ K_v(z) & \mbox{if } z > 0 \\[6pt] \textrm{NaN} & \mbox{if } z = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{modified\_bessel\_second\_kind}(v, z)}{\partial z} = \begin{cases} \textrm{error} & \mbox{if } z \leq 0 \\ \frac{\partial\, K_v(z)}{\partial z} & \mbox{if } z > 0 \\[6pt] \textrm{NaN} & \mbox{if } z = \textrm{NaN} \end{cases} \]

\[ {K_v}(z) = \frac{\pi}{2}\cdot\frac{I_{-v}(z) - I_{v}(z)}{\sin(v\pi)} \]

\[ \frac{\partial \, K_v(z)}{\partial z} = -\frac{v}{z}K_v(z)-K_{v-1}(z) \]

Definition at line 42 of file modified_bessel_second_kind.hpp.

◆ modulus()

int stan::math::modulus ( int  x,
int  y 
)
inline

Definition at line 12 of file modulus.hpp.

◆ multi_gp_cholesky_log() [1/2]

template<bool propto, typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args<T_y, T_covar, T_w>::type stan::math::multi_gp_cholesky_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  L,
const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &  w 
)

The log of a multivariate Gaussian Process for the given y, w, and a Cholesky factor L of the kernel matrix Sigma.

Sigma = LL', a square, semi-positive definite matrix. y is a dxN matrix, where each column is a different observation and each row is a different output dimension. The Gaussian Process is assumed to have a scaled kernel matrix with a different scale for each output dimension. This distribution is equivalent to: for (i in 1:d) row(y, i) ~ multi_normal(0, (1/w[i])*LL').

Deprecated:
use multi_gp_cholesky_lpdf
Parameters
yA dxN matrix
LThe Cholesky decomposition of a kernel matrix
wA d-dimensional vector of positve inverse scale parameters for each output.
Returns
The log of the multivariate GP density.
Exceptions
std::domain_errorif Sigma is not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_covarType of kernel.
T_wType of weight.

Definition at line 36 of file multi_gp_cholesky_log.hpp.

◆ multi_gp_cholesky_log() [2/2]

template<typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args<T_y, T_covar, T_w>::type stan::math::multi_gp_cholesky_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  L,
const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &  w 
)
inline
Deprecated:
use multi_gp_cholesky_lpdf

Definition at line 48 of file multi_gp_cholesky_log.hpp.

◆ multi_gp_cholesky_lpdf() [1/2]

template<bool propto, typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args<T_y, T_covar, T_w>::type stan::math::multi_gp_cholesky_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  L,
const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &  w 
)

The log of a multivariate Gaussian Process for the given y, w, and a Cholesky factor L of the kernel matrix Sigma.

Sigma = LL', a square, semi-positive definite matrix. y is a dxN matrix, where each column is a different observation and each row is a different output dimension. The Gaussian Process is assumed to have a scaled kernel matrix with a different scale for each output dimension. This distribution is equivalent to: for (i in 1:d) row(y, i) ~ multi_normal(0, (1/w[i])*LL').

Parameters
yA dxN matrix
LThe Cholesky decomposition of a kernel matrix
wA d-dimensional vector of positve inverse scale parameters for each output.
Returns
The log of the multivariate GP density.
Exceptions
std::domain_errorif Sigma is not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_covarType of kernel.
T_wType of weight.

Definition at line 39 of file multi_gp_cholesky_lpdf.hpp.

◆ multi_gp_cholesky_lpdf() [2/2]

template<typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args<T_y, T_covar, T_w>::type stan::math::multi_gp_cholesky_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  L,
const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &  w 
)
inline

Definition at line 89 of file multi_gp_cholesky_lpdf.hpp.

◆ multi_gp_log() [1/2]

template<bool propto, typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args<T_y, T_covar, T_w>::type stan::math::multi_gp_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  Sigma,
const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &  w 
)

The log of a multivariate Gaussian Process for the given y, Sigma, and w.

y is a dxN matrix, where each column is a different observation and each row is a different output dimension. The Gaussian Process is assumed to have a scaled kernel matrix with a different scale for each output dimension. This distribution is equivalent to: for (i in 1:d) row(y, i) ~ multi_normal(0, (1/w[i])*Sigma).

Deprecated:
use multi_gp_lpdf
Parameters
yA dxN matrix
SigmaThe NxN kernel matrix
wA d-dimensional vector of positve inverse scale parameters for each output.
Returns
The log of the multivariate GP density.
Exceptions
std::domain_errorif Sigma is not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_covarType of kernel.
T_wType of weight.

Definition at line 34 of file multi_gp_log.hpp.

◆ multi_gp_log() [2/2]

template<typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args<T_y, T_covar, T_w>::type stan::math::multi_gp_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  Sigma,
const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &  w 
)
inline
Deprecated:
use multi_gp_lpdf

Definition at line 46 of file multi_gp_log.hpp.

◆ multi_gp_lpdf() [1/2]

template<bool propto, typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args<T_y, T_covar, T_w>::type stan::math::multi_gp_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  Sigma,
const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &  w 
)

The log of a multivariate Gaussian Process for the given y, Sigma, and w.

y is a dxN matrix, where each column is a different observation and each row is a different output dimension. The Gaussian Process is assumed to have a scaled kernel matrix with a different scale for each output dimension. This distribution is equivalent to: for (i in 1:d) row(y, i) ~ multi_normal(0, (1/w[i])*Sigma).

Parameters
yA dxN matrix
SigmaThe NxN kernel matrix
wA d-dimensional vector of positve inverse scale parameters for each output.
Returns
The log of the multivariate GP density.
Exceptions
std::domain_errorif Sigma is not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_covarType of kernel.
T_wType of weight.

Definition at line 39 of file multi_gp_lpdf.hpp.

◆ multi_gp_lpdf() [2/2]

template<typename T_y , typename T_covar , typename T_w >
boost::math::tools::promote_args<T_y, T_covar, T_w>::type stan::math::multi_gp_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  Sigma,
const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &  w 
)
inline

Definition at line 88 of file multi_gp_lpdf.hpp.

◆ multi_normal_cholesky_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_cholesky_log ( const T_y &  y,
const T_loc &  mu,
const T_covar &  L 
)

The log of the multivariate normal density for the given y, mu, and a Cholesky factor L of the variance matrix.

Sigma = LL', a square, semi-positive definite matrix.

Deprecated:
use multi_normal_cholesky_lpdf
Parameters
yA scalar vector
muThe mean vector of the multivariate normal distribution.
LThe Cholesky decomposition of a variance matrix of the multivariate normal distribution
Returns
The log of the multivariate normal density.
Exceptions
std::domain_errorif LL' is not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_locType of location.
T_covarType of scale.

Definition at line 30 of file multi_normal_cholesky_log.hpp.

◆ multi_normal_cholesky_log() [2/2]

template<typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_cholesky_log ( const T_y &  y,
const T_loc &  mu,
const T_covar &  L 
)
inline
Deprecated:
use multi_normal_cholesky_lpdf

Definition at line 40 of file multi_normal_cholesky_log.hpp.

◆ multi_normal_cholesky_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_cholesky_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_covar &  L 
)

The log of the multivariate normal density for the given y, mu, and a Cholesky factor L of the variance matrix.

Sigma = LL', a square, semi-positive definite matrix.

Analytic expressions taken from http://qwone.com/~jason/writing/multivariateNormal.pdf written by Jason D. M. Rennie.

All expressions are adapted to avoid (most) inversions and maximal reuse of intermediates.

Parameters
yA scalar vector
muThe mean vector of the multivariate normal distribution.
LThe Cholesky decomposition of a variance matrix of the multivariate normal distribution
Returns
The log of the multivariate normal density.
Exceptions
std::domain_errorif LL' is not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_locType of location.
T_covarType of scale.

Definition at line 41 of file multi_normal_cholesky_lpdf.hpp.

◆ multi_normal_cholesky_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_cholesky_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_covar &  L 
)
inline

Definition at line 159 of file multi_normal_cholesky_lpdf.hpp.

◆ multi_normal_cholesky_rng()

template<typename T_loc , class RNG >
StdVectorBuilder<true, Eigen::VectorXd, T_loc>::type stan::math::multi_normal_cholesky_rng ( const T_loc &  mu,
const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &  L,
RNG &  rng 
)
inline

Return a multivariate normal random variate with the given location and Cholesky factorization of the covariance using the specified random number generator.

mu can be either an Eigen::VectorXd, an Eigen::RowVectorXd, or a std::vector of either of those types.

Template Parameters
T_locType of location paramater
RNGType of pseudo-random number generator
Parameters
mu(Sequence of) location parameter(s)
LLower Cholesky factor of target covariance matrix
rngrandom number generator
Exceptions
std::invalid_argumentif the length of (each) mu is not equal to the number of rows and columns in L

Definition at line 31 of file multi_normal_cholesky_rng.hpp.

◆ multi_normal_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_log ( const T_y &  y,
const T_loc &  mu,
const T_covar &  Sigma 
)
Deprecated:
use matrix_normal_lpdf

Definition at line 14 of file multi_normal_log.hpp.

◆ multi_normal_log() [2/2]

template<typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_log ( const T_y &  y,
const T_loc &  mu,
const T_covar &  Sigma 
)
inline
Deprecated:
use matrix_normal_lpdf

Definition at line 23 of file multi_normal_log.hpp.

◆ multi_normal_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_covar &  Sigma 
)

Definition at line 20 of file multi_normal_lpdf.hpp.

◆ multi_normal_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_covar &  Sigma 
)
inline

Definition at line 117 of file multi_normal_lpdf.hpp.

◆ multi_normal_prec_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_prec_log ( const T_y &  y,
const T_loc &  mu,
const T_covar &  Sigma 
)
Deprecated:
use multi_normal_prec_lpdf

Definition at line 14 of file multi_normal_prec_log.hpp.

◆ multi_normal_prec_log() [2/2]

template<typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_prec_log ( const T_y &  y,
const T_loc &  mu,
const T_covar &  Sigma 
)
inline
Deprecated:
use multi_normal_prec_lpdf

Definition at line 23 of file multi_normal_prec_log.hpp.

◆ multi_normal_prec_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_prec_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_covar &  Sigma 
)

Definition at line 21 of file multi_normal_prec_lpdf.hpp.

◆ multi_normal_prec_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_covar >
return_type<T_y, T_loc, T_covar>::type stan::math::multi_normal_prec_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_covar &  Sigma 
)
inline

Definition at line 118 of file multi_normal_prec_lpdf.hpp.

◆ multi_normal_prec_rng()

template<typename T_loc , class RNG >
StdVectorBuilder<true, Eigen::VectorXd, T_loc>::type stan::math::multi_normal_prec_rng ( const T_loc &  mu,
const Eigen::MatrixXd &  S,
RNG &  rng 
)
inline

Return a multivariate normal random variate with the given location and precision using the specified random number generator.

mu can be either an Eigen::VectorXd, an Eigen::RowVectorXd, or a std::vector of either of those types.

Template Parameters
T_locType of location paramater
RNGType of pseudo-random number generator
Parameters
mu(Sequence of) location parameter(s)
SPrecision matrix
rngrandom number generator
Exceptions
std::domain_errorif S is not positive definite, or std::invalid_argument if the length of (each) mu is not equal to the number of rows and columns in S

Definition at line 34 of file multi_normal_prec_rng.hpp.

◆ multi_normal_rng()

template<typename T_loc , class RNG >
StdVectorBuilder<true, Eigen::VectorXd, T_loc>::type stan::math::multi_normal_rng ( const T_loc &  mu,
const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &  S,
RNG &  rng 
)
inline

Return a multivariate normal random variate with the given location and covariance using the specified random number generator.

mu can be either an Eigen::VectorXd, an Eigen::RowVectorXd, or a std::vector of either of those types.

Template Parameters
T_locType of location paramater
RNGType of pseudo-random number generator
Parameters
mu(Sequence of) location parameter(s)
SCovariance matrix
rngrandom number generator
Exceptions
std::domain_errorif S is not positive definite, or std::invalid_argument if the length of (each) mu is not equal to the number of rows and columns in S

Definition at line 33 of file multi_normal_rng.hpp.

◆ multi_student_t_log() [1/2]

template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::multi_student_t_log ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  Sigma 
)

Return the log of the multivariate Student t distribution at the specified arguments.

Deprecated:
use multi_student_t_lpdf
Template Parameters
proptoCarry out calculations up to a proportion

Definition at line 20 of file multi_student_t_log.hpp.

◆ multi_student_t_log() [2/2]

template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::multi_student_t_log ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  Sigma 
)
inline
Deprecated:
use multi_student_t_lpdf

Definition at line 31 of file multi_student_t_log.hpp.

◆ multi_student_t_lpdf() [1/2]

template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::multi_student_t_lpdf ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  Sigma 
)

Return the log of the multivariate Student t distribution at the specified arguments.

Template Parameters
proptoCarry out calculations up to a proportion

Definition at line 31 of file multi_student_t_lpdf.hpp.

◆ multi_student_t_lpdf() [2/2]

template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::multi_student_t_lpdf ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  Sigma 
)
inline

Definition at line 142 of file multi_student_t_lpdf.hpp.

◆ multi_student_t_rng()

template<typename T_loc , class RNG >
StdVectorBuilder<true, Eigen::VectorXd, T_loc>::type stan::math::multi_student_t_rng ( double  nu,
const T_loc &  mu,
const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &  S,
RNG &  rng 
)
inline

Return a multivariate student-t random variate with the given degrees of freedom location and covariance using the specified random number generator.

mu can be either an Eigen::VectorXd, an Eigen::RowVectorXd, or a std::vector of either of those types.

Template Parameters
T_locType of location paramater
RNGType of pseudo-random number generator
Parameters
nudegrees of freedom parameter
mu(Sequence of) location parameter(s)
SCovariance matrix
rngrandom number generator
Exceptions
std::domain_errorif S is not positive definite, any value in mu is not finite, nu is not positive, or nu is NaN
std::invalid_argumentif the length of (each) mu is not equal to the number of rows and columns in S

Definition at line 37 of file multi_student_t_rng.hpp.

◆ multinomial_log() [1/2]

template<bool propto, typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::multinomial_log ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)
Deprecated:
use multinomial_lpmf

Definition at line 17 of file multinomial_log.hpp.

◆ multinomial_log() [2/2]

template<typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::multinomial_log ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)
Deprecated:
use multinomial_lpmf

Definition at line 27 of file multinomial_log.hpp.

◆ multinomial_lpmf() [1/2]

template<bool propto, typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::multinomial_lpmf ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)

Definition at line 17 of file multinomial_lpmf.hpp.

◆ multinomial_lpmf() [2/2]

template<typename T_prob >
boost::math::tools::promote_args<T_prob>::type stan::math::multinomial_lpmf ( const std::vector< int > &  ns,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta 
)

Definition at line 46 of file multinomial_lpmf.hpp.

◆ multinomial_rng()

template<class RNG >
std::vector<int> stan::math::multinomial_rng ( const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  theta,
int  N,
RNG &  rng 
)
inline

Definition at line 14 of file multinomial_rng.hpp.

◆ multiply() [1/24]

template<typename T , int R1, int C1>
Eigen::Matrix<fvar<T>, R1, C1> stan::math::multiply ( const Eigen::Matrix< fvar< T >, R1, C1 > &  m,
const fvar< T > &  c 
)
inline

Definition at line 14 of file multiply.hpp.

◆ multiply() [2/24]

template<int R, int C, typename T >
std::enable_if<std::is_arithmetic<T>::value, Eigen::Matrix<double, R, C> >::type stan::math::multiply ( const Eigen::Matrix< double, R, C > &  m,
c 
)
inline

Return specified matrix multiplied by specified scalar.

Template Parameters
RRow type for matrix.
CColumn type for matrix.
Parameters
mMatrix.
cScalar.
Returns
Product of matrix and scalar.

Definition at line 23 of file multiply.hpp.

◆ multiply() [3/24]

template<typename T , int R2, int C2>
Eigen::Matrix<fvar<T>, R2, C2> stan::math::multiply ( const Eigen::Matrix< fvar< T >, R2, C2 > &  m,
double  c 
)
inline

Definition at line 25 of file multiply.hpp.

◆ multiply() [4/24]

template<typename T , int R1, int C1>
Eigen::Matrix<fvar<T>, R1, C1> stan::math::multiply ( const Eigen::Matrix< double, R1, C1 > &  m,
const fvar< T > &  c 
)
inline

Definition at line 36 of file multiply.hpp.

◆ multiply() [5/24]

template<int R, int C, typename T >
std::enable_if<std::is_arithmetic<T>::value, Eigen::Matrix<double, R, C> >::type stan::math::multiply ( c,
const Eigen::Matrix< double, R, C > &  m 
)
inline

Return specified scalar multiplied by specified matrix.

Template Parameters
RRow type for matrix.
CColumn type for matrix.
Parameters
cScalar.
mMatrix.
Returns
Product of scalar and matrix.

Definition at line 38 of file multiply.hpp.

◆ multiply() [6/24]

template<typename T , int R1, int C1>
Eigen::Matrix<fvar<T>, R1, C1> stan::math::multiply ( const fvar< T > &  c,
const Eigen::Matrix< fvar< T >, R1, C1 > &  m 
)
inline

Definition at line 47 of file multiply.hpp.

◆ multiply() [7/24]

template<typename T , int R1, int C1>
Eigen::Matrix<fvar<T>, R1, C1> stan::math::multiply ( double  c,
const Eigen::Matrix< fvar< T >, R1, C1 > &  m 
)
inline

Definition at line 53 of file multiply.hpp.

◆ multiply() [8/24]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<double, R1, C2> stan::math::multiply ( const Eigen::Matrix< double, R1, C1 > &  m1,
const Eigen::Matrix< double, R2, C2 > &  m2 
)
inline

Return the product of the specified matrices.

The number of columns in the first matrix must be the same as the number of rows in the second matrix.

Parameters
m1First matrix.
m2Second matrix.
Returns
The product of the first and second matrices.
Exceptions
std::domain_errorif the number of columns of m1 does not match the number of rows of m2.

Definition at line 53 of file multiply.hpp.

◆ multiply() [9/24]

template<typename T , int R1, int C1>
Eigen::Matrix<fvar<T>, R1, C1> stan::math::multiply ( const fvar< T > &  c,
const Eigen::Matrix< double, R1, C1 > &  m 
)
inline

Definition at line 59 of file multiply.hpp.

◆ multiply() [10/24]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::multiply ( const Eigen::Matrix< fvar< T >, R1, C1 > &  m1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  m2 
)
inline

Definition at line 65 of file multiply.hpp.

◆ multiply() [11/24]

template<int C1, int R2>
double stan::math::multiply ( const Eigen::Matrix< double, 1, C1 > &  rv,
const Eigen::Matrix< double, R2, 1 > &  v 
)
inline

Return the scalar product of the specified row vector and specified column vector.

The return is the same as the dot product. The two vectors must be the same size.

Parameters
rvRow vector.
vColumn vector.
Returns
Scalar result of multiplying row vector by column vector.
Exceptions
std::domain_errorif rv and v are not the same size.

Definition at line 70 of file multiply.hpp.

◆ multiply() [12/24]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::multiply ( const Eigen::Matrix< fvar< T >, R1, C1 > &  m1,
const Eigen::Matrix< double, R2, C2 > &  m2 
)
inline

Definition at line 81 of file multiply.hpp.

◆ multiply() [13/24]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, C2> stan::math::multiply ( const Eigen::Matrix< double, R1, C1 > &  m1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  m2 
)
inline

Definition at line 97 of file multiply.hpp.

◆ multiply() [14/24]

matrix_cl stan::math::multiply ( const matrix_cl A,
const double  scalar 
)
inline

Multiplies the specified matrix on the OpenCL device with the specified scalar.

Parameters
Amatrix
scalarscalar
Returns
matrix multipled with scalar

Definition at line 113 of file multiply.hpp.

◆ multiply() [15/24]

template<typename T , int C1, int R2>
fvar<T> stan::math::multiply ( const Eigen::Matrix< fvar< T >, 1, C1 > &  rv,
const Eigen::Matrix< fvar< T >, R2, 1 > &  v 
)
inline

Definition at line 113 of file multiply.hpp.

◆ multiply() [16/24]

template<typename T , int C1, int R2>
fvar<T> stan::math::multiply ( const Eigen::Matrix< fvar< T >, 1, C1 > &  rv,
const Eigen::Matrix< double, R2, 1 > &  v 
)
inline

Definition at line 120 of file multiply.hpp.

◆ multiply() [17/24]

template<typename T , int C1, int R2>
fvar<T> stan::math::multiply ( const Eigen::Matrix< double, 1, C1 > &  rv,
const Eigen::Matrix< fvar< T >, R2, 1 > &  v 
)
inline

Definition at line 127 of file multiply.hpp.

◆ multiply() [18/24]

auto stan::math::multiply ( const double  scalar,
const matrix_cl A 
)
inline

Multiplies the specified matrix on the OpenCL device with the specified scalar.

Parameters
scalarscalar
Amatrix
Returns
matrix multipled with scalar

Definition at line 134 of file multiply.hpp.

◆ multiply() [19/24]

auto stan::math::multiply ( const matrix_cl A,
const matrix_cl B 
)
inline

Computes the product of the specified matrices.

Computes the matrix multiplication C[M, K] = A[M, N] x B[N, K]

Parameters
Afirst matrix
Bsecond matrix
Returns
the product of the first and second matrix
Exceptions
<code>std::invalid_argument</code>if the number of columns in A and rows in B do not match

Definition at line 150 of file multiply.hpp.

◆ multiply() [20/24]

template<typename T1 , typename T2 >
std::enable_if< (boost::is_scalar<T1>::value || std::is_same<T1, var>::value) && (boost::is_scalar<T2>::value || std::is_same<T2, var>::value), typename boost::math::tools::promote_args<T1, T2>::type>::type stan::math::multiply ( const T1 &  v,
const T2 &  c 
)
inline

Return the product of two scalars.

Template Parameters
T1scalar type of v
T2scalar type of c
Parameters
[in]vFirst scalar
[in]cSpecified scalar
Returns
Product of scalars

Definition at line 535 of file multiply.hpp.

◆ multiply() [21/24]

template<typename T1 , typename T2 , int R2, int C2>
Eigen::Matrix<var, R2, C2> stan::math::multiply ( const T1 &  c,
const Eigen::Matrix< T2, R2, C2 > &  m 
)
inline

Return the product of scalar and matrix.

Template Parameters
T1scalar type v
T2scalar type matrix m
R2Rows matrix m
C2Columns matrix m
Parameters
[in]cSpecified scalar
[in]mMatrix
Returns
Product of scalar and matrix

Definition at line 550 of file multiply.hpp.

◆ multiply() [22/24]

template<typename T1 , int R1, int C1, typename T2 >
Eigen::Matrix<var, R1, C1> stan::math::multiply ( const Eigen::Matrix< T1, R1, C1 > &  m,
const T2 &  c 
)
inline

Return the product of scalar and matrix.

Template Parameters
T1scalar type matrix m
T2scalar type v
R1Rows matrix m
C1Columns matrix m
Parameters
[in]cSpecified scalar
[in]mMatrix
Returns
Product of scalar and matrix

Definition at line 568 of file multiply.hpp.

◆ multiply() [23/24]

template<typename Ta , int Ra, int Ca, typename Tb , int Cb>
std::enable_if<std::is_same<Ta, var>::value || std::is_same<Tb, var>::value, Eigen::Matrix<var, Ra, Cb> >::type stan::math::multiply ( const Eigen::Matrix< Ta, Ra, Ca > &  A,
const Eigen::Matrix< Tb, Ca, Cb > &  B 
)
inline

Return the product of two matrices.

Template Parameters
Tascalar type matrix A
RaRows matrix A
CaColumns matrix A
Tbscalar type matrix B
RBRows matrix B
CbColumns matrix B
Parameters
[in]AMatrix
[in]BMatrix
Returns
Product of scalar and matrix.

Definition at line 591 of file multiply.hpp.

◆ multiply() [24/24]

template<typename Ta , int Ca, typename Tb >
std::enable_if< std::is_same<Ta, var>::value || std::is_same<Tb, var>::value, var>::type stan::math::multiply ( const Eigen::Matrix< Ta, 1, Ca > &  A,
const Eigen::Matrix< Tb, Ca, 1 > &  B 
)
inline

Return the scalar product of a row vector and a vector.

Template Parameters
Tascalar type row vector A
CaColumns matrix A
Tbscalar type vector B
Parameters
[in]ARow vector
[in]BColumn vector
Returns
Scalar product of row vector and vector

Definition at line 620 of file multiply.hpp.

◆ multiply_log() [1/7]

template<typename T >
fvar<T> stan::math::multiply_log ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 12 of file multiply_log.hpp.

◆ multiply_log() [2/7]

template<typename T >
fvar<T> stan::math::multiply_log ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 19 of file multiply_log.hpp.

◆ multiply_log() [3/7]

template<typename T >
fvar<T> stan::math::multiply_log ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 25 of file multiply_log.hpp.

◆ multiply_log() [4/7]

template<typename T_a , typename T_b >
boost::math::tools::promote_args<T_a, T_b>::type stan::math::multiply_log ( const T_a  a,
const T_b  b 
)
inline

Calculated the value of the first argument times log of the second argument while behaving properly with 0 inputs.

$ a * \log b $.

\[ \mbox{multiply\_log}(x, y) = \begin{cases} 0 & \mbox{if } x=y=0\\ x\ln y & \mbox{if } x, y\neq0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{multiply\_log}(x, y)}{\partial x} = \begin{cases} \infty & \mbox{if } x=y=0\\ \ln y & \mbox{if } x, y\neq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{multiply\_log}(x, y)}{\partial y} = \begin{cases} \infty & \mbox{if } x=y=0\\ \frac{x}{y} & \mbox{if } x, y\neq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
athe first variable
bthe second variable
Returns
a * log(b)

Definition at line 51 of file multiply_log.hpp.

◆ multiply_log() [5/7]

var stan::math::multiply_log ( const var a,
const var b 
)
inline

Return the value of a*log(b).

When both a and b are 0, the value returned is 0. The partial deriviative with respect to a is log(b). The partial deriviative with respect to b is a/b. When a and b are both 0, this is set to Inf.

Parameters
aFirst variable.
bSecond variable.
Returns
Value of a*log(b)

Definition at line 70 of file multiply_log.hpp.

◆ multiply_log() [6/7]

var stan::math::multiply_log ( const var a,
double  b 
)
inline

Return the value of a*log(b).

When both a and b are 0, the value returned is 0. The partial deriviative with respect to a is log(b).

Parameters
aFirst variable.
bSecond scalar.
Returns
Value of a*log(b)

Definition at line 83 of file multiply_log.hpp.

◆ multiply_log() [7/7]

var stan::math::multiply_log ( double  a,
const var b 
)
inline

Return the value of a*log(b).

When both a and b are 0, the value returned is 0. The partial deriviative with respect to b is a/b. When a and b are both 0, this is set to Inf.

Parameters
aFirst scalar.
bSecond variable.
Returns
Value of a*log(b)

Definition at line 97 of file multiply_log.hpp.

◆ multiply_lower_tri_self_transpose() [1/3]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, R> stan::math::multiply_lower_tri_self_transpose ( const Eigen::Matrix< fvar< T >, R, C > &  m)
inline

Definition at line 13 of file multiply_lower_tri_self_transpose.hpp.

◆ multiply_lower_tri_self_transpose() [2/3]

matrix_v stan::math::multiply_lower_tri_self_transpose ( const matrix_v L)
inline

Definition at line 14 of file multiply_lower_tri_self_transpose.hpp.

◆ multiply_lower_tri_self_transpose() [3/3]

matrix_d stan::math::multiply_lower_tri_self_transpose ( const matrix_d L)
inline

Returns the result of multiplying the lower triangular portion of the input matrix by its own transpose.

Parameters
LMatrix to multiply.
Returns
The lower triangular values in L times their own transpose.
Exceptions
std::domain_errorIf the input matrix is not square.

Definition at line 18 of file multiply_lower_tri_self_transpose.hpp.

◆ multiply_transpose()

matrix_cl stan::math::multiply_transpose ( const matrix_cl A)
inline

Computes the product of a square OpenCL matrix with its transpose.

Computes the matrix multiplication C = A x A^T

Parameters
Ainput matrix
Returns
the product of the input matrix and its transpose

Definition at line 24 of file multiply_transpose.hpp.

◆ neg_binomial_2_ccdf_log()

template<typename T_n , typename T_location , typename T_precision >
return_type<T_location, T_precision>::type stan::math::neg_binomial_2_ccdf_log ( const T_n &  n,
const T_location &  mu,
const T_precision &  phi 
)
Deprecated:
use neg_binomial_2_lccdf

Definition at line 14 of file neg_binomial_2_ccdf_log.hpp.

◆ neg_binomial_2_cdf()

template<typename T_n , typename T_location , typename T_precision >
return_type<T_location, T_precision>::type stan::math::neg_binomial_2_cdf ( const T_n &  n,
const T_location &  mu,
const T_precision &  phi 
)

Definition at line 20 of file neg_binomial_2_cdf.hpp.

◆ neg_binomial_2_cdf_log()

template<typename T_n , typename T_location , typename T_precision >
return_type<T_location, T_precision>::type stan::math::neg_binomial_2_cdf_log ( const T_n &  n,
const T_location &  mu,
const T_precision &  phi 
)
Deprecated:
use neg_binomial_2_lcdf

Definition at line 14 of file neg_binomial_2_cdf_log.hpp.

◆ neg_binomial_2_lccdf()

template<typename T_n , typename T_location , typename T_precision >
return_type<T_location, T_precision>::type stan::math::neg_binomial_2_lccdf ( const T_n &  n,
const T_location &  mu,
const T_precision &  phi 
)

Definition at line 17 of file neg_binomial_2_lccdf.hpp.

◆ neg_binomial_2_lcdf()

template<typename T_n , typename T_location , typename T_precision >
return_type<T_location, T_precision>::type stan::math::neg_binomial_2_lcdf ( const T_n &  n,
const T_location &  mu,
const T_precision &  phi 
)

Definition at line 16 of file neg_binomial_2_lcdf.hpp.

◆ neg_binomial_2_log() [1/2]

template<bool propto, typename T_n , typename T_location , typename T_precision >
return_type<T_location, T_precision>::type stan::math::neg_binomial_2_log ( const T_n &  n,
const T_location &  mu,
const T_precision &  phi 
)
Deprecated:
use neg_binomial_2_lpmf

Definition at line 14 of file neg_binomial_2_log.hpp.

◆ neg_binomial_2_log() [2/2]

template<typename T_n , typename T_location , typename T_precision >
return_type<T_location, T_precision>::type stan::math::neg_binomial_2_log ( const T_n &  n,
const T_location &  mu,
const T_precision &  phi 
)
inline
Deprecated:
use neg_binomial_2_lpmf

Definition at line 23 of file neg_binomial_2_log.hpp.

◆ neg_binomial_2_log_glm_log() [1/2]

template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type<T_x, T_alpha, T_beta, T_precision>::type stan::math::neg_binomial_2_log_glm_log ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta,
const T_precision &  phi 
)
Deprecated:
use neg_binomial_2_log_glm_lpmf

Definition at line 16 of file neg_binomial_2_log_glm_log.hpp.

◆ neg_binomial_2_log_glm_log() [2/2]

template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type<T_x, T_alpha, T_beta, T_precision>::type stan::math::neg_binomial_2_log_glm_log ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta,
const T_precision &  phi 
)
inline
Deprecated:
use poisson_logit_glm_lpmf

Definition at line 28 of file neg_binomial_2_log_glm_log.hpp.

◆ neg_binomial_2_log_glm_lpmf() [1/2]

template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type<T_x, T_alpha, T_beta, T_precision>::type stan::math::neg_binomial_2_log_glm_lpmf ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta,
const T_precision &  phi 
)

Returns the log PMF of the Generalized Linear Model (GLM) with Negative-Binomial-2 distribution and log link function.

The idea is that neg_binomial_2_log_glm_lpmf(y, x, alpha, beta, phi) should compute a more efficient version of neg_binomial_2_log_lpmf(y, alpha + x * beta, phi) by using analytically simplified gradients. If containers are supplied, returns the log sum of the probabilities.

Template Parameters
T_ytype of positive int vector of variates (labels); this can also be a single positive integer value;
T_xtype of the matrix of covariates (features); this should be an Eigen::Matrix type whose number of rows should match the length of y and whose number of columns should match the length of beta
T_alphatype of the intercept(s); this can be a vector (of the same length as y) of intercepts or a single value (for models with constant intercept);
T_betatype of the weight vector; this can also be a scalar;
T_precisiontype of the (positive) precision(s); this can be a vector (of the same length as y, for heteroskedasticity) or a scalar.
Parameters
yfailures count vector parameter
xdesign matrix
alphaintercept (in log odds)
betaweight vector
phi(vector of) precision parameter(s)
Returns
log probability or log sum of probabilities
Exceptions
std::invalid_argumentif container sizes mismatch.
std::domain_errorif x, beta or alpha is infinite.
std::domain_errorif phi is infinite or non-positive.
std::domain_errorif y is negative.

Definition at line 57 of file neg_binomial_2_log_glm_lpmf.hpp.

◆ neg_binomial_2_log_glm_lpmf() [2/2]

template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type<T_x, T_alpha, T_beta, T_precision>::type stan::math::neg_binomial_2_log_glm_lpmf ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta,
const T_precision &  phi 
)
inline

Definition at line 194 of file neg_binomial_2_log_glm_lpmf.hpp.

◆ neg_binomial_2_log_log() [1/2]

template<bool propto, typename T_n , typename T_log_location , typename T_precision >
return_type<T_log_location, T_precision>::type stan::math::neg_binomial_2_log_log ( const T_n &  n,
const T_log_location &  eta,
const T_precision &  phi 
)
Deprecated:
use neg_binomial_2_log_lpmf

Definition at line 15 of file neg_binomial_2_log_log.hpp.

◆ neg_binomial_2_log_log() [2/2]

template<typename T_n , typename T_log_location , typename T_precision >
return_type<T_log_location, T_precision>::type stan::math::neg_binomial_2_log_log ( const T_n &  n,
const T_log_location &  eta,
const T_precision &  phi 
)
inline
Deprecated:
use neg_binomial_2_log_lpmf

Definition at line 26 of file neg_binomial_2_log_log.hpp.

◆ neg_binomial_2_log_lpmf() [1/2]

template<bool propto, typename T_n , typename T_log_location , typename T_precision >
return_type<T_log_location, T_precision>::type stan::math::neg_binomial_2_log_lpmf ( const T_n &  n,
const T_log_location &  eta,
const T_precision &  phi 
)

Definition at line 22 of file neg_binomial_2_log_lpmf.hpp.

◆ neg_binomial_2_log_lpmf() [2/2]

template<typename T_n , typename T_log_location , typename T_precision >
return_type<T_log_location, T_precision>::type stan::math::neg_binomial_2_log_lpmf ( const T_n &  n,
const T_log_location &  eta,
const T_precision &  phi 
)
inline

Definition at line 104 of file neg_binomial_2_log_lpmf.hpp.

◆ neg_binomial_2_log_rng()

template<typename T_loc , typename T_inv , class RNG >
VectorBuilder<true, int, T_loc, T_inv>::type stan::math::neg_binomial_2_log_rng ( const T_loc &  eta,
const T_inv &  phi,
RNG &  rng 
)
inline

Return a negative binomial random variate with the specified log-location and inverse dispersion parameters using the given random number generator.

eta and phi can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_locType of log-location parameter
T_invType of inverse overdispersion parameter
RNGtype of random number generator
Parameters
eta(Sequence of) positive log-location parameter(s)
phi(Sequence of) positive inverse dispersion parameter(s)
rngrandom number generator
Returns
(Sequence of) negative binomial random variate(s)
Exceptions
std::domain_errorif eta is non-finite or phi is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 38 of file neg_binomial_2_log_rng.hpp.

◆ neg_binomial_2_lpmf() [1/2]

template<bool propto, typename T_n , typename T_location , typename T_precision >
return_type<T_location, T_precision>::type stan::math::neg_binomial_2_lpmf ( const T_n &  n,
const T_location &  mu,
const T_precision &  phi 
)

Definition at line 21 of file neg_binomial_2_lpmf.hpp.

◆ neg_binomial_2_lpmf() [2/2]

template<typename T_n , typename T_location , typename T_precision >
return_type<T_location, T_precision>::type stan::math::neg_binomial_2_lpmf ( const T_n &  n,
const T_location &  mu,
const T_precision &  phi 
)
inline

Definition at line 104 of file neg_binomial_2_lpmf.hpp.

◆ neg_binomial_2_rng()

template<typename T_loc , typename T_prec , class RNG >
VectorBuilder<true, int, T_loc, T_prec>::type stan::math::neg_binomial_2_rng ( const T_loc &  mu,
const T_prec &  phi,
RNG &  rng 
)
inline

Return a negative binomial random variate with the specified location and precision parameters using the given random number generator.

mu and phi can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_locType of location parameter
T_precType of precision parameter
RNGtype of random number generator
Parameters
mu(Sequence of) positive location parameter(s)
phi(Sequence of) positive precision parameter(s)
rngrandom number generator
Returns
(Sequence of) negative binomial random variate(s)
Exceptions
std::domain_errorif mu or phi are nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 38 of file neg_binomial_2_rng.hpp.

◆ neg_binomial_ccdf_log()

template<typename T_n , typename T_shape , typename T_inv_scale >
return_type<T_shape, T_inv_scale>::type stan::math::neg_binomial_ccdf_log ( const T_n &  n,
const T_shape &  alpha,
const T_inv_scale &  beta 
)
Deprecated:
use neg_binomial_lccdf

Definition at line 14 of file neg_binomial_ccdf_log.hpp.

◆ neg_binomial_cdf()

template<typename T_n , typename T_shape , typename T_inv_scale >
return_type<T_shape, T_inv_scale>::type stan::math::neg_binomial_cdf ( const T_n &  n,
const T_shape &  alpha,
const T_inv_scale &  beta 
)

Definition at line 20 of file neg_binomial_cdf.hpp.

◆ neg_binomial_cdf_log()

template<typename T_n , typename T_shape , typename T_inv_scale >
return_type<T_shape, T_inv_scale>::type stan::math::neg_binomial_cdf_log ( const T_n &  n,
const T_shape &  alpha,
const T_inv_scale &  beta 
)
Deprecated:
use neg_binomial_lcdf

Definition at line 14 of file neg_binomial_cdf_log.hpp.

◆ neg_binomial_lccdf()

template<typename T_n , typename T_shape , typename T_inv_scale >
return_type<T_shape, T_inv_scale>::type stan::math::neg_binomial_lccdf ( const T_n &  n,
const T_shape &  alpha,
const T_inv_scale &  beta 
)

Definition at line 22 of file neg_binomial_lccdf.hpp.

◆ neg_binomial_lcdf()

template<typename T_n , typename T_shape , typename T_inv_scale >
return_type<T_shape, T_inv_scale>::type stan::math::neg_binomial_lcdf ( const T_n &  n,
const T_shape &  alpha,
const T_inv_scale &  beta 
)

Definition at line 21 of file neg_binomial_lcdf.hpp.

◆ neg_binomial_log() [1/2]

template<bool propto, typename T_n , typename T_shape , typename T_inv_scale >
return_type<T_shape, T_inv_scale>::type stan::math::neg_binomial_log ( const T_n &  n,
const T_shape &  alpha,
const T_inv_scale &  beta 
)
Deprecated:
use neg_binomial_lpmf

Definition at line 14 of file neg_binomial_log.hpp.

◆ neg_binomial_log() [2/2]

template<typename T_n , typename T_shape , typename T_inv_scale >
return_type<T_shape, T_inv_scale>::type stan::math::neg_binomial_log ( const T_n &  n,
const T_shape &  alpha,
const T_inv_scale &  beta 
)
inline
Deprecated:
use neg_binomial_lpmf

Definition at line 23 of file neg_binomial_log.hpp.

◆ neg_binomial_lpmf() [1/2]

template<bool propto, typename T_n , typename T_shape , typename T_inv_scale >
return_type<T_shape, T_inv_scale>::type stan::math::neg_binomial_lpmf ( const T_n &  n,
const T_shape &  alpha,
const T_inv_scale &  beta 
)

Definition at line 22 of file neg_binomial_lpmf.hpp.

◆ neg_binomial_lpmf() [2/2]

template<typename T_n , typename T_shape , typename T_inv_scale >
return_type<T_shape, T_inv_scale>::type stan::math::neg_binomial_lpmf ( const T_n &  n,
const T_shape &  alpha,
const T_inv_scale &  beta 
)
inline

Definition at line 132 of file neg_binomial_lpmf.hpp.

◆ neg_binomial_rng()

template<typename T_shape , typename T_inv , class RNG >
VectorBuilder<true, int, T_shape, T_inv>::type stan::math::neg_binomial_rng ( const T_shape &  alpha,
const T_inv &  beta,
RNG &  rng 
)
inline

Return a negative binomial random variate with the specified shape and inverse scale parameters using the given random number generator.

alpha and beta can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_shapeType of shape parameter
T_invType of inverse scale parameter
RNGtype of random number generator
Parameters
alpha(Sequence of) positive shape parameter(s)
beta(Sequence of) positive inverse scale parameter(s)
rngrandom number generator
Returns
(Sequence of) negative binomial random variate(s)
Exceptions
std::domain_errorif alpha or beta are nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 37 of file neg_binomial_rng.hpp.

◆ negative_infinity()

double stan::math::negative_infinity ( )
inline

Return negative infinity.

Returns
Negative infinity.

Definition at line 115 of file constants.hpp.

◆ nested_size()

static size_t stan::math::nested_size ( )
inlinestatic

Definition at line 10 of file nested_size.hpp.

◆ normal_ccdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::normal_ccdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use normal_lccdf

Definition at line 14 of file normal_ccdf_log.hpp.

◆ normal_cdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::normal_cdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Calculates the normal cumulative distribution function for the given variate, location, and scale.

$\Phi(x) = \frac{1}{\sqrt{2 \pi}} \int_{-\inf}^x e^{-t^2/2} dt$.

Parameters
yA scalar variate.
muThe location of the normal distribution.
sigmaThe scale of the normal distriubtion
Returns
The unit normal cdf evaluated at the specified arguments.
Template Parameters
T_yType of y.
T_locType of mean parameter.
T_scaleType of standard deviation paramater.

Definition at line 32 of file normal_cdf.hpp.

◆ normal_cdf_log()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::normal_cdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use normal_lcdf

Definition at line 14 of file normal_cdf_log.hpp.

◆ normal_id_glm_log() [1/2]

template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type<T_y, T_x, T_alpha, T_beta, T_scale>::type stan::math::normal_id_glm_log ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta,
const T_scale &  sigma 
)
Deprecated:
use normal_id_glm_lpdf

Definition at line 16 of file normal_id_glm_log.hpp.

◆ normal_id_glm_log() [2/2]

template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type<T_y, T_x, T_alpha, T_beta, T_scale>::type stan::math::normal_id_glm_log ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta,
const T_scale &  sigma 
)
inline
Deprecated:
use normal_id_glm_lpdf

Definition at line 28 of file normal_id_glm_log.hpp.

◆ normal_id_glm_lpdf() [1/2]

template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type<T_y, T_x, T_alpha, T_beta, T_scale>::type stan::math::normal_id_glm_lpdf ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta,
const T_scale &  sigma 
)

Returns the log PDF of the Generalized Linear Model (GLM) with Normal distribution and id link function.

If containers are supplied, returns the log sum of the probabilities. The idea is that normal_id_glm_lpdf(y, x, alpha, beta, sigma) should compute a more efficient version of normal_lpdf(y, alpha + x * beta, sigma) by using analytically simplified gradients.

Template Parameters
T_ytype of vector of dependent variables (labels);
T_xtype of the matrix of independent variables (features); this should be an Eigen::Matrix type whose number of rows should match the length of y and whose number of columns should match the length of beta
T_alphatype of the intercept(s); this can be a vector (of the same length as y) of intercepts or a single value (for models with constant intercept);
T_betatype of the weight vector; this can also be a single value;
T_scaletype of the (positive) scale(s); this can be a vector (of the same length as y, for heteroskedasticity) or a scalar.
Parameters
yvector parameter
xdesign matrix
alphaintercept (in log odds)
betaweight vector
sigma(Sequence of) scale parameters for the normal distribution.
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif x, beta or alpha is infinite.
std::domain_errorif the scale is not positive.
std::invalid_argumentif container sizes mismatch.

Definition at line 50 of file normal_id_glm_lpdf.hpp.

◆ normal_id_glm_lpdf() [2/2]

template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type<T_y, T_x, T_alpha, T_beta, T_scale>::type stan::math::normal_id_glm_lpdf ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta,
const T_scale &  sigma 
)
inline

Definition at line 173 of file normal_id_glm_lpdf.hpp.

◆ normal_lccdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::normal_lccdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 19 of file normal_lccdf.hpp.

◆ normal_lcdf()

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::normal_lcdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 19 of file normal_lcdf.hpp.

◆ normal_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::normal_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

The log of the normal density for the specified scalar(s) given the specified mean(s) and deviation(s).

y, mu, or sigma can each be either a scalar or a vector. Any vector inputs must be the same length.

The result log probability is defined to be the sum of the log probabilities for each observation/mean/deviation triple.

Deprecated:
use normal_lpdf
Parameters
y(Sequence of) scalar(s).
mu(Sequence of) location parameter(s) for the normal distribution.
sigma(Sequence of) scale parameters for the normal distribution.
Returns
The log of the product of the densities.
Exceptions
std::domain_errorif the scale is not positive.
Template Parameters
T_yUnderlying type of scalar in sequence.
T_locType of location parameter.

Definition at line 32 of file normal_log.hpp.

◆ normal_log() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::normal_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
inline
Deprecated:
use normal_lpdf

Definition at line 41 of file normal_log.hpp.

◆ normal_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::normal_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)

The log of the normal density for the specified scalar(s) given the specified mean(s) and deviation(s).

y, mu, or sigma can each be either a scalar or a vector. Any vector inputs must be the same length.

The result log probability is defined to be the sum of the log probabilities for each observation/mean/deviation triple.

Template Parameters
T_yUnderlying type of scalar in sequence.
T_locType of location parameter.
T_scaleType of scale parameter.
Parameters
y(Sequence of) scalar(s).
mu(Sequence of) location parameter(s) for the normal distribution.
sigma(Sequence of) scale parameters for the normal distribution.
Returns
The log of the product of the densities.
Exceptions
std::domain_errorif the scale is not positive.

Definition at line 37 of file normal_lpdf.hpp.

◆ normal_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::normal_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma 
)
inline

Definition at line 106 of file normal_lpdf.hpp.

◆ normal_rng()

template<typename T_loc , typename T_scale , class RNG >
VectorBuilder<true, double, T_loc, T_scale>::type stan::math::normal_rng ( const T_loc &  mu,
const T_scale &  sigma,
RNG &  rng 
)
inline

Return a Normal random variate for the given location and scale using the specified random number generator.

mu and sigma can each be a scalar or a vector. Any non-scalar inputs must be the same length.

Template Parameters
T_locType of location parameter
T_scaleType of scale parameter
RNGtype of random number generator
Parameters
mu(Sequence of) location parameter(s)
sigma(Sequence of) positive scale parameter(s)
rngrandom number generator
Returns
(Sequence of) normal random variate(s)
Exceptions
std::domain_errorif mu is infinite or sigma is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 33 of file normal_rng.hpp.

◆ normal_sufficient_log() [1/2]

template<bool propto, typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type<T_y, T_s, T_loc, T_scale>::type stan::math::normal_sufficient_log ( const T_y &  y_bar,
const T_s &  s_squared,
const T_n &  n_obs,
const T_loc &  mu,
const T_scale &  sigma 
)
inline
Deprecated:
use normal_lpdf

Definition at line 16 of file normal_sufficient_log.hpp.

◆ normal_sufficient_log() [2/2]

template<typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type<T_y, T_s, T_loc, T_scale>::type stan::math::normal_sufficient_log ( const T_y &  y_bar,
const T_s &  s_squared,
const T_n &  n_obs,
const T_loc &  mu,
const T_scale &  sigma 
)
inline
Deprecated:
use normal_lpdf

Definition at line 28 of file normal_sufficient_log.hpp.

◆ normal_sufficient_lpdf() [1/2]

template<bool propto, typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type<T_y, T_s, T_loc, T_scale>::type stan::math::normal_sufficient_lpdf ( const T_y &  y_bar,
const T_s &  s_squared,
const T_n &  n_obs,
const T_loc &  mu,
const T_scale &  sigma 
)

The log of the normal density for the specified scalar(s) given the specified mean(s) and deviation(s).

y, s_quared, mu, or sigma can each be either a scalar, a std vector or Eigen vector. n can be either a single int or an std vector of ints. Any vector inputs must be the same length.

The result log probability is defined to be the sum of the log probabilities for each observation/mean/deviation triple.

Template Parameters
T_yType of sample average parameter.
T_sType of sample squared errors parameter.
T_nType of sample size parameter.
T_locType of location parameter.
T_scaleType of scale parameter.
Parameters
y_bar(Sequence of) scalar(s) (sample average(s)).
s_squared(Sequence of) sum(s) of sample squared errors
n_obs(Sequence of) sample size(s)
mu(Sequence of) location parameter(s) for the normal distribution.
sigma(Sequence of) scale parameters for the normal distribution.
Returns
The log of the product of the densities.
Exceptions
std::domain_errorif either n or sigma are not positive, if s_squared is negative or if any parameter is not finite.

Definition at line 46 of file normal_sufficient_lpdf.hpp.

◆ normal_sufficient_lpdf() [2/2]

template<typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type<T_y, T_s, T_loc, T_scale>::type stan::math::normal_sufficient_lpdf ( const T_y &  y_bar,
const T_s &  s_squared,
const T_n &  n_obs,
const T_loc &  mu,
const T_scale &  sigma 
)
inline

Definition at line 132 of file normal_sufficient_lpdf.hpp.

◆ not_a_number()

double stan::math::not_a_number ( )
inline

Return (quiet) not-a-number.

Returns
Quiet not-a-number.

Definition at line 122 of file constants.hpp.

◆ num_elements() [1/3]

template<typename T >
int stan::math::num_elements ( const T &  x)
inline

Returns 1, the number of elements in a primitive type.

Parameters
xArgument of primitive type.
Returns
1

Definition at line 17 of file num_elements.hpp.

◆ num_elements() [2/3]

template<typename T , int R, int C>
int stan::math::num_elements ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the size of the specified matrix.

Parameters
margument matrix
Returns
size of matrix

Definition at line 28 of file num_elements.hpp.

◆ num_elements() [3/3]

template<typename T >
int stan::math::num_elements ( const std::vector< T > &  v)
inline

Returns the number of elements in the specified vector.

This assumes it is not ragged and that each of its contained elements has the same number of elements.

Parameters
vargument vector
Returns
number of contained arguments

Definition at line 41 of file num_elements.hpp.

◆ offset_multiplier_constrain() [1/2]

template<typename T , typename M , typename S >
boost::math::tools::promote_args<T, M, S>::type stan::math::offset_multiplier_constrain ( const T &  x,
const M &  mu,
const S &  sigma 
)
inline

Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier.

The transform applied is

$f(x) = mu + sigma * x$

where mu is the offset and sigma is the multiplier.

If the offset is zero and the multiplier is one this reduces to identity_constrain(x).

Template Parameters
Ttype of scalar
Mtype of offset
Stype of multiplier
Parameters
[in]xUnconstrained scalar input
[in]muoffset of constrained output
[in]sigmamultiplier of constrained output
Returns
linear transformed value correspdonding to inputs
Exceptions
std::domain_errorif sigma <= 0
std::domain_errorif mu is not finite

Definition at line 42 of file offset_multiplier_constrain.hpp.

◆ offset_multiplier_constrain() [2/2]

template<typename T , typename M , typename S >
boost::math::tools::promote_args<T, M, S>::type stan::math::offset_multiplier_constrain ( const T &  x,
const M &  mu,
const S &  sigma,
T &  lp 
)
inline

Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier, incrementing the specified reference with the log absolute Jacobian determinant of the transform.

The transform applied is

$f(x) = mu + sigma * x$

where mu is the offset and sigma is the multiplier.

If the offset is zero and multiplier is one, this function reduces to identity_constraint(x, lp).

Template Parameters
Ttype of scalar
Mtype of offset
Stype of multiplier
Parameters
[in]xUnconstrained scalar input
[in]muoffset of constrained output
[in]sigmamultiplier of constrained output
[in,out]lpReference to log probability to increment.
Returns
linear transformed value corresponding to inputs
Exceptions
std::domain_errorif sigma <= 0
std::domain_errorif mu is not finite

Definition at line 81 of file offset_multiplier_constrain.hpp.

◆ offset_multiplier_free()

template<typename T , typename L , typename S >
boost::math::tools::promote_args<T, L, S>::type stan::math::offset_multiplier_free ( const T &  y,
const L &  mu,
const S &  sigma 
)
inline

Return the unconstrained scalar that transforms to the specified offset and multiplier constrained scalar given the specified offset and multiplier.

The transfrom in locmultiplier_constrain(T, double, double), is reversed by the reverse affine transformation,

$f^{-1}(y) = \frac{y - L}{S}$

where $L$ and $S$ are the offset and multiplier.

If the offset is zero and multiplier is one, this function reduces to identity_free(y).

Template Parameters
Ttype of scalar
Ltype of offset
Stype of multiplier
Parameters
yconstrained value
[in]muoffset of constrained output
[in]sigmamultiplier of constrained output
Returns
the free scalar that transforms to the input scalar given the offset and multiplier
Exceptions
std::domain_errorif sigma <= 0
std::domain_errorif mu is not finite

Definition at line 43 of file offset_multiplier_free.hpp.

◆ operator &&() [1/6]

bool stan::math::operator&& ( const var x,
const var y 
)
inline

Return the logical conjunction of the values of the two arguments as defined by &&.

Parameters
[in]xfirst argument
[in]ysecond argument
Returns
disjuntion of the argument's values

Definition at line 17 of file operator_logical_and.hpp.

◆ operator &&() [2/6]

template<typename T >
bool stan::math::operator&& ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Return the logical conjunction of the values of the two arguments as defined by &&.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
disjuntion of the argument's values

Definition at line 19 of file operator_logical_and.hpp.

◆ operator &&() [3/6]

template<typename T >
bool stan::math::operator&& ( const var x,
double  y 
)
inline

Return the logical conjunction of the values of the two arguments as defined by &&.

Parameters
[in]xfirst argument
[in]ysecond argument
Returns
conjunction of first argument's value and second argument

Definition at line 31 of file operator_logical_and.hpp.

◆ operator &&() [4/6]

template<typename T >
bool stan::math::operator&& ( const fvar< T > &  x,
double  y 
)
inline

Return the logical conjunction of the values of the two arguments as defined by &&.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
conjunction of first argument's value and second argument

Definition at line 34 of file operator_logical_and.hpp.

◆ operator &&() [5/6]

template<typename T >
bool stan::math::operator&& ( double  x,
const var y 
)
inline

Return the logical conjunction of the values of the two arguments as defined by &&.

Parameters
[in]xfirst argument
[in]ysecond argument
Returns
conjunction of first argument and second argument's value

Definition at line 45 of file operator_logical_and.hpp.

◆ operator &&() [6/6]

template<typename T >
bool stan::math::operator&& ( double  x,
const fvar< T > &  y 
)
inline

Return the logical conjunction of the values of the two arguments as defined by &&.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
conjunction of first argument and the second argument's value

Definition at line 49 of file operator_logical_and.hpp.

◆ operator!() [1/2]

bool stan::math::operator! ( const var x)
inline

Return the negation of the value of the argument as defined by !.

Parameters
[in]xargument
Returns
negation of argument value

Definition at line 16 of file operator_unary_not.hpp.

◆ operator!() [2/2]

template<typename T >
bool stan::math::operator! ( const fvar< T > &  x)
inline

Return the negation of the value of the argument as defined by !.

Template Parameters
valueand tangent type for variables
Parameters
[in]xargument
Returns
negation of argument value

Definition at line 18 of file operator_unary_not.hpp.

◆ operator!=() [1/6]

template<typename T >
bool stan::math::operator!= ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Return true if the value of the two arguments are not equal as defined by !=.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the values of the arguments are not equal

Definition at line 19 of file operator_not_equal.hpp.

◆ operator!=() [2/6]

bool stan::math::operator!= ( const var a,
const var b 
)
inline

Inequality operator comparing two variables' values (C++).

\[ \mbox{operator!=}(x, y) = \begin{cases} 0 & \mbox{if } x = y\\ 1 & \mbox{if } x \neq y \\[6pt] 0 & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable.
bSecond variable.
Returns
True if the first variable's value is not the same as the second's.

Definition at line 26 of file operator_not_equal.hpp.

◆ operator!=() [3/6]

template<typename T >
bool stan::math::operator!= ( const fvar< T > &  x,
double  y 
)
inline

Return true if the value of the first argument is not equal to the second argument as defined by !=.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the value of the first argument is not equal to the second argument

Definition at line 34 of file operator_not_equal.hpp.

◆ operator!=() [4/6]

bool stan::math::operator!= ( const var a,
double  b 
)
inline

Inequality operator comparing a variable's value and a double (C++).

Parameters
aFirst variable.
bSecond value.
Returns
True if the first variable's value is not the same as the second value.

Definition at line 39 of file operator_not_equal.hpp.

◆ operator!=() [5/6]

template<typename T >
bool stan::math::operator!= ( double  x,
const fvar< T > &  y 
)
inline

Return true if the first argument is not equal to the value of the second argument as defined by !=.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument is not equal to the value of the second argument

Definition at line 49 of file operator_not_equal.hpp.

◆ operator!=() [6/6]

bool stan::math::operator!= ( double  a,
const var b 
)
inline

Inequality operator comparing a double and a variable's value (C++).

Parameters
aFirst value.
bSecond variable.
Returns
True if the first value is not the same as the second variable's value.

Definition at line 50 of file operator_not_equal.hpp.

◆ operator*() [1/9]

template<typename T >
fvar<T> stan::math::operator* ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Return the product of the two arguments.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
product of arguments

Definition at line 18 of file operator_multiplication.hpp.

◆ operator*() [2/9]

template<typename T >
fvar<T> stan::math::operator* ( double  x,
const fvar< T > &  y 
)
inline

Return the product of the two arguments.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
product of arguments

Definition at line 31 of file operator_multiplication.hpp.

◆ operator*() [3/9]

template<typename T >
fvar<T> stan::math::operator* ( const fvar< T > &  x,
double  y 
)
inline

Return the product of the two arguments.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
product of arguments

Definition at line 44 of file operator_multiplication.hpp.

◆ operator*() [4/9]

var stan::math::operator* ( const var a,
const var b 
)
inline

Multiplication operator for two variables (C++).

The partial derivatives are

$\frac{\partial}{\partial x} (x * y) = y$, and

$\frac{\partial}{\partial y} (x * y) = x$.

\[ \mbox{operator*}(x, y) = \begin{cases} xy & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{operator*}(x, y)}{\partial x} = \begin{cases} y & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{operator*}(x, y)}{\partial y} = \begin{cases} x & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable operand.
bSecond variable operand.
Returns
Variable result of multiplying operands.

Definition at line 78 of file operator_multiplication.hpp.

◆ operator*() [5/9]

var stan::math::operator* ( const var a,
double  b 
)
inline

Multiplication operator for a variable and a scalar (C++).

The partial derivative for the variable is

$\frac{\partial}{\partial x} (x * c) = c$, and

Parameters
aVariable operand.
bScalar operand.
Returns
Variable result of multiplying operands.

Definition at line 93 of file operator_multiplication.hpp.

◆ operator*() [6/9]

var stan::math::operator* ( double  a,
const var b 
)
inline

Multiplication operator for a scalar and a variable (C++).

The partial derivative for the variable is

$\frac{\partial}{\partial y} (c * y) = c$.

Parameters
aScalar operand.
bVariable operand.
Returns
Variable result of multiplying the operands.

Definition at line 110 of file operator_multiplication.hpp.

◆ operator*() [7/9]

matrix_cl stan::math::operator* ( const matrix_cl A,
const matrix_cl B 
)
inline

Templated product operator for OpenCL matrices.

Computes the matrix multiplication C[M, K] = A[M, N] x B[N, K].

Parameters
AA matrix or scalar
BA matrix or scalar
Returns
the product of the first and second arguments
Exceptions
<code>std::invalid_argument</code>if the number of columns in A and rows in B do not match

Definition at line 166 of file multiply.hpp.

◆ operator*() [8/9]

matrix_cl stan::math::operator* ( const matrix_cl B,
const double  scalar 
)
inline

Definition at line 169 of file multiply.hpp.

◆ operator*() [9/9]

matrix_cl stan::math::operator* ( const double  scalar,
const matrix_cl B 
)
inline

Definition at line 172 of file multiply.hpp.

◆ operator+() [1/9]

template<typename T >
fvar<T> stan::math::operator+ ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Return the sum of the specified forward mode addends.

Template Parameters
Ttype of values and tangents
Parameters
x1first addend
x2second addend
Returns
sum of addends

Definition at line 18 of file operator_addition.hpp.

◆ operator+() [2/9]

template<typename T >
fvar<T> stan::math::operator+ ( const fvar< T > &  x)
inline

Returns the argument.

It is included for completeness. The primitive unary operator+ exists to promote integer to floating point values.

Template Parameters
Tvalue and tangent type of the argument
Parameters
xargument
Returns
the argument

Definition at line 19 of file operator_unary_plus.hpp.

◆ operator+() [3/9]

template<typename T >
fvar<T> stan::math::operator+ ( double  x1,
const fvar< T > &  x2 
)
inline

Return the sum of the specified double and forward mode addends.

Template Parameters
Ttype of values and tangents
Parameters
x1first addend
x2second addend
Returns
sum of addends

Definition at line 31 of file operator_addition.hpp.

◆ operator+() [4/9]

var stan::math::operator+ ( const var a)
inline

Unary plus operator for variables (C++).

The function simply returns its input, because

$\frac{d}{dx} +x = \frac{d}{dx} x = 1$.

The effect of unary plus on a built-in C++ scalar type is integer promotion. Because variables are all double-precision floating point already, promotion is not necessary.

\[ \mbox{operator+}(x) = \begin{cases} x & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{operator+}(x)}{\partial x} = \begin{cases} 1 & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aArgument variable.
Returns
The input reference.

Definition at line 43 of file operator_unary_plus.hpp.

◆ operator+() [5/9]

template<typename T >
fvar<T> stan::math::operator+ ( const fvar< T > &  x1,
double  x2 
)
inline

Return the sum of the specified forward mode and double addends.

Template Parameters
Ttype of values and tangents
Parameters
x1first addend
x2second addend
Returns
sum of addends

Definition at line 44 of file operator_addition.hpp.

◆ operator+() [6/9]

auto stan::math::operator+ ( const matrix_cl A,
const matrix_cl B 
)
inline

Matrix addition on the OpenCL device.

Parameters
Afirst matrix
Bsecond matrix
Returns
sum of A and B
Exceptions
<code>std::invalid_argument</code>if the input matrices do not have matching dimensions

Definition at line 51 of file add.hpp.

◆ operator+() [7/9]

var stan::math::operator+ ( const var a,
const var b 
)
inline

Addition operator for variables (C++).

The partial derivatives are defined by

$\frac{\partial}{\partial x} (x+y) = 1$, and

$\frac{\partial}{\partial y} (x+y) = 1$.

\[ \mbox{operator+}(x, y) = \begin{cases} x+y & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{operator+}(x, y)}{\partial x} = \begin{cases} 1 & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{operator+}(x, y)}{\partial y} = \begin{cases} 1 & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable operand.
bSecond variable operand.
Returns
Variable result of adding two variables.

Definition at line 79 of file operator_addition.hpp.

◆ operator+() [8/9]

var stan::math::operator+ ( const var a,
double  b 
)
inline

Addition operator for variable and scalar (C++).

The derivative with respect to the variable is

$\frac{d}{dx} (x + c) = 1$.

Parameters
aFirst variable operand.
bSecond scalar operand.
Returns
Result of adding variable and scalar.

Definition at line 94 of file operator_addition.hpp.

◆ operator+() [9/9]

var stan::math::operator+ ( double  a,
const var b 
)
inline

Addition operator for scalar and variable (C++).

The derivative with respect to the variable is

$\frac{d}{dy} (c + y) = 1$.

Parameters
aFirst scalar operand.
bSecond variable operand.
Returns
Result of adding variable and scalar.

Definition at line 111 of file operator_addition.hpp.

◆ operator++() [1/2]

var& stan::math::operator++ ( var a)
inline

Prefix increment operator for variables (C++).

Following C++, (++a) is defined to behave exactly as (a = a + 1.0) does, but is faster and uses less memory. In particular, the result is an assignable lvalue.

Parameters
aVariable to increment.
Returns
Reference the result of incrementing this input variable.

Definition at line 34 of file operator_unary_increment.hpp.

◆ operator++() [2/2]

var stan::math::operator++ ( var a,
int   
)
inline

Postfix increment operator for variables (C++).

Following C++, the expression (a++) is defined to behave like the sequence of operations

var temp = a; a = a + 1.0; return temp;

Parameters
aVariable to increment.
Returns
Input variable.

Definition at line 50 of file operator_unary_increment.hpp.

◆ operator-() [1/9]

template<typename T >
fvar<T> stan::math::operator- ( const fvar< T > &  x)
inline

Return the negation of the specified argument.

Template Parameters
valueand tangent type of the argument
Parameters
[in]xargument
Returns
negation of argument

Definition at line 17 of file operator_unary_minus.hpp.

◆ operator-() [2/9]

template<typename T >
fvar<T> stan::math::operator- ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Return the difference of the specified arguments.

Template Parameters
Ttype of values and tangents
Parameters
x1first argument
x2second argument
Returns
difference of the arguments

Definition at line 18 of file operator_subtraction.hpp.

◆ operator-() [3/9]

template<typename T >
fvar<T> stan::math::operator- ( double  x1,
const fvar< T > &  x2 
)
inline

Return the difference of the specified arguments.

Template Parameters
Ttype of values and tangents
Parameters
x1first argument
x2second argument
Returns
difference of the arguments

Definition at line 31 of file operator_subtraction.hpp.

◆ operator-() [4/9]

template<typename T >
fvar<T> stan::math::operator- ( const fvar< T > &  x1,
double  x2 
)
inline

Return the difference of the specified arguments.

Template Parameters
Ttype of values and tangents
Parameters
x1first argument
x2second argument
Returns
difference of the arguments

Definition at line 44 of file operator_subtraction.hpp.

◆ operator-() [5/9]

var stan::math::operator- ( const var a)
inline

Unary negation operator for variables (C++).

$\frac{d}{dx} -x = -1$.

\[ \mbox{operator-}(x) = \begin{cases} -x & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{operator-}(x)}{\partial x} = \begin{cases} -1 & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aArgument variable.
Returns
Negation of variable.

Definition at line 49 of file operator_unary_negative.hpp.

◆ operator-() [6/9]

auto stan::math::operator- ( const matrix_cl A,
const matrix_cl B 
)
inline

Matrix subtraction on the OpenCL device Subtracts the second matrix from the first matrix and stores the result in the third matrix (C=A-B)

Parameters
Afirst matrix
Bsecond matrix
Returns
subtraction result matrix
Exceptions
<code>std::invalid_argument</code>if the input matrices do not have matching dimensions.

Definition at line 58 of file subtract.hpp.

◆ operator-() [7/9]

var stan::math::operator- ( const var a,
const var b 
)
inline

Subtraction operator for variables (C++).

The partial derivatives are defined by

$\frac{\partial}{\partial x} (x-y) = 1$, and

$\frac{\partial}{\partial y} (x-y) = -1$.

\[ \mbox{operator-}(x, y) = \begin{cases} x-y & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{operator-}(x, y)}{\partial x} = \begin{cases} 1 & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{operator-}(x, y)}{\partial y} = \begin{cases} -1 & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable operand.
bSecond variable operand.
Returns
Variable result of subtracting the second variable from the first.

Definition at line 91 of file operator_subtraction.hpp.

◆ operator-() [8/9]

var stan::math::operator- ( const var a,
double  b 
)
inline

Subtraction operator for variable and scalar (C++).

The derivative for the variable is

$\frac{\partial}{\partial x} (x-c) = 1$, and

Parameters
aFirst variable operand.
bSecond scalar operand.
Returns
Result of subtracting the scalar from the variable.

Definition at line 106 of file operator_subtraction.hpp.

◆ operator-() [9/9]

var stan::math::operator- ( double  a,
const var b 
)
inline

Subtraction operator for scalar and variable (C++).

The derivative for the variable is

$\frac{\partial}{\partial y} (c-y) = -1$, and

Parameters
aFirst scalar operand.
bSecond variable operand.
Returns
Result of sutracting a variable from a scalar.

Definition at line 123 of file operator_subtraction.hpp.

◆ operator--() [1/2]

var& stan::math::operator-- ( var a)
inline

Prefix decrement operator for variables (C++).

Following C++, (–a) is defined to behave exactly as

a = a - 1.0)

does, but is faster and uses less memory. In particular, the result is an assignable lvalue.

Parameters
aVariable to decrement.
Returns
Reference the result of decrementing this input variable.

Definition at line 38 of file operator_unary_decrement.hpp.

◆ operator--() [2/2]

var stan::math::operator-- ( var a,
int   
)
inline

Postfix decrement operator for variables (C++).

Following C++, the expression (a–) is defined to behave like the sequence of operations

var temp = a; a = a - 1.0; return temp;

Parameters
aVariable to decrement.
Returns
Input variable.

Definition at line 54 of file operator_unary_decrement.hpp.

◆ operator/() [1/9]

template<typename T >
fvar<T> stan::math::operator/ ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Return the result of dividing the first argument by the second.

Template Parameters
Ttype of fvar value and tangent
Parameters
x1first argument
x2second argument
Returns
first argument divided by second argument

Definition at line 18 of file operator_division.hpp.

◆ operator/() [2/9]

template<typename T >
fvar<T> stan::math::operator/ ( const fvar< T > &  x1,
double  x2 
)
inline

Return the result of dividing the first argument by the second.

Template Parameters
Ttype of fvar value and tangent
Parameters
x1first argument
x2second argument
Returns
first argument divided by second argument

Definition at line 32 of file operator_division.hpp.

◆ operator/() [3/9]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, C> stan::math::operator/ ( const Eigen::Matrix< fvar< T >, R, C > &  v,
const fvar< T > &  c 
)
inline

Definition at line 44 of file divide.hpp.

◆ operator/() [4/9]

template<typename T >
fvar<T> stan::math::operator/ ( double  x1,
const fvar< T > &  x2 
)
inline

Return the result of dividing the first argument by the second.

Template Parameters
Ttype of fvar value and tangent
Parameters
x1first argument
x2second argument
Returns
first argument divided by second argument

Definition at line 45 of file operator_division.hpp.

◆ operator/() [5/9]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, C> stan::math::operator/ ( const Eigen::Matrix< fvar< T >, R, C > &  v,
double  c 
)
inline

Definition at line 50 of file divide.hpp.

◆ operator/() [6/9]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, C> stan::math::operator/ ( const Eigen::Matrix< double, R, C > &  v,
const fvar< T > &  c 
)
inline

Definition at line 56 of file divide.hpp.

◆ operator/() [7/9]

var stan::math::operator/ ( const var a,
const var b 
)
inline

Division operator for two variables (C++).

The partial derivatives for the variables are

$\frac{\partial}{\partial x} (x/y) = 1/y$, and

$\frac{\partial}{\partial y} (x/y) = -x / y^2$.

\[ \mbox{operator/}(x, y) = \begin{cases} \frac{x}{y} & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{operator/}(x, y)}{\partial x} = \begin{cases} \frac{1}{y} & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{operator/}(x, y)}{\partial y} = \begin{cases} -\frac{x}{y^2} & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable operand.
bSecond variable operand.
Returns
Variable result of dividing the first variable by the second.

Definition at line 87 of file operator_division.hpp.

◆ operator/() [8/9]

var stan::math::operator/ ( const var a,
double  b 
)
inline

Division operator for dividing a variable by a scalar (C++).

The derivative with respect to the variable is

$\frac{\partial}{\partial x} (x/c) = 1/c$.

Parameters
aVariable operand.
bScalar operand.
Returns
Variable result of dividing the variable by the scalar.

Definition at line 102 of file operator_division.hpp.

◆ operator/() [9/9]

var stan::math::operator/ ( double  a,
const var b 
)
inline

Division operator for dividing a scalar by a variable (C++).

The derivative with respect to the variable is

$\frac{d}{d y} (c/y) = -c / y^2$.

Parameters
aScalar operand.
bVariable operand.
Returns
Variable result of dividing the scalar by the variable.

Definition at line 119 of file operator_division.hpp.

◆ operator<() [1/6]

template<typename T >
bool stan::math::operator< ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Return true if the first argument has a value less than the value of the second argument as defined by <.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument's value is less than the second argument's value

Definition at line 20 of file operator_less_than.hpp.

◆ operator<() [2/6]

bool stan::math::operator< ( const var a,
const var b 
)
inline

Less than operator comparing variables' values (C++).

\[ \mbox{operator\textless}(x, y) = \begin{cases} 0 & \mbox{if } x \geq y \\ 1 & \mbox{if } x < y \\[6pt] 0 & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable.
bSecond variable.
Returns
True if first variable's value is less than second's.

Definition at line 24 of file operator_less_than.hpp.

◆ operator<() [3/6]

bool stan::math::operator< ( const var a,
double  b 
)
inline

Less than operator comparing variable's value and a double (C++).

Parameters
aFirst variable.
bSecond value.
Returns
True if first variable's value is less than second value.

Definition at line 34 of file operator_less_than.hpp.

◆ operator<() [4/6]

template<typename T >
bool stan::math::operator< ( double  x,
const fvar< T > &  y 
)
inline

Return true if the first argument is less than the value of the second argument as defined by <.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument is less than the second's value argument

Definition at line 35 of file operator_less_than.hpp.

◆ operator<() [5/6]

bool stan::math::operator< ( double  a,
const var b 
)
inline

Less than operator comparing a double and variable's value (C++).

Parameters
aFirst value.
bSecond variable.
Returns
True if first value is less than second variable's value.

Definition at line 44 of file operator_less_than.hpp.

◆ operator<() [6/6]

template<typename T >
bool stan::math::operator< ( const fvar< T > &  x,
double  y 
)
inline

Return true if the first argument has a value less than the second argument as defined by <.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument has a value less than the second argument argument

Definition at line 51 of file operator_less_than.hpp.

◆ operator<=() [1/6]

template<typename T >
bool stan::math::operator<= ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Return true if the first argument has a value less than or equal to the value of the second argument as defined by <=.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument's value is less than or equal to the second argument's value

Definition at line 21 of file operator_less_than_or_equal.hpp.

◆ operator<=() [2/6]

bool stan::math::operator<= ( const var a,
const var b 
)
inline

Less than or equal operator comparing two variables' values (C++).

\[ \mbox{operator\textless=}(x, y) = \begin{cases} 0 & \mbox{if } x > y\\ 1 & \mbox{if } x \leq y \\[6pt] 0 & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable.
bSecond variable.
Returns
True if first variable's value is less than or equal to the second's.

Definition at line 26 of file operator_less_than_or_equal.hpp.

◆ operator<=() [3/6]

template<typename T >
bool stan::math::operator<= ( const fvar< T > &  x,
double  y 
)
inline

Return true if the first argument has a value less than or equal to the second argument as defined by <=.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument's value is less than or equal to the second argument

Definition at line 36 of file operator_less_than_or_equal.hpp.

◆ operator<=() [4/6]

bool stan::math::operator<= ( const var a,
double  b 
)
inline

Less than or equal operator comparing a variable's value and a scalar (C++).

Parameters
aFirst variable.
bSecond value.
Returns
True if first variable's value is less than or equal to the second value.

Definition at line 39 of file operator_less_than_or_equal.hpp.

◆ operator<=() [5/6]

bool stan::math::operator<= ( double  a,
const var b 
)
inline

Less than or equal operator comparing a double and variable's value (C++).

Parameters
aFirst value.
bSecond variable.
Returns
True if first value is less than or equal to the second variable's value.

Definition at line 50 of file operator_less_than_or_equal.hpp.

◆ operator<=() [6/6]

template<typename T >
bool stan::math::operator<= ( double  x,
const fvar< T > &  y 
)
inline

Return true if the first argument is less than or equal to the second argument's value as defined by <=.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument is less than or equal to the second argument's value

Definition at line 51 of file operator_less_than_or_equal.hpp.

◆ operator==() [1/6]

template<typename T >
bool stan::math::operator== ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Return true if the specified variables have equal values as defined by ==.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the arguments have equal values

Definition at line 19 of file operator_equal.hpp.

◆ operator==() [2/6]

bool stan::math::operator== ( const var a,
const var b 
)
inline

Equality operator comparing two variables' values (C++).

\[ \mbox{operator==}(x, y) = \begin{cases} 0 & \mbox{if } x \neq y\\ 1 & \mbox{if } x = y \\[6pt] 0 & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable.
bSecond variable.
Returns
True if the first variable's value is the same as the second's.

Definition at line 26 of file operator_equal.hpp.

◆ operator==() [3/6]

template<typename T >
bool stan::math::operator== ( const fvar< T > &  x,
double  y 
)
inline

Return true if the the first variable has a value equal to the second argument as defined by by ==.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the arguments have equal values

Definition at line 34 of file operator_equal.hpp.

◆ operator==() [4/6]

bool stan::math::operator== ( const var a,
double  b 
)
inline

Equality operator comparing a variable's value and a double (C++).

Parameters
aFirst variable.
bSecond value.
Returns
True if the first variable's value is the same as the second value.

Definition at line 39 of file operator_equal.hpp.

◆ operator==() [5/6]

template<typename T >
bool stan::math::operator== ( double  x,
const fvar< T > &  y 
)
inline

Return true if the the first argument is equal to the value of the second argument as defined by by ==.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the arguments have equal values

Definition at line 48 of file operator_equal.hpp.

◆ operator==() [6/6]

bool stan::math::operator== ( double  a,
const var b 
)
inline

Equality operator comparing a scalar and a variable's value (C++).

Parameters
aFirst scalar.
bSecond variable.
Returns
True if the variable's value is equal to the scalar.

Definition at line 49 of file operator_equal.hpp.

◆ operator>() [1/6]

template<typename T >
bool stan::math::operator> ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Return true if the first argument has a greater value than the second as defined by >.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument has a greater value than the second

Definition at line 20 of file operator_greater_than.hpp.

◆ operator>() [2/6]

bool stan::math::operator> ( const var a,
const var b 
)
inline

Greater than operator comparing variables' values (C++).

\[ \mbox{operator\textgreater}(x, y) = \begin{cases} 0 & \mbox{if } x \leq y\\ 1 & \mbox{if } x > y \\[6pt] 0 & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable.
bSecond variable.
Returns
True if first variable's value is greater than second's.

Definition at line 25 of file operator_greater_than.hpp.

◆ operator>() [3/6]

bool stan::math::operator> ( const var a,
double  b 
)
inline

Greater than operator comparing variable's value and double (C++).

Parameters
aFirst variable.
bSecond value.
Returns
True if first variable's value is greater than second value.

Definition at line 35 of file operator_greater_than.hpp.

◆ operator>() [4/6]

template<typename T >
bool stan::math::operator> ( const fvar< T > &  x,
double  y 
)
inline

Return true if the first argument has a greater value than the second as defined by >.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument has a greater value than the second

Definition at line 35 of file operator_greater_than.hpp.

◆ operator>() [5/6]

bool stan::math::operator> ( double  a,
const var b 
)
inline

Greater than operator comparing a double and a variable's value (C++).

Parameters
aFirst value.
bSecond variable.
Returns
True if first value is greater than second variable's value.

Definition at line 45 of file operator_greater_than.hpp.

◆ operator>() [6/6]

template<typename T >
bool stan::math::operator> ( double  x,
const fvar< T > &  y 
)
inline

Return true if the first argument has a greater value than the second as defined by >.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument has a greater value than the second

Definition at line 50 of file operator_greater_than.hpp.

◆ operator>=() [1/6]

template<typename T >
bool stan::math::operator>= ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Return true if the value of the first argument is greater than or equal to that of the second as defined by >=.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument has a value greater than or equal to that of the second

Definition at line 20 of file operator_greater_than_or_equal.hpp.

◆ operator>=() [2/6]

bool stan::math::operator>= ( const var a,
const var b 
)
inline

Greater than or equal operator comparing two variables' values (C++).

\[ \mbox{operator\textgreater=}(x, y) = \begin{cases} 0 & \mbox{if } x < y\\ 1 & \mbox{if } x \geq y \\[6pt] 0 & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
aFirst variable.
bSecond variable.
Returns
True if first variable's value is greater than or equal to the second's.

Definition at line 27 of file operator_greater_than_or_equal.hpp.

◆ operator>=() [3/6]

template<typename T >
bool stan::math::operator>= ( const fvar< T > &  x,
double  y 
)
inline

Return true if the value of the first argument has a value greater than or equal to the second argument as defined by >=.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument has a value greater than or equal to that of the second

Definition at line 36 of file operator_greater_than_or_equal.hpp.

◆ operator>=() [4/6]

bool stan::math::operator>= ( const var a,
double  b 
)
inline

Greater than or equal operator comparing variable's value and double (C++).

Parameters
aFirst variable.
bSecond value.
Returns
True if first variable's value is greater than or equal to second value.

Definition at line 40 of file operator_greater_than_or_equal.hpp.

◆ operator>=() [5/6]

bool stan::math::operator>= ( double  a,
const var b 
)
inline

Greater than or equal operator comparing double and variable's value (C++).

Parameters
aFirst value.
bSecond variable.
Returns
True if the first value is greater than or equal to the second variable's value.

Definition at line 51 of file operator_greater_than_or_equal.hpp.

◆ operator>=() [6/6]

template<typename T >
bool stan::math::operator>= ( double  x,
const fvar< T > &  y 
)
inline

Return true if the first argument is greater than or equal to the value of the second argument as defined by >=.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
true if the first argument has a value greater than or equal to that of the second

Definition at line 52 of file operator_greater_than_or_equal.hpp.

◆ operator||() [1/6]

bool stan::math::operator|| ( const var x,
const var y 
)
inline

Return the logical disjunction of the values of the two arguments as defined by ||.

Parameters
[in]xfirst argument
[in]ysecond argument
Returns
disjuntion of the argument's values

Definition at line 17 of file operator_logical_or.hpp.

◆ operator||() [2/6]

template<typename T >
bool stan::math::operator|| ( const fvar< T > &  x,
const fvar< T > &  y 
)
inline

Return the logical disjunction of the values of the two arguments as defined by ||.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
disjuntion of the argument's values

Definition at line 19 of file operator_logical_or.hpp.

◆ operator||() [3/6]

template<typename T >
bool stan::math::operator|| ( const var x,
double  y 
)
inline

Return the logical disjunction of the values of the two arguments as defined by ||.

Parameters
[in]xfirst argument
[in]ysecond argument
Returns
disjunction of first argument's value and second argument

Definition at line 31 of file operator_logical_or.hpp.

◆ operator||() [4/6]

template<typename T >
bool stan::math::operator|| ( const fvar< T > &  x,
double  y 
)
inline

Return the logical disjunction of the values of the two arguments as defined by ||.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
disjunction of first argument's value and second argument

Definition at line 34 of file operator_logical_or.hpp.

◆ operator||() [5/6]

template<typename T >
bool stan::math::operator|| ( double  x,
const var y 
)
inline

Return the logical disjunction of the values of the two arguments as defined by ||.

Parameters
[in]xfirst argument
[in]ysecond argument
Returns
disjunction of first argument and the second argument's value

Definition at line 45 of file operator_logical_or.hpp.

◆ operator||() [6/6]

template<typename T >
bool stan::math::operator|| ( double  x,
const fvar< T > &  y 
)
inline

Return the logical disjunction of the values of the two arguments as defined by ||.

Template Parameters
valueand tangent type for variables
Parameters
[in]xfirst argument
[in]ysecond argument
Returns
disjunction of first argument and the second argument's value

Definition at line 49 of file operator_logical_or.hpp.

◆ ordered_constrain() [1/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::ordered_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x)

Return an increasing ordered vector derived from the specified free vector.

The returned constrained vector will have the same dimensionality as the specified free vector.

Parameters
xFree vector of scalars.
Returns
Positive, increasing ordered vector.
Template Parameters
TType of scalar.

Definition at line 21 of file ordered_constrain.hpp.

◆ ordered_constrain() [2/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::ordered_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
T &  lp 
)
inline

Return a positive valued, increasing ordered vector derived from the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.

The returned constrained vector will have the same dimensionality as the specified free vector.

Parameters
xFree vector of scalars.
lpLog probability reference.
Returns
Positive, increasing ordered vector.
Template Parameters
TType of scalar.

Definition at line 52 of file ordered_constrain.hpp.

◆ ordered_constrain() [3/3]

Eigen::Matrix<var, Eigen::Dynamic, 1> stan::math::ordered_constrain ( const Eigen::Matrix< var, Eigen::Dynamic, 1 > &  x)
inline

Return an increasing ordered vector derived from the specified free vector.

The returned constrained vector will have the same dimensionality as the specified free vector.

Parameters
xFree vector of scalars
Returns
Increasing ordered vector

Definition at line 86 of file ordered_constrain.hpp.

◆ ordered_free()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::ordered_free ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  y)

Return the vector of unconstrained scalars that transform to the specified positive ordered vector.

This function inverts the constraining operation defined in ordered_constrain(Matrix),

Parameters
yVector of positive, ordered scalars.
Returns
Free vector that transforms into the input vector.
Template Parameters
TType of scalar.
Exceptions
std::domain_errorif y is not a vector of positive, ordered scalars.

Definition at line 25 of file ordered_free.hpp.

◆ ordered_logistic_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_logistic_log ( const T_y &  y,
const T_loc &  lambda,
const T_cut &  c 
)

Returns the (natural) log probability of the integer/s given the vector of continuous location/s and specified cutpoints in an ordered logistic model.

Typically the continous location will be the dot product of a vector of regression coefficients and a vector of predictors for the outcome.

Template Parameters
proptoTrue if calculating up to a proportion.
T_yy variable type (int or array of integers).
T_locLocation type (double or vector).
T_cutCut-point type (vector or array of vectors).
Parameters
yIntegers
lambdaContinuous location variables.
cPositive increasing cutpoints.
Returns
Log probability of outcome given location and cutpoints.
Exceptions
std::domain_errorIf the outcome is not between 1 and the number of cutpoints plus 2; if the cutpoint vector is empty; if the cutpoint vector contains a non-positive, non-finite value; or if the cutpoint vector is not sorted in ascending order.
std::invalid_argumentIf array y and vector lambda are different lengths.
std::invalid_argumentif array y and array of vectors c are different lengths.
Deprecated:
use ordered_logistic_lpmf

Definition at line 41 of file ordered_logistic_log.hpp.

◆ ordered_logistic_log() [2/2]

template<typename T_y , typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_logistic_log ( const T_y &  y,
const T_loc &  lambda,
const T_cut &  c 
)
Deprecated:
use ordered_logistic_lpmf

Definition at line 50 of file ordered_logistic_log.hpp.

◆ ordered_logistic_lpmf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_logistic_lpmf ( const T_y &  y,
const T_loc &  lambda,
const T_cut &  c 
)

Returns the (natural) log probability of the specified array of integers given the vector of continuous locations and specified cutpoints in an ordered logistic model.

Typically the continous location will be the dot product of a vector of regression coefficients and a vector of predictors for the outcome

\[ \frac{\partial }{\partial \lambda} = \begin{cases}\\ -\mathrm{logit}^{-1}(\lambda - c_1) & \mbox{if } k = 1,\\ -(((1-e^{c_{k-1}-c_{k-2}})^{-1} - \mathrm{logit}^{-1}(c_{k-2}-\lambda)) + ((1-e^{c_{k-2}-c_{k-1}})^{-1} - \mathrm{logit}^{-1}(c_{k-1}-\lambda))) & \mathrm{if } 1 < k < K, \mathrm{and}\\ \mathrm{logit}^{-1}(c_{K-2}-\lambda) & \mathrm{if } k = K. \end{cases} \]

\[ \frac{\partial }{\partial \lambda} = \begin{cases} -\mathrm{logit}^{-1}(\lambda - c_1) & \text{if } k = 1,\\ -(((1-e^{c_{k-1}-c_{k-2}})^{-1} - \mathrm{logit}^{-1}(c_{k-2}-\lambda)) + ((1-e^{c_{k-2}-c_{k-1}})^{-1} - \mathrm{logit}^{-1}(c_{k-1}-\lambda))) & \text{if } 1 < k < K, \text{ and}\\ \mathrm{logit}^{-1}(c_{K-2}-\lambda) & \text{if } k = K. \end{cases} \]

Template Parameters
proptoTrue if calculating up to a proportion.
T_yY variable type (integer or array of integers).
T_locLocation type.
T_cutCut-point type.
Parameters
yArray of integers
lambdaVector of continuous location variables.
cPositive increasing vector of cutpoints.
Returns
Log probability of outcome given location and cutpoints.
Exceptions
std::domain_errorIf the outcome is not between 1 and the number of cutpoints plus 2; if the cutpoint vector is empty; if the cutpoint vector contains a non-positive, non-finite value; or if the cutpoint vector is not sorted in ascending order.
std::invalid_argumentIf y and lambda are different lengths.

Definition at line 72 of file ordered_logistic_lpmf.hpp.

◆ ordered_logistic_lpmf() [2/2]

template<typename T_y , typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_logistic_lpmf ( const T_y &  y,
const T_loc &  lambda,
const T_cut &  c 
)

Definition at line 167 of file ordered_logistic_lpmf.hpp.

◆ ordered_logistic_rng()

template<class RNG >
int stan::math::ordered_logistic_rng ( double  eta,
const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  c,
RNG &  rng 
)
inline

Definition at line 15 of file ordered_logistic_rng.hpp.

◆ ordered_probit_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_probit_log ( const T_y &  y,
const T_loc &  lambda,
const T_cut &  c 
)

Returns the (natural) log probability of the integer/s given the vector of continuous location/s and specified cutpoints in an ordered probit model.

Typically the continous location will be the dot product of a vector of regression coefficients and a vector of predictors for the outcome.

Template Parameters
proptoTrue if calculating up to a proportion.
T_yy variable type (int or array of integers).
T_locLocation type (double or vector).
T_cutCut-point type (vector or array of vectors).
Parameters
yIntegers
lambdaContinuous location variables.
cPositive increasing cutpoints.
Returns
Log probability of outcome given location and cutpoints.
Exceptions
std::domain_errorIf the outcome is not between 1 and the number of cutpoints plus 2; if the cutpoint vector is empty; if the cutpoint vector contains a non-positive, non-finite value; or if the cutpoint vector is not sorted in ascending order.
std::invalid_argumentIf array y and vector lambda are different lengths.
std::invalid_argumentif array y and array of vectors c are different lengths.
Deprecated:
use ordered_probit_lpmf

Definition at line 41 of file ordered_probit_log.hpp.

◆ ordered_probit_log() [2/2]

template<typename T_y , typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_probit_log ( const T_y &  y,
const T_loc &  lambda,
const T_cut &  c 
)
Deprecated:
use ordered_probit_lpmf

Definition at line 51 of file ordered_probit_log.hpp.

◆ ordered_probit_lpmf() [1/6]

template<bool propto, typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_probit_lpmf ( int  y,
const T_loc &  lambda,
const Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > &  c 
)

Returns the (natural) log probability of the specified integer outcome given the continuous location and specified cutpoints in an ordered probit model.

Typically the continous location will be the dot product of a vector of regression coefficients and a vector of predictors for the outcome.

Template Parameters
proptoTrue if calculating up to a proportion.
T_locLocation type.
T_cutCut-point type.
Parameters
yOutcome.
lambdaLocation.
cPositive increasing vector of cutpoints.
Returns
Log probability of outcome given location and cutpoints.
Exceptions
std::domain_errorIf the outcome is not between 1 and the number of cutpoints plus 2; if the cutpoint vector is empty; if the cutpoint vector contains a non-positive, non-finite value; or if the cutpoint vector is not sorted in ascending order.

Definition at line 40 of file ordered_probit_lpmf.hpp.

◆ ordered_probit_lpmf() [2/6]

template<typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_probit_lpmf ( int  y,
const T_loc &  lambda,
const Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > &  c 
)

Definition at line 66 of file ordered_probit_lpmf.hpp.

◆ ordered_probit_lpmf() [3/6]

template<bool propto, typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_probit_lpmf ( const std::vector< int > &  y,
const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &  lambda,
const Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > &  c 
)

Returns the (natural) log probability of the specified array of integers given the vector of continuous locations and specified cutpoints in an ordered probit model.

Typically the continous location will be the dot product of a vector of regression coefficients and a vector of predictors for the outcome.

Template Parameters
proptoTrue if calculating up to a proportion.
T_locLocation type.
T_cutCut-point type.
Parameters
yArray of integers
lambdaVector of continuous location variables.
cPositive increasing vector of cutpoints.
Returns
Log probability of outcome given location and cutpoints.
Exceptions
std::domain_errorIf the outcome is not between 1 and the number of cutpoints plus 2; if the cutpoint vector is empty; if the cutpoint vector contains a non-positive, non-finite value; or if the cutpoint vector is not sorted in ascending order.
std::invalid_argumentIf y and lambda are different lengths.

Definition at line 98 of file ordered_probit_lpmf.hpp.

◆ ordered_probit_lpmf() [4/6]

template<typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_probit_lpmf ( const std::vector< int > &  y,
const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &  lambda,
const Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > &  c 
)

Definition at line 133 of file ordered_probit_lpmf.hpp.

◆ ordered_probit_lpmf() [5/6]

template<bool propto, typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_probit_lpmf ( const std::vector< int > &  y,
const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &  lambda,
const std::vector< Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > > &  c 
)

Returns the (natural) log probability of the specified array of integers given the vector of continuous locations and array of specified cutpoints in an ordered probit model.

Typically the continous location will be the dot product of a vector of regression coefficients and a vector of predictors for the outcome.

Template Parameters
proptoTrue if calculating up to a proportion.
T_yType of y variable (should be std::vector<int>).
T_locLocation type.
T_cutCut-point type.
Parameters
yArray of integers
lambdaVector of continuous location variables.
carray of Positive increasing vectors of cutpoints.
Returns
Log probability of outcome given location and cutpoints.
Exceptions
std::domain_errorIf the outcome is not between 1 and the number of cutpoints plus 2; if the cutpoint vector is empty; if the cutpoint vector contains a non-positive, non-finite value; or if the cutpoint vector is not sorted in ascending order.
std::invalid_argumentIf y and lambda are different lengths, or if y and the array of cutpoints are of different lengths.

Definition at line 168 of file ordered_probit_lpmf.hpp.

◆ ordered_probit_lpmf() [6/6]

template<typename T_loc , typename T_cut >
return_type<T_loc, T_cut>::type stan::math::ordered_probit_lpmf ( const std::vector< int > &  y,
const Eigen::Matrix< T_loc, Eigen::Dynamic, 1 > &  lambda,
const std::vector< Eigen::Matrix< T_cut, Eigen::Dynamic, 1 > > &  c 
)

Definition at line 210 of file ordered_probit_lpmf.hpp.

◆ ordered_probit_rng()

template<class RNG >
int stan::math::ordered_probit_rng ( double  eta,
const Eigen::VectorXd &  c,
RNG &  rng 
)
inline

Definition at line 15 of file ordered_probit_rng.hpp.

◆ out_of_range()

void stan::math::out_of_range ( const char *  function,
int  max,
int  index,
const char *  msg1 = "",
const char *  msg2 = "" 
)
inline

Throw an out_of_range exception with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing out of range. This will allow us to change the behavior for all functions at once. The message is: "<function>: index <index> out of range; expecting index to be between " "1 and <max><msg1><msg2>"

Parameters
functionName of the function
maxMax
indexIndex
msg1Message to print. Default is "".
msg2Message to print. Default is "".
Exceptions
std::out_of_rangewith message.

Definition at line 27 of file out_of_range.hpp.

◆ owens_t() [1/7]

template<typename T >
fvar<T> stan::math::owens_t ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Return Owen's T function applied to the specified arguments.

Parameters
x1First argument.
x2Second argument.
Returns
Owen's T function applied to the specified arguments.

Definition at line 24 of file owens_t.hpp.

◆ owens_t() [2/7]

template<typename T >
fvar<T> stan::math::owens_t ( double  x1,
const fvar< T > &  x2 
)
inline

Return Owen's T function applied to the specified arguments.

Parameters
x1First argument.
x2Second argument.
Returns
Owen's T function applied to the specified arguments.

Definition at line 45 of file owens_t.hpp.

◆ owens_t() [3/7]

double stan::math::owens_t ( double  h,
double  a 
)
inline

Return the result of applying Owen's T function to the specified arguments.

Used to compute the cumulative density function for the skew normal distribution.

\[ \mbox{owens\_t}(h, a) = \begin{cases} \mbox{owens\_t}(h, a) & \mbox{if } -\infty\leq h, a \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } h = \textrm{NaN or } a = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{owens\_t}(h, a)}{\partial h} = \begin{cases} \frac{\partial\, \mbox{owens\_t}(h, a)}{\partial h} & \mbox{if } -\infty\leq h, a\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } h = \textrm{NaN or } a = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{owens\_t}(h, a)}{\partial a} = \begin{cases} \frac{\partial\, \mbox{owens\_t}(h, a)}{\partial a} & \mbox{if } -\infty\leq h, a\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } h = \textrm{NaN or } a = \textrm{NaN} \end{cases} \]

\[ \mbox{owens\_t}(h, a) = \frac{1}{2\pi} \int_0^a \frac{\exp(-\frac{1}{2}h^2(1+x^2))}{1+x^2}dx \]

\[ \frac{\partial \, \mbox{owens\_t}(h, a)}{\partial h} = -\frac{1}{2\sqrt{2\pi}} \operatorname{erf}\left(\frac{ha}{\sqrt{2}}\right) \exp\left(-\frac{h^2}{2}\right) \]

\[ \frac{\partial \, \mbox{owens\_t}(h, a)}{\partial a} = \frac{\exp\left(-\frac{1}{2}h^2(1+a^2)\right)}{2\pi (1+a^2)} \]

Parameters
hFirst argument
aSecond argument
Returns
Owen's T function applied to the arguments.

Definition at line 57 of file owens_t.hpp.

◆ owens_t() [4/7]

template<typename T >
fvar<T> stan::math::owens_t ( const fvar< T > &  x1,
double  x2 
)
inline

Return Owen's T function applied to the specified arguments.

Parameters
x1First argument.
x2Second argument.
Returns
Owen's T function applied to the specified arguments.

Definition at line 63 of file owens_t.hpp.

◆ owens_t() [5/7]

var stan::math::owens_t ( const var h,
const var a 
)
inline

The Owen's T function of h and a.

Used to compute the cumulative density function for the skew normal distribution.

Parameters
hvar parameter.
avar parameter.
Returns
The Owen's T function.

Definition at line 64 of file owens_t.hpp.

◆ owens_t() [6/7]

var stan::math::owens_t ( const var h,
double  a 
)
inline

The Owen's T function of h and a.

Used to compute the cumulative density function for the skew normal distribution.

Parameters
hvar parameter.
adouble parameter.
Returns
The Owen's T function.

Definition at line 78 of file owens_t.hpp.

◆ owens_t() [7/7]

var stan::math::owens_t ( double  h,
const var a 
)
inline

The Owen's T function of h and a.

Used to compute the cumulative density function for the skew normal distribution.

Parameters
hdouble parameter.
avar parameter.
Returns
The Owen's T function.

Definition at line 92 of file owens_t.hpp.

◆ packed_copy() [1/2]

template<TriangularViewCL triangular_view>
std::vector<double> stan::math::packed_copy ( const matrix_cl src)
inline

Packs the flat triagnular matrix on the OpenCL device and copies it to the std::vector.

Template Parameters
triangular_viewthe triangularity of the source matrix
Parameters
srcthe flat triangular source matrix on the OpenCL device
Returns
the packed std::vector

Definition at line 108 of file copy.hpp.

◆ packed_copy() [2/2]

template<TriangularViewCL triangular_view>
matrix_cl stan::math::packed_copy ( const std::vector< double > &  src,
int  rows 
)
inline

Copies the packed triangular matrix from the source std::vector to an OpenCL buffer and unpacks it to a flat matrix on the OpenCL device.

Template Parameters
triangular_viewthe triangularity of the source matrix
Parameters
srcthe packed source std::vector
rowsthe number of rows in the flat matrix
Returns
the destination flat matrix on the OpenCL device
Exceptions
<code>std::invalid_argument</code>if the size of the vector does not match the expected size for the packed triangular matrix

Definition at line 148 of file copy.hpp.

◆ pareto_ccdf_log()

template<typename T_y , typename T_scale , typename T_shape >
return_type<T_y, T_scale, T_shape>::type stan::math::pareto_ccdf_log ( const T_y &  y,
const T_scale &  y_min,
const T_shape &  alpha 
)
Deprecated:
use pareto_lccdf

Definition at line 14 of file pareto_ccdf_log.hpp.

◆ pareto_cdf()

template<typename T_y , typename T_scale , typename T_shape >
return_type<T_y, T_scale, T_shape>::type stan::math::pareto_cdf ( const T_y &  y,
const T_scale &  y_min,
const T_shape &  alpha 
)

Definition at line 18 of file pareto_cdf.hpp.

◆ pareto_cdf_log()

template<typename T_y , typename T_scale , typename T_shape >
return_type<T_y, T_scale, T_shape>::type stan::math::pareto_cdf_log ( const T_y &  y,
const T_scale &  y_min,
const T_shape &  alpha 
)
Deprecated:
use pareto_lcdf

Definition at line 14 of file pareto_cdf_log.hpp.

◆ pareto_lccdf()

template<typename T_y , typename T_scale , typename T_shape >
return_type<T_y, T_scale, T_shape>::type stan::math::pareto_lccdf ( const T_y &  y,
const T_scale &  y_min,
const T_shape &  alpha 
)

Definition at line 19 of file pareto_lccdf.hpp.

◆ pareto_lcdf()

template<typename T_y , typename T_scale , typename T_shape >
return_type<T_y, T_scale, T_shape>::type stan::math::pareto_lcdf ( const T_y &  y,
const T_scale &  y_min,
const T_shape &  alpha 
)

Definition at line 19 of file pareto_lcdf.hpp.

◆ pareto_log() [1/2]

template<bool propto, typename T_y , typename T_scale , typename T_shape >
return_type<T_y, T_scale, T_shape>::type stan::math::pareto_log ( const T_y &  y,
const T_scale &  y_min,
const T_shape &  alpha 
)
Deprecated:
use pareto_lpdf

Definition at line 14 of file pareto_log.hpp.

◆ pareto_log() [2/2]

template<typename T_y , typename T_scale , typename T_shape >
return_type<T_y, T_scale, T_shape>::type stan::math::pareto_log ( const T_y &  y,
const T_scale &  y_min,
const T_shape &  alpha 
)
inline
Deprecated:
use pareto_lpdf

Definition at line 23 of file pareto_log.hpp.

◆ pareto_lpdf() [1/2]

template<bool propto, typename T_y , typename T_scale , typename T_shape >
return_type<T_y, T_scale, T_shape>::type stan::math::pareto_lpdf ( const T_y &  y,
const T_scale &  y_min,
const T_shape &  alpha 
)

Definition at line 18 of file pareto_lpdf.hpp.

◆ pareto_lpdf() [2/2]

template<typename T_y , typename T_scale , typename T_shape >
return_type<T_y, T_scale, T_shape>::type stan::math::pareto_lpdf ( const T_y &  y,
const T_scale &  y_min,
const T_shape &  alpha 
)
inline

Definition at line 101 of file pareto_lpdf.hpp.

◆ pareto_rng()

template<typename T_shape , typename T_scale , class RNG >
VectorBuilder<true, double, T_shape, T_scale>::type stan::math::pareto_rng ( const T_scale &  y_min,
const T_shape &  alpha,
RNG &  rng 
)
inline

Return a Pareto random variate for the given shape and scale parameters using the specified random number generator.

y_min and alpha can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_scaleType of scale parameter
T_shapeType of shape parameter
RNGtype of random number generator
Parameters
y_min(Sequence of) positive scale parameter(s)
alpha(Sequence of) positive shape parameter(s)
rngrandom number generator
Returns
(Sequence of) Pareto random variate(s)
Exceptions
std::domain_errorif y_min or alpha are nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 32 of file pareto_rng.hpp.

◆ pareto_type_2_ccdf_log()

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::pareto_type_2_ccdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  lambda,
const T_shape &  alpha 
)
Deprecated:
use pareto_type_2_lccdf

Definition at line 14 of file pareto_type_2_ccdf_log.hpp.

◆ pareto_type_2_cdf()

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::pareto_type_2_cdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  lambda,
const T_shape &  alpha 
)

Definition at line 18 of file pareto_type_2_cdf.hpp.

◆ pareto_type_2_cdf_log()

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::pareto_type_2_cdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  lambda,
const T_shape &  alpha 
)
Deprecated:
use pareto_type_2_lcdf

Definition at line 14 of file pareto_type_2_cdf_log.hpp.

◆ pareto_type_2_lccdf()

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::pareto_type_2_lccdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  lambda,
const T_shape &  alpha 
)

Definition at line 18 of file pareto_type_2_lccdf.hpp.

◆ pareto_type_2_lcdf()

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::pareto_type_2_lcdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  lambda,
const T_shape &  alpha 
)

Definition at line 19 of file pareto_type_2_lcdf.hpp.

◆ pareto_type_2_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::pareto_type_2_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  lambda,
const T_shape &  alpha 
)
Deprecated:
use pareto_type_2_lpdf

Definition at line 15 of file pareto_type_2_log.hpp.

◆ pareto_type_2_log() [2/2]

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::pareto_type_2_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  lambda,
const T_shape &  alpha 
)
inline
Deprecated:
use pareto_type_2_lpdf

Definition at line 27 of file pareto_type_2_log.hpp.

◆ pareto_type_2_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::pareto_type_2_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  lambda,
const T_shape &  alpha 
)

Definition at line 21 of file pareto_type_2_lpdf.hpp.

◆ pareto_type_2_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::pareto_type_2_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  lambda,
const T_shape &  alpha 
)
inline

Definition at line 119 of file pareto_type_2_lpdf.hpp.

◆ pareto_type_2_rng()

template<typename T_loc , typename T_scale , typename T_shape , class RNG >
VectorBuilder<true, double, T_loc, T_scale, T_shape>::type stan::math::pareto_type_2_rng ( const T_loc &  mu,
const T_scale &  lambda,
const T_shape &  alpha,
RNG &  rng 
)
inline

Return a Pareto type 2 random variate for the given location, scale, and shape using the specified random number generator.

mu, lambda, and alpha can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_locType of location parameter
T_scaleType of scale parameter
T_shapeType of shape parameter
RNGtype of random number generator
Parameters
mu(Sequence of) location parameter(s)
lambda(Sequence of) scale parameter(s)
alpha(Sequence of) shape parameter(s)
rngrandom number generator
Returns
(Sequence of) Pareto type 2 random variate(s)
Exceptions
std::domain_errorif mu is infinite or lambda or alpha are nonpositive,
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 39 of file pareto_type_2_rng.hpp.

◆ partial_derivative()

template<typename T , typename F >
void stan::math::partial_derivative ( const F &  f,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
int  n,
T &  fx,
T &  dfx_dxn 
)

Return the partial derivative of the specified multiivariate function at the specified argument.

Template Parameters
TArgument type
FFunction type
Parameters
fFunction
[in]xArgument vector
[in]nIndex of argument with which to take derivative
[out]fxValue of function applied to argument
[out]dfx_dxnValue of partial derivative

Definition at line 25 of file partial_derivative.hpp.

◆ Phi() [1/4]

template<typename T >
fvar<T> stan::math::Phi ( const fvar< T > &  x)
inline

Definition at line 13 of file Phi.hpp.

◆ Phi() [2/4]

double stan::math::Phi ( double  x)
inline

The unit normal cumulative distribution function.

The return value for a specified input is the probability that a random unit normal variate is less than or equal to the specified value, defined by

$\Phi(x) = \int_{-\infty}^x \mbox{\sf Norm}(x|0, 1) \ dx$

This function can be used to implement the inverse link function for probit regression.

Phi will underflow to 0 below -37.5 and overflow to 1 above 8

Parameters
xArgument.
Returns
Probability random sample is less than or equal to argument.

Definition at line 30 of file Phi.hpp.

◆ Phi() [3/4]

template<typename T >
apply_scalar_unary<Phi_fun, T>::return_t stan::math::Phi ( const T &  x)
inline

Vectorized version of Phi().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Unit normal CDF of each value in x.

Definition at line 30 of file Phi.hpp.

◆ Phi() [4/4]

var stan::math::Phi ( const var a)
inline

The unit normal cumulative density function for variables (stan).

See Phi() for the double-based version.

The derivative is the unit normal density function,

$\frac{d}{dx} \Phi(x) = \mbox{\sf Norm}(x|0, 1) = \frac{1}{\sqrt{2\pi}} \exp(-\frac{1}{2} x^2)$.

\[ \mbox{Phi}(x) = \begin{cases} 0 & \mbox{if } x < -37.5 \\ \Phi(x) & \mbox{if } -37.5 \leq x \leq 8.25 \\ 1 & \mbox{if } x > 8.25 \\[6pt] \textrm{error} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{Phi}(x)}{\partial x} = \begin{cases} 0 & \mbox{if } x < -27.5 \\ \frac{\partial\, \Phi(x)}{\partial x} & \mbox{if } -27.5 \leq x \leq 27.5 \\ 0 & \mbox{if } x > 27.5 \\[6pt] \textrm{error} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \Phi(x) = \frac{1}{\sqrt{2\pi}} \int_{0}^{x} e^{-t^2/2} dt \]

\[ \frac{\partial \, \Phi(x)}{\partial x} = \frac{e^{-x^2/2}}{\sqrt{2\pi}} \]

Parameters
aVariable argument.
Returns
The unit normal cdf evaluated at the specified argument.

Definition at line 64 of file Phi.hpp.

◆ Phi_approx() [1/5]

double stan::math::Phi_approx ( double  x)
inline

Return an approximation of the unit normal CDF.

http://www.jiem.org/index.php/jiem/article/download/60/27

This function can be used to implement the inverse link function for probit regression.

Parameters
xArgument.
Returns
Probability random sample is less than or equal to argument.

Definition at line 22 of file Phi_approx.hpp.

◆ Phi_approx() [2/5]

template<typename T >
fvar<T> stan::math::Phi_approx ( const fvar< T > &  x)
inline

Return an approximation of the unit normal cumulative distribution function (CDF).

Template Parameters
Tscalar type of forward-mode autodiff variable argument.
Parameters
xargument
Returns
approximate probability random sample is less than or equal to argument

Definition at line 23 of file Phi_approx.hpp.

◆ Phi_approx() [3/5]

double stan::math::Phi_approx ( int  x)
inline

Return an approximation of the unit normal CDF.

Parameters
xargument.
Returns
approximate probability random sample is less than or equal to argument.

Definition at line 34 of file Phi_approx.hpp.

◆ Phi_approx() [4/5]

template<typename T >
apply_scalar_unary<Phi_approx_fun, T>::return_t stan::math::Phi_approx ( const T &  x)
inline

Return the elementwise application of Phi_approx() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
Tcontainer type
Parameters
xcontainer
Returns
elementwise Phi_approx of container elements

Definition at line 39 of file Phi_approx.hpp.

◆ Phi_approx() [5/5]

var stan::math::Phi_approx ( const var a)
inline

Approximation of the unit normal CDF for variables (stan).

http://www.jiem.org/index.php/jiem/article/download/60/27

\[ \mbox{Phi\_approx}(x) = \begin{cases} \Phi_{\mbox{\footnotesize approx}}(x) & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{Phi\_approx}(x)}{\partial x} = \begin{cases} \frac{\partial\, \Phi_{\mbox{\footnotesize approx}}(x)}{\partial x} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \Phi_{\mbox{\footnotesize approx}}(x) = \mbox{logit}^{-1}(0.07056 \, x^3 + 1.5976 \, x) \]

\[ \frac{\partial \, \Phi_{\mbox{\footnotesize approx}}(x)}{\partial x} = -\Phi_{\mbox{\footnotesize approx}}^2(x) e^{-0.07056x^3 - 1.5976x}(-0.21168x^2-1.5976) \]

Parameters
aVariable argument.
Returns
The corresponding unit normal cdf approximation.

Definition at line 46 of file Phi_approx.hpp.

◆ pi()

double stan::math::pi ( )
inline

Return the value of pi.

Returns
Pi.

Definition at line 80 of file constants.hpp.

◆ poisson_ccdf_log()

template<typename T_n , typename T_rate >
return_type<T_rate>::type stan::math::poisson_ccdf_log ( const T_n &  n,
const T_rate &  lambda 
)
Deprecated:
use poisson_lccdf

Definition at line 14 of file poisson_ccdf_log.hpp.

◆ poisson_cdf()

template<typename T_n , typename T_rate >
return_type<T_rate>::type stan::math::poisson_cdf ( const T_n &  n,
const T_rate &  lambda 
)

Definition at line 20 of file poisson_cdf.hpp.

◆ poisson_cdf_log()

template<typename T_n , typename T_rate >
return_type<T_rate>::type stan::math::poisson_cdf_log ( const T_n &  n,
const T_rate &  lambda 
)
Deprecated:
use poisson_lcdf

Definition at line 14 of file poisson_cdf_log.hpp.

◆ poisson_lccdf()

template<typename T_n , typename T_rate >
return_type<T_rate>::type stan::math::poisson_lccdf ( const T_n &  n,
const T_rate &  lambda 
)

Definition at line 19 of file poisson_lccdf.hpp.

◆ poisson_lcdf()

template<typename T_n , typename T_rate >
return_type<T_rate>::type stan::math::poisson_lcdf ( const T_n &  n,
const T_rate &  lambda 
)

Definition at line 20 of file poisson_lcdf.hpp.

◆ poisson_log() [1/2]

template<bool propto, typename T_n , typename T_rate >
return_type<T_rate>::type stan::math::poisson_log ( const T_n &  n,
const T_rate &  lambda 
)
Deprecated:
use poisson_lpmf

Definition at line 14 of file poisson_log.hpp.

◆ poisson_log() [2/2]

template<typename T_n , typename T_rate >
return_type<T_rate>::type stan::math::poisson_log ( const T_n &  n,
const T_rate &  lambda 
)
inline
Deprecated:
use poisson_lpmf

Definition at line 23 of file poisson_log.hpp.

◆ poisson_log_glm_log() [1/2]

template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type<T_x, T_alpha, T_beta>::type stan::math::poisson_log_glm_log ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta 
)
Deprecated:
use poisson_logit_glm_lpmf

Definition at line 15 of file poisson_log_glm_log.hpp.

◆ poisson_log_glm_log() [2/2]

template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type<T_x, T_alpha, T_beta>::type stan::math::poisson_log_glm_log ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta 
)
inline
Deprecated:
use poisson_logit_glm_lpmf

Definition at line 25 of file poisson_log_glm_log.hpp.

◆ poisson_log_glm_lpmf() [1/2]

template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type<T_x, T_alpha, T_beta>::type stan::math::poisson_log_glm_lpmf ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta 
)

Returns the log PMF of the Generalized Linear Model (GLM) with Poisson distribution and log link function.

The idea is that poisson_log_glm_lpmf(y, x, alpha, beta) should compute a more efficient version of poisson_log_lpmf(y, alpha + x * beta) by using analytically simplified gradients. If containers are supplied, returns the log sum of the probabilities.

Template Parameters
T_ytype of vector of variates (labels), integers >=0; this can also be a single positive integer;
T_xtype of the matrix of covariates (features); this should be an Eigen::Matrix type whose number of rows should match the length of y and whose number of columns should match the length of beta
T_alphatype of the intercept(s); this can be a vector (of the same length as y) of intercepts or a single value (for models with constant intercept);
T_betatype of the weight vector; this can also be a single value;
Parameters
ypositive integer vector parameter
xdesign matrix
alphaintercept (in log odds)
betaweight vector
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif x, beta or alpha is infinite.
std::domain_errorif y is negative.
std::invalid_argumentif container sizes mismatch.

Definition at line 46 of file poisson_log_glm_lpmf.hpp.

◆ poisson_log_glm_lpmf() [2/2]

template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type<T_x, T_alpha, T_beta>::type stan::math::poisson_log_glm_lpmf ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta 
)
inline

Definition at line 128 of file poisson_log_glm_lpmf.hpp.

◆ poisson_log_log() [1/2]

template<bool propto, typename T_n , typename T_log_rate >
return_type<T_log_rate>::type stan::math::poisson_log_log ( const T_n &  n,
const T_log_rate &  alpha 
)
Deprecated:
use poisson_log_lpmf

Definition at line 14 of file poisson_log_log.hpp.

◆ poisson_log_log() [2/2]

template<typename T_n , typename T_log_rate >
return_type<T_log_rate>::type stan::math::poisson_log_log ( const T_n &  n,
const T_log_rate &  alpha 
)
inline
Deprecated:
use poisson_log_lpmf

Definition at line 23 of file poisson_log_log.hpp.

◆ poisson_log_lpmf() [1/2]

template<bool propto, typename T_n , typename T_log_rate >
return_type<T_log_rate>::type stan::math::poisson_log_lpmf ( const T_n &  n,
const T_log_rate &  alpha 
)

Definition at line 20 of file poisson_log_lpmf.hpp.

◆ poisson_log_lpmf() [2/2]

template<typename T_n , typename T_log_rate >
return_type<T_log_rate>::type stan::math::poisson_log_lpmf ( const T_n &  n,
const T_log_rate &  alpha 
)
inline

Definition at line 81 of file poisson_log_lpmf.hpp.

◆ poisson_log_rng()

template<typename T_rate , class RNG >
VectorBuilder<true, int, T_rate>::type stan::math::poisson_log_rng ( const T_rate &  alpha,
RNG &  rng 
)
inline

Return a Poisson random variate with specified log rate parameter using the given random number generator.

lambda can be a scalar or a one-dimensional container.

Template Parameters
T_ratetype of log rate parameter
RNGtype of random number generator
Parameters
alpha(Sequence of) log rate parameter(s)
rngrandom number generator
Returns
(Sequence of) Poisson random variate(s)
Exceptions
std::domain_errorif alpha is nonfinite

Definition at line 27 of file poisson_log_rng.hpp.

◆ poisson_lpmf() [1/2]

template<bool propto, typename T_n , typename T_rate >
return_type<T_rate>::type stan::math::poisson_lpmf ( const T_n &  n,
const T_rate &  lambda 
)

Definition at line 21 of file poisson_lpmf.hpp.

◆ poisson_lpmf() [2/2]

template<typename T_n , typename T_rate >
return_type<T_rate>::type stan::math::poisson_lpmf ( const T_n &  n,
const T_rate &  lambda 
)
inline

Definition at line 72 of file poisson_lpmf.hpp.

◆ poisson_rng()

template<typename T_rate , class RNG >
VectorBuilder<true, int, T_rate>::type stan::math::poisson_rng ( const T_rate &  lambda,
RNG &  rng 
)
inline

Return a Poisson random variate with specified rate parameter using the given random number generator.

lambda can be a scalar or a one-dimensional container.

Template Parameters
T_ratetype of rate parameter
RNGtype of random number generator
Parameters
lambda(Sequence of) rate parameter(s)
rngrandom number generator
Returns
(Sequence of) Poisson random variate(s)
Exceptions
std::domain_errorif lambda is nonpositive

Definition at line 29 of file poisson_rng.hpp.

◆ positive_constrain() [1/2]

template<typename T >
T stan::math::positive_constrain ( const T &  x)
inline

Return the positive value for the specified unconstrained input.

The transform applied is

$f(x) = \exp(x)$.

Parameters
xArbitrary input scalar.
Returns
Input transformed to be positive.

Definition at line 21 of file positive_constrain.hpp.

◆ positive_constrain() [2/2]

template<typename T >
T stan::math::positive_constrain ( const T &  x,
T &  lp 
)
inline

Return the positive value for the specified unconstrained input, incrementing the scalar reference with the log absolute Jacobian determinant.

See positive_constrain(T) for details of the transform. The log absolute Jacobian determinant is

$\log | \frac{d}{dx} \mbox{exp}(x) | = \log | \mbox{exp}(x) | = x$.

Template Parameters
Ttype of unconstrained value
Parameters
xunconstrained value
lplog density reference.
Returns
positive constrained version of unconstrained value

Definition at line 43 of file positive_constrain.hpp.

◆ positive_free()

template<typename T >
T stan::math::positive_free ( const T &  y)
inline

Return the unconstrained value corresponding to the specified positive-constrained value.

The transform is the inverse of the transform $f$ applied by positive_constrain(T), namely

$f^{-1}(x) = \log(x)$.

The input is validated using check_positive().

Parameters
yInput scalar.
Returns
Unconstrained value that produces the input when constrained.
Template Parameters
TType of scalar.
Exceptions
std::domain_errorif the variable is negative

Definition at line 28 of file positive_free.hpp.

◆ positive_infinity()

double stan::math::positive_infinity ( )
inline

Return positive infinity.

Returns
Positive infinity.

Definition at line 108 of file constants.hpp.

◆ positive_ordered_constrain() [1/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::positive_ordered_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x)

Return an increasing positive ordered vector derived from the specified free vector.

The returned constrained vector will have the same dimensionality as the specified free vector.

Parameters
xFree vector of scalars.
Returns
Positive, increasing ordered vector.
Template Parameters
TType of scalar.

Definition at line 21 of file positive_ordered_constrain.hpp.

◆ positive_ordered_constrain() [2/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::positive_ordered_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x,
T &  lp 
)
inline

Return a positive valued, increasing positive ordered vector derived from the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.

The returned constrained vector will have the same dimensionality as the specified free vector.

Parameters
xFree vector of scalars.
lpLog probability reference.
Returns
Positive, increasing ordered vector.
Template Parameters
TType of scalar.

Definition at line 51 of file positive_ordered_constrain.hpp.

◆ positive_ordered_constrain() [3/3]

Eigen::Matrix<var, Eigen::Dynamic, 1> stan::math::positive_ordered_constrain ( const Eigen::Matrix< var, Eigen::Dynamic, 1 > &  x)
inline

Return an increasing positive ordered vector derived from the specified free vector.

The returned constrained vector will have the same dimensionality as the specified free vector.

Parameters
xFree vector of scalars
Returns
Positive, increasing ordered vector

Definition at line 84 of file positive_ordered_constrain.hpp.

◆ positive_ordered_free()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::positive_ordered_free ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  y)

Return the vector of unconstrained scalars that transform to the specified positive ordered vector.

This function inverts the constraining operation defined in positive_ordered_constrain(Matrix),

Parameters
yVector of positive, ordered scalars.
Returns
Free vector that transforms into the input vector.
Template Parameters
TType of scalar.
Exceptions
std::domain_errorif y is not a vector of positive, ordered scalars.

Definition at line 25 of file positive_ordered_free.hpp.

◆ pow() [1/6]

template<typename T >
fvar<T> stan::math::pow ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Definition at line 16 of file pow.hpp.

◆ pow() [2/6]

template<typename T >
fvar<T> stan::math::pow ( double  x1,
const fvar< T > &  x2 
)
inline

Definition at line 25 of file pow.hpp.

◆ pow() [3/6]

template<typename T >
fvar<T> stan::math::pow ( const fvar< T > &  x1,
double  x2 
)
inline

Definition at line 33 of file pow.hpp.

◆ pow() [4/6]

var stan::math::pow ( const var base,
const var exponent 
)
inline

Return the base raised to the power of the exponent (cmath).

The partial derivatives are

$\frac{\partial}{\partial x} \mbox{pow}(x, y) = y x^{y-1}$, and

$\frac{\partial}{\partial y} \mbox{pow}(x, y) = x^y \ \log x$.

\[ \mbox{pow}(x, y) = \begin{cases} x^y & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{pow}(x, y)}{\partial x} = \begin{cases} yx^{y-1} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{pow}(x, y)}{\partial y} = \begin{cases} x^y\ln x & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
baseBase variable.
exponentExponent variable.
Returns
Base raised to the exponent.

Definition at line 105 of file pow.hpp.

◆ pow() [5/6]

var stan::math::pow ( const var base,
double  exponent 
)
inline

Return the base variable raised to the power of the exponent scalar (cmath).

The derivative for the variable is

$\frac{d}{dx} \mbox{pow}(x, c) = c x^{c-1}$.

Parameters
baseBase variable.
exponentExponent scalar.
Returns
Base raised to the exponent.

Definition at line 121 of file pow.hpp.

◆ pow() [6/6]

var stan::math::pow ( double  base,
const var exponent 
)
inline

Return the base scalar raised to the power of the exponent variable (cmath).

The derivative for the variable is

$\frac{d}{d y} \mbox{pow}(c, y) = c^y \log c $.

Parameters
baseBase scalar.
exponentExponent variable.
Returns
Base raised to the exponent.

Definition at line 149 of file pow.hpp.

◆ precomputed_gradients()

var stan::math::precomputed_gradients ( double  value,
const std::vector< var > &  operands,
const std::vector< double > &  gradients 
)
inline

This function returns a var for an expression that has the specified value, vector of operands, and vector of partial derivatives of value with respect to the operands.

Parameters
[in]valueThe value of the resulting dependent variable.
[in]operandsoperands.
[in]gradientsvector of partial derivatives of result with respect to operands.
Returns
An auto-diff variable that uses the precomputed gradients provided.

Definition at line 88 of file precomputed_gradients.hpp.

◆ primitive_value() [1/4]

double stan::math::primitive_value ( const var v)
inline

Return the primitive double value for the specified auto-diff variable.

Parameters
vinput variable.
Returns
value of input.

Definition at line 18 of file primitive_value.hpp.

◆ primitive_value() [2/4]

template<typename T >
double stan::math::primitive_value ( const fvar< T > &  v)
inline

Return the primitive value of the specified forward-mode autodiff variable.

This function applies recursively to higher-order autodiff types to return a primitive double value.

Template Parameters
Tscalar type for autodiff variable.
Parameters
vinput variable.
Returns
primitive value of input.

Definition at line 21 of file primitive_value.hpp.

◆ primitive_value() [3/4]

template<typename T >
std::enable_if<std::is_arithmetic<T>::value, T>::type stan::math::primitive_value ( x)
inline

Return the value of the specified arithmetic argument unmodified with its own declared type.

This template function can only be instantiated with arithmetic types as defined by std library's is_arithmetic trait metaprogram.

This function differs from value_of in that it does not cast all return types to double.

Template Parameters
Ttype of arithmetic input.
Parameters
xinput.
Returns
input unmodified.

Definition at line 28 of file primitive_value.hpp.

◆ primitive_value() [4/4]

template<typename T >
std::enable_if<!std::is_arithmetic<T>::value, double>::type stan::math::primitive_value ( const T &  x)
inline

Return the primitive value of the specified argument.

This implementation only applies to non-arithmetic types as defined by std libray's is_arithmetic trait metaprogram.

Template Parameters
Ttype of non-arithmetic input.
Parameters
xinput.
Returns
value of input.

Definition at line 44 of file primitive_value.hpp.

◆ print_mat_size()

template<int N>
void stan::math::print_mat_size ( std::ostream &  o)
inline

Helper function to return the matrix size as either "dynamic" or "1".

Template Parameters
NEigen matrix size specification
Parameters
ooutput stream

Definition at line 25 of file assign.hpp.

◆ print_stack()

void stan::math::print_stack ( std::ostream &  o)
inline

Prints the auto-dif variable stack.

This function is used for debugging purposes.

Only works if all members of stack are vari* as it casts to vari*.

Parameters
oostream to modify

Definition at line 20 of file print_stack.hpp.

◆ prob_constrain() [1/2]

template<typename T >
T stan::math::prob_constrain ( const T &  x)
inline

Return a probability value constrained to fall between 0 and 1 (inclusive) for the specified free scalar.

The transform is the inverse logit,

$f(x) = \mbox{logit}^{-1}(x) = \frac{1}{1 + \exp(x)}$.

Template Parameters
Ttype of scalar
Parameters
[in]xunconstrained value
Returns
result constrained to fall in (0, 1)

Definition at line 25 of file prob_constrain.hpp.

◆ prob_constrain() [2/2]

template<typename T >
T stan::math::prob_constrain ( const T &  x,
T &  lp 
)
inline

Return a probability value constrained to fall between 0 and 1 (inclusive) for the specified free scalar and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.

The transform is as defined for prob_constrain(T). The log absolute Jacobian determinant is

The log absolute Jacobian determinant is

$\log | \frac{d}{dx} \mbox{logit}^{-1}(x) |$

$\log ((\mbox{logit}^{-1}(x)) (1 - \mbox{logit}^{-1}(x))$

$\log (\mbox{logit}^{-1}(x)) + \log (1 - \mbox{logit}^{-1}(x))$.

Template Parameters
Ttype of scalar
Parameters
[in]xunconstrained value
[in,out]lplog density
Returns
result constrained to fall in (0, 1)

Definition at line 50 of file prob_constrain.hpp.

◆ prob_free()

template<typename T >
T stan::math::prob_free ( const T &  y)
inline

Return the free scalar that when transformed to a probability produces the specified scalar.

The function that reverses the constraining transform specified in prob_constrain(T) is the logit function,

$f^{-1}(y) = \mbox{logit}(y) = \frac{1 - y}{y}$.

Template Parameters
Ttype of constrained value
Parameters
yconstrained value
Returns
corresponding unconstrained value
Exceptions
std::domain_errorif y is not in (0, 1)

Definition at line 27 of file prob_free.hpp.

◆ prod() [1/2]

template<typename T >
T stan::math::prod ( const std::vector< T > &  v)
inline

Returns the product of the coefficients of the specified standard vector.

Parameters
vSpecified vector.
Returns
Product of coefficients of vector.

Definition at line 17 of file prod.hpp.

◆ prod() [2/2]

template<typename T , int R, int C>
T stan::math::prod ( const Eigen::Matrix< T, R, C > &  v)
inline

Returns the product of the coefficients of the specified column vector.

Parameters
vSpecified vector.
Returns
Product of coefficients of vector.

Definition at line 31 of file prod.hpp.

◆ promote_common()

template<typename T1 , typename T2 , typename F >
common_type<T1, T2>::type stan::math::promote_common ( const F &  u)
inline

Return the result of promoting either a scalar or the scalar elements of a container to either of two specified types, as determined by stan::math::common_type.

Template Parameters
T1first type
T2second type
Ftype of container elements, must be either T1 or T2
Parameters
uelements to promote
Returns
the result of promoting elements

Definition at line 22 of file promote_common.hpp.

◆ promote_scalar()

template<typename T , typename S >
promote_scalar_type<T, S>::type stan::math::promote_scalar ( const S &  x)

This is the top-level function to call to promote the scalar types of an input of type S to type T.

Template Parameters
Tscalar type of output.
Sinput type.
Parameters
xinput vector.
Returns
input vector with scalars promoted to type T.

Definition at line 62 of file promote_scalar.hpp.

◆ qr_Q() [1/2]

template<typename T >
Eigen::Matrix<fvar<T>, Eigen::Dynamic, Eigen::Dynamic> stan::math::qr_Q ( const Eigen::Matrix< fvar< T >, Eigen::Dynamic, Eigen::Dynamic > &  m)

Definition at line 13 of file qr_Q.hpp.

◆ qr_Q() [2/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::qr_Q ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)

Returns the orthogonal factor of the fat QR decomposition.

Parameters
mMatrix.
Template Parameters
Tscalar type
Returns
Orthogonal matrix with maximal columns

Definition at line 19 of file qr_Q.hpp.

◆ qr_R() [1/2]

template<typename T >
Eigen::Matrix<fvar<T>, Eigen::Dynamic, Eigen::Dynamic> stan::math::qr_R ( const Eigen::Matrix< fvar< T >, Eigen::Dynamic, Eigen::Dynamic > &  m)

Definition at line 13 of file qr_R.hpp.

◆ qr_R() [2/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::qr_R ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)

Returns the upper triangular factor of the fat QR decomposition.

Parameters
mMatrix.
Template Parameters
Tscalar type
Returns
Upper triangular matrix with maximal rows

Definition at line 19 of file qr_R.hpp.

◆ qr_thin_Q()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::qr_thin_Q ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)

Returns the orthogonal factor of the thin QR decomposition.

Parameters
mMatrix.
Template Parameters
Tscalar type
Returns
Orthogonal matrix with minimal columns

Definition at line 19 of file qr_thin_Q.hpp.

◆ qr_thin_R()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::qr_thin_R ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)

Returns the upper triangular factor of the thin QR decomposition.

Parameters
mMatrix.
Template Parameters
Tscalar type
Returns
Upper triangular matrix with minimal rows

Definition at line 19 of file qr_thin_R.hpp.

◆ quad_form() [1/4]

template<int RA, int CA, int RB, int CB, typename T >
Eigen::Matrix<T, CB, CB> stan::math::quad_form ( const Eigen::Matrix< T, RA, CA > &  A,
const Eigen::Matrix< T, RB, CB > &  B 
)
inline

Compute B^T A B.

Definition at line 14 of file quad_form.hpp.

◆ quad_form() [2/4]

template<int RA, int CA, int RB, typename T >
T stan::math::quad_form ( const Eigen::Matrix< T, RA, CA > &  A,
const Eigen::Matrix< T, RB, 1 > &  B 
)
inline

Definition at line 22 of file quad_form.hpp.

◆ quad_form() [3/4]

template<typename Ta , int Ra, int Ca, typename Tb , int Rb, int Cb>
std::enable_if<std::is_same<Ta, var>::value || std::is_same<Tb, var>::value, Eigen::Matrix<var, Cb, Cb> >::type stan::math::quad_form ( const Eigen::Matrix< Ta, Ra, Ca > &  A,
const Eigen::Matrix< Tb, Rb, Cb > &  B 
)
inline

Definition at line 116 of file quad_form.hpp.

◆ quad_form() [4/4]

template<typename Ta , int Ra, int Ca, typename Tb , int Rb>
std::enable_if< std::is_same<Ta, var>::value || std::is_same<Tb, var>::value, var>::type stan::math::quad_form ( const Eigen::Matrix< Ta, Ra, Ca > &  A,
const Eigen::Matrix< Tb, Rb, 1 > &  B 
)
inline

Definition at line 130 of file quad_form.hpp.

◆ quad_form_diag()

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::quad_form_diag ( const Eigen::Matrix< T1, Eigen::Dynamic, Eigen::Dynamic > &  mat,
const Eigen::Matrix< T2, R, C > &  vec 
)
inline

Definition at line 16 of file quad_form_diag.hpp.

◆ quad_form_sym() [1/8]

template<int RA, int CA, int RB, int CB, typename T >
Eigen::Matrix<fvar<T>, CB, CB> stan::math::quad_form_sym ( const Eigen::Matrix< fvar< T >, RA, CA > &  A,
const Eigen::Matrix< double, RB, CB > &  B 
)
inline

Definition at line 12 of file quad_form_sym.hpp.

◆ quad_form_sym() [2/8]

template<int RA, int CA, int RB, int CB, typename T >
Eigen::Matrix<T, CB, CB> stan::math::quad_form_sym ( const Eigen::Matrix< T, RA, CA > &  A,
const Eigen::Matrix< T, RB, CB > &  B 
)
inline

Definition at line 13 of file quad_form_sym.hpp.

◆ quad_form_sym() [3/8]

template<typename Ta , int Ra, int Ca, typename Tb , int Rb, int Cb>
std::enable_if<std::is_same<Ta, var>::value || std::is_same<Tb, var>::value, Eigen::Matrix<var, Cb, Cb> >::type stan::math::quad_form_sym ( const Eigen::Matrix< Ta, Ra, Ca > &  A,
const Eigen::Matrix< Tb, Rb, Cb > &  B 
)
inline

Definition at line 20 of file quad_form_sym.hpp.

◆ quad_form_sym() [4/8]

template<int RA, int CA, int RB, typename T >
fvar<T> stan::math::quad_form_sym ( const Eigen::Matrix< fvar< T >, RA, CA > &  A,
const Eigen::Matrix< double, RB, 1 > &  B 
)
inline

Definition at line 23 of file quad_form_sym.hpp.

◆ quad_form_sym() [5/8]

template<int RA, int CA, int RB, typename T >
T stan::math::quad_form_sym ( const Eigen::Matrix< T, RA, CA > &  A,
const Eigen::Matrix< T, RB, 1 > &  B 
)
inline

Definition at line 23 of file quad_form_sym.hpp.

◆ quad_form_sym() [6/8]

template<int RA, int CA, int RB, int CB, typename T >
Eigen::Matrix<fvar<T>, CB, CB> stan::math::quad_form_sym ( const Eigen::Matrix< double, RA, CA > &  A,
const Eigen::Matrix< fvar< T >, RB, CB > &  B 
)
inline

Definition at line 31 of file quad_form_sym.hpp.

◆ quad_form_sym() [7/8]

template<typename Ta , int Ra, int Ca, typename Tb , int Rb>
std::enable_if< std::is_same<Ta, var>::value || std::is_same<Tb, var>::value, var>::type stan::math::quad_form_sym ( const Eigen::Matrix< Ta, Ra, Ca > &  A,
const Eigen::Matrix< Tb, Rb, 1 > &  B 
)
inline

Definition at line 35 of file quad_form_sym.hpp.

◆ quad_form_sym() [8/8]

template<int RA, int CA, int RB, typename T >
fvar<T> stan::math::quad_form_sym ( const Eigen::Matrix< double, RA, CA > &  A,
const Eigen::Matrix< fvar< T >, RB, 1 > &  B 
)
inline

Definition at line 42 of file quad_form_sym.hpp.

◆ rank()

template<typename C >
int stan::math::rank ( const C &  v,
int  s 
)
inline

Return the number of components of v less than v[s].

Template Parameters
Ccontainer type
Parameters
[in]vinput vector
[in]sposition in vector
Returns
number of components of v less than v[s].
Exceptions
std::out_of_rangeif s is out of range.

Definition at line 20 of file rank.hpp.

◆ rayleigh_ccdf_log()

template<typename T_y , typename T_scale >
return_type<T_y, T_scale>::type stan::math::rayleigh_ccdf_log ( const T_y &  y,
const T_scale &  sigma 
)
Deprecated:
use rayleigh_lccdf

Definition at line 14 of file rayleigh_ccdf_log.hpp.

◆ rayleigh_cdf()

template<typename T_y , typename T_scale >
return_type<T_y, T_scale>::type stan::math::rayleigh_cdf ( const T_y &  y,
const T_scale &  sigma 
)

Definition at line 18 of file rayleigh_cdf.hpp.

◆ rayleigh_cdf_log()

template<typename T_y , typename T_scale >
return_type<T_y, T_scale>::type stan::math::rayleigh_cdf_log ( const T_y &  y,
const T_scale &  sigma 
)
Deprecated:
use rayleigh_lcdf

Definition at line 14 of file rayleigh_cdf_log.hpp.

◆ rayleigh_lccdf()

template<typename T_y , typename T_scale >
return_type<T_y, T_scale>::type stan::math::rayleigh_lccdf ( const T_y &  y,
const T_scale &  sigma 
)

Definition at line 17 of file rayleigh_lccdf.hpp.

◆ rayleigh_lcdf()

template<typename T_y , typename T_scale >
return_type<T_y, T_scale>::type stan::math::rayleigh_lcdf ( const T_y &  y,
const T_scale &  sigma 
)

Definition at line 18 of file rayleigh_lcdf.hpp.

◆ rayleigh_log() [1/2]

template<bool propto, typename T_y , typename T_scale >
return_type<T_y, T_scale>::type stan::math::rayleigh_log ( const T_y &  y,
const T_scale &  sigma 
)
Deprecated:
use rayleigh_lpdf

Definition at line 14 of file rayleigh_log.hpp.

◆ rayleigh_log() [2/2]

template<typename T_y , typename T_scale >
return_type<T_y, T_scale>::type stan::math::rayleigh_log ( const T_y &  y,
const T_scale &  sigma 
)
inline
Deprecated:
use rayleigh_lpdf

Definition at line 23 of file rayleigh_log.hpp.

◆ rayleigh_lpdf() [1/2]

template<bool propto, typename T_y , typename T_scale >
return_type<T_y, T_scale>::type stan::math::rayleigh_lpdf ( const T_y &  y,
const T_scale &  sigma 
)

Definition at line 17 of file rayleigh_lpdf.hpp.

◆ rayleigh_lpdf() [2/2]

template<typename T_y , typename T_scale >
return_type<T_y, T_scale>::type stan::math::rayleigh_lpdf ( const T_y &  y,
const T_scale &  sigma 
)
inline

Definition at line 77 of file rayleigh_lpdf.hpp.

◆ rayleigh_rng()

template<typename T_scale , class RNG >
VectorBuilder<true, double, T_scale>::type stan::math::rayleigh_rng ( const T_scale &  sigma,
RNG &  rng 
)
inline

Return a Rayleigh random variate with scale parameter sigma using the specified random number generator.

sigma can be a scalar or a one-dimensional container.

Template Parameters
T_scaleType of scale parameter
RNGclass of random number generator
Parameters
sigma(Sequence of) positive scale parameter(s)
rngrandom number generator
Returns
(Sequence of) Rayleigh random variate(s)
Exceptions
std::domain_errorif sigma is nonpositive

Definition at line 26 of file rayleigh_rng.hpp.

◆ read_corr_L() [1/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::read_corr_L ( const Eigen::Array< T, Eigen::Dynamic, 1 > &  CPCs,
size_t  K 
)

Return the Cholesky factor of the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations.

It is generally better to work with the Cholesky factor rather than the correlation matrix itself when the determinant, inverse, etc. of the correlation matrix is needed for some statistical calculation.

See read_corr_matrix(Array, size_t, T) for more information.

Parameters
CPCsThe (K choose 2) canonical partial correlations in (-1, 1).
KDimensionality of correlation matrix.
Returns
Cholesky factor of correlation matrix for specified canonical partial correlations.
Template Parameters
TType of underlying scalar.

Definition at line 35 of file read_corr_L.hpp.

◆ read_corr_L() [2/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::read_corr_L ( const Eigen::Array< T, Eigen::Dynamic, 1 > &  CPCs,
size_t  K,
T &  log_prob 
)

Return the Cholesky factor of the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations, incrementing the specified scalar reference with the log absolute determinant of the Jacobian of the transformation.

The implementation is Ben Goodrich's Cholesky factor-based approach to the C-vine method of:

  • Daniel Lewandowski, Dorota Kurowicka, and Harry Joe, Generating random correlation matrices based on vines and extended onion method Journal of Multivariate Analysis 100 (2009) 1989–2001
Parameters
CPCsThe (K choose 2) canonical partial correlations in (-1, 1).
KDimensionality of correlation matrix.
log_probReference to variable to increment with the log Jacobian determinant.
Returns
Cholesky factor of correlation matrix for specified partial correlations.
Template Parameters
TType of underlying scalar.

Definition at line 88 of file read_corr_L.hpp.

◆ read_corr_matrix() [1/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::read_corr_matrix ( const Eigen::Array< T, Eigen::Dynamic, 1 > &  CPCs,
size_t  K 
)

Return the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations.

See read_corr_matrix(Array, size_t, T) for more information.

Parameters
CPCsThe (K choose 2) canonical partial correlations in (-1, 1).
KDimensionality of correlation matrix.
Returns
Cholesky factor of correlation matrix for specified canonical partial correlations.
Template Parameters
TType of underlying scalar.

Definition at line 25 of file read_corr_matrix.hpp.

◆ read_corr_matrix() [2/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::read_corr_matrix ( const Eigen::Array< T, Eigen::Dynamic, 1 > &  CPCs,
size_t  K,
T &  log_prob 
)

Return the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations, incrementing the specified scalar reference with the log absolute determinant of the Jacobian of the transformation.

It is usually preferable to utilize the version that returns the Cholesky factor of the correlation matrix rather than the correlation matrix itself in statistical calculations.

Parameters
CPCsThe (K choose 2) canonical partial correlations in (-1, 1).
KDimensionality of correlation matrix.
log_probReference to variable to increment with the log Jacobian determinant.
Returns
Correlation matrix for specified partial correlations.
Template Parameters
TType of underlying scalar.

Definition at line 50 of file read_corr_matrix.hpp.

◆ read_cov_L()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::read_cov_L ( const Eigen::Array< T, Eigen::Dynamic, 1 > &  CPCs,
const Eigen::Array< T, Eigen::Dynamic, 1 > &  sds,
T &  log_prob 
)

This is the function that should be called prior to evaluating the density of any elliptical distribution.

Parameters
CPCson (-1, 1)
sdson (0, inf)
log_probthe log probability value to increment with the Jacobian
Returns
Cholesky factor of covariance matrix for specified partial correlations.

Definition at line 21 of file read_cov_L.hpp.

◆ read_cov_matrix() [1/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::read_cov_matrix ( const Eigen::Array< T, Eigen::Dynamic, 1 > &  CPCs,
const Eigen::Array< T, Eigen::Dynamic, 1 > &  sds,
T &  log_prob 
)

A generally worse alternative to call prior to evaluating the density of an elliptical distribution.

Parameters
CPCson (-1, 1)
sdson (0, inf)
log_probthe log probability value to increment with the Jacobian
Returns
Covariance matrix for specified partial correlations.

Definition at line 21 of file read_cov_matrix.hpp.

◆ read_cov_matrix() [2/2]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::read_cov_matrix ( const Eigen::Array< T, Eigen::Dynamic, 1 > &  CPCs,
const Eigen::Array< T, Eigen::Dynamic, 1 > &  sds 
)

Builds a covariance matrix from CPCs and standard deviations.

Parameters
CPCsin (-1, 1)
sdsin (0, inf)

Definition at line 37 of file read_cov_matrix.hpp.

◆ recover_memory()

static void stan::math::recover_memory ( )
inlinestatic

Recover memory used for all variables for reuse.

Exceptions
std::logic_errorif empty_nested() returns false

Definition at line 18 of file recover_memory.hpp.

◆ recover_memory_nested()

static void stan::math::recover_memory_nested ( )
inlinestatic

Recover only the memory used for the top nested call.

If there is nothing on the nested stack, then a std::logic_error exception is thrown.

Exceptions
std::logic_errorif empty_nested() returns true

Definition at line 20 of file recover_memory_nested.hpp.

◆ rep_array() [1/3]

template<typename T >
std::vector<T> stan::math::rep_array ( const T &  x,
int  n 
)
inline

Definition at line 12 of file rep_array.hpp.

◆ rep_array() [2/3]

template<typename T >
std::vector<std::vector<T> > stan::math::rep_array ( const T &  x,
int  m,
int  n 
)
inline

Definition at line 18 of file rep_array.hpp.

◆ rep_array() [3/3]

template<typename T >
std::vector<std::vector<std::vector<T> > > stan::math::rep_array ( const T &  x,
int  k,
int  m,
int  n 
)
inline

Definition at line 26 of file rep_array.hpp.

◆ rep_matrix() [1/3]

template<typename T >
Eigen::Matrix<typename boost::math::tools::promote_args<T>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::rep_matrix ( const T &  x,
int  m,
int  n 
)
inline

Definition at line 14 of file rep_matrix.hpp.

◆ rep_matrix() [2/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::rep_matrix ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  v,
int  n 
)
inline

Definition at line 22 of file rep_matrix.hpp.

◆ rep_matrix() [3/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::rep_matrix ( const Eigen::Matrix< T, 1, Eigen::Dynamic > &  rv,
int  m 
)
inline

Definition at line 31 of file rep_matrix.hpp.

◆ rep_row_vector()

template<typename T >
Eigen::Matrix<typename boost::math::tools::promote_args<T>::type, 1, Eigen::Dynamic> stan::math::rep_row_vector ( const T &  x,
int  m 
)
inline

Definition at line 14 of file rep_row_vector.hpp.

◆ rep_vector()

template<typename T >
Eigen::Matrix<typename boost::math::tools::promote_args<T>::type, Eigen::Dynamic, 1> stan::math::rep_vector ( const T &  x,
int  n 
)
inline

Definition at line 14 of file rep_vector.hpp.

◆ resize()

template<typename T >
void stan::math::resize ( T &  x,
std::vector< int >  dims 
)
inline

Recursively resize the specified vector of vectors, which must bottom out at scalar values, Eigen vectors or Eigen matrices.

Parameters
xArray-like object to resize.
dimsNew dimensions.
Template Parameters
TType of object being resized.

Definition at line 41 of file resize.hpp.

◆ rising_factorial() [1/3]

var stan::math::rising_factorial ( const var a,
int  b 
)
inline

Definition at line 25 of file rising_factorial.hpp.

◆ rising_factorial() [2/3]

template<typename T >
fvar<T> stan::math::rising_factorial ( const fvar< T > &  x,
int  n 
)
inline

Return autodiff variable with the gradient and result of the rising factorial function applied to the inputs.

Will throw for NaN x and for negative n, as implemented in primitive function.

Template Parameters
TScalar type of autodiff variable.
Parameters
xArgument.
nArgument
Returns
tangent of rising factorial at arguments.

Definition at line 26 of file rising_factorial.hpp.

◆ rising_factorial() [3/3]

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::rising_factorial ( const T &  x,
int  n 
)
inline

Return the rising factorial function evaluated at the inputs.

Will throw for NaN x and for negative n

Template Parameters
TType of x argument.
Parameters
xArgument.
nArgument
Returns
Result of rising factorial function.
Exceptions
std::domain_errorif x is NaN
std::domain_errorif n is negative

\[ \mbox{rising\_factorial}(x, n) = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ x^{(n)} & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{rising\_factorial}(x, n)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \frac{\partial\, x^{(n)}}{\partial x} & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{rising\_factorial}(x, n)}{\partial n} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \frac{\partial\, x^{(n)}}{\partial n} & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]

\[ x^{(n)}=\frac{\Gamma(x+n)}{\Gamma(x)} \]

\[ \frac{\partial \, x^{(n)}}{\partial x} = x^{(n)}(\Psi(x+n)-\Psi(x)) \]

\[ \frac{\partial \, x^{(n)}}{\partial n} = (x)_n\Psi(x+n) \]

Definition at line 65 of file rising_factorial.hpp.

◆ round() [1/5]

double stan::math::round ( double  x)
inline

Return the closest integer to the specified argument, with halfway cases rounded away from zero.

Parameters
xArgument.
Returns
The rounded value of the argument.

Definition at line 17 of file round.hpp.

◆ round() [2/5]

template<typename T >
fvar<T> stan::math::round ( const fvar< T > &  x)
inline

Return the closest integer to the specified argument, with halfway cases rounded away from zero.

The derivative is always zero.

Template Parameters
TScalar type for autodiff variable.
Parameters
xArgument.
Returns
The rounded value of the argument.

Definition at line 24 of file round.hpp.

◆ round() [3/5]

double stan::math::round ( int  x)
inline

Return the closest integer to the specified argument, with halfway cases rounded away from zero.

Parameters
xArgument.
Returns
The rounded value of the argument.

Definition at line 26 of file round.hpp.

◆ round() [4/5]

template<typename T >
apply_scalar_unary<round_fun, T>::return_t stan::math::round ( const T &  x)
inline

Vectorized version of round.

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Rounded value of each value in x.

Definition at line 31 of file round.hpp.

◆ round() [5/5]

var stan::math::round ( const var a)
inline

Returns the rounded form of the specified variable (C99).

The derivative is zero everywhere but numbers half way between whole numbers, so for convenience the derivative is defined to be everywhere zero,

$\frac{d}{dx} \mbox{round}(x) = 0$.

\[ \mbox{round}(x) = \begin{cases} \lceil x \rceil & \mbox{if } x-\lfloor x\rfloor \geq 0.5 \\ \lfloor x \rfloor & \mbox{if } x-\lfloor x\rfloor < 0.5 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{round}(x)}{\partial x} = \begin{cases} 0 & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aSpecified variable.
Returns
Rounded variable.

Definition at line 54 of file round.hpp.

◆ row()

template<typename T >
Eigen::Matrix<T, 1, Eigen::Dynamic> stan::math::row ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m,
size_t  i 
)
inline

Return the specified row of the specified matrix, using start-at-1 indexing.

This is equivalent to calling m.row(i - 1) and assigning the resulting template expression to a row vector.

Template Parameters
TScalar value type for matrix.
Parameters
mMatrix.
iRow index (count from 1).
Returns
Specified row of the matrix.
Exceptions
std::out_of_rangeif i is out of range.

Definition at line 24 of file row.hpp.

◆ rows()

template<typename T , int R, int C>
int stan::math::rows ( const Eigen::Matrix< T, R, C > &  m)
inline

Return the number of rows in the specified matrix, vector, or row vector.

Template Parameters
TType of matrix entries.
RRow type of matrix.
CColumn type of matrix.
Parameters
[in]mInput matrix, vector, or row vector.
Returns
Number of rows.

Definition at line 20 of file rows.hpp.

◆ rows_dot_product() [1/5]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, 1> stan::math::rows_dot_product ( const Eigen::Matrix< fvar< T >, R1, C1 > &  v1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  v2 
)
inline

Definition at line 13 of file rows_dot_product.hpp.

◆ rows_dot_product() [2/5]

template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
std::enable_if<std::is_same<T1, var>::value || std::is_same<T2, var>::value, Eigen::Matrix<var, R1, 1> >::type stan::math::rows_dot_product ( const Eigen::Matrix< T1, R1, C1 > &  v1,
const Eigen::Matrix< T2, R2, C2 > &  v2 
)
inline

Definition at line 19 of file rows_dot_product.hpp.

◆ rows_dot_product() [3/5]

template<int R1, int C1, int R2, int C2>
Eigen::Matrix<double, R1, 1> stan::math::rows_dot_product ( const Eigen::Matrix< double, R1, C1 > &  v1,
const Eigen::Matrix< double, R2, C2 > &  v2 
)
inline

Returns the dot product of the specified vectors.

Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 20 of file rows_dot_product.hpp.

◆ rows_dot_product() [4/5]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, 1> stan::math::rows_dot_product ( const Eigen::Matrix< double, R1, C1 > &  v1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  v2 
)
inline

Definition at line 27 of file rows_dot_product.hpp.

◆ rows_dot_product() [5/5]

template<typename T , int R1, int C1, int R2, int C2>
Eigen::Matrix<fvar<T>, R1, 1> stan::math::rows_dot_product ( const Eigen::Matrix< fvar< T >, R1, C1 > &  v1,
const Eigen::Matrix< double, R2, C2 > &  v2 
)
inline

Definition at line 41 of file rows_dot_product.hpp.

◆ rows_dot_self() [1/2]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, 1> stan::math::rows_dot_self ( const Eigen::Matrix< fvar< T >, R, C > &  x)
inline

Definition at line 12 of file rows_dot_self.hpp.

◆ rows_dot_self() [2/2]

template<typename T , int R, int C>
Eigen::Matrix<T, R, 1> stan::math::rows_dot_self ( const Eigen::Matrix< T, R, C > &  x)
inline

Returns the dot product of each row of a matrix with itself.

Parameters
xMatrix.
Template Parameters
Tscalar type

Definition at line 15 of file rows_dot_self.hpp.

◆ scale_matrix_exp_multiply() [1/2]

template<int Cb>
Eigen::Matrix<double, -1, Cb> stan::math::scale_matrix_exp_multiply ( const double &  t,
const Eigen::MatrixXd &  A,
const Eigen::Matrix< double, -1, Cb > &  B 
)
inline

Return product of exp(At) and B, where A is a NxN double matrix, B is a NxCb double matrix, and t is a double.

Template Parameters
CbColumns matrix B
Parameters
[in]AMatrix
[in]BMatrix
[in]tdouble
Returns
exponential of At multiplies B

Definition at line 20 of file scale_matrix_exp_multiply.hpp.

◆ scale_matrix_exp_multiply() [2/2]

template<typename Ta , typename Tb , int Cb>
Eigen::Matrix<typename stan::return_type<Ta, Tb>::type, -1, Cb> stan::math::scale_matrix_exp_multiply ( const double &  t,
const Eigen::Matrix< Ta, -1, -1 > &  A,
const Eigen::Matrix< Tb, -1, Cb > &  B 
)
inline

Return product of exp(At) and B, where A is a NxN matrix, B is a NxCb matrix, and t is a double.

Template Parameters
Tascalar type matrix A
Tbscalar type matrix B
CbColumns matrix B
Parameters
[in]AMatrix
[in]BMatrix
[in]tdouble
Returns
exponential of At multiplies B

Definition at line 30 of file scale_matrix_exp_multiply.hpp.

◆ scaled_add()

void stan::math::scaled_add ( std::vector< double > &  x,
const std::vector< double > &  y,
double  lambda 
)
inline

Definition at line 11 of file scaled_add.hpp.

◆ scaled_inv_chi_square_ccdf_log()

template<typename T_y , typename T_dof , typename T_scale >
return_type<T_y, T_dof, T_scale>::type stan::math::scaled_inv_chi_square_ccdf_log ( const T_y &  y,
const T_dof &  nu,
const T_scale &  s 
)
Deprecated:
use scaled_inv_chi_square_lccdf

Definition at line 14 of file scaled_inv_chi_square_ccdf_log.hpp.

◆ scaled_inv_chi_square_cdf()

template<typename T_y , typename T_dof , typename T_scale >
return_type<T_y, T_dof, T_scale>::type stan::math::scaled_inv_chi_square_cdf ( const T_y &  y,
const T_dof &  nu,
const T_scale &  s 
)

The CDF of a scaled inverse chi-squared density for y with the specified degrees of freedom parameter and scale parameter.

Parameters
yA scalar variable.
nuDegrees of freedom.
sScale parameter.
Exceptions
std::domain_errorif nu is not greater than 0
std::domain_errorif s is not greater than 0.
std::domain_errorif y is not greater than 0.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.

Definition at line 35 of file scaled_inv_chi_square_cdf.hpp.

◆ scaled_inv_chi_square_cdf_log()

template<typename T_y , typename T_dof , typename T_scale >
return_type<T_y, T_dof, T_scale>::type stan::math::scaled_inv_chi_square_cdf_log ( const T_y &  y,
const T_dof &  nu,
const T_scale &  s 
)
Deprecated:
use scaled_inv_chi_square_lcdf

Definition at line 14 of file scaled_inv_chi_square_cdf_log.hpp.

◆ scaled_inv_chi_square_lccdf()

template<typename T_y , typename T_dof , typename T_scale >
return_type<T_y, T_dof, T_scale>::type stan::math::scaled_inv_chi_square_lccdf ( const T_y &  y,
const T_dof &  nu,
const T_scale &  s 
)

Definition at line 23 of file scaled_inv_chi_square_lccdf.hpp.

◆ scaled_inv_chi_square_lcdf()

template<typename T_y , typename T_dof , typename T_scale >
return_type<T_y, T_dof, T_scale>::type stan::math::scaled_inv_chi_square_lcdf ( const T_y &  y,
const T_dof &  nu,
const T_scale &  s 
)

Definition at line 23 of file scaled_inv_chi_square_lcdf.hpp.

◆ scaled_inv_chi_square_log() [1/2]

template<bool propto, typename T_y , typename T_dof , typename T_scale >
return_type<T_y, T_dof, T_scale>::type stan::math::scaled_inv_chi_square_log ( const T_y &  y,
const T_dof &  nu,
const T_scale &  s 
)

The log of a scaled inverse chi-squared density for y with the specified degrees of freedom parameter and scale parameter.

\begin{eqnarray*} y &\sim& \mbox{\sf{Inv-}}\chi^2(\nu, s^2) \\ \log (p (y \, |\, \nu, s)) &=& \log \left( \frac{(\nu / 2)^{\nu / 2}}{\Gamma (\nu / 2)} s^\nu y^{- (\nu / 2 + 1)} \exp^{-\nu s^2 / (2y)} \right) \\ &=& \frac{\nu}{2} \log(\frac{\nu}{2}) - \log (\Gamma (\nu / 2)) + \nu \log(s) - (\frac{\nu}{2} + 1) \log(y) - \frac{\nu s^2}{2y} \\ & & \mathrm{ where } \; y > 0 \end{eqnarray*}

Deprecated:
use scaled_inv_chi_square_lpdf
Parameters
yA scalar variable.
nuDegrees of freedom.
sScale parameter.
Exceptions
std::domain_errorif nu is not greater than 0
std::domain_errorif s is not greater than 0.
std::domain_errorif y is not greater than 0.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.

Definition at line 34 of file scaled_inv_chi_square_log.hpp.

◆ scaled_inv_chi_square_log() [2/2]

template<typename T_y , typename T_dof , typename T_scale >
return_type<T_y, T_dof, T_scale>::type stan::math::scaled_inv_chi_square_log ( const T_y &  y,
const T_dof &  nu,
const T_scale &  s 
)
inline
Deprecated:
use scaled_inv_chi_square_lpdf

Definition at line 44 of file scaled_inv_chi_square_log.hpp.

◆ scaled_inv_chi_square_lpdf() [1/2]

template<bool propto, typename T_y , typename T_dof , typename T_scale >
return_type<T_y, T_dof, T_scale>::type stan::math::scaled_inv_chi_square_lpdf ( const T_y &  y,
const T_dof &  nu,
const T_scale &  s 
)

The log of a scaled inverse chi-squared density for y with the specified degrees of freedom parameter and scale parameter.

\begin{eqnarray*} y &\sim& \mbox{\sf{Inv-}}\chi^2(\nu, s^2) \\ \log (p (y \, |\, \nu, s)) &=& \log \left( \frac{(\nu / 2)^{\nu / 2}}{\Gamma (\nu / 2)} s^\nu y^{- (\nu / 2 + 1)} \exp^{-\nu s^2 / (2y)} \right) \\ &=& \frac{\nu}{2} \log(\frac{\nu}{2}) - \log (\Gamma (\nu / 2)) + \nu \log(s) - (\frac{\nu}{2} + 1) \log(y) - \frac{\nu s^2}{2y} \\ & & \mathrm{ where } \; y > 0 \end{eqnarray*}

Parameters
yA scalar variable.
nuDegrees of freedom.
sScale parameter.
Exceptions
std::domain_errorif nu is not greater than 0
std::domain_errorif s is not greater than 0.
std::domain_errorif y is not greater than 0.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.

Definition at line 40 of file scaled_inv_chi_square_lpdf.hpp.

◆ scaled_inv_chi_square_lpdf() [2/2]

template<typename T_y , typename T_dof , typename T_scale >
return_type<T_y, T_dof, T_scale>::type stan::math::scaled_inv_chi_square_lpdf ( const T_y &  y,
const T_dof &  nu,
const T_scale &  s 
)
inline

Definition at line 145 of file scaled_inv_chi_square_lpdf.hpp.

◆ scaled_inv_chi_square_rng()

template<typename T_deg , typename T_scale , class RNG >
VectorBuilder<true, double, T_deg, T_scale>::type stan::math::scaled_inv_chi_square_rng ( const T_deg &  nu,
const T_scale &  s,
RNG &  rng 
)
inline

Return a scaled chi square random variate for the given number of degrees of freedom and scale using the specified random number generator.

nu and sigma can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_degType of degrees of freedom parameter
T_scaleType of scale parameter
RNGtype of random number generator
Parameters
nu(Sequence of) positive degrees of freedom parameter(s)
s(Sequence of) positive scale parameter(s)
rngrandom number generator
Returns
(Sequence of) scaled chi square random variate(s)
Exceptions
std::domain_errorif nu or sigma are nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 35 of file scaled_inv_chi_square_rng.hpp.

◆ sd() [1/4]

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::sd ( const std::vector< T > &  v)
inline

Returns the unbiased sample standard deviation of the coefficients in the specified column vector.

Parameters
vSpecified vector.
Returns
Sample variance of vector.

Definition at line 20 of file sd.hpp.

◆ sd() [2/4]

template<typename T , int R, int C>
boost::math::tools::promote_args<T>::type stan::math::sd ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the unbiased sample standard deviation of the coefficients in the specified vector, row vector, or matrix.

Parameters
mSpecified vector, row vector or matrix.
Returns
Sample variance.

Definition at line 35 of file sd.hpp.

◆ sd() [3/4]

var stan::math::sd ( const std::vector< var > &  v)
inline

Return the sample standard deviation of the specified standard vector.

Raise domain error if size is not greater than zero.

Parameters
[in]va vector
Returns
sample standard deviation of specified vector

Definition at line 59 of file sd.hpp.

◆ sd() [4/4]

template<int R, int C>
var stan::math::sd ( const Eigen::Matrix< var, R, C > &  m)

Definition at line 77 of file sd.hpp.

◆ segment() [1/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::segment ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  v,
size_t  i,
size_t  n 
)
inline

Return the specified number of elements as a vector starting from the specified element - 1 of the specified vector.

Definition at line 17 of file segment.hpp.

◆ segment() [2/3]

template<typename T >
Eigen::Matrix<T, 1, Eigen::Dynamic> stan::math::segment ( const Eigen::Matrix< T, 1, Eigen::Dynamic > &  v,
size_t  i,
size_t  n 
)
inline

Definition at line 30 of file segment.hpp.

◆ segment() [3/3]

template<typename T >
std::vector<T> stan::math::segment ( const std::vector< T > &  sv,
size_t  i,
size_t  n 
)

Definition at line 44 of file segment.hpp.

◆ set_zero_all_adjoints()

static void stan::math::set_zero_all_adjoints ( )
static

Reset all adjoint values in the stack to zero.

Definition at line 14 of file set_zero_all_adjoints.hpp.

◆ set_zero_all_adjoints_nested()

static void stan::math::set_zero_all_adjoints_nested ( )
static

Reset all adjoint values in the top nested portion of the stack to zero.

Definition at line 17 of file set_zero_all_adjoints_nested.hpp.

◆ sign()

template<typename T >
int stan::math::sign ( const T &  z)
inline

Definition at line 10 of file sign.hpp.

◆ simplex_constrain() [1/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::simplex_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  y)

Return the simplex corresponding to the specified free vector.

A simplex is a vector containing values greater than or equal to 0 that sum to 1. A vector with (K-1) unconstrained values will produce a simplex of size K.

The transform is based on a centered stick-breaking process.

Parameters
yFree vector input of dimensionality K - 1.
Returns
Simplex of dimensionality K.
Template Parameters
TType of scalar.

Definition at line 28 of file simplex_constrain.hpp.

◆ simplex_constrain() [2/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::simplex_constrain ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  y,
T &  lp 
)

Return the simplex corresponding to the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.

The simplex transform is defined through a centered stick-breaking process.

Parameters
yFree vector input of dimensionality K - 1.
lpLog probability reference to increment.
Returns
Simplex of dimensionality K.
Template Parameters
TType of scalar.

Definition at line 62 of file simplex_constrain.hpp.

◆ simplex_constrain() [3/3]

Eigen::Matrix<var, Eigen::Dynamic, 1> stan::math::simplex_constrain ( const Eigen::Matrix< var, Eigen::Dynamic, 1 > &  y)
inline

Return the simplex corresponding to the specified free vector.

A simplex is a vector containing values greater than or equal to 0 that sum to 1. A vector with (K-1) unconstrained values will produce a simplex of size K.

The transform is based on a centered stick-breaking process.

Parameters
yFree vector input of dimensionality K - 1
Returns
Simplex of dimensionality K

Definition at line 95 of file simplex_constrain.hpp.

◆ simplex_free()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::simplex_free ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x)

Return an unconstrained vector that when transformed produces the specified simplex.

It applies to a simplex of dimensionality K and produces an unconstrained vector of dimensionality (K-1).

The simplex transform is defined through a centered stick-breaking process.

Parameters
xSimplex of dimensionality K.
Returns
Free vector of dimensionality (K-1) that transfroms to the simplex.
Template Parameters
TType of scalar.
Exceptions
std::domain_errorif x is not a valid simplex

Definition at line 28 of file simplex_free.hpp.

◆ sin() [1/3]

template<typename T >
fvar<T> stan::math::sin ( const fvar< T > &  x)
inline

Definition at line 11 of file sin.hpp.

◆ sin() [2/3]

template<typename T >
apply_scalar_unary<sin_fun, T>::return_t stan::math::sin ( const T &  x)
inline

Vectorized version of sin().

Parameters
xContainer of angles in radians.
Template Parameters
TContainer type.
Returns
Sine of each value in x.

Definition at line 31 of file sin.hpp.

◆ sin() [3/3]

var stan::math::sin ( const var a)
inline

Return the sine of a radian-scaled variable (cmath).

The derivative is defined by

$\frac{d}{dx} \sin x = \cos x$.

\[ \mbox{sin}(x) = \begin{cases} \sin(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{sin}(x)}{\partial x} = \begin{cases} \cos(x) & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable for radians of angle.
Returns
Sine of variable.

Definition at line 46 of file sin.hpp.

◆ singular_values()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::singular_values ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)

Return the vector of the singular values of the specified matrix in decreasing order of magnitude.

See the documentation for svd() for information on the signular values.

Parameters
mSpecified matrix.
Returns
Singular values of the matrix.

Definition at line 18 of file singular_values.hpp.

◆ sinh() [1/3]

template<typename T >
fvar<T> stan::math::sinh ( const fvar< T > &  x)
inline

Definition at line 11 of file sinh.hpp.

◆ sinh() [2/3]

template<typename T >
apply_scalar_unary<sinh_fun, T>::return_t stan::math::sinh ( const T &  x)
inline

Vectorized version of sinh().

Parameters
xContainer of variables.
Template Parameters
TContainer type.
Returns
Hyperbolic sine of each variable in x.

Definition at line 31 of file sinh.hpp.

◆ sinh() [3/3]

var stan::math::sinh ( const var a)
inline

Return the hyperbolic sine of the specified variable (cmath).

The derivative is defined by

$\frac{d}{dx} \sinh x = \cosh x$.

\[ \mbox{sinh}(x) = \begin{cases} \sinh(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{sinh}(x)}{\partial x} = \begin{cases} \cosh(x) & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable.
Returns
Hyperbolic sine of variable.

Definition at line 45 of file sinh.hpp.

◆ size()

template<typename T >
int stan::math::size ( const std::vector< T > &  x)
inline

Return the size of the specified standard vector.

Template Parameters
TType of elements.
Parameters
[in]xInput vector.
Returns
Size of input vector.

Definition at line 17 of file size.hpp.

◆ size_zero() [1/2]

template<typename T >
bool stan::math::size_zero ( T &  x)
inline

Returns 1 if input is of length 0, returns 0 otherwise.

Parameters
xargument
Returns
0 or 1

Definition at line 18 of file size_zero.hpp.

◆ size_zero() [2/2]

template<typename T , typename... Ts>
bool stan::math::size_zero ( T &  x,
Ts &&...  xs 
)
inline

Returns 1 if any inputs are of length 0, returns 0 otherwise.

Parameters
xfirst argument
xsparameter pack of remaining arguments to forward to function
Returns
0 or 1

Definition at line 31 of file size_zero.hpp.

◆ skew_normal_ccdf_log()

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::skew_normal_ccdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  alpha 
)
Deprecated:
use skew_normal_lccdf

Definition at line 14 of file skew_normal_ccdf_log.hpp.

◆ skew_normal_cdf()

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::skew_normal_cdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  alpha 
)

Definition at line 19 of file skew_normal_cdf.hpp.

◆ skew_normal_cdf_log()

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::skew_normal_cdf_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  alpha 
)
Deprecated:
use skew_normal_lcdf

Definition at line 14 of file skew_normal_cdf_log.hpp.

◆ skew_normal_lccdf()

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::skew_normal_lccdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  alpha 
)

Definition at line 19 of file skew_normal_lccdf.hpp.

◆ skew_normal_lcdf()

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::skew_normal_lcdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  alpha 
)

Definition at line 19 of file skew_normal_lcdf.hpp.

◆ skew_normal_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::skew_normal_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  alpha 
)
Deprecated:
use skew_normal_lpdf

Definition at line 15 of file skew_normal_log.hpp.

◆ skew_normal_log() [2/2]

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::skew_normal_log ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  alpha 
)
inline
Deprecated:
use skew_normal_lpdf

Definition at line 25 of file skew_normal_log.hpp.

◆ skew_normal_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::skew_normal_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  alpha 
)

Definition at line 21 of file skew_normal_lpdf.hpp.

◆ skew_normal_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type<T_y, T_loc, T_scale, T_shape>::type stan::math::skew_normal_lpdf ( const T_y &  y,
const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  alpha 
)
inline

Definition at line 112 of file skew_normal_lpdf.hpp.

◆ skew_normal_rng()

template<typename T_loc , typename T_scale , typename T_shape , class RNG >
VectorBuilder<true, double, T_loc, T_scale, T_shape>::type stan::math::skew_normal_rng ( const T_loc &  mu,
const T_scale &  sigma,
const T_shape &  alpha,
RNG &  rng 
)
inline

Return a Skew-normal random variate for the given location, scale, and shape using the specified random number generator.

mu, sigma, and alpha can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_locType of location parameter
T_scaleType of scale parameter
T_shapeType of shape parameter
RNGtype of random number generator
Parameters
mu(Sequence of) location parameter(s)
sigma(Sequence of) scale parameter(s)
alpha(Sequence of) shape parameter(s)
rngrandom number generator
Returns
(Sequence of) Skew-normal random variate(s)
Exceptions
std::domain_errorif mu is infinite, sigma is nonpositive, or alpha is infinite
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 38 of file skew_normal_rng.hpp.

◆ softmax() [1/3]

template<typename T >
Eigen::Matrix<fvar<T>, Eigen::Dynamic, 1> stan::math::softmax ( const Eigen::Matrix< fvar< T >, Eigen::Dynamic, 1 > &  alpha)
inline

Definition at line 12 of file softmax.hpp.

◆ softmax() [2/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::softmax ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  v)
inline

Return the softmax of the specified vector.

$ \mbox{softmax}(y) = \frac{\exp(y)} {\sum_{k=1}^K \exp(y_k)}, $

The entries in the Jacobian of the softmax function are given by $ \begin{array}{l} \displaystyle \frac{\partial}{\partial y_m} \mbox{softmax}(y)[k] \\[8pt] \displaystyle \mbox{ } \ \ \ = \left\{ \begin{array}{ll} \mbox{softmax}(y)[k] \times (1 - \mbox{softmax}(y)[m]) & \mbox{ if } m = k, \mbox{ and} \\[6pt] -\mbox{softmax}(y)[k] \times \mbox{softmax}(y)[m] & \mbox{ if } m \neq k. \end{array} \right. \end{array} $

Template Parameters
TScalar type of values in vector.
Parameters
[in]vVector to transform.
Returns
Unit simplex result of the softmax transform of the vector.

Definition at line 45 of file softmax.hpp.

◆ softmax() [3/3]

Eigen::Matrix<var, Eigen::Dynamic, 1> stan::math::softmax ( const Eigen::Matrix< var, Eigen::Dynamic, 1 > &  alpha)
inline

Return the softmax of the specified Eigen vector.

Softmax is guaranteed to return a simplex.

Parameters
alphaUnconstrained input vector.
Returns
Softmax of the input.
Exceptions
std::domain_errorIf the input vector is size 0.

Definition at line 74 of file softmax.hpp.

◆ sort_asc() [1/2]

template<typename T , int R, int C>
Eigen::Matrix<T, R, C> stan::math::sort_asc ( Eigen::Matrix< T, R, C >  xs)
inline

Return the specified vector in ascending order.

Template Parameters
TType of elements contained in vector.
Parameters
xsVector to order.
Returns
Vector in ascending order.
Exceptions
std::domain_errorIf any of the values are NaN.

Definition at line 20 of file sort_asc.hpp.

◆ sort_asc() [2/2]

template<typename T >
std::vector<T> stan::math::sort_asc ( std::vector< T >  xs)
inline

Return the specified standard vector in ascending order.

Template Parameters
TType of elements contained in vector.
Parameters
xsVector to order.
Returns
Vector in ascending order.
Exceptions
std::domain_errorIf any of the values are NaN.

Definition at line 21 of file sort_asc.hpp.

◆ sort_desc() [1/2]

template<typename T , int R, int C>
Eigen::Matrix<T, R, C> stan::math::sort_desc ( Eigen::Matrix< T, R, C >  xs)
inline

Return the specified vector in descending order.

Template Parameters
TType of elements contained in vector.
Parameters
xsVector to order.
Returns
Vector in descending order.
Exceptions
std::domain_errorIf any of the values are NaN.

Definition at line 22 of file sort_desc.hpp.

◆ sort_desc() [2/2]

template<typename T >
std::vector<T> stan::math::sort_desc ( std::vector< T >  xs)
inline

Return the specified standard vector in descending order.

Template Parameters
TType of elements contained in vector.
Parameters
xsVector to order.
Returns
Vector in descending order.
Exceptions
std::domain_errorIf any of the values are NaN.

Definition at line 22 of file sort_desc.hpp.

◆ sort_indices()

template<bool ascending, typename C >
std::vector<int> stan::math::sort_indices ( const C &  xs)

Return an integer array of indices of the specified container sorting the values in ascending or descending order based on the value of the first template prameter.

Template Parameters
ascendingtrue if sort is in ascending order
Ctype of container
Parameters
xsContainer to sort
Returns
sorted version of container

Definition at line 62 of file sort_indices.hpp.

◆ sort_indices_asc()

template<typename C >
std::vector<int> stan::math::sort_indices_asc ( const C &  xs)

Return a sorted copy of the argument container in ascending order.

Template Parameters
Ctype of container
Parameters
xsContainer to sort
Returns
sorted version of container

Definition at line 21 of file sort_indices_asc.hpp.

◆ sort_indices_desc()

template<typename C >
std::vector<int> stan::math::sort_indices_desc ( const C &  xs)

Return a sorted copy of the argument container in ascending order.

Template Parameters
Ctype of container
Parameters
xsContainer to sort
Returns
sorted version of container

Definition at line 21 of file sort_indices_desc.hpp.

◆ sqrt() [1/4]

template<typename T >
fvar<T> stan::math::sqrt ( const fvar< T > &  x)
inline

Definition at line 13 of file sqrt.hpp.

◆ sqrt() [2/4]

double stan::math::sqrt ( int  x)
inline

Return the square root of the specified argument.

This version is required to disambiguate sqrt(int).

Parameters
[in]xArgument.
Returns
Natural exponential of argument.

Definition at line 17 of file sqrt.hpp.

◆ sqrt() [3/4]

template<typename T >
apply_scalar_unary<sqrt_fun, T>::return_t stan::math::sqrt ( const T &  x)
inline

Vectorized version of sqrt().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Square root of each value in x.

Definition at line 31 of file sqrt.hpp.

◆ sqrt() [4/4]

var stan::math::sqrt ( const var a)
inline

Return the square root of the specified variable (cmath).

The derivative is defined by

$\frac{d}{dx} \sqrt{x} = \frac{1}{2 \sqrt{x}}$.

\[ \mbox{sqrt}(x) = \begin{cases} \textrm{NaN} & x < 0 \\ \sqrt{x} & \mbox{if } x\geq 0\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{sqrt}(x)}{\partial x} = \begin{cases} \textrm{NaN} & x < 0 \\ \frac{1}{2\sqrt{x}} & x\geq 0\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable whose square root is taken.
Returns
Square root of variable.

Definition at line 47 of file sqrt.hpp.

◆ sqrt2()

double stan::math::sqrt2 ( )
inline

Return the square root of two.

Returns
Square root of two.

Definition at line 94 of file constants.hpp.

◆ square() [1/4]

template<typename T >
fvar<T> stan::math::square ( const fvar< T > &  x)
inline

Definition at line 12 of file square.hpp.

◆ square() [2/4]

double stan::math::square ( double  x)
inline

Return the square of the specified argument.

$\mbox{square}(x) = x^2$.

The implementation of square(x) is just x * x. Given this, this method is mainly useful in cases where x is not a simple primitive type, particularly when it is an auto-dif type.

Parameters
xInput to square.
Returns
Square of input.

Definition at line 22 of file square.hpp.

◆ square() [3/4]

template<typename T >
apply_scalar_unary<square_fun, T>::return_t stan::math::square ( const T &  x)
inline

Vectorized version of square().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Each value in x squared.

Definition at line 30 of file square.hpp.

◆ square() [4/4]

var stan::math::square ( const var x)
inline

Return the square of the input variable.

Using square(x) is more efficient than using x * x.

\[ \mbox{square}(x) = \begin{cases} x^2 & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{square}(x)}{\partial x} = \begin{cases} 2x & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
xVariable to square.
Returns
Square of variable.

Definition at line 43 of file square.hpp.

◆ squared_distance() [1/15]

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1, T2>::type stan::math::squared_distance ( const T1 &  x1,
const T2 &  x2 
)
inline

Returns the squared distance.

Parameters
x1First vector.
x2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 21 of file squared_distance.hpp.

◆ squared_distance() [2/15]

template<int R, int C>
double stan::math::squared_distance ( const Eigen::Matrix< double, R, C > &  v1,
const Eigen::Matrix< double, R, C > &  v2 
)
inline

Returns the squared distance between the specified vectors of the same dimensions.

Template Parameters
RRows at compile time of vector inputs
Ccolumns at compile time of vector inputs
Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 25 of file squared_distance.hpp.

◆ squared_distance() [3/15]

template<typename T , int R, int C>
fvar<T> stan::math::squared_distance ( const Eigen::Matrix< fvar< T >, R, C > &  v1,
const Eigen::Matrix< double, R, C > &  v2 
)
inline

Returns the squared distance between the specified vectors of the same dimensions.

Template Parameters
RRows at compile time of vector inputs
Ccolumns at compile time of vector inputs
TChild scalar type of fvar vector input
Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 27 of file squared_distance.hpp.

◆ squared_distance() [4/15]

var stan::math::squared_distance ( const var a,
const var b 
)
inline

Returns the log sum of exponentials.

Definition at line 37 of file squared_distance.hpp.

◆ squared_distance() [5/15]

var stan::math::squared_distance ( const var a,
double  b 
)
inline

Returns the log sum of exponentials.

Definition at line 43 of file squared_distance.hpp.

◆ squared_distance() [6/15]

template<int R1, int C1, int R2, int C2>
double stan::math::squared_distance ( const Eigen::Matrix< double, R1, C1 > &  v1,
const Eigen::Matrix< double, R2, C2 > &  v2 
)
inline

Returns the squared distance between the specified vectors of the same dimensions.

Template Parameters
R1Rows at compile time of first vector input
C1Columns at compile time of first vector input
R2Rows at compile time of second vector input
C2Columns at compile time of second vector input
Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 48 of file squared_distance.hpp.

◆ squared_distance() [7/15]

var stan::math::squared_distance ( double  a,
const var b 
)
inline

Returns the log sum of exponentials.

Definition at line 49 of file squared_distance.hpp.

◆ squared_distance() [8/15]

template<typename T , int R1, int C1, int R2, int C2>
fvar<T> stan::math::squared_distance ( const Eigen::Matrix< fvar< T >, R1, C1 > &  v1,
const Eigen::Matrix< double, R2, C2 > &  v2 
)
inline

Returns the squared distance between the specified vectors of the same dimensions.

Template Parameters
R1Rows at compile time of first vector input
C1Columns at compile time of first vector input
R2Rows at compile time of second vector input
C2Columns at compile time of second vector input
TChild scalar type of fvar vector input
Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 52 of file squared_distance.hpp.

◆ squared_distance() [9/15]

template<typename T , int R, int C>
fvar<T> stan::math::squared_distance ( const Eigen::Matrix< double, R, C > &  v1,
const Eigen::Matrix< fvar< T >, R, C > &  v2 
)
inline

Returns the squared distance between the specified vectors of the same dimensions.

Template Parameters
RRows at compile time of vector inputs
Ccolumns at compile time of vector inputs
TChild scalar type of fvar vector input
Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 76 of file squared_distance.hpp.

◆ squared_distance() [10/15]

template<typename T , int R1, int C1, int R2, int C2>
fvar<T> stan::math::squared_distance ( const Eigen::Matrix< double, R1, C1 > &  v1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  v2 
)
inline

Returns the squared distance between the specified vectors of the same dimensions.

Template Parameters
R1Rows at compile time of first vector input
C1Columns at compile time of first vector input
R2Rows at compile time of second vector input
C2Columns at compile time of second vector input
TChild scalar type of fvar vector input
Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 101 of file squared_distance.hpp.

◆ squared_distance() [11/15]

template<int R1, int C1, int R2, int C2>
var stan::math::squared_distance ( const Eigen::Matrix< var, R1, C1 > &  v1,
const Eigen::Matrix< var, R2, C2 > &  v2 
)
inline

Definition at line 104 of file squared_distance.hpp.

◆ squared_distance() [12/15]

template<int R1, int C1, int R2, int C2>
var stan::math::squared_distance ( const Eigen::Matrix< var, R1, C1 > &  v1,
const Eigen::Matrix< double, R2, C2 > &  v2 
)
inline

Definition at line 112 of file squared_distance.hpp.

◆ squared_distance() [13/15]

template<int R1, int C1, int R2, int C2>
var stan::math::squared_distance ( const Eigen::Matrix< double, R1, C1 > &  v1,
const Eigen::Matrix< var, R2, C2 > &  v2 
)
inline

Definition at line 120 of file squared_distance.hpp.

◆ squared_distance() [14/15]

template<typename T , int R, int C>
fvar<T> stan::math::squared_distance ( const Eigen::Matrix< fvar< T >, R, C > &  v1,
const Eigen::Matrix< fvar< T >, R, C > &  v2 
)
inline

Returns the squared distance between the specified vectors of the same dimensions.

Template Parameters
RRows at compile time of vector inputs
Ccolumns at compile time of vector inputs
TChild scalar type of fvar vector input
Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 124 of file squared_distance.hpp.

◆ squared_distance() [15/15]

template<typename T , int R1, int C1, int R2, int C2>
fvar<T> stan::math::squared_distance ( const Eigen::Matrix< fvar< T >, R1, C1 > &  v1,
const Eigen::Matrix< fvar< T >, R2, C2 > &  v2 
)
inline

Returns the squared distance between the specified vectors of the same dimensions.

Template Parameters
R1Rows at compile time of first vector input
C1Columns at compile time of first vector input
R2Rows at compile time of second vector input
C2Columns at compile time of second vector input
TChild scalar type of fvar vector input
Parameters
v1First vector.
v2Second vector.
Returns
Dot product of the vectors.
Exceptions
std::domain_errorIf the vectors are not the same size or if they are both not vector dimensioned.

Definition at line 149 of file squared_distance.hpp.

◆ stan_print() [1/6]

void stan::math::stan_print ( std::ostream *  o,
const var x 
)
inline

Definition at line 11 of file stan_print.hpp.

◆ stan_print() [2/6]

template<typename T >
void stan::math::stan_print ( std::ostream *  o,
const T &  x 
)

Definition at line 12 of file stan_print.hpp.

◆ stan_print() [3/6]

template<typename T >
void stan::math::stan_print ( std::ostream *  o,
const std::vector< T > &  x 
)

Definition at line 17 of file stan_print.hpp.

◆ stan_print() [4/6]

template<typename T >
void stan::math::stan_print ( std::ostream *  o,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x 
)

Definition at line 28 of file stan_print.hpp.

◆ stan_print() [5/6]

template<typename T >
void stan::math::stan_print ( std::ostream *  o,
const Eigen::Matrix< T, 1, Eigen::Dynamic > &  x 
)

Definition at line 39 of file stan_print.hpp.

◆ stan_print() [6/6]

template<typename T >
void stan::math::stan_print ( std::ostream *  o,
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  x 
)

Definition at line 50 of file stan_print.hpp.

◆ start_nested()

static void stan::math::start_nested ( )
inlinestatic

Record the current position so that recover_memory_nested() can find it.

Definition at line 13 of file start_nested.hpp.

◆ std_normal_log() [1/2]

template<bool propto, typename T_y >
return_type<T_y>::type stan::math::std_normal_log ( const T_y &  y)

The log of a standard normal density for the specified scalar(s).

y can be either a scalar or a vector.

The result log probability is defined to be the sum of the log probabilities for each observation.

Deprecated:
use std_normal_lpdf
Template Parameters
T_yUnderlying type of scalar in sequence.
Parameters
y(Sequence of) scalar(s).
Returns
The log of the product of the densities.
Exceptions
std::domain_errorif any scalar is nan.

Definition at line 25 of file std_normal_log.hpp.

◆ std_normal_log() [2/2]

template<typename T_y >
return_type<T_y>::type stan::math::std_normal_log ( const T_y &  y)
inline
Deprecated:
use std_normal_lpdf

Definition at line 33 of file std_normal_log.hpp.

◆ std_normal_lpdf() [1/2]

template<bool propto, typename T_y >
return_type<T_y>::type stan::math::std_normal_lpdf ( const T_y &  y)

The log of the normal density for the specified scalar(s) given a location of 0 and a scale of 1.

y can be either a scalar or a vector.

The result log probability is defined to be the sum of the log probabilities for each observation.

Template Parameters
T_yUnderlying type of scalar in sequence.
Parameters
y(Sequence of) scalar(s).
Returns
The log of the product of the densities.
Exceptions
std::domain_errorif any scalar is nan.

Definition at line 26 of file std_normal_lpdf.hpp.

◆ std_normal_lpdf() [2/2]

template<typename T_y >
return_type<T_y>::type stan::math::std_normal_lpdf ( const T_y &  y)
inline

Definition at line 54 of file std_normal_lpdf.hpp.

◆ step() [1/2]

var stan::math::step ( const var a)
inline

Return the step, or heaviside, function applied to the specified variable (stan).

See step() for the double-based version.

The derivative of the step function is zero everywhere but at 0, so for convenience, it is taken to be everywhere zero,

$\mbox{step}(x) = 0$.

Parameters
aVariable argument.
Returns
The constant variable with value 1.0 if the argument's value is greater than or equal to 0.0, and value 0.0 otherwise.

Definition at line 26 of file step.hpp.

◆ step() [2/2]

template<typename T >
double stan::math::step ( const T &  y)
inline

The step, or Heaviside, function.

The function is defined by

step(y) = (y < 0.0) ? 0 : 1.

\[ \mbox{step}(x) = \begin{cases} 0 & \mbox{if } x \leq 0 \\ 1 & \mbox{if } x > 0 \\[6pt] 0 & \mbox{if } x = \textrm{NaN} \end{cases} \]

Template Parameters
Ttype of value
Parameters
yvalue
Returns
zero if the value is less than zero, and one otherwise

Definition at line 29 of file step.hpp.

◆ student_t_ccdf_log()

template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::student_t_ccdf_log ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use student_t_lccdf

Definition at line 14 of file student_t_ccdf_log.hpp.

◆ student_t_cdf()

template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::student_t_cdf ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 21 of file student_t_cdf.hpp.

◆ student_t_cdf_log()

template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::student_t_cdf_log ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  sigma 
)
Deprecated:
use student_t_lcdf

Definition at line 14 of file student_t_cdf_log.hpp.

◆ student_t_lccdf()

template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::student_t_lccdf ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 22 of file student_t_lccdf.hpp.

◆ student_t_lcdf()

template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::student_t_lcdf ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  sigma 
)

Definition at line 22 of file student_t_lcdf.hpp.

◆ student_t_log() [1/2]

template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::student_t_log ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  sigma 
)

The log of the Student-t density for the given y, nu, mean, and scale parameter.

The scale parameter must be greater than 0.

\begin{eqnarray*} y &\sim& t_{\nu} (\mu, \sigma^2) \\ \log (p (y \, |\, \nu, \mu, \sigma) ) &=& \log \left( \frac{\Gamma((\nu + 1) /2)} {\Gamma(\nu/2)\sqrt{\nu \pi} \sigma} \left( 1 + \frac{1}{\nu} (\frac{y - \mu}{\sigma})^2 \right)^{-(\nu + 1)/2} \right) \\ &=& \log( \Gamma( (\nu+1)/2 )) - \log (\Gamma (\nu/2) - \frac{1}{2} \log(\nu \pi) - \log(\sigma) -\frac{\nu + 1}{2} \log (1 + \frac{1}{\nu} (\frac{y - \mu}{\sigma})^2) \end{eqnarray*}

Deprecated:
use student_t_lpdf
Parameters
yA scalar variable.
nuDegrees of freedom.
muThe mean of the Student-t distribution.
sigmaThe scale parameter of the Student-t distribution.
Returns
The log of the Student-t density at y.
Exceptions
std::domain_errorif sigma is not greater than 0.
std::domain_errorif nu is not greater than 0.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.
T_locType of location.
T_scaleType of scale.

Definition at line 42 of file student_t_log.hpp.

◆ student_t_log() [2/2]

template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::student_t_log ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  sigma 
)
inline
Deprecated:
use student_t_lpdf

Definition at line 51 of file student_t_log.hpp.

◆ student_t_lpdf() [1/2]

template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::student_t_lpdf ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  sigma 
)

The log of the Student-t density for the given y, nu, mean, and scale parameter.

The scale parameter must be greater than 0.

\begin{eqnarray*} y &\sim& t_{\nu} (\mu, \sigma^2) \\ \log (p (y \, |\, \nu, \mu, \sigma) ) &=& \log \left( \frac{\Gamma((\nu + 1) /2)} {\Gamma(\nu/2)\sqrt{\nu \pi} \sigma} \left( 1 + \frac{1}{\nu} (\frac{y - \mu}{\sigma})^2 \right)^{-(\nu + 1)/2} \right) \\ &=& \log( \Gamma( (\nu+1)/2 )) - \log (\Gamma (\nu/2) - \frac{1}{2} \log(\nu \pi) - \log(\sigma) -\frac{\nu + 1}{2} \log (1 + \frac{1}{\nu} (\frac{y - \mu}{\sigma})^2) \end{eqnarray*}

Parameters
yA scalar variable.
nuDegrees of freedom.
muThe mean of the Student-t distribution.
sigmaThe scale parameter of the Student-t distribution.
Returns
The log of the Student-t density at y.
Exceptions
std::domain_errorif sigma is not greater than 0.
std::domain_errorif nu is not greater than 0.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.
T_locType of location.
T_scaleType of scale.

Definition at line 50 of file student_t_lpdf.hpp.

◆ student_t_lpdf() [2/2]

template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type<T_y, T_dof, T_loc, T_scale>::type stan::math::student_t_lpdf ( const T_y &  y,
const T_dof &  nu,
const T_loc &  mu,
const T_scale &  sigma 
)
inline

Definition at line 190 of file student_t_lpdf.hpp.

◆ student_t_rng()

template<typename T_deg , typename T_loc , typename T_scale , class RNG >
VectorBuilder<true, double, T_deg, T_loc, T_scale>::type stan::math::student_t_rng ( const T_deg &  nu,
const T_loc &  mu,
const T_scale &  sigma,
RNG &  rng 
)
inline

Return a student-t random variate for the given degrees of freedom, location, and scale using the specified random number generator.

nu, mu, and sigma can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_degType of degrees of freedom parameter
T_locType of location parameter
T_scaleType of scale parameter
RNGtype of random number generator
Parameters
nu(Sequence of) degrees of freedom parameter(s)
mu(Sequence of) location parameter(s)
sigma(Sequence of) scale parameter(s)
rngrandom number generator
Returns
Student-t random variate
Exceptions
std::domain_errorif nu is nonpositive, mu is infinite, or sigma is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 37 of file student_t_rng.hpp.

◆ sub()

void stan::math::sub ( std::vector< double > &  x,
std::vector< double > &  y,
std::vector< double > &  result 
)
inline

Definition at line 11 of file sub.hpp.

◆ sub_col()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::sub_col ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m,
size_t  i,
size_t  j,
size_t  nrows 
)
inline

Return a nrows x 1 subcolumn starting at (i-1, j-1).

Parameters
mMatrix.
iStarting row + 1.
jStarting column + 1.
nrowsNumber of rows in block.
Exceptions
std::out_of_rangeif either index is out of range.

Definition at line 21 of file sub_col.hpp.

◆ sub_row()

template<typename T >
Eigen::Matrix<T, 1, Eigen::Dynamic> stan::math::sub_row ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m,
size_t  i,
size_t  j,
size_t  ncols 
)
inline

Return a 1 x nrows subrow starting at (i-1, j-1).

Parameters
mMatrix Input matrix.
iStarting row + 1.
jStarting column + 1.
ncolsNumber of columns in block.
Exceptions
std::out_of_rangeif either index is out of range.

Definition at line 21 of file sub_row.hpp.

◆ subtract() [1/4]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C> stan::math::subtract ( const Eigen::Matrix< T1, R, C > &  m1,
const Eigen::Matrix< T2, R, C > &  m2 
)
inline

Return the result of subtracting the second specified matrix from the first specified matrix.

The return scalar type is the promotion of the input types.

Template Parameters
T1Scalar type of first matrix.
T2Scalar type of second matrix.
RRow type of matrices.
CColumn type of matrices.
Parameters
m1First matrix.
m2Second matrix.
Returns
Difference between first matrix and second matrix.

Definition at line 27 of file subtract.hpp.

◆ subtract() [2/4]

auto stan::math::subtract ( const matrix_cl A,
const matrix_cl B 
)
inline

Matrix subtraction on the OpenCL device Subtracts the second matrix from the first matrix and stores the result in the third matrix (C=A-B)

Parameters
Afirst matrix
Bsecond matrix
Returns
subtraction result matrix
Exceptions
<code>std::invalid_argument</code>if the input matrices do not have matching dimensions.

Definition at line 28 of file subtract.hpp.

◆ subtract() [3/4]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C> stan::math::subtract ( const T1 &  c,
const Eigen::Matrix< T2, R, C > &  m 
)
inline

Definition at line 35 of file subtract.hpp.

◆ subtract() [4/4]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C> stan::math::subtract ( const Eigen::Matrix< T1, R, C > &  m,
const T2 &  c 
)
inline

Definition at line 42 of file subtract.hpp.

◆ sum() [1/8]

double stan::math::sum ( double  v)
inline

Returns specified input value.

Template Parameters
TType of element.
Parameters
vSpecified value.
Returns
Same value (the sum of one value).

Definition at line 15 of file sum.hpp.

◆ sum() [2/8]

template<typename Derived >
Eigen::DenseBase<Derived>::Scalar stan::math::sum ( const Eigen::DenseBase< Derived > &  v)
inline

Returns the sum of the coefficients of the specified Eigen Matrix, Array or expression.

Template Parameters
DerivedDerived argument type.
Parameters
vSpecified argument.
Returns
Sum of coefficients of argument.

Definition at line 19 of file sum.hpp.

◆ sum() [3/8]

template<typename T >
fvar<T> stan::math::sum ( const std::vector< fvar< T > > &  m)
inline

Return the sum of the entries of the specified standard vector.

Template Parameters
TType of vector entries.
Parameters
mVector.
Returns
Sum of vector entries.

Definition at line 20 of file sum.hpp.

◆ sum() [4/8]

template<typename T >
T stan::math::sum ( const std::vector< T > &  xs)
inline

Return the sum of the values in the specified standard vector.

Template Parameters
TType of elements summed.
Parameters
xsStandard vector to sum.
Returns
Sum of elements.

Definition at line 20 of file sum.hpp.

◆ sum() [5/8]

template<typename T , int R, int C>
fvar<T> stan::math::sum ( const Eigen::Matrix< fvar< T >, R, C > &  m)
inline

Return the sum of the entries of the specified matrix.

Template Parameters
TType of matrix entries.
RRow type of matrix.
CColumn type of matrix.
Parameters
mMatrix.
Returns
Sum of matrix entries.

Definition at line 21 of file sum.hpp.

◆ sum() [6/8]

int stan::math::sum ( int  v)
inline

Returns specified input value.

Template Parameters
TType of element.
Parameters
vSpecified value.
Returns
Same value (the sum of one value).

Definition at line 24 of file sum.hpp.

◆ sum() [7/8]

template<int R, int C>
var stan::math::sum ( const Eigen::Matrix< var, R, C > &  m)
inline

Returns the sum of the coefficients of the specified matrix, column vector or row vector.

Template Parameters
RRow type for matrix.
CColumn type for matrix.
Parameters
mSpecified matrix or vector.
Returns
Sum of coefficients of matrix.

Definition at line 50 of file sum.hpp.

◆ sum() [8/8]

var stan::math::sum ( const std::vector< var > &  m)
inline

Returns the sum of the entries of the specified vector.

Parameters
mVector.
Returns
Sum of vector entries.

Definition at line 52 of file sum.hpp.

◆ system_error() [1/2]

void stan::math::system_error ( const char *  function,
const char *  name,
const int &  y,
const char *  msg1,
const char *  msg2 
)
inline

Throw a system error with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing system errors. This will allow us to change the behavior for all functions at once. The message is: "<function>: <name> <msg1><y><msg2>"

Parameters
[in]functionName of the function.
[in]nameName of the variable.
[in]yError code.
[in]msg1Message to print before the variable.
[in]msg2Message to print after the variable.
Exceptions
std::system_errorAlways.

Definition at line 25 of file system_error.hpp.

◆ system_error() [2/2]

void stan::math::system_error ( const char *  function,
const char *  name,
const int &  y,
const char *  msg1 
)
inline

Throw a system error with a consistently formatted message.

This is an abstraction for all Stan functions to use when throwing system errors. This will allow us to change the behavior for all functions at once. The message is: * "<function>: <name> <msg1><y>"

Parameters
[in]functionName of the function.
[in]nameName of the variable.
[in]yError code.
[in]msg1Message to print before the variable.
Exceptions
std::system_errorAlways.

Definition at line 45 of file system_error.hpp.

◆ tail() [1/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::tail ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  v,
size_t  n 
)
inline

Return the specified number of elements as a vector from the back of the specified vector.

Template Parameters
TType of value in vector.
Parameters
vVector input.
nSize of return.
Returns
The last n elements of v.
Exceptions
std::out_of_rangeif n is out of range.

Definition at line 25 of file tail.hpp.

◆ tail() [2/3]

template<typename T >
Eigen::Matrix<T, 1, Eigen::Dynamic> stan::math::tail ( const Eigen::Matrix< T, 1, Eigen::Dynamic > &  rv,
size_t  n 
)
inline

Return the specified number of elements as a row vector from the back of the specified row vector.

Template Parameters
TType of value in vector.
Parameters
rvRow vector.
nSize of return row vector.
Returns
The last n elements of rv.
Exceptions
std::out_of_rangeif n is out of range.

Definition at line 43 of file tail.hpp.

◆ tail() [3/3]

template<typename T >
std::vector<T> stan::math::tail ( const std::vector< T > &  sv,
size_t  n 
)

Return the specified number of elements as a standard vector from the back of the specified standard vector.

Template Parameters
TType of value in vector.
Parameters
svStandard vector.
nSize of return.
Returns
The last n elements of sv.
Exceptions
std::out_of_rangeif n is out of range.

Definition at line 61 of file tail.hpp.

◆ tan() [1/3]

template<typename T >
fvar<T> stan::math::tan ( const fvar< T > &  x)
inline

Definition at line 11 of file tan.hpp.

◆ tan() [2/3]

template<typename T >
apply_scalar_unary<tan_fun, T>::return_t stan::math::tan ( const T &  x)
inline

Vectorized version of tan().

Parameters
xContainer of angles in radians.
Template Parameters
TContainer type.
Returns
Tangent of each value in x.

Definition at line 31 of file tan.hpp.

◆ tan() [3/3]

var stan::math::tan ( const var a)
inline

Return the tangent of a radian-scaled variable (cmath).

The derivative is defined by

$\frac{d}{dx} \tan x = \sec^2 x$.

\[ \mbox{tan}(x) = \begin{cases} \tan(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{tan}(x)}{\partial x} = \begin{cases} \sec^2(x) & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable for radians of angle.
Returns
Tangent of variable.

Definition at line 46 of file tan.hpp.

◆ tanh() [1/3]

template<typename T >
fvar<T> stan::math::tanh ( const fvar< T > &  x)
inline

Definition at line 11 of file tanh.hpp.

◆ tanh() [2/3]

template<typename T >
apply_scalar_unary<tanh_fun, T>::return_t stan::math::tanh ( const T &  x)
inline

Vectorized version of tanh().

Parameters
xContainer of angles in radians.
Template Parameters
TContainer type.
Returns
Hyperbolic tangent of each value in x.

Definition at line 31 of file tanh.hpp.

◆ tanh() [3/3]

var stan::math::tanh ( const var a)
inline

Return the hyperbolic tangent of the specified variable (cmath).

The derivative is defined by

$\frac{d}{dx} \tanh x = \frac{1}{\cosh^2 x}$.

\[ \mbox{tanh}(x) = \begin{cases} \tanh(x) & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{tanh}(x)}{\partial x} = \begin{cases} \mbox{sech}^2(x) & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aVariable.
Returns
Hyperbolic tangent of variable.

Definition at line 49 of file tanh.hpp.

◆ tcrossprod() [1/3]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, R> stan::math::tcrossprod ( const Eigen::Matrix< fvar< T >, R, C > &  m)
inline

Definition at line 12 of file tcrossprod.hpp.

◆ tcrossprod() [2/3]

matrix_d stan::math::tcrossprod ( const matrix_d M)
inline

Returns the result of post-multiplying a matrix by its own transpose.

Parameters
MMatrix to multiply.
Returns
M times its transpose.

Definition at line 16 of file tcrossprod.hpp.

◆ tcrossprod() [3/3]

matrix_v stan::math::tcrossprod ( const matrix_v M)
inline

Returns the result of post-multiplying a matrix by its own transpose.

Parameters
MMatrix to multiply.
Returns
M times its transpose.

Definition at line 21 of file tcrossprod.hpp.

◆ tgamma() [1/4]

double stan::math::tgamma ( double  x)
inline

Return the gamma function applied to the specified argument.

Parameters
xArgument.
Returns
The gamma function applied to argument.

Definition at line 18 of file tgamma.hpp.

◆ tgamma() [2/4]

template<typename T >
fvar<T> stan::math::tgamma ( const fvar< T > &  x)
inline

Return the result of applying the gamma function to the specified argument.

Template Parameters
TScalar type of autodiff variable.
Parameters
xArgument.
Returns
Gamma function applied to argument.

Definition at line 21 of file tgamma.hpp.

◆ tgamma() [3/4]

template<typename T >
apply_scalar_unary<tgamma_fun, T>::return_t stan::math::tgamma ( const T &  x)
inline

Vectorized version of tgamma().

Parameters
xContainer.
Template Parameters
TContainer type.
Returns
Gamma function applied to each value in x.
Exceptions
std::domain_errorif any value is 0 or a negative integer

Definition at line 32 of file tgamma.hpp.

◆ tgamma() [4/4]

var stan::math::tgamma ( const var a)
inline

Return the Gamma function applied to the specified variable (C99).

The derivative with respect to the argument is

$\frac{d}{dx} \Gamma(x) = \Gamma(x) \Psi^{(0)}(x)$

where $\Psi^{(0)}(x)$ is the digamma function.

\[ \mbox{tgamma}(x) = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \Gamma(x) & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{tgamma}(x)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \frac{\partial\, \Gamma(x)}{\partial x} & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \Gamma(x)=\int_0^{\infty} u^{x - 1} \exp(-u) \, du \]

\[ \frac{\partial \, \Gamma(x)}{\partial x} = \Gamma(x)\Psi(x) \]

Parameters
aArgument to function.
Returns
The Gamma function applied to the specified argument.

Definition at line 56 of file tgamma.hpp.

◆ to_array_1d() [1/3]

template<typename T , int R, int C>
std::vector<T> stan::math::to_array_1d ( const Eigen::Matrix< T, R, C > &  matrix)
inline

Definition at line 15 of file to_array_1d.hpp.

◆ to_array_1d() [2/3]

template<typename T >
std::vector<T> stan::math::to_array_1d ( const std::vector< T > &  x)
inline

Definition at line 26 of file to_array_1d.hpp.

◆ to_array_1d() [3/3]

template<typename T >
std::vector<typename scalar_type<T>::type> stan::math::to_array_1d ( const std::vector< std::vector< T > > &  x)
inline

Definition at line 32 of file to_array_1d.hpp.

◆ to_array_2d()

template<typename T >
std::vector<std::vector<T> > stan::math::to_array_2d ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  matrix)
inline

Definition at line 12 of file to_array_2d.hpp.

◆ to_fvar() [1/8]

template<typename T >
fvar<T> stan::math::to_fvar ( const T &  x)
inline

Definition at line 11 of file to_fvar.hpp.

◆ to_fvar() [2/8]

template<typename T >
std::vector<fvar<T> > stan::math::to_fvar ( const std::vector< T > &  v)
inline

Definition at line 12 of file to_fvar.hpp.

◆ to_fvar() [3/8]

template<int R, int C, typename T >
Eigen::Matrix<T, R, C> stan::math::to_fvar ( const Eigen::Matrix< T, R, C > &  m)
inline

Definition at line 13 of file to_fvar.hpp.

◆ to_fvar() [4/8]

template<typename T >
fvar<T> stan::math::to_fvar ( const fvar< T > &  x)
inline

Definition at line 16 of file to_fvar.hpp.

◆ to_fvar() [5/8]

template<int R, int C>
Eigen::Matrix<fvar<double>, R, C> stan::math::to_fvar ( const Eigen::Matrix< double, R, C > &  m)
inline

Definition at line 18 of file to_fvar.hpp.

◆ to_fvar() [6/8]

template<typename T >
std::vector<fvar<T> > stan::math::to_fvar ( const std::vector< T > &  v,
const std::vector< T > &  d 
)
inline

Definition at line 20 of file to_fvar.hpp.

◆ to_fvar() [7/8]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, C> stan::math::to_fvar ( const Eigen::Matrix< T, R, C > &  val,
const Eigen::Matrix< T, R, C > &  deriv 
)
inline

Definition at line 27 of file to_fvar.hpp.

◆ to_fvar() [8/8]

template<typename T >
std::vector<fvar<T> > stan::math::to_fvar ( const std::vector< fvar< T > > &  v)
inline

Definition at line 29 of file to_fvar.hpp.

◆ to_matrix() [1/8]

template<typename T , int R, int C>
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::to_matrix ( const Eigen::Matrix< T, R, C > &  x)
inline

Returns a matrix with dynamic dimensions constructed from an Eigen matrix which is either a row vector, column vector, or matrix.

The runtime dimensions will be the same as the input.

Template Parameters
Ttype of the scalar
Rnumber of rows
Cnumber of columns
Parameters
xmatrix
Returns
the matrix representation of the input

Definition at line 25 of file to_matrix.hpp.

◆ to_matrix() [2/8]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::to_matrix ( const std::vector< Eigen::Matrix< T, 1, Eigen::Dynamic > > &  x)
inline

Returns a matrix representation of a standard vector of Eigen row vectors with the same dimensions and indexing order.

Template Parameters
Ttype of the scalar
Parameters
xEigen vector of vectors of scalar values
Returns
the matrix representation of the input

Definition at line 39 of file to_matrix.hpp.

◆ to_matrix() [3/8]

template<typename T >
Eigen::Matrix<typename boost::math::tools::promote_args<T, double>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::to_matrix ( const std::vector< std::vector< T > > &  x)
inline

Returns a matrix representation of the standard vector of standard vectors with the same dimensions and indexing order.

Template Parameters
Ttype of the scalar
Parameters
xvector of vectors of scalar values
Returns
the matrix representation of the input

Definition at line 63 of file to_matrix.hpp.

◆ to_matrix() [4/8]

template<typename T , int R, int C>
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::to_matrix ( const Eigen::Matrix< T, R, C > &  x,
int  m,
int  n 
)
inline

Returns a matrix representation of the vector in column-major order with the specified number of rows and columns.

Template Parameters
Ttype of the scalar
Parameters
xmatrix
mrows
ncolumns
Returns
Reshaped inputted matrix
Exceptions
<code>std::invalid_argument</code>if the sizes do not match

Definition at line 92 of file to_matrix.hpp.

◆ to_matrix() [5/8]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::to_matrix ( const std::vector< T > &  x,
int  m,
int  n 
)
inline

Returns a matrix representation of the vector in column-major order with the specified number of rows and columns.

Template Parameters
Ttype of the scalar
Parameters
xvector of values
mrows
ncolumns
Returns
the matrix representation of the input
Exceptions
<code>std::invalid_argument</code>if the sizes do not match

Definition at line 114 of file to_matrix.hpp.

◆ to_matrix() [6/8]

Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> stan::math::to_matrix ( const std::vector< int > &  x,
int  m,
int  n 
)
inline

Returns a matrix representation of the vector in column-major order with the specified number of rows and columns.

Parameters
xvector of values
mrows
ncolumns
Returns
the matrix representation of the input
Exceptions
<code>std::invalid_argument</code>if the sizes do not match

Definition at line 133 of file to_matrix.hpp.

◆ to_matrix() [7/8]

template<typename T , int R, int C>
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::math::to_matrix ( const Eigen::Matrix< T, R, C > &  x,
int  m,
int  n,
bool  col_major 
)
inline

Returns a matrix representation of the vector in column-major order with the specified number of rows and columns.

Template Parameters
Ttype of the scalar
Parameters
xmatrix
mrows
ncolumns
col_majorcolumn-major indicator: if 1, output matrix is transversed in column-major order, if 0, output matrix is transversed in row-major order, otherwise function throws std::invalid_argument
Returns
Reshaped inputted matrix
Exceptions
<code>std::invalid_argument</code>if the sizes do not match

Definition at line 161 of file to_matrix.hpp.

◆ to_matrix() [8/8]

template<typename T >
Eigen::Matrix<typename boost::math::tools::promote_args<T, double>::type, Eigen::Dynamic, Eigen::Dynamic> stan::math::to_matrix ( const std::vector< T > &  x,
int  m,
int  n,
bool  col_major 
)
inline

Returns a matrix representation of the vector in column-major order with the specified number of rows and columns.

Template Parameters
Ttype of the scalar
Parameters
xvector of values
mrows
ncolumns
col_majorcolumn-major indicator: if 1, output matrix is transversed in column-major order, if 0, output matrix is transversed in row-major order, otherwise function throws std::invalid_argument
Returns
the matrix representation of the input
Exceptions
<code>std::invalid_argument</code>if the sizes do not match

Definition at line 193 of file to_matrix.hpp.

◆ to_matrix_cl() [1/2]

template<int R, int C>
matrix_cl stan::math::to_matrix_cl ( const Eigen::Matrix< double, R, C > &  src)
inline

Copies the source Eigen matrix to the destination matrix that is stored on the OpenCL device.

Template Parameters
RCompile time rows of the Eigen matrix
CCompile time columns of the Eigen matrix
Parameters
srcsource Eigen matrix
Returns
matrix_cl with a copy of the data in the source matrix

Writes the contents of src to the OpenCL buffer starting at the offset 0 CL_FALSE denotes that the call is non-blocking This means that future kernels need to know about the copy_event So that they do not execute until this transfer finishes.

Definition at line 37 of file copy.hpp.

◆ to_matrix_cl() [2/2]

template<typename T , std::enable_if_t< std::is_arithmetic< T >::value, int > = 0>
matrix_cl stan::math::to_matrix_cl ( const T &  src)
inline

Copy an arithmetic type to the device.

Template Parameters
TAn arithmetic type to pass the value from the OpenCL matrix to.
Parameters
srcArithmetic to receive the matrix_cl value.
Returns
A 1x1 matrix on the device.

Definition at line 242 of file copy.hpp.

◆ to_row_vector() [1/3]

template<typename T , int R, int C>
Eigen::Matrix<T, 1, Eigen::Dynamic> stan::math::to_row_vector ( const Eigen::Matrix< T, R, C > &  matrix)
inline

Definition at line 15 of file to_row_vector.hpp.

◆ to_row_vector() [2/3]

template<typename T >
Eigen::Matrix<T, 1, Eigen::Dynamic> stan::math::to_row_vector ( const std::vector< T > &  vec)
inline

Definition at line 23 of file to_row_vector.hpp.

◆ to_row_vector() [3/3]

Eigen::Matrix<double, 1, Eigen::Dynamic> stan::math::to_row_vector ( const std::vector< int > &  vec)
inline

Definition at line 29 of file to_row_vector.hpp.

◆ to_var() [1/10]

var stan::math::to_var ( double  x)
inline

Converts argument to an automatic differentiation variable.

Returns a var variable with the input value.

Parameters
[in]xA scalar value
Returns
An automatic differentiation variable with the input value.

Definition at line 18 of file to_var.hpp.

◆ to_var() [2/10]

std::vector<var> stan::math::to_var ( const std::vector< double > &  v)
inline

Converts argument to an automatic differentiation variable.

Returns a var variable with the input value.

Parameters
[in]vA std::vector<double>
Returns
A std::vector<var> with the values set

Definition at line 19 of file to_var.hpp.

◆ to_var() [3/10]

matrix_v stan::math::to_var ( const matrix_d m)
inline

Converts argument to an automatic differentiation variable.

Returns a var variable with the input value.

Parameters
[in]mA Matrix with scalars
Returns
A Matrix with automatic differentiation variables

Definition at line 22 of file to_var.hpp.

◆ to_var() [4/10]

var stan::math::to_var ( const var x)
inline

Converts argument to an automatic differentiation variable.

Returns a var variable with the input value.

Parameters
[in]xAn automatic differentiation variable.
Returns
An automatic differentiation variable with the input value.

Definition at line 28 of file to_var.hpp.

◆ to_var() [5/10]

std::vector<var> stan::math::to_var ( const std::vector< var > &  v)
inline

Converts argument to an automatic differentiation variable.

Returns a var variable with the input value.

Parameters
[in]vA std::vector<var>
Returns
A std::vector<var>

Definition at line 34 of file to_var.hpp.

◆ to_var() [6/10]

matrix_v stan::math::to_var ( const matrix_v m)
inline

Converts argument to an automatic differentiation variable.

Returns a var variable with the input value.

Parameters
[in]mA Matrix with automatic differentiation variables.
Returns
A Matrix with automatic differentiation variables.

Definition at line 37 of file to_var.hpp.

◆ to_var() [7/10]

vector_v stan::math::to_var ( const vector_d v)
inline

Converts argument to an automatic differentiation variable.

Returns a var variable with the input value.

Parameters
[in]vA Vector of scalars
Returns
A Vector of automatic differentiation variables with values of v

Definition at line 47 of file to_var.hpp.

◆ to_var() [8/10]

vector_v stan::math::to_var ( const vector_v v)
inline

Converts argument to an automatic differentiation variable.

Returns a var variable with the input value.

Parameters
[in]vA Vector of automatic differentiation variables
Returns
A Vector of automatic differentiation variables with values of v

Definition at line 62 of file to_var.hpp.

◆ to_var() [9/10]

row_vector_v stan::math::to_var ( const row_vector_d rv)
inline

Converts argument to an automatic differentiation variable.

Returns a var variable with the input value.

Parameters
[in]rvA row vector of scalars
Returns
A row vector of automatic differentation variables with values of rv.

Definition at line 72 of file to_var.hpp.

◆ to_var() [10/10]

row_vector_v stan::math::to_var ( const row_vector_v rv)
inline

Converts argument to an automatic differentiation variable.

Returns a var variable with the input value.

Parameters
[in]rvA row vector with automatic differentiation variables
Returns
A row vector with automatic differentiation variables with values of rv.

Definition at line 87 of file to_var.hpp.

◆ to_vector() [1/3]

template<typename T , int R, int C>
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::to_vector ( const Eigen::Matrix< T, R, C > &  matrix)
inline

Definition at line 15 of file to_vector.hpp.

◆ to_vector() [2/3]

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::to_vector ( const std::vector< T > &  vec)
inline

Definition at line 23 of file to_vector.hpp.

◆ to_vector() [3/3]

Eigen::Matrix<double, Eigen::Dynamic, 1> stan::math::to_vector ( const std::vector< int > &  vec)
inline

Definition at line 29 of file to_vector.hpp.

◆ trace() [1/2]

template<typename T >
T stan::math::trace ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)
inline

Returns the trace of the specified matrix.

The trace is defined as the sum of the elements on the diagonal. The matrix is not required to be square. Returns 0 if matrix is empty.

Parameters
[in]mSpecified matrix.
Returns
Trace of the matrix.

Definition at line 19 of file trace.hpp.

◆ trace() [2/2]

template<typename T >
T stan::math::trace ( const T &  m)
inline

Definition at line 24 of file trace.hpp.

◆ trace_gen_inv_quad_form_ldlt() [1/2]

template<typename T1 , int R1, int C1, typename T2 , int R2, int C2, typename T3 , int R3, int C3>
std::enable_if<stan::is_var<T1>::value || stan::is_var<T2>::value || stan::is_var<T3>::value, var>::type stan::math::trace_gen_inv_quad_form_ldlt ( const Eigen::Matrix< T1, R1, C1 > &  D,
const LDLT_factor< T2, R2, C2 > &  A,
const Eigen::Matrix< T3, R3, C3 > &  B 
)
inline

Compute the trace of an inverse quadratic form.

I.E., this computes trace(D B^T A^-1 B) where D is a square matrix and the LDLT_factor of A is provided.

Definition at line 26 of file trace_gen_inv_quad_form_ldlt.hpp.

◆ trace_gen_inv_quad_form_ldlt() [2/2]

template<typename T1 , typename T2 , typename T3 , int R1, int C1, int R2, int C2, int R3, int C3>
std::enable_if< !stan::is_var<T1>::value && !stan::is_var<T2>::value && !stan::is_var<T3>::value, typename boost::math::tools::promote_args<T1, T2, T3>::type>::type stan::math::trace_gen_inv_quad_form_ldlt ( const Eigen::Matrix< T1, R1, C1 > &  D,
const LDLT_factor< T2, R2, C2 > &  A,
const Eigen::Matrix< T3, R3, C3 > &  B 
)
inline

Definition at line 28 of file trace_gen_inv_quad_form_ldlt.hpp.

◆ trace_gen_quad_form() [1/3]

template<int RD, int CD, int RA, int CA, int RB, int CB>
double stan::math::trace_gen_quad_form ( const Eigen::Matrix< double, RD, CD > &  D,
const Eigen::Matrix< double, RA, CA > &  A,
const Eigen::Matrix< double, RB, CB > &  B 
)
inline

Compute trace(D B^T A B).

Definition at line 14 of file trace_gen_quad_form.hpp.

◆ trace_gen_quad_form() [2/3]

template<int RD, int CD, int RA, int CA, int RB, int CB, typename T >
fvar<T> stan::math::trace_gen_quad_form ( const Eigen::Matrix< fvar< T >, RD, CD > &  D,
const Eigen::Matrix< fvar< T >, RA, CA > &  A,
const Eigen::Matrix< fvar< T >, RB, CB > &  B 
)
inline

Definition at line 15 of file trace_gen_quad_form.hpp.

◆ trace_gen_quad_form() [3/3]

template<typename Td , int Rd, int Cd, typename Ta , int Ra, int Ca, typename Tb , int Rb, int Cb>
std::enable_if<std::is_same<Td, var>::value || std::is_same<Ta, var>::value || std::is_same<Tb, var>::value, var>::type stan::math::trace_gen_quad_form ( const Eigen::Matrix< Td, Rd, Cd > &  D,
const Eigen::Matrix< Ta, Ra, Ca > &  A,
const Eigen::Matrix< Tb, Rb, Cb > &  B 
)
inline

Definition at line 100 of file trace_gen_quad_form.hpp.

◆ trace_inv_quad_form_ldlt() [1/2]

template<typename T1 , typename T2 , int R2, int C2, int R3, int C3>
std::enable_if< !stan::is_var<T1>::value && !stan::is_var<T2>::value, typename boost::math::tools::promote_args<T1, T2>::type>::type stan::math::trace_inv_quad_form_ldlt ( const LDLT_factor< T1, R2, C2 > &  A,
const Eigen::Matrix< T2, R3, C3 > &  B 
)
inline

Definition at line 25 of file trace_inv_quad_form_ldlt.hpp.

◆ trace_inv_quad_form_ldlt() [2/2]

template<typename T2 , int R2, int C2, typename T3 , int R3, int C3>
std::enable_if<stan::is_var<T2>::value || stan::is_var<T3>::value, var>::type stan::math::trace_inv_quad_form_ldlt ( const LDLT_factor< T2, R2, C2 > &  A,
const Eigen::Matrix< T3, R3, C3 > &  B 
)
inline

Compute the trace of an inverse quadratic form.

I.E., this computes trace(B^T A^-1 B) where the LDLT_factor of A is provided.

Definition at line 162 of file trace_inv_quad_form_ldlt.hpp.

◆ trace_quad_form() [1/5]

template<int RA, int CA, int RB, int CB>
double stan::math::trace_quad_form ( const Eigen::Matrix< double, RA, CA > &  A,
const Eigen::Matrix< double, RB, CB > &  B 
)
inline

Compute trace(B^T A B).

Definition at line 14 of file trace_quad_form.hpp.

◆ trace_quad_form() [2/5]

template<int RA, int CA, int RB, int CB, typename T >
fvar<T> stan::math::trace_quad_form ( const Eigen::Matrix< fvar< T >, RA, CA > &  A,
const Eigen::Matrix< fvar< T >, RB, CB > &  B 
)
inline

Definition at line 16 of file trace_quad_form.hpp.

◆ trace_quad_form() [3/5]

template<int RA, int CA, int RB, int CB, typename T >
fvar<T> stan::math::trace_quad_form ( const Eigen::Matrix< fvar< T >, RA, CA > &  A,
const Eigen::Matrix< double, RB, CB > &  B 
)
inline

Definition at line 24 of file trace_quad_form.hpp.

◆ trace_quad_form() [4/5]

template<int RA, int CA, int RB, int CB, typename T >
fvar<T> stan::math::trace_quad_form ( const Eigen::Matrix< double, RA, CA > &  A,
const Eigen::Matrix< fvar< T >, RB, CB > &  B 
)
inline

Definition at line 32 of file trace_quad_form.hpp.

◆ trace_quad_form() [5/5]

template<typename Ta , int Ra, int Ca, typename Tb , int Rb, int Cb>
std::enable_if< std::is_same<Ta, var>::value || std::is_same<Tb, var>::value, var>::type stan::math::trace_quad_form ( const Eigen::Matrix< Ta, Ra, Ca > &  A,
const Eigen::Matrix< Tb, Rb, Cb > &  B 
)
inline

Definition at line 85 of file trace_quad_form.hpp.

◆ transpose() [1/2]

template<typename T , int R, int C>
Eigen::Matrix<T, C, R> stan::math::transpose ( const Eigen::Matrix< T, R, C > &  m)
inline

Definition at line 10 of file transpose.hpp.

◆ transpose() [2/2]

matrix_cl stan::math::transpose ( const matrix_cl src)
inline

Takes the transpose of the matrix on the OpenCL device.

Parameters
srcthe input matrix
Returns
transposed input matrix

Definition at line 20 of file transpose.hpp.

◆ tri_inverse()

template<TriangularViewCL triangular_view>
matrix_cl stan::math::tri_inverse ( const matrix_cl A)
inline

Computes the inverse of a triangular matrix.

For a full guide to how this works and fits into Cholesky decompositions, see the reference report here and kernel doc here.

Template Parameters
triangular_viewthe triangularity of the input matrix
Parameters
Amatrix on the OpenCL device
Returns
the inverse of A
Exceptions
<code>std::invalid_argument</code>if the matrix is not square

Definition at line 39 of file tri_inverse.hpp.

◆ trigamma() [1/5]

template<typename T >
fvar<T> stan::math::trigamma ( const fvar< T > &  u)
inline

Return the value of the trigamma function at the specified argument (i.e., the second derivative of the log Gamma function at the specified argument).

Parameters
uargument
Returns
trigamma function at argument

Definition at line 20 of file trigamma.hpp.

◆ trigamma() [2/5]

var stan::math::trigamma ( const var u)
inline

Return the value of the trigamma function at the specified argument (i.e., the second derivative of the log Gamma function at the specified argument).

Parameters
uargument
Returns
trigamma function at argument

Definition at line 23 of file trigamma.hpp.

◆ trigamma() [3/5]

template<typename T >
apply_scalar_unary<trigamma_fun, T>::return_t stan::math::trigamma ( const T &  x)
inline

Return the elementwise application of trigamma() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
Tcontainer type
Parameters
xcontainer
Returns
elementwise trigamma of container elements

Definition at line 39 of file trigamma.hpp.

◆ trigamma() [4/5]

double stan::math::trigamma ( double  u)
inline

Return the second derivative of the log Gamma function evaluated at the specified argument.

\[ \mbox{trigamma}(x) = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \Psi_1(x) & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{trigamma}(x)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \frac{\partial\, \Psi_1(x)}{\partial x} & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \Psi_1(x)=\sum_{n=0}^\infty \frac{1}{(x+n)^2} \]

\[ \frac{\partial \, \Psi_1(x)}{\partial x} = -2\sum_{n=0}^\infty \frac{1}{(x+n)^3} \]

Parameters
[in]uargument
Returns
second derivative of log Gamma function at argument

Definition at line 115 of file trigamma.hpp.

◆ trigamma() [5/5]

double stan::math::trigamma ( int  u)
inline

Return the second derivative of the log Gamma function evaluated at the specified argument.

Parameters
[in]uargument
Returns
second derivative of log Gamma function at argument

Definition at line 124 of file trigamma.hpp.

◆ trigamma_impl()

template<typename T >
T stan::math::trigamma_impl ( const T &  x)
inline

Return the trigamma function applied to the argument.

The trigamma function returns the second derivative of the log Gamma function evaluated at the specified argument. This base templated version is used in prim, fwd, and rev implementations.

Template Parameters
Tscalar argument type
Parameters
xargument
Returns
second derivative of log Gamma function at argument

Definition at line 33 of file trigamma.hpp.

◆ trunc() [1/5]

double stan::math::trunc ( double  x)
inline

Return the nearest integral value that is not larger in magnitude than the specified argument.

Parameters
[in]xArgument.
Returns
The truncated argument.

Definition at line 17 of file trunc.hpp.

◆ trunc() [2/5]

template<typename T >
fvar<T> stan::math::trunc ( const fvar< T > &  x)
inline

Return the nearest integral value that is not larger in magnitude than the specified argument.

Template Parameters
TScalar type of autodiff variable.
Parameters
[in]xArgument.
Returns
The truncated argument.

Definition at line 20 of file trunc.hpp.

◆ trunc() [3/5]

double stan::math::trunc ( int  x)
inline

Return the nearest integral value that is not larger in magnitude than the specified argument.

Parameters
[in]xArgument.
Returns
The truncated argument.

Definition at line 26 of file trunc.hpp.

◆ trunc() [4/5]

template<typename T >
apply_scalar_unary<trunc_fun, T>::return_t stan::math::trunc ( const T &  x)
inline

Return the elementwise application of trunc() to specified argument container.

The return type promotes the underlying scalar argument type to double if it is an integer, and otherwise is the argument type.

Template Parameters
Tcontainer type
Parameters
xcontainer
Returns
elementwise trunc of container elements

Definition at line 39 of file trunc.hpp.

◆ trunc() [5/5]

var stan::math::trunc ( const var a)
inline

Returns the truncatation of the specified variable (C99).

See trunc() for the double-based version.

The derivative is zero everywhere but at integer values, so for convenience the derivative is defined to be everywhere zero,

$\frac{d}{dx} \mbox{trunc}(x) = 0$.

\[ \mbox{trunc}(x) = \begin{cases} \lfloor x \rfloor & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{trunc}(x)}{\partial x} = \begin{cases} 0 & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aSpecified variable.
Returns
Truncation of the variable.

Definition at line 54 of file trunc.hpp.

◆ ub_constrain() [1/2]

template<typename T , typename U >
boost::math::tools::promote_args<T, U>::type stan::math::ub_constrain ( const T &  x,
const U &  ub 
)
inline

Return the upper-bounded value for the specified unconstrained scalar and upper bound.

The transform is

$f(x) = U - \exp(x)$

where $U$ is the upper bound.

If the upper bound is positive infinity, this function reduces to identity_constrain(x).

Template Parameters
Ttype of scalar
Utype of upper bound
Parameters
[in]xfree scalar.
[in]ubupper bound
Returns
scalar constrained to have upper bound

Definition at line 33 of file ub_constrain.hpp.

◆ ub_constrain() [2/2]

template<typename T , typename U >
boost::math::tools::promote_args<T, U>::type stan::math::ub_constrain ( const T &  x,
const U &  ub,
T &  lp 
)
inline

Return the upper-bounded value for the specified unconstrained scalar and upper bound and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.

The transform is as specified for ub_constrain(T, double). The log absolute Jacobian determinant is

$ \log | \frac{d}{dx} -\mbox{exp}(x) + U | = \log | -\mbox{exp}(x) + 0 | = x$.

If the upper bound is positive infinity, this function reduces to identity_constrain(x, lp).

Template Parameters
Ttype of scalar
Utype of upper bound
Parameters
[in]xfree scalar.
[in]ubupper bound
[in,out]lplog density
Returns
scalar constrained to have upper bound

Definition at line 65 of file ub_constrain.hpp.

◆ ub_free()

template<typename T , typename U >
boost::math::tools::promote_args<T, U>::type stan::math::ub_free ( const T &  y,
const U &  ub 
)
inline

Return the free scalar that corresponds to the specified upper-bounded value with respect to the specified upper bound.

The transform is the reverse of the ub_constrain(T, double) transform,

$f^{-1}(y) = \log -(y - U)$

where $U$ is the upper bound.

If the upper bound is positive infinity, this function reduces to identity_free(y).

Template Parameters
Ttype of scalar
Utype of upper bound
Parameters
yconstrained scalar with specified upper bound
ubupper bound
Returns
unconstrained scalar with respect to upper bound
Exceptions
std::invalid_argumentif constrained scalar is greater than the upper bound.

Definition at line 37 of file ub_free.hpp.

◆ uniform_ccdf_log()

template<typename T_y , typename T_low , typename T_high >
return_type<T_y, T_low, T_high>::type stan::math::uniform_ccdf_log ( const T_y &  y,
const T_low &  alpha,
const T_high &  beta 
)
Deprecated:
use uniform_lccdf

Definition at line 14 of file uniform_ccdf_log.hpp.

◆ uniform_cdf()

template<typename T_y , typename T_low , typename T_high >
return_type<T_y, T_low, T_high>::type stan::math::uniform_cdf ( const T_y &  y,
const T_low &  alpha,
const T_high &  beta 
)

Definition at line 16 of file uniform_cdf.hpp.

◆ uniform_cdf_log()

template<typename T_y , typename T_low , typename T_high >
return_type<T_y, T_low, T_high>::type stan::math::uniform_cdf_log ( const T_y &  y,
const T_low &  alpha,
const T_high &  beta 
)
Deprecated:
use uniform_lcdf

Definition at line 14 of file uniform_cdf_log.hpp.

◆ uniform_lccdf()

template<typename T_y , typename T_low , typename T_high >
return_type<T_y, T_low, T_high>::type stan::math::uniform_lccdf ( const T_y &  y,
const T_low &  alpha,
const T_high &  beta 
)

Definition at line 18 of file uniform_lccdf.hpp.

◆ uniform_lcdf()

template<typename T_y , typename T_low , typename T_high >
return_type<T_y, T_low, T_high>::type stan::math::uniform_lcdf ( const T_y &  y,
const T_low &  alpha,
const T_high &  beta 
)

Definition at line 18 of file uniform_lcdf.hpp.

◆ uniform_log() [1/2]

template<bool propto, typename T_y , typename T_low , typename T_high >
return_type<T_y, T_low, T_high>::type stan::math::uniform_log ( const T_y &  y,
const T_low &  alpha,
const T_high &  beta 
)

The log of a uniform density for the given y, lower, and upper bound.

\begin{eqnarray*} y &\sim& \mbox{\sf{U}}(\alpha, \beta) \\ \log (p (y \, |\, \alpha, \beta)) &=& \log \left( \frac{1}{\beta-\alpha} \right) \\ &=& \log (1) - \log (\beta - \alpha) \\ &=& -\log (\beta - \alpha) \\ & & \mathrm{ where } \; y \in [\alpha, \beta], \log(0) \; \mathrm{otherwise} \end{eqnarray*}

Deprecated:
use uniform_lpdf
Parameters
yA scalar variable.
alphaLower bound.
betaUpper bound.
Exceptions
std::invalid_argumentif the lower bound is greater than or equal to the lower bound
Template Parameters
T_yType of scalar.
T_lowType of lower bound.
T_highType of upper bound.

Definition at line 35 of file uniform_log.hpp.

◆ uniform_log() [2/2]

template<typename T_y , typename T_low , typename T_high >
return_type<T_y, T_low, T_high>::type stan::math::uniform_log ( const T_y &  y,
const T_low &  alpha,
const T_high &  beta 
)
inline
Deprecated:
use uniform_lpdf

Definition at line 45 of file uniform_log.hpp.

◆ uniform_lpdf() [1/2]

template<bool propto, typename T_y , typename T_low , typename T_high >
return_type<T_y, T_low, T_high>::type stan::math::uniform_lpdf ( const T_y &  y,
const T_low &  alpha,
const T_high &  beta 
)

The log of a uniform density for the given y, lower, and upper bound.

\begin{eqnarray*} y &\sim& \mbox{\sf{U}}(\alpha, \beta) \\ \log (p (y \, |\, \alpha, \beta)) &=& \log \left( \frac{1}{\beta-\alpha} \right) \\ &=& \log (1) - \log (\beta - \alpha) \\ &=& -\log (\beta - \alpha) \\ & & \mathrm{ where } \; y \in [\alpha, \beta], \log(0) \; \mathrm{otherwise} \end{eqnarray*}

Parameters
yA scalar variable.
alphaLower bound.
betaUpper bound.
Exceptions
std::invalid_argumentif the lower bound is greater than or equal to the lower bound
Template Parameters
T_yType of scalar.
T_lowType of lower bound.
T_highType of upper bound.

Definition at line 40 of file uniform_lpdf.hpp.

◆ uniform_lpdf() [2/2]

template<typename T_y , typename T_low , typename T_high >
return_type<T_y, T_low, T_high>::type stan::math::uniform_lpdf ( const T_y &  y,
const T_low &  alpha,
const T_high &  beta 
)
inline

Definition at line 104 of file uniform_lpdf.hpp.

◆ uniform_rng()

template<typename T_alpha , typename T_beta , class RNG >
VectorBuilder<true, double, T_alpha, T_beta>::type stan::math::uniform_rng ( const T_alpha &  alpha,
const T_beta &  beta,
RNG &  rng 
)
inline

Return a uniform random variate for the given upper and lower bounds using the specified random number generator.

alpha and beta can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_alphaType of shape parameter
T_betaType of inverse scale parameter
RNGtype of random number generator
Parameters
alpha(Sequence of) lower bound parameter(s)
beta(Sequence of) upper bound parameter(s)
rngrandom number generator
Returns
(Sequence of) uniform random variate(s)
Exceptions
std::domain_errorif alpha or beta are non-finite
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 36 of file uniform_rng.hpp.

◆ unit_vector_constrain() [1/6]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, C> stan::math::unit_vector_constrain ( const Eigen::Matrix< fvar< T >, R, C > &  y)
inline

Definition at line 19 of file unit_vector_constrain.hpp.

◆ unit_vector_constrain() [2/6]

template<typename T , int R, int C>
Eigen::Matrix<T, R, C> stan::math::unit_vector_constrain ( const Eigen::Matrix< T, R, C > &  y)

Return the unit length vector corresponding to the free vector y.

See the Wikipedia page on generating random points on an N-sphere.

Template Parameters
TScalar type.
Parameters
yvector of K unrestricted variables
Returns
Unit length vector of dimension K

Definition at line 26 of file unit_vector_constrain.hpp.

◆ unit_vector_constrain() [3/6]

template<typename T , int R, int C>
Eigen::Matrix<T, R, C> stan::math::unit_vector_constrain ( const Eigen::Matrix< T, R, C > &  y,
T &  lp 
)

Return the unit length vector corresponding to the free vector y.

See https://en.wikipedia.org/wiki/N-sphere#Generating_random_points

Parameters
yvector of K unrestricted variables
Returns
Unit length vector of dimension K
Parameters
lpLog probability reference to increment.
Template Parameters
TScalar type.

Definition at line 45 of file unit_vector_constrain.hpp.

◆ unit_vector_constrain() [4/6]

template<typename T , int R, int C>
Eigen::Matrix<fvar<T>, R, C> stan::math::unit_vector_constrain ( const Eigen::Matrix< fvar< T >, R, C > &  y,
fvar< T > &  lp 
)
inline

Definition at line 48 of file unit_vector_constrain.hpp.

◆ unit_vector_constrain() [5/6]

template<int R, int C>
Eigen::Matrix<var, R, C> stan::math::unit_vector_constrain ( const Eigen::Matrix< var, R, C > &  y)

Return the unit length vector corresponding to the free vector y.

See https://en.wikipedia.org/wiki/N-sphere#Generating_random_points

Parameters
yvector of K unrestricted variables
Returns
Unit length vector of dimension K
Template Parameters
TScalar type.

Definition at line 56 of file unit_vector_constrain.hpp.

◆ unit_vector_constrain() [6/6]

template<int R, int C>
Eigen::Matrix<var, R, C> stan::math::unit_vector_constrain ( const Eigen::Matrix< var, R, C > &  y,
var lp 
)

Return the unit length vector corresponding to the free vector y.

See https://en.wikipedia.org/wiki/N-sphere#Generating_random_points

Parameters
yvector of K unrestricted variables
Returns
Unit length vector of dimension K
Parameters
lpLog probability reference to increment.
Template Parameters
TScalar type.

Definition at line 97 of file unit_vector_constrain.hpp.

◆ unit_vector_free()

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::math::unit_vector_free ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x)

Transformation of a unit length vector to a "free" vector However, we are just fixing the unidentified radius to 1.

Thus, the transformation is just the identity

Parameters
xunit vector of dimension K
Returns
Unit vector of dimension K considered "free"
Template Parameters
TScalar type.

Definition at line 22 of file unit_vector_free.hpp.

◆ validate_non_negative_index()

void stan::math::validate_non_negative_index ( const char *  var_name,
const char *  expr,
int  val 
)
inline

Definition at line 12 of file validate_non_negative_index.hpp.

◆ value_of() [1/9]

template<typename T >
T stan::math::value_of ( const fvar< T > &  v)
inline

Return the value of the specified variable.

Parameters
vVariable.
Returns
Value of variable.

Definition at line 17 of file value_of.hpp.

◆ value_of() [2/9]

template<typename T >
std::vector<typename child_type<T>::type> stan::math::value_of ( const std::vector< T > &  x)
inline

Convert a std::vector of type T to a std::vector of child_type<T>::type.

Template Parameters
TScalar type in std::vector
Parameters
[in]xstd::vector to be converted
Returns
std::vector of values

Definition at line 21 of file value_of.hpp.

◆ value_of() [3/9]

double stan::math::value_of ( const var v)
inline

Return the value of the specified variable.

This function is used internally by auto-dif functions along with value_of(T x) to extract the double value of either a scalar or an auto-dif variable. This function will be called when the argument is a var even if the function is not referred to by namespace because of argument-dependent lookup.

Parameters
vVariable.
Returns
Value of variable.

Definition at line 23 of file value_of.hpp.

◆ value_of() [4/9]

template<typename T , int R, int C>
Eigen::Matrix<typename child_type<T>::type, R, C> stan::math::value_of ( const Eigen::Matrix< T, R, C > &  M)
inline

Convert a matrix of type T to a matrix of doubles.

T must implement value_of. See test/math/fwd/mat/fun/value_of.cpp for fvar and var usage.

Template Parameters
TScalar type in matrix
RRows of matrix
CColumns of matrix
Parameters
[in]MMatrix to be converted
Returns
Matrix of values

Definition at line 24 of file value_of.hpp.

◆ value_of() [5/9]

template<typename T >
double stan::math::value_of ( const T  x)
inline

Return the value of the specified scalar argument converted to a double value.

See the primitive_value function to extract values without casting to double.

This function is meant to cover the primitive types. For types requiring pass-by-reference, this template function should be specialized.

Template Parameters
Ttype of scalar.
Parameters
xscalar to convert to double
Returns
value of scalar cast to double

Definition at line 24 of file value_of.hpp.

◆ value_of() [6/9]

const std::vector<double>& stan::math::value_of ( const std::vector< double > &  x)
inline

Return the specified argument.

See value_of(T) for a polymorphic implementation using static casts.

This inline pass-through no-op should be compiled away.

Parameters
xSpecified std::vector.
Returns
Specified std::vector.

Definition at line 41 of file value_of.hpp.

◆ value_of() [7/9]

template<int R, int C>
const Eigen::Matrix<double, R, C>& stan::math::value_of ( const Eigen::Matrix< double, R, C > &  x)
inline

Return the specified argument.

See value_of(T) for a polymorphic implementation using static casts.

This inline pass-through no-op should be compiled away.

Parameters
xSpecified matrix.
Returns
Specified matrix.

Definition at line 45 of file value_of.hpp.

◆ value_of() [8/9]

int stan::math::value_of ( int  x)
inline

Return the specified argument.

See value_of(T) for a polymorphic implementation using static casts.

This inline pass-through no-op should be compiled away.

Parameters
xvalue
Returns
input value

Definition at line 55 of file value_of.hpp.

◆ value_of() [9/9]

const std::vector<int>& stan::math::value_of ( const std::vector< int > &  x)
inline

Return the specified argument.

See value_of(T) for a polymorphic implementation using static casts.

This inline pass-through no-op should be compiled away.

Parameters
xSpecified std::vector.
Returns
Specified std::vector.

Definition at line 56 of file value_of.hpp.

◆ value_of< double >()

template<>
double stan::math::value_of< double > ( double  x)
inline

Return the specified argument.

See value_of(T) for a polymorphic implementation using static casts.

This inline pass-through no-op should be compiled away.

Parameters
xvalue
Returns
input value

Definition at line 40 of file value_of.hpp.

◆ value_of_rec() [1/7]

double stan::math::value_of_rec ( const var v)
inline

Return the value of the specified variable.

Parameters
vVariable.
Returns
Value of variable.

Definition at line 17 of file value_of_rec.hpp.

◆ value_of_rec() [2/7]

template<typename T >
double stan::math::value_of_rec ( const fvar< T > &  v)
inline

Return the value of the specified variable.

T must implement value_of_rec.

Template Parameters
TScalar type
Parameters
vVariable.
Returns
Value of variable.

Definition at line 22 of file value_of_rec.hpp.

◆ value_of_rec() [3/7]

template<typename T >
std::vector<double> stan::math::value_of_rec ( const std::vector< T > &  x)
inline

Convert a std::vector of type T to a std::vector of doubles.

T must implement value_of_rec. See test/math/fwd/mat/fun/value_of_rec.cpp for fvar and var usage.

Template Parameters
TScalar type in std::vector
Parameters
[in]xstd::vector to be converted
Returns
std::vector of values

Definition at line 23 of file value_of_rec.hpp.

◆ value_of_rec() [4/7]

template<typename T , int R, int C>
Eigen::Matrix<double, R, C> stan::math::value_of_rec ( const Eigen::Matrix< T, R, C > &  M)
inline

Convert a matrix of type T to a matrix of doubles.

T must implement value_of_rec. See test/unit/math/fwd/mat/fun/value_of_test.cpp for fvar and var usage.

Template Parameters
TScalar type in matrix
RRows of matrix
CColumns of matrix
Parameters
[in]MMatrix to be converted
Returns
Matrix of values

Definition at line 23 of file value_of_rec.hpp.

◆ value_of_rec() [5/7]

template<typename T >
double stan::math::value_of_rec ( const T  x)
inline

Return the value of the specified scalar argument converted to a double value.

See the primitive_value function to extract values without casting to double.

This function is meant to cover the primitive types. For types requiring pass-by-reference, this template function should be specialized.

Template Parameters
TType of scalar.
Parameters
xScalar to convert to double.
Returns
Value of scalar cast to a double.

Definition at line 24 of file value_of_rec.hpp.

◆ value_of_rec() [6/7]

const std::vector<double>& stan::math::value_of_rec ( const std::vector< double > &  x)
inline

Return the specified argument.

See value_of_rec(T) for a polymorphic implementation using static casts.

This inline pass-through no-op should be compiled away.

Parameters
xSpecified std::vector.
Returns
Specified std::vector.

Definition at line 42 of file value_of_rec.hpp.

◆ value_of_rec() [7/7]

template<int R, int C>
const Eigen::Matrix<double, R, C>& stan::math::value_of_rec ( const Eigen::Matrix< double, R, C > &  x)
inline

Return the specified argument.

See value_of_rec(T) for a polymorphic implementation using static casts.

This inline pass-through no-op should be compiled away.

Parameters
xSpecified matrix.
Returns
Specified matrix.

Definition at line 44 of file value_of_rec.hpp.

◆ value_of_rec< double >()

template<>
double stan::math::value_of_rec< double > ( double  x)
inline

Return the specified argument.

See value_of(T) for a polymorphic implementation using static casts.

This inline pass-through no-op should be compiled away.

Parameters
xSpecified value.
Returns
Specified value.

Definition at line 40 of file value_of_rec.hpp.

◆ variance() [1/4]

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::variance ( const std::vector< T > &  v)
inline

Returns the sample variance (divide by length - 1) of the coefficients in the specified standard vector.

Parameters
vSpecified vector.
Returns
Sample variance of vector.
Exceptions
std::domain_errorif the size of the vector is less than 1.

Definition at line 22 of file variance.hpp.

◆ variance() [2/4]

template<typename T , int R, int C>
boost::math::tools::promote_args<T>::type stan::math::variance ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the sample variance (divide by length - 1) of the coefficients in the specified column vector.

Parameters
mSpecified vector.
Returns
Sample variance of vector.

Definition at line 43 of file variance.hpp.

◆ variance() [3/4]

var stan::math::variance ( const std::vector< var > &  v)
inline

Return the sample variance of the specified standard vector.

Raise domain error if size is not greater than zero.

Parameters
[in]va vector
Returns
sample variance of specified vector

Definition at line 46 of file variance.hpp.

◆ variance() [4/4]

template<int R, int C>
var stan::math::variance ( const Eigen::Matrix< var, R, C > &  m)

Definition at line 64 of file variance.hpp.

◆ vec_concat() [1/2]

template<typename T >
const std::vector<T>& stan::math::vec_concat ( const std::vector< T > &  v1)
inline

Ends the recursion to extract the event stack.

Parameters
v1Events on the OpenCL event stack.
Returns
returns input vector.

Definition at line 17 of file vec_concat.hpp.

◆ vec_concat() [2/2]

template<typename T , typename... Args>
const std::vector<T> stan::math::vec_concat ( const std::vector< T > &  v1,
const Args...  args 
)
inline

Gets the event stack from a vector of events and other arguments.

Parameters
v1A event stack to roll up.
argsvariadic arcs passed down to the next recursion.
Template Parameters
ArgsTypes for variadic.
Returns
Vector of OpenCL events

Definition at line 29 of file vec_concat.hpp.

◆ von_mises_log() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::von_mises_log ( T_y const &  y,
T_loc const &  mu,
T_scale const &  kappa 
)
Deprecated:
use von_mises_lpdf

Definition at line 14 of file von_mises_log.hpp.

◆ von_mises_log() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::von_mises_log ( T_y const &  y,
T_loc const &  mu,
T_scale const &  kappa 
)
inline
Deprecated:
use von_mises_lpdf

Definition at line 23 of file von_mises_log.hpp.

◆ von_mises_lpdf() [1/2]

template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::von_mises_lpdf ( T_y const &  y,
T_loc const &  mu,
T_scale const &  kappa 
)

Definition at line 19 of file von_mises_lpdf.hpp.

◆ von_mises_lpdf() [2/2]

template<typename T_y , typename T_loc , typename T_scale >
return_type<T_y, T_loc, T_scale>::type stan::math::von_mises_lpdf ( T_y const &  y,
T_loc const &  mu,
T_scale const &  kappa 
)
inline

Definition at line 101 of file von_mises_lpdf.hpp.

◆ von_mises_rng()

template<typename T_loc , typename T_conc , class RNG >
VectorBuilder<true, double, T_loc, T_conc>::type stan::math::von_mises_rng ( const T_loc &  mu,
const T_conc &  kappa,
RNG &  rng 
)
inline

Return a von Mises random variate for the given location and concentration using the specified random number generator.

mu and kappa can each be a scalar or a vector. Any non-scalar inputs must be the same length.

The algorithm used in von_mises_rng is a modified version of the algorithm in:

Efficient Simulation of the von Mises Distribution D. J. Best and N. I. Fisher Journal of the Royal Statistical Society. Series C (Applied Statistics), Vol. 28, No. 2 (1979), pp. 152-157

See licenses/stan-license.txt for Stan license.

Template Parameters
T_locType of location parameter
T_concType of concentration parameter
RNGtype of random number generator
Parameters
mu(Sequence of) location parameter(s)
kappa(Sequence of) positive concentration parameter(s)
rngrandom number generator
Returns
(Sequence of) von Mises random variate(s)
Exceptions
std::domain_errorif mu is infinite or kappa is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 46 of file von_mises_rng.hpp.

◆ weibull_ccdf_log()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::weibull_ccdf_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)
Deprecated:
use weibull_lccdf

Definition at line 14 of file weibull_ccdf_log.hpp.

◆ weibull_cdf()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::weibull_cdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)

Returns the Weibull cumulative distribution function for the given location and scale.

Given containers of matching sizes, returns the product of probabilities.

Template Parameters
T_ytype of real parameter
T_shapetype of shape parameter
T_scaletype of scale paramater
Parameters
yreal parameter
alphashape parameter
sigmascale parameter
Returns
probability or product of probabilities
Exceptions
std::domain_errorif y is negative, alpha sigma is nonpositive

Definition at line 29 of file weibull_cdf.hpp.

◆ weibull_cdf_log()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::weibull_cdf_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)
Deprecated:
use weibull_lcdf

Definition at line 14 of file weibull_cdf_log.hpp.

◆ weibull_lccdf()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::weibull_lccdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)

Returns the Weibull log complementary cumulative distribution function for the given location and scale.

Given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ytype of real parameter
T_shapetype of shape parameter
T_scaletype of scale paramater
Parameters
yreal parameter
alphashape parameter
sigmascale parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif y is negative, alpha sigma is nonpositive

Definition at line 29 of file weibull_lccdf.hpp.

◆ weibull_lcdf()

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::weibull_lcdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)

Returns the Weibull log cumulative distribution function for the given location and scale.

Given containers of matching sizes, returns the log sum of probabilities.

Template Parameters
T_ytype of real parameter
T_shapetype of shape parameter
T_scaletype of scale paramater
Parameters
yreal parameter
alphashape parameter
sigmascale parameter
Returns
log probability or log sum of probabilities
Exceptions
std::domain_errorif y is negative, alpha sigma is nonpositive

Definition at line 29 of file weibull_lcdf.hpp.

◆ weibull_log() [1/2]

template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::weibull_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)
Deprecated:
use weibull_lpdf

Definition at line 14 of file weibull_log.hpp.

◆ weibull_log() [2/2]

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::weibull_log ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)
inline
Deprecated:
use weibull_lpdf

Definition at line 23 of file weibull_log.hpp.

◆ weibull_lpdf() [1/2]

template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::weibull_lpdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)

Returns the Weibull log probability density for the given location and scale.

Given containers of matching sizes, returns the log sum of probability densities.

Template Parameters
T_ytype of real parameter
T_shapetype of shape parameter
T_scaletype of scale paramater
Parameters
yreal parameter
alphashape parameter
sigmascale parameter
Returns
log probability density or log sum of probability densities
Exceptions
std::domain_errorif y is negative, alpha sigma is nonpositive

Definition at line 31 of file weibull_lpdf.hpp.

◆ weibull_lpdf() [2/2]

template<typename T_y , typename T_shape , typename T_scale >
return_type<T_y, T_shape, T_scale>::type stan::math::weibull_lpdf ( const T_y &  y,
const T_shape &  alpha,
const T_scale &  sigma 
)
inline

Definition at line 128 of file weibull_lpdf.hpp.

◆ weibull_rng()

template<typename T_shape , typename T_scale , class RNG >
VectorBuilder<true, double, T_shape, T_scale>::type stan::math::weibull_rng ( const T_shape &  alpha,
const T_scale &  sigma,
RNG &  rng 
)
inline

Return a Weibull random variate for the given shape and scale parameters using the specified random number generator.

alpha and sigma can each be a scalar or a one-dimensional container. Any non-scalar inputs must be the same size.

Template Parameters
T_shapeType of shape parameter
T_scaleType of scale parameter
RNGtype of random number generator
Parameters
alpha(Sequence of) positive shape parameter(s)
sigma(Sequence of) positive scale parameter(s)
rngrandom number generator
Returns
(Sequence of) Weibull random variate(s)
Exceptions
std::domain_errorif alpha is nonpositive or sigma is nonpositive
std::invalid_argumentif non-scalar arguments are of different sizes

Definition at line 32 of file weibull_rng.hpp.

◆ wiener_log() [1/2]

template<bool propto, typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type<T_y, T_alpha, T_tau, T_beta, T_delta>::type stan::math::wiener_log ( const T_y &  y,
const T_alpha &  alpha,
const T_tau &  tau,
const T_beta &  beta,
const T_delta &  delta 
)

The log of the first passage time density function for a (Wiener) drift diffusion model for the given $y$, boundary separation $\alpha$, nondecision time $\tau$, relative bias $\beta$, and drift rate $\delta$.

$\alpha$ and $\tau$ must be greater than 0, and $\beta$ must be between 0 and 1. $y$ should contain reaction times in seconds (strictly positive) with upper-boundary responses.

Deprecated:
use wiener_lpdf
Parameters
yA scalar variate.
alphaThe boundary separation.
tauThe nondecision time.
betaThe relative bias.
deltaThe drift rate.
Returns
The log of the Wiener first passage time density of the specified arguments.

Definition at line 33 of file wiener_log.hpp.

◆ wiener_log() [2/2]

template<typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type<T_y, T_alpha, T_tau, T_beta, T_delta>::type stan::math::wiener_log ( const T_y &  y,
const T_alpha &  alpha,
const T_tau &  tau,
const T_beta &  beta,
const T_delta &  delta 
)
inline
Deprecated:
use wiener_lpdf

Definition at line 46 of file wiener_log.hpp.

◆ wiener_lpdf() [1/2]

template<bool propto, typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type<T_y, T_alpha, T_tau, T_beta, T_delta>::type stan::math::wiener_lpdf ( const T_y &  y,
const T_alpha &  alpha,
const T_tau &  tau,
const T_beta &  beta,
const T_delta &  delta 
)

The log of the first passage time density function for a (Wiener) drift diffusion model for the given $y$, boundary separation $\alpha$, nondecision time $\tau$, relative bias $\beta$, and drift rate $\delta$.

$\alpha$ and $\tau$ must be greater than 0, and $\beta$ must be between 0 and 1. $y$ should contain reaction times in seconds (strictly positive) with upper-boundary responses.

Parameters
yA scalar variate.
alphaThe boundary separation.
tauThe nondecision time.
betaThe relative bias.
deltaThe drift rate.
Returns
The log of the Wiener first passage time density of the specified arguments.

Definition at line 70 of file wiener_lpdf.hpp.

◆ wiener_lpdf() [2/2]

template<typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type<T_y, T_alpha, T_tau, T_beta, T_delta>::type stan::math::wiener_lpdf ( const T_y &  y,
const T_alpha &  alpha,
const T_tau &  tau,
const T_beta &  beta,
const T_delta &  delta 
)
inline

Definition at line 196 of file wiener_lpdf.hpp.

◆ wishart_log() [1/2]

template<bool propto, typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args<T_y, T_dof, T_scale>::type stan::math::wishart_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  W,
const T_dof &  nu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &  S 
)

The log of the Wishart density for the given W, degrees of freedom, and scale matrix.

The scale matrix, S, must be k x k, symmetric, and semi-positive definite. Dimension, k, is implicit. nu must be greater than k-1

\begin{eqnarray*} W &\sim& \mbox{\sf{Wishart}}_{\nu} (S) \\ \log (p (W \, |\, \nu, S) ) &=& \log \left( \left(2^{\nu k/2} \pi^{k (k-1) /4} \prod_{i=1}^k{\Gamma (\frac{\nu + 1 - i}{2})} \right)^{-1} \times \left| S \right|^{-\nu/2} \left| W \right|^{(\nu - k - 1) / 2} \times \exp (-\frac{1}{2} \mbox{tr} (S^{-1} W)) \right) \\ &=& -\frac{\nu k}{2}\log(2) - \frac{k (k-1)}{4} \log(\pi) - \sum_{i=1}^{k}{\log (\Gamma (\frac{\nu+1-i}{2}))} -\frac{\nu}{2} \log(\det(S)) + \frac{\nu-k-1}{2}\log (\det(W)) - \frac{1}{2} \mbox{tr} (S^{-1}W) \end{eqnarray*}

Deprecated:
use wishart_lpdf
Parameters
WA scalar matrix
nuDegrees of freedom
SThe scale matrix
Returns
The log of the Wishart density at W given nu and S.
Exceptions
std::domain_errorif nu is not greater than k-1
std::domain_errorif S is not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.
T_scaleType of scale.

Definition at line 46 of file wishart_log.hpp.

◆ wishart_log() [2/2]

template<typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args<T_y, T_dof, T_scale>::type stan::math::wishart_log ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  W,
const T_dof &  nu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &  S 
)
inline
Deprecated:
use wishart_lpdf

Definition at line 57 of file wishart_log.hpp.

◆ wishart_lpdf() [1/2]

template<bool propto, typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args<T_y, T_dof, T_scale>::type stan::math::wishart_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  W,
const T_dof &  nu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &  S 
)

The log of the Wishart density for the given W, degrees of freedom, and scale matrix.

The scale matrix, S, must be k x k, symmetric, and semi-positive definite. Dimension, k, is implicit. nu must be greater than k-1

\begin{eqnarray*} W &\sim& \mbox{\sf{Wishart}}_{\nu} (S) \\ \log (p (W \, |\, \nu, S) ) &=& \log \left( \left(2^{\nu k/2} \pi^{k (k-1) /4} \prod_{i=1}^k{\Gamma (\frac{\nu + 1 - i}{2})} \right)^{-1} \times \left| S \right|^{-\nu/2} \left| W \right|^{(\nu - k - 1) / 2} \times \exp (-\frac{1}{2} \mbox{tr} (S^{-1} W)) \right) \\ &=& -\frac{\nu k}{2}\log(2) - \frac{k (k-1)}{4} \log(\pi) - \sum_{i=1}^{k}{\log (\Gamma (\frac{\nu+1-i}{2}))} -\frac{\nu}{2} \log(\det(S)) + \frac{\nu-k-1}{2}\log (\det(W)) - \frac{1}{2} \mbox{tr} (S^{-1}W) \end{eqnarray*}

Parameters
WA scalar matrix
nuDegrees of freedom
SThe scale matrix
Returns
The log of the Wishart density at W given nu and S.
Exceptions
std::domain_errorif nu is not greater than k-1
std::domain_errorif S is not square, not symmetric, or not semi-positive definite.
Template Parameters
T_yType of scalar.
T_dofType of degrees of freedom.
T_scaleType of scale.

Definition at line 50 of file wishart_lpdf.hpp.

◆ wishart_lpdf() [2/2]

template<typename T_y , typename T_dof , typename T_scale >
boost::math::tools::promote_args<T_y, T_dof, T_scale>::type stan::math::wishart_lpdf ( const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  W,
const T_dof &  nu,
const Eigen::Matrix< T_scale, Eigen::Dynamic, Eigen::Dynamic > &  S 
)
inline

Definition at line 97 of file wishart_lpdf.hpp.

◆ wishart_rng()

template<class RNG >
Eigen::MatrixXd stan::math::wishart_rng ( double  nu,
const Eigen::MatrixXd &  S,
RNG &  rng 
)
inline

Definition at line 15 of file wishart_rng.hpp.

Variable Documentation

◆ CONSTRAINT_TOLERANCE

const double stan::math::CONSTRAINT_TOLERANCE = 1E-8

The tolerance for checking arithmetic bounds In rank and in simplexes.

The default value is 1E-8.

Definition at line 12 of file constraint_tolerance.hpp.

◆ E

const double stan::math::E = boost::math::constants::e<double>()

The base of the natural logarithm, $ e $.

Definition at line 19 of file constants.hpp.

◆ EPSILON

const double stan::math::EPSILON = std::numeric_limits<double>::epsilon()

Smallest positive value.

Definition at line 63 of file constants.hpp.

◆ INFTY

const double stan::math::INFTY = std::numeric_limits<double>::infinity()

Positive infinity.

Definition at line 48 of file constants.hpp.

◆ INV_SQRT_2

const double stan::math::INV_SQRT_2 = inv(SQRT_2)

The value of 1 over the square root of 2, $ 1 / \sqrt{2} $.

Definition at line 31 of file constants.hpp.

◆ INV_SQRT_TWO_PI

const double stan::math::INV_SQRT_TWO_PI = inv(SQRT_TWO_PI)

Definition at line 142 of file constants.hpp.

◆ LOG_10

const double stan::math::LOG_10 = log(10.0)

The natural logarithm of 10, $ \log 10 $.

Definition at line 43 of file constants.hpp.

◆ LOG_2

const double stan::math::LOG_2 = log(2.0)

The natural logarithm of 2, $ \log 2 $.

Definition at line 37 of file constants.hpp.

◆ LOG_EPSILON

const double stan::math::LOG_EPSILON = log(EPSILON)

Definition at line 168 of file constants.hpp.

◆ LOG_HALF

const double stan::math::LOG_HALF = log(0.5)

Definition at line 152 of file constants.hpp.

◆ LOG_PI

const double stan::math::LOG_PI = log(pi())

Definition at line 144 of file constants.hpp.

◆ LOG_PI_OVER_FOUR

const double stan::math::LOG_PI_OVER_FOUR = LOG_PI / 4.0

Definition at line 146 of file constants.hpp.

◆ LOG_SQRT_PI

const double stan::math::LOG_SQRT_PI = log(SQRT_PI)

Definition at line 148 of file constants.hpp.

◆ LOG_TWO_PI

const double stan::math::LOG_TWO_PI = LOG_2 + LOG_PI

Definition at line 164 of file constants.hpp.

◆ LOG_ZERO

const double stan::math::LOG_ZERO = log(0.0)

Definition at line 150 of file constants.hpp.

◆ MAJOR_VERSION

const std::string stan::math::MAJOR_VERSION = STAN_STRING(STAN_MATH_MAJOR)

Major version number for Stan math library.

Definition at line 22 of file version.hpp.

◆ MINOR_VERSION

const std::string stan::math::MINOR_VERSION = STAN_STRING(STAN_MATH_MINOR)

Minor version number for Stan math library.

Definition at line 25 of file version.hpp.

◆ NEG_LOG_PI

const double stan::math::NEG_LOG_PI = -LOG_PI

Definition at line 158 of file constants.hpp.

◆ NEG_LOG_SQRT_PI

const double stan::math::NEG_LOG_SQRT_PI = -LOG_SQRT_PI

Definition at line 160 of file constants.hpp.

◆ NEG_LOG_SQRT_TWO_PI

const double stan::math::NEG_LOG_SQRT_TWO_PI = -log(SQRT_TWO_PI)

Definition at line 156 of file constants.hpp.

◆ NEG_LOG_TWO

const double stan::math::NEG_LOG_TWO = -LOG_2

Definition at line 154 of file constants.hpp.

◆ NEG_LOG_TWO_OVER_TWO

const double stan::math::NEG_LOG_TWO_OVER_TWO = -LOG_2 / 2.0

Definition at line 162 of file constants.hpp.

◆ NEG_LOG_TWO_PI

const double stan::math::NEG_LOG_TWO_PI = -LOG_TWO_PI

Definition at line 166 of file constants.hpp.

◆ NEG_TWO_OVER_SQRT_PI

const double stan::math::NEG_TWO_OVER_SQRT_PI = -TWO_OVER_SQRT_PI

Definition at line 138 of file constants.hpp.

◆ NEGATIVE_EPSILON

const double stan::math::NEGATIVE_EPSILON = -EPSILON

Largest negative value (i.e., smallest absolute value).

Definition at line 68 of file constants.hpp.

◆ NEGATIVE_INFTY

const double stan::math::NEGATIVE_INFTY = -INFTY

Negative infinity.

Definition at line 53 of file constants.hpp.

◆ NOT_A_NUMBER

const double stan::math::NOT_A_NUMBER = std::numeric_limits<double>::quiet_NaN()

(Quiet) not-a-number value.

Definition at line 58 of file constants.hpp.

◆ opencl_context

Definition at line 394 of file opencl_context.hpp.

◆ PATCH_VERSION

const std::string stan::math::PATCH_VERSION = STAN_STRING(STAN_MATH_PATCH)

Patch version for Stan math library.

Definition at line 28 of file version.hpp.

◆ POISSON_MAX_RATE

const double stan::math::POISSON_MAX_RATE = pow(2.0, 30)

Largest rate parameter allowed in Poisson RNG.

Definition at line 73 of file constants.hpp.

◆ SQRT_2

const double stan::math::SQRT_2 = sqrt(2.0)

The value of the square root of 2, $ \sqrt{2} $.

Definition at line 25 of file constants.hpp.

◆ SQRT_2_TIMES_SQRT_PI

const double stan::math::SQRT_2_TIMES_SQRT_PI = SQRT_2 * SQRT_PI

Definition at line 134 of file constants.hpp.

◆ SQRT_PI

const double stan::math::SQRT_PI = sqrt(pi())

Definition at line 132 of file constants.hpp.

◆ SQRT_TWO_PI

const double stan::math::SQRT_TWO_PI = sqrt(2.0 * pi())

Definition at line 140 of file constants.hpp.

◆ TWO_OVER_SQRT_PI

const double stan::math::TWO_OVER_SQRT_PI = 2.0 / SQRT_PI

Definition at line 136 of file constants.hpp.


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