Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Classes | Typedefs | Functions | Variables
stan::math Namespace Reference

Matrices and templated mathematical functions. More...

Namespaces

 detail
 
 policies
 Extending boost functionality.
 

Classes

class  LDLT_factor< stan::agrad::var, R, C >
 A template specialization of src/stan/math/matrix/LDLT_factor.hpp for stan::agrad::var which can be used with all the *_ldlt functions. More...
 
struct  coupled_ode_system< F, double, stan::agrad::var >
 The coupled ODE system for known initial values and unknown parameters. More...
 
struct  coupled_ode_system< F, stan::agrad::var, double >
 The coupled ODE system for unknown initial values and known parameters. More...
 
struct  coupled_ode_system< F, stan::agrad::var, stan::agrad::var >
 The coupled ode system for unknown intial values and unknown parameters. More...
 
struct  promote_scalar_struct
 General 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_struct< T, std::vector< S > >
 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, 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...
 
class  accumulator
 Class to accumulate values and eventually return their sum. More...
 
struct  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  common_type
 
struct  common_type< std::vector< T1 >, std::vector< T2 > >
 
struct  common_type< Eigen::Matrix< T1, R, C >, Eigen::Matrix< T2, R, C > >
 
class  LDLT_factor
 
class  LDLT_factor< T, R, C >
 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...
 
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  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  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_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, 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, 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  promoter
 
struct  promoter< T, T >
 
struct  promoter< std::vector< F >, std::vector< T > >
 
struct  promoter< std::vector< T >, std::vector< T > >
 
struct  promoter< Eigen::Matrix< F, R, C >, Eigen::Matrix< T, R, C > >
 
struct  promoter< Eigen::Matrix< T, R, C >, Eigen::Matrix< T, R, C > >
 
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< std::vector< T > >
 Template metaprogram class to compute the type of index for a standard vector. 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< std::vector< T > >
 Template metaprogram class to compute the type of values stored in a standard vector. More...
 
struct  coupled_ode_observer
 Observer for the coupled states. More...
 
struct  coupled_ode_system
 Base template class for a coupled ordinary differential equation system, which adds sensitivities to the base system. More...
 
struct  coupled_ode_system< F, double, double >
 The coupled ode system for known initial values and known parameters. More...
 
struct  store_type
 
struct  store_type< double >
 
struct  store_type< int >
 
struct  pass_type
 
struct  pass_type< double >
 
struct  pass_type< int >
 
class  seq_view
 
class  seq_view< T, Eigen::Matrix< S, Eigen::Dynamic, 1 > >
 
class  seq_view< T, Eigen::Matrix< S, 1, Eigen::Dynamic > >
 
class  seq_view< T, Eigen::Matrix< S, Eigen::Dynamic, Eigen::Dynamic > >
 
class  seq_view< T, std::vector< S > >
 
class  seq_view< T, std::vector< T > >
 
class  seq_view< T, std::vector< std::vector< T > > >
 
class  seq_view< double, std::vector< int > >
 

Typedefs

typedef index_type
< Eigen::Matrix< double,
Eigen::Dynamic, Eigen::Dynamic >
>::type 
size_type
 Type for sizes and indexes in an Eigen matrix with double e. More...
 
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...
 

Functions

void add_initial_values (const std::vector< stan::agrad::var > &y0, std::vector< std::vector< stan::agrad::var > > &y)
 Increment the state derived from the coupled system in the with the original initial state. 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_y , typename T_low , typename T_high , typename T_result >
bool check_bounded (const char *function, const T_y &y, const T_low &low, const T_high &high, const char *name, T_result *result)
 
template<typename T , typename T_result >
bool check_consistent_size (size_t max_size, const char *function, const T &x, const char *name, T_result *result)
 
template<typename T1 , typename T2 , typename T_result >
bool check_consistent_sizes (const char *function, const T1 &x1, const T2 &x2, const char *name1, const char *name2, T_result *result)
 
template<typename T1 , typename T2 , typename T3 , typename T_result >
bool check_consistent_sizes (const char *function, const T1 &x1, const T2 &x2, const T3 &x3, const char *name1, const char *name2, const char *name3, T_result *result)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T_result >
bool check_consistent_sizes (const char *function, const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4, const char *name1, const char *name2, const char *name3, const char *name4, T_result *result)
 
template<typename T_y , typename T_eq , typename T_result >
bool check_equal (const char *function, const T_y &y, const T_eq &eq, const char *name, T_result *result)
 
template<typename T_y , typename T_result >
bool check_finite (const char *function, const T_y &y, const char *name, T_result *result)
 Checks if the variable y is finite. More...
 
template<typename T_y , typename T_low , typename T_result >
bool check_greater (const char *function, const T_y &y, const T_low &low, const char *name, T_result *result)
 
template<typename T_y , typename T_low , typename T_result >
bool check_greater_or_equal (const char *function, const T_y &y, const T_low &low, const char *name, T_result *result)
 
template<typename T_y , typename T_high , typename T_result >
bool check_less (const char *function, const T_y &y, const T_high &high, const char *name, T_result *result)
 
template<typename T_y , typename T_high , typename T_result >
bool check_less_or_equal (const char *function, const T_y &y, const T_high &high, const char *name, T_result *result)
 
template<typename T_y , typename T_result >
bool check_nonnegative (const char *function, const T_y &y, const char *name, T_result *result)
 
template<typename T_y , typename T_result >
bool check_not_nan (const char *function, const T_y &y, const char *name, T_result *result)
 Checks if the variable y is nan. More...
 
template<typename T_y , typename T_result >
bool check_positive (const char *function, const T_y &y, const char *name, T_result *result)
 
template<typename T_y , typename T_result >
bool check_positive_finite (const char *function, const T_y &y, const char *name, T_result *result)
 
template<typename T , typename T_result , typename T_msg >
bool dom_err (const char *function, const T &y, const char *name, const char *error_msg, const T_msg error_msg2, T_result *result)
 
template<typename T , typename T_result , typename T_msg >
bool dom_err_vec (const size_t i, const char *function, const T &y, const char *name, const char *error_msg, const T_msg error_msg2, T_result *result)
 
template<typename T_y , typename T_result >
bool check_cholesky_factor (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 Return true if the specified matrix is a valid Cholesky factor. More...
 
template<typename T_y , typename T_result >
bool check_cholesky_factor_corr (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 Return true if the specified matrix is a valid Cholesky factor. More...
 
template<typename T >
bool check_cholesky_factor_corr (const char *function, const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T *result=0)
 
template<typename T_y , typename T_result >
bool check_cholesky_factor_corr (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, T_result *result)
 Return true if the specified matrix is a valid Cholesky factor (lower triangular, positive diagonal). More...
 
template<typename T >
bool check_cholesky_factor_corr (const char *function, const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &y, T *result=0)
 
template<typename T_y , typename T_result , int R, int C>
bool check_column_index (const char *function, size_t i, const Eigen::Matrix< T_y, R, C > &y, const char *name, T_result *result)
 Return true if the specified index is a valid column of the matrix. More...
 
template<typename T_y , typename T_result >
bool check_corr_matrix (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 Return true if the specified matrix is a valid correlation matrix. More...
 
template<typename T_y , typename T_result >
bool check_cov_matrix (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 Return true if the specified matrix is a valid covariance matrix. More...
 
template<typename T , int R, int C, typename T_result >
bool check_ldlt_factor (const char *function, stan::math::LDLT_factor< T, R, C > &A, const char *name, T_result *result)
 Return true if the underlying matrix is positive definite. More...
 
template<typename T_y , typename T_result >
bool check_lower_triangular (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 Return true if the specified matrix is lower triangular. More...
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2, typename T_result >
bool check_matching_dims (const char *function, const Eigen::Matrix< T1, R1, C1 > &y1, const char *name1, const Eigen::Matrix< T2, R2, C2 > &y2, const char *name2, T_result *result)
 
template<typename T_y1 , typename T_y2 , typename T_result >
bool check_matching_sizes (const char *function, const T_y1 &y1, const char *name1, const T_y2 &y2, const char *name2, T_result *result)
 
template<typename T1 , typename T2 , typename T_result >
bool check_multiplicable (const char *function, const T1 &y1, const char *name1, const T2 &y2, const char *name2, T_result *result)
 
template<typename T_y , typename T_result >
bool check_nonzero_size (const char *function, const T_y &y, const char *name, T_result *result)
 Return true if the specified matrix/vector is of non-zero size. More...
 
template<typename T_y , typename T_result >
bool check_ordered (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &y, const char *name, T_result *result)
 Return true if the specified vector is sorted into increasing order. More...
 
template<typename T_y , typename T_result >
bool check_ordered (const char *function, const std::vector< T_y > &y, const char *name, T_result *result)
 
template<typename T >
bool check_ordered (const char *function, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &y, const char *name, T *result=0)
 
template<typename T >
bool check_ordered (const char *function, const std::vector< T > &y, const char *name, T *result=0)
 
template<typename T_y , typename T_result >
bool check_pos_definite (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 Return true if the specified matrix is positive definite. More...
 
template<typename T_y , typename T_result >
bool check_pos_semidefinite (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 Return true if the specified matrix is positive definite. More...
 
template<typename T_y , typename T_result >
bool check_positive_ordered (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &y, const char *name, T_result *result)
 Return true if the specified vector contains only non-negative values and is sorted into increasing order. More...
 
void check_range (size_t max, size_t i, const char *msg, size_t idx)
 
template<typename T_y , typename T_result , int R, int C>
bool check_row_index (const char *function, size_t i, const Eigen::Matrix< T_y, R, C > &y, const char *name, T_result *result)
 Return true if the specified index is a valid row of the matrix. More...
 
template<typename T_prob , typename T_result >
bool check_simplex (const char *function, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta, const char *name, T_result *result)
 Return true if the specified vector is simplex. More...
 
template<typename T_size1 , typename T_size2 , typename T_result >
bool check_size_match (const char *function, T_size1 i, const char *name_i, T_size2 j, const char *name_j, T_result *result)
 
template<typename T_y , typename T_result >
bool check_spsd_matrix (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 Return true if the specified matrix is a square, symmetric, and positive semi-definite. More...
 
template<typename T_y , typename T_result >
bool check_square (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 Return true if the specified matrix is square. More...
 
template<typename T_y , typename T_result >
bool check_std_vector_index (const char *function, size_t i, const std::vector< T_y > &y, const char *name, T_result *result)
 Return true if the specified index is valid in std vector. More...
 
template<typename T_y , typename T_result >
bool check_symmetric (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 Return true if the specified matrix is symmetric. More...
 
template<typename T_prob , typename T_result >
bool check_unit_vector (const char *function, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta, const char *name, T_result *result)
 Return true if the specified vector is unit vector. More...
 
template<typename T >
bool check_unit_vector (const char *function, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &theta, const char *name, T *result=0)
 
template<typename T , int R, int C, typename T_result >
bool check_vector (const char *function, const Eigen::Matrix< T, R, C > &x, const char *name, T_result *result)
 
void validate_non_negative_index (const std::string &var_name, const std::string &expr, int val)
 
double abs (double x)
 Return floating-point absolute value. More...
 
template<typename T >
bool as_bool (const T x)
 Return 1 if the argument is unequal to zero and 0 otherwise. More...
 
template<typename T2 >
T2 bessel_first_kind (const 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 (const 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 T >
boost::math::tools::promote_args
< T >::type 
binary_log_loss (const 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 digamma (double x)
 

\[ \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} \]

More...
 
double dist (const std::vector< double > &x, const std::vector< double > &y)
 
int divide (const int x, const int y)
 
double dot (const std::vector< double > &x, const std::vector< double > &y)
 
double dot_self (const std::vector< double > &x)
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
exp2 (const T y)
 Return the exponent base 2 of the specified argument (C99). More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args
< T1, T2 >::type 
falling_factorial (const T1 x, const T2 n)
 

\[ \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} \]

More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args
< T1, T2 >::type 
fdim (T1 a, T2 b)
 The positive difference function (C99). 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...
 
double ibeta (const double a, const double b, const double x)
 The normalized incomplete beta function of a, b, and x. 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...
 
template<typename T >
unsigned int int_step (const T y)
 The integer step, or Heaviside, function. More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
inv (const T x)
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
inv_cloglog (T x)
 The inverse complementary log-log function. More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
inv_logit (const T a)
 Returns the inverse logit function applied to the argument. More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
inv_sqrt (const T x)
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
inv_square (const T x)
 
template<typename Vector >
void inverse_softmax (const Vector &simplex, Vector &y)
 Writes the inverse softmax of the simplex argument into the second argument. More...
 
int is_inf (const double x)
 Returns 1 if the input is infinite and 0 otherwise. More...
 
int is_nan (const double x)
 Returns 1 if the input is NaN and 0 otherwise. More...
 
template<typename T >
bool is_uninitialized (T x)
 Returns true if the specified variable is uninitialized. 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...
 
double lgamma (double x)
 

\[ \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} \]

More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
lmgamma (const int k, T x)
 Return the natural logarithm of the multivariate gamma function with the speciifed dimensions and argument. More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
log1m (T x)
 Return the natural logarithm of one minus the specified value. More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
log1m_exp (const T a)
 Calculates the log of 1 minus the exponential of the specified value without overflow log1m_exp(x) = log(1-exp(x)). More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
log1m_inv_logit (const T u)
 Returns the natural logarithm of 1 minus the inverse logit of the specified argument. More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
log1p (const T x)
 Return the natural logarithm of one plus the specified value. More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
log1p_exp (const T a)
 Calculates the log of 1 plus the exponential of the specified value without overflow. More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
log2 (const T a)
 Returns the base 2 logarithm of the argument (C99). 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 >
boost::math::tools::promote_args
< T1, T2 >::type 
log_falling_factorial (const T1 x, const T2 n)
 

\[ \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} \]

More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
log_inv_logit (const T &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_rising_factorial (const T1 x, const T2 n)
 

\[ \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} \]

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...
 
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 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 1 if the input is equal to zero and 0 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...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
logit (const T a)
 Returns the logit function applied to the argument. More...
 
double max (const double a, const double b)
 
double min (const double a, const double b)
 
template<typename T2 >
T2 modified_bessel_first_kind (const 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 (const 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 (const int x, const 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 T1 , typename T2 >
boost::math::tools::promote_args
< T1, T2 >::type 
owens_t (const T1 &h, const T2 &a)
 The Owen's T function of h and a. More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
Phi (const T x)
 The unit normal cumulative distribution function. More...
 
template<typename T >
boost::math::tools::promote_args
< T >::type 
Phi_approx (T x)
 Approximation of the unit normal CDF. More...
 
template<typename T >
boost::enable_if
< boost::is_arithmetic< T >, T >
::type 
primitive_value (T x)
 Return the value of the specified arithmetic argument unmodified with its own declared type. More...
 
template<typename T >
boost::disable_if
< boost::is_arithmetic< T >
, double >::type 
primitive_value (const T &x)
 Return the primitive value of the specified argument. 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 T1 , typename T2 >
boost::math::tools::promote_args
< T1, T2 >::type 
rising_factorial (const T1 x, const T2 n)
 

\[ \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} \]

More...
 
void scaled_add (std::vector< double > &x, const std::vector< double > &y, const double lambda)
 
template<typename T >
int sign (const T &z)
 
template<typename T >
square (const T x)
 Return the square of the specified argument. More...
 
template<typename T >
int step (const T y)
 The step, or Heaviside, function. More...
 
void sub (std::vector< double > &x, std::vector< double > &y, std::vector< double > &result)
 
double sum (std::vector< double > &x)
 
template<typename T >
trigamma (T x)
 

\[ \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} \]

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 > (const double x)
 Return the specified argument. 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 T1 , typename T2 , int R1, int C1, int R2, int C2>
Matrix< typename return_type
< T1, T2 >::type, Dynamic,
Dynamic > 
append_col (const Matrix< T1, R1, C1 > &A, const Matrix< T2, R2, C2 > &B)
 
template<typename T1 , typename T2 , int C1, int C2>
Matrix< typename return_type
< T1, T2 >::type, 1, Dynamic > 
append_col (const Matrix< T1, 1, C1 > &A, const Matrix< T2, 1, C2 > &B)
 
template<typename T , int R1, int C1, int R2, int C2>
Matrix< T, Dynamic, Dynamic > append_col (const Matrix< T, R1, C1 > &A, const Matrix< T, R2, C2 > &B)
 
template<typename T , int C1, int C2>
Matrix< T, 1, Dynamic > append_col (const Matrix< T, 1, C1 > &A, const Matrix< T, 1, C2 > &B)
 
template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Matrix< typename return_type
< T1, T2 >::type, Dynamic,
Dynamic > 
append_row (const Matrix< T1, R1, C1 > &A, const Matrix< T2, R2, C2 > &B)
 
template<typename T1 , typename T2 , int R1, int R2>
Matrix< typename return_type
< T1, T2 >::type, Dynamic, 1 > 
append_row (const Matrix< T1, R1, 1 > &A, const Matrix< T2, R1, 1 > &B)
 
template<typename T , int R1, int C1, int R2, int C2>
Matrix< T, Dynamic, Dynamic > append_row (const Matrix< T, R1, C1 > &A, const Matrix< T, R2, C2 > &B)
 
template<typename T , int R1, int R2>
Matrix< T, Dynamic, 1 > append_row (const Matrix< T, R1, 1 > &A, const Matrix< T, R1, 1 > &B)
 
template<typename LHS , typename RHS >
void assign (LHS &lhs, const RHS &rhs)
 Copy the right-hand side's value to the left-hand side variable. More...
 
template<typename LHS , typename RHS , int R1, int C1, int R2, int C2>
void assign (Eigen::Matrix< LHS, R1, C1 > &x, const Eigen::Matrix< RHS, R2, C2 > &y)
 Copy the right-hand side's value to the left-hand side variable. More...
 
template<typename LHS , typename RHS , int R, int C>
void assign (Eigen::Matrix< LHS, R, C > &x, const Eigen::Matrix< RHS, R, C > &y)
 Copy the right-hand side's value to the left-hand side variable. More...
 
template<typename LHS , typename RHS , int R, int C>
void assign (Eigen::Block< LHS > x, const Eigen::Matrix< RHS, R, C > &y)
 Copy the right-hand side's value to the left-hand side variable. More...
 
template<typename LHS , typename RHS >
void assign (std::vector< LHS > &x, const std::vector< RHS > &y)
 Copy the right-hand side's value to the left-hand side variable. 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 >
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<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>
size_t cols (const Eigen::Matrix< T, R, C > &m)
 
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 , int R, int C>
Matrix< T, Dynamic, Dynamic > to_matrix (Matrix< T, R, C > matrix)
 
template<typename T >
Matrix< T, Dynamic, Dynamic > to_matrix (const vector< vector< T > > &vec)
 
Matrix< double, Dynamic, Dynamic > to_matrix (const vector< vector< int > > &vec)
 
template<typename T , int R, int C>
Matrix< T, Dynamic, 1 > to_vector (const Matrix< T, R, C > &matrix)
 
template<typename T >
Matrix< T, Dynamic, 1 > to_vector (const vector< T > &vec)
 
Matrix< double, Dynamic, 1 > to_vector (const vector< int > &vec)
 
template<typename T , int R, int C>
Matrix< T, 1, Dynamic > to_row_vector (const Matrix< T, R, C > &matrix)
 
template<typename T >
Matrix< T, 1, Dynamic > to_row_vector (const vector< T > &vec)
 
Matrix< double, 1, Dynamic > to_row_vector (const vector< int > &vec)
 
template<typename T >
vector< vector< T > > to_array_2d (const Matrix< T, Dynamic, Dynamic > &matrix)
 
template<typename T , int R, int C>
vector< T > to_array_1d (const Matrix< T, R, C > &matrix)
 
template<typename T >
vector< T > to_array_1d (const vector< T > &x)
 
template<typename T >
vector< typename scalar_type
< T >::type > 
to_array_1d (const vector< vector< T > > &x)
 
matrix_d crossprod (const matrix_d &M)
 Returns the result of pre-multiplying a matrix by its own transpose. 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 >
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 >
boost::enable_if_c
< boost::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<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 , int Rows, int Cols>
Eigen::Matrix< T, Rows, Cols > exp (const Eigen::Matrix< T, Rows, Cols > &m)
 Return the element-wise exponentiation of the matrix or vector. More...
 
template<int Rows, int Cols>
Eigen::Matrix< double, Rows, Cols > exp (const Eigen::Matrix< double, Rows, Cols > &m)
 
template<typename T , typename S >
void fill (T &x, const S &y)
 Fill the specified container with the specified value. 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 , typename S >
void fill (std::vector< T > &x, const S &y)
 Fill the specified container with the specified value. 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 stan::math::accumulator< T_lp_accum > &lp_accum)
 
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 >
boost::enable_if_c
< boost::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 >
Eigen::Matrix< T,
Eigen::Dynamic, Eigen::Dynamic > 
inverse (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &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 , int Rows, int Cols>
Eigen::Matrix< T, Rows, Cols > log (const Eigen::Matrix< T, Rows, Cols > &m)
 Return the element-wise logarithm of the matrix or vector. 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 (stan::math::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 >
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...
 
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 stan::math::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<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)
 
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 stan::math::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 stan::math::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 >
boost::enable_if_c
< boost::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 >
boost::enable_if_c
< boost::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 >
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)
 
template<typename T >
Eigen::Matrix< T,
Eigen::Dynamic, Eigen::Dynamic > 
qr_Q (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 
template<typename T >
Eigen::Matrix< T,
Eigen::Dynamic, Eigen::Dynamic > 
qr_R (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 
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<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 T1 , typename T2 , int R, int C>
Matrix< typename promote_args
< T1, T2 >::type, Dynamic,
Dynamic > 
quad_form_diag (const Matrix< T1, Dynamic, Dynamic > &mat, const Matrix< T2, R, C > &vec)
 
template<typename T >
size_t rank (const std::vector< T > &v, int s)
 Return the number of components of v less than v[s]. More...
 
template<typename T , int R, int C>
size_t rank (const Eigen::Matrix< T, R, C > &v, int s)
 Return the number of components of v less than v[s]. More...
 
template<typename T >
void resize (T &x, std::vector< size_t > dims)
 Recursively resize the specified vector of vectors, which must bottom out at scalar values, Eigen vectors or Eigen matrices. 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>
size_t rows (const Eigen::Matrix< T, R, C > &m)
 
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<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 > 
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 >
int size (const std::vector< T > &x)
 
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 >
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...
 
template<typename T , int R, int C>
Eigen::Matrix< T, R, C > sort_asc (Eigen::Matrix< T, R, C > xs)
 Return the specified eigen 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 eigen vector in descending order. 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<int R1, int C1, int R2, int C2, typename T1 , typename T2 >
boost::math::tools::promote_args
< T1, T2 >::type 
squared_distance (const Eigen::Matrix< T1, R1, C1 > &v1, const Eigen::Matrix< T2, R2, C2 > &v2)
 Returns the squared distance between the specified vectors. 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 T >
sum (const std::vector< T > &xs)
 Return the sum of the values in the specified standard vector. More...
 
template<typename T , int R, int C>
double sum (const Eigen::Matrix< T, R, C > &v)
 Returns the sum of the coefficients of the specified column vector. 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)
 
matrix_d tcrossprod (const matrix_d &M)
 Returns the result of post-multiplying a matrix by its own transpose. More...
 
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>
boost::enable_if_c
<!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 stan::math::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>
boost::enable_if_c
<!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 stan::math::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 >
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 , typename T1 , typename T2 >
std::vector< std::vector
< typename stan::return_type
< T1, T2 >::type > > 
integrate_ode (const F &f, const std::vector< T1 > y0, const double t0, const std::vector< double > &ts, const std::vector< T2 > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs)
 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 >
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)
 
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)
 
double F32 (double a, double b, double c, double d, double e, double z, double precision=1e-6)
 
void gradF32 (double *g, double a, double b, double c, double d, double e, double z, double precision=1e-6)
 
void grad2F1 (double &gradA, double &gradC, double a, double b, double c, double z, double precision=1e-6)
 
void gradIncBeta (double &g1, double &g2, double a, double b, double z)
 
void gradRegIncBeta (double &g1, double &g2, double a, double b, double z, double digammaA, double digammaB, double digammaSum, double betaAB)
 
double gradRegIncGamma (double a, double z, double g, double dig, double precision=1e-6)
 

Variables

const double E = boost::math::constants::e<double>()
 The base of the natural logarithm, $ e $. More...
 
const double SQRT_2 = std::sqrt(2.0)
 The value of the square root of 2, $ \sqrt{2} $. More...
 
const double INV_SQRT_2 = 1.0 / SQRT_2
 The value of 1 over the square root of 2, $ 1 / \sqrt{2} $. More...
 
const double LOG_2 = std::log(2.0)
 The natural logarithm of 2, $ \log 2 $. More...
 
const double LOG_10 = std::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 = - std::numeric_limits<double>::infinity()
 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 = - std::numeric_limits<double>::epsilon()
 Largest negative value (i.e., smallest absolute value). More...
 
const double LOG_PI_OVER_FOUR = std::log(boost::math::constants::pi<double>()) / 4.0
 
const double TWO_OVER_SQRT_PI = 2.0 / std::sqrt(boost::math::constants::pi<double>())
 
const double NEG_TWO_OVER_SQRT_PI = -TWO_OVER_SQRT_PI
 
const double INV_SQRT_TWO_PI = 1.0 / std::sqrt(2.0 * boost::math::constants::pi<double>())
 
const double CONSTRAINT_TOLERANCE = 1E-8
 The tolerance for checking arithmetic bounds In rank and in simplexes. More...
 

Detailed Description

Matrices and templated mathematical functions.

Typedef Documentation

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

Type for matrix of double values.

Definition at line 23 of file typedefs.hpp.

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

Type for (row) vector of double values.

Definition at line 37 of file typedefs.hpp.

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

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

Definition at line 16 of file typedefs.hpp.

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

Type for (column) vector of double values.

Definition at line 30 of file typedefs.hpp.

Function Documentation

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

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.

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::domain_errorif m1 and m2 do not have the same dimensions.

Definition at line 27 of file add.hpp.

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 50 of file add.hpp.

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 71 of file add.hpp.

void stan::math::add_initial_values ( const std::vector< stan::agrad::var > &  y0,
std::vector< std::vector< stan::agrad::var > > &  y 
)

Increment the state derived from the coupled system in the with the original initial state.

This is necessary because the coupled system subtracts out the initial state in its representation when the initial state is unknown.

Parameters
[in]y0original initial values to add back into the coupled system.
[in,out]ystate of the coupled system on input, incremented with initial values on output.

Definition at line 34 of file coupled_ode_system.hpp.

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

Definition at line 23 of file append_col.hpp.

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

Definition at line 49 of file append_col.hpp.

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

Definition at line 69 of file append_col.hpp.

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

Definition at line 85 of file append_col.hpp.

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

Definition at line 23 of file append_row.hpp.

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

Definition at line 49 of file append_row.hpp.

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

Definition at line 68 of file append_row.hpp.

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

Definition at line 84 of file append_row.hpp.

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

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

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

Definition at line 14 of file as_bool.hpp.

template<typename LHS , typename RHS >
void stan::math::assign ( LHS &  lhs,
const RHS &  rhs 
)
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
LHSType of left-hand side.
RHSType of right-hand side.
Parameters
lhsLeft-hand side.
rhsRight-hand side.

Definition at line 37 of file assign.hpp.

template<typename LHS , typename RHS , int R1, int C1, int R2, int C2>
void stan::math::assign ( Eigen::Matrix< LHS, R1, C1 > &  x,
const Eigen::Matrix< 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
LHSType of left-hand side matrix elements.
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::domain_errorif sizes do not match.

Definition at line 63 of file assign.hpp.

template<typename LHS , typename RHS , int R, int C>
void stan::math::assign ( Eigen::Matrix< LHS, R, C > &  x,
const Eigen::Matrix< 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
LHSType of left-hand side matrix elements.
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::domain_errorif sizes do not match.

Definition at line 94 of file assign.hpp.

template<typename LHS , typename RHS , int R, int C>
void stan::math::assign ( Eigen::Block< LHS >  x,
const Eigen::Matrix< 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 shape of the right-hand side matrix is specified in the row and column shape template parameters.

Template Parameters
LHSType of matrix block elements.
RHSType 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::domain_errorif sizes do not match.

Definition at line 122 of file assign.hpp.

template<typename LHS , typename RHS >
void stan::math::assign ( std::vector< LHS > &  x,
const std::vector< 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
LHSType of left-hand side vector elements.
RHSType of right-hand side vector elements.
Parameters
xLeft-hand side vector.
yRight-hand side vector.
Exceptions
std::domain_errorif sizes do not match.

Definition at line 153 of file assign.hpp.

template<typename T2 >
T2 stan::math::bessel_first_kind ( const 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 40 of file bessel_first_kind.hpp.

template<typename T2 >
T2 stan::math::bessel_second_kind ( const 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.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::binary_log_loss ( const 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}) $.

Parameters
yReference value in { 0 , 1 }.
y_hatResponse value in [0,1].
Returns
Log loss for response given reference value.

Definition at line 26 of file binary_log_loss.hpp.

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 63 of file binomial_coefficient_log.hpp.

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

Definition at line 23 of file block.hpp.

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

Definition at line 79 of file check_bounded.hpp.

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

Return true 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).

Parameters
function
yMatrix to test.
name
result
Returns
true if the matrix is a valid Cholesky factor.
throws if any element in matrix is nan
Template Parameters
T_yType of elements of Cholesky factor
T_resultType of result.

Definition at line 30 of file check_cholesky_factor.hpp.

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

Return true 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).

Tolerance is specified by math::CONSTRAINT_TOLERANCE.

Parameters
function
yMatrix to test.
name
result
Returns
true if the matrix is a valid Cholesky factor.
throws if any element in y is nan.
Template Parameters
T_yType of elements of Cholesky factor
T_resultType of result.

Definition at line 34 of file check_cholesky_factor_corr.hpp.

template<typename T >
bool stan::math::check_cholesky_factor_corr ( const char *  function,
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  y,
const char *  name,
T *  result = 0 
)
inline

Definition at line 54 of file check_cholesky_factor_corr.hpp.

template<typename T_y , typename T_result >
bool stan::math::check_cholesky_factor_corr ( const char *  function,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
T_result *  result 
)
inline

Return true if the specified matrix is a valid Cholesky factor (lower triangular, positive diagonal).

Parameters
functionName of function.
yMatrix to test.
resultPointer into which to write result.
Returns
true if the matrix is a valid Cholesky factor.
throws if any element in matrix is nan
Template Parameters
T_yType of elements of Cholesky factor
T_resultType of result.

Definition at line 75 of file check_cholesky_factor_corr.hpp.

template<typename T >
bool stan::math::check_cholesky_factor_corr ( const char *  function,
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  y,
T *  result = 0 
)
inline

Definition at line 83 of file check_cholesky_factor_corr.hpp.

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

Return true if the specified index is a valid column of the matrix.

NOTE: this will not throw if y contains nan values.

Parameters
function
iis index
yMatrix to test against
name
result
Returns
true if the index is a valid column index of the matrix.
Template Parameters
TType of scalar.

Definition at line 25 of file check_column_index.hpp.

template<typename T , typename T_result >
bool stan::math::check_consistent_size ( size_t  max_size,
const char *  function,
const T &  x,
const char *  name,
T_result *  result 
)
inline

Definition at line 13 of file check_consistent_size.hpp.

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

Definition at line 13 of file check_consistent_sizes.hpp.

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

Definition at line 26 of file check_consistent_sizes.hpp.

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

Definition at line 41 of file check_consistent_sizes.hpp.

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

Return true 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 (inclussive).

Parameters
function
yMatrix to test.
name
result
Returns
true if the specified matrix is a valid correlation matrix.
throw if any element in matrix is nan
Template Parameters
TType of scalar.

Definition at line 38 of file check_corr_matrix.hpp.

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

Return true if the specified matrix is a valid covariance matrix.

A valid covariance matrix must be square, symmetric, and positive definite.

Parameters
function
yMatrix to test.
name
result
Returns
true if the matrix is a valid covariance matrix.
throws if any element in matrix is nan
Template Parameters
TType of scalar.

Definition at line 29 of file check_cov_matrix.hpp.

template<typename T_y , typename T_eq , typename T_result >
bool stan::math::check_equal ( const char *  function,
const T_y &  y,
const T_eq &  eq,
const char *  name,
T_result *  result 
)
inline

Definition at line 57 of file check_equal.hpp.

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

Checks if the variable y is finite.

NOTE: throws if any element in y is nan.

Definition at line 52 of file check_finite.hpp.

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

Definition at line 58 of file check_greater.hpp.

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

Definition at line 58 of file check_greater_or_equal.hpp.

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

Return true if the underlying matrix is positive definite.

Parameters
function
A
name
result
Returns
true if the matrix is positive definite.
throws if any element in lower triangular of matrix is nan
Template Parameters
TType of scalar.

Definition at line 24 of file check_ldlt_factor.hpp.

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

Definition at line 52 of file check_less.hpp.

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

Definition at line 52 of file check_less_or_equal.hpp.

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

Return true 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.

Parameters
function
yMatrix to test.
name
result
Returns
true if the matrix is symmetric.
throws if any element in upper triangular is nan
Template Parameters
TType of scalar.

Definition at line 27 of file check_lower_triangular.hpp.

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

Definition at line 15 of file check_matching_dims.hpp.

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

Definition at line 15 of file check_matching_sizes.hpp.

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

Definition at line 15 of file check_multiplicable.hpp.

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

Definition at line 52 of file check_nonnegative.hpp.

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

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

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

NOTE: this will not throw if y contains nan values.

Parameters
function
ymatrix/vector to test against
name
result
Returns
true if the the specified matrix/vector is of non-zero size
Exceptions
std::domain_errorif the specified matrix/vector is of non-zero size
Template Parameters
TType of scalar.

Definition at line 33 of file check_nonzero_size.hpp.

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

Checks if the variable y is nan.

Parameters
functionName of function being invoked.
yReference to variable being tested.
nameName of variable being tested.
resultPointer to resulting value after test.
Template Parameters
T_yType of variable being tested.
T_resultType of result returned.

Definition at line 56 of file check_not_nan.hpp.

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

Return true if the specified vector is sorted into increasing order.

There may not be duplicate values. Otherwise, raise a domain error according to the specified policy.

Parameters
function
yVector to test.
name
result
Returns
true if the vector has positive, ordered values.
throws if any element in y is nan

Definition at line 29 of file check_ordered.hpp.

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

Definition at line 57 of file check_ordered.hpp.

template<typename T >
bool stan::math::check_ordered ( const char *  function,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  y,
const char *  name,
T *  result = 0 
)

Definition at line 81 of file check_ordered.hpp.

template<typename T >
bool stan::math::check_ordered ( const char *  function,
const std::vector< T > &  y,
const char *  name,
T *  result = 0 
)

Definition at line 88 of file check_ordered.hpp.

template<typename T_y , typename T_result >
bool stan::math::check_pos_definite ( const char *  function,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const char *  name,
T_result *  result 
)
inline

Return true if the specified matrix is positive definite.

NOTE: symmetry is NOT checked by this function

Parameters
function
yMatrix to test.
name
result
Returns
true if the matrix is positive definite.
throws if any element in lower triangular of matrix is nan.
Template Parameters
TType of scalar.

Definition at line 29 of file check_pos_definite.hpp.

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

Return true if the specified matrix is positive definite.

NOTE: symmetry is NOT checked by this function

Parameters
function
yMatrix to test.
name
result
Returns
true if the matrix is positive semi-definite.
throws if any element in y is nan
Template Parameters
TType of scalar.

Definition at line 33 of file check_pos_semidefinite.hpp.

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

Definition at line 54 of file check_positive.hpp.

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

Definition at line 12 of file check_positive_finite.hpp.

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

Return true if the specified vector contains only non-negative values and is sorted into increasing order.

There may not be duplicate values. Otherwise, raise a domain error according to the specified policy.

Parameters
function
yVector to test.
name
result
Returns
true if the vector has positive, ordered
throws if any element in y is nan values.

Definition at line 29 of file check_positive_ordered.hpp.

void stan::math::check_range ( size_t  max,
size_t  i,
const char *  msg,
size_t  idx 
)
inline

Definition at line 30 of file check_range.hpp.

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

Return true if the specified index is a valid row of the matrix.

NOTE: this will not throw if y contains nan values.

Parameters
function
iis index
yMatrix to test against
name
result
Returns
true if the index is a valid row index of the matrix.
Template Parameters
TType of scalar.

Definition at line 25 of file check_row_index.hpp.

template<typename T_prob , typename T_result >
bool stan::math::check_simplex ( const char *  function,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta,
const char *  name,
T_result *  result 
)

Return true 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.

The test that the values sum to 1 is done to within the tolerance specified by CONSTRAINT_TOLERANCE.

Parameters
function
thetaVector to test.
name
result
Returns
true if the vector is a simplex.
throws if any element is nan.

Definition at line 32 of file check_simplex.hpp.

template<typename T_size1 , typename T_size2 , typename T_result >
bool stan::math::check_size_match ( const char *  function,
T_size1  i,
const char *  name_i,
T_size2  j,
const char *  name_j,
T_result *  result 
)
inline

Definition at line 13 of file check_size_match.hpp.

template<typename T_y , typename T_result >
bool stan::math::check_spsd_matrix ( const char *  function,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const char *  name,
T_result *  result 
)
inline

Return true if the specified matrix is a square, symmetric, and positive semi-definite.

Parameters
function
yMatrix to test.
name
result
Returns
true if the matrix is a square, symmetric, and positive semi-definite.
throws if any element in matrix is nan.
Template Parameters
TType of scalar.

Definition at line 29 of file check_spsd_matrix.hpp.

template<typename T_y , typename T_result >
bool stan::math::check_square ( const char *  function,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const char *  name,
T_result *  result 
)
inline

Return true if the specified matrix is square.

NOTE: this will not throw if any elements in y are nan.

Parameters
function
yMatrix to test.
name
result
Returns
true if the matrix is a square matrix.
Template Parameters
TType of scalar.

Definition at line 24 of file check_square.hpp.

template<typename T_y , typename T_result >
bool stan::math::check_std_vector_index ( const char *  function,
size_t  i,
const std::vector< T_y > &  y,
const char *  name,
T_result *  result 
)
inline

Return true if the specified index is valid in std vector.

NOTE: this will not throw if y contains nan values.

Parameters
function
iis index
ystd vector to test against
name
result
Returns
true if the index is a valid in std vector.
Template Parameters
TType of scalar.

Definition at line 25 of file check_std_vector_index.hpp.

template<typename T_y , typename T_result >
bool stan::math::check_symmetric ( const char *  function,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const char *  name,
T_result *  result 
)
inline

Return true if the specified matrix is symmetric.

NOTE: squareness is not checked by this function

Parameters
function
yMatrix to test.
name
result
Returns
true if the matrix is symmetric.
throws if any element not on the main diagonal is NaN
Template Parameters
TType of scalar.

Definition at line 31 of file check_symmetric.hpp.

template<typename T_prob , typename T_result >
bool stan::math::check_unit_vector ( const char *  function,
const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &  theta,
const char *  name,
T_result *  result 
)

Return true if the specified vector is unit vector.

The test that the values sum to 1 is done to within the tolerance specified by CONSTRAINT_TOLERANCE.

Parameters
function
thetaVector to test.
name
result
Returns
true if the vector is a unit vector.
throws if any element in theta is nan

Definition at line 27 of file check_unit_vector.hpp.

template<typename T >
bool stan::math::check_unit_vector ( const char *  function,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  theta,
const char *  name,
T *  result = 0 
)
inline

Definition at line 55 of file check_unit_vector.hpp.

template<typename T , int R, int C, typename T_result >
bool stan::math::check_vector ( const char *  function,
const Eigen::Matrix< T, R, C > &  x,
const char *  name,
T_result *  result 
)
inline

Definition at line 14 of file check_vector.hpp.

template<typename T >
Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> stan::math::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.

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.
Exceptions
std::domain_errorif m is not a symmetric matrix.

Definition at line 23 of file cholesky_decompose.hpp.

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.

Definition at line 24 of file col.hpp.

template<typename T , int R, int C>
size_t stan::math::cols ( const Eigen::Matrix< T, R, C > &  m)
inline

Definition at line 12 of file cols.hpp.

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 22 of file columns_dot_product.hpp.

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 16 of file columns_dot_self.hpp.

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 17 of file crossprod.hpp.

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 23 of file cumulative_sum.hpp.

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 49 of file cumulative_sum.hpp.

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.

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 18 of file diag_matrix.hpp.

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 13 of file diag_post_multiply.hpp.

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 13 of file diag_pre_multiply.hpp.

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 18 of file diagonal.hpp.

double stan::math::digamma ( double  x)

\[ \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)} \]

Definition at line 39 of file digamma.hpp.

template<typename T >
void stan::math::dims ( const T &  x,
std::vector< int > &  result 
)
inline

Definition at line 13 of file dims.hpp.

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 18 of file dims.hpp.

template<typename T >
void stan::math::dims ( const std::vector< T > &  x,
std::vector< int > &  result 
)
inline

Definition at line 25 of file dims.hpp.

template<typename T >
std::vector<int> stan::math::dims ( const T &  x)
inline

Definition at line 34 of file dims.hpp.

double stan::math::dist ( const std::vector< double > &  x,
const std::vector< double > &  y 
)
inline

Definition at line 11 of file dist.hpp.

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 25 of file distance.hpp.

int stan::math::divide ( const int  x,
const int  y 
)
inline

Definition at line 11 of file divide.hpp.

template<int R, int C, typename T >
boost::enable_if_c<boost::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 23 of file divide.hpp.

template<typename T , typename T_result , typename T_msg >
bool stan::math::dom_err ( const char *  function,
const T &  y,
const char *  name,
const char *  error_msg,
const T_msg  error_msg2,
T_result *  result 
)
inline

Definition at line 36 of file dom_err.hpp.

template<typename T , typename T_result , typename T_msg >
bool stan::math::dom_err_vec ( const size_t  i,
const char *  function,
const T &  y,
const char *  name,
const char *  error_msg,
const T_msg  error_msg2,
T_result *  result 
)
inline

Definition at line 33 of file dom_err_vec.hpp.

double stan::math::dot ( const std::vector< double > &  x,
const std::vector< double > &  y 
)
inline

Definition at line 11 of file dot.hpp.

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 22 of file dot_product.hpp.

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 36 of file dot_product.hpp.

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 49 of file dot_product.hpp.

double stan::math::dot_self ( const std::vector< double > &  x)
inline

Definition at line 11 of file dot_self.hpp.

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.

double stan::math::e ( )
inline

Return the base of the natural logarithm.

Returns
Base of natural logarithm.

Definition at line 86 of file constants.hpp.

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 22 of file eigenvalues_sym.hpp.

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 13 of file eigenvectors_sym.hpp.

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.

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 49 of file elt_divide.hpp.

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 67 of file elt_divide.hpp.

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.

template<typename T , int Rows, int Cols>
Eigen::Matrix<T,Rows,Cols> stan::math::exp ( const Eigen::Matrix< T, Rows, Cols > &  m)
inline

Return the element-wise exponentiation of the matrix or vector.

Parameters
mThe matrix or vector.
Returns
ret(i,j) = exp(m(i,j))

Definition at line 18 of file exp.hpp.

template<int Rows, int Cols>
Eigen::Matrix<double,Rows,Cols> stan::math::exp ( const Eigen::Matrix< double, Rows, Cols > &  m)
inline

Definition at line 26 of file exp.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::exp2 ( const T  y)
inline

Return the exponent base 2 of the specified argument (C99).

The exponent base 2 function is defined by

exp2(y) = pow(2.0,y).

Parameters
yValue.
Template Parameters
TType of scalar.
Returns
Exponent base 2 of value.

Definition at line 23 of file exp2.hpp.

double stan::math::F32 ( double  a,
double  b,
double  c,
double  d,
double  e,
double  z,
double  precision = 1e-6 
)

Definition at line 14 of file internal_math.hpp.

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1,T2>::type stan::math::falling_factorial ( const T1  x,
const T2  n 
)
inline

\[ \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 53 of file falling_factorial.hpp.

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

The positive difference function (C99).

The function is defined by

fdim(a,b) = (a > b) ? (a - b) : 0.0.

Parameters
aFirst value.
bSecond value.
Returns
Returns min(a - b, 0.0).

Definition at line 23 of file fdim.hpp.

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 22 of file fill.hpp.

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 39 of file fill.hpp.

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
xContainer.
yValue.

Definition at line 55 of file fill.hpp.

double stan::math::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} \]

\[ \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)} \]

Definition at line 53 of file gamma_p.hpp.

double stan::math::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} \]

\[ \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)} \]

Definition at line 53 of file gamma_q.hpp.

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.

Definition at line 27 of file get_base1.hpp.

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.

Definition at line 52 of file get_base1.hpp.

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.

Definition at line 79 of file get_base1.hpp.

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.

Definition at line 108 of file get_base1.hpp.

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.

Definition at line 139 of file get_base1.hpp.

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.

Definition at line 172 of file get_base1.hpp.

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.

Definition at line 208 of file get_base1.hpp.

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.

Definition at line 246 of file get_base1.hpp.

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.

Definition at line 284 of file get_base1.hpp.

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.

Definition at line 310 of file get_base1.hpp.

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.

Definition at line 336 of file get_base1.hpp.

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.

Definition at line 360 of file get_base1.hpp.

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.

Definition at line 27 of file get_base1_lhs.hpp.

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.

Definition at line 52 of file get_base1_lhs.hpp.

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.

Definition at line 79 of file get_base1_lhs.hpp.

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.

Definition at line 108 of file get_base1_lhs.hpp.

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.

Definition at line 139 of file get_base1_lhs.hpp.

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.

Definition at line 172 of file get_base1_lhs.hpp.

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.

Definition at line 208 of file get_base1_lhs.hpp.

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.

Definition at line 246 of file get_base1_lhs.hpp.

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.

Definition at line 285 of file get_base1_lhs.hpp.

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.

Definition at line 311 of file get_base1_lhs.hpp.

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.

Definition at line 337 of file get_base1_lhs.hpp.

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.

Definition at line 362 of file get_base1_lhs.hpp.

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 stan::math::accumulator< T_lp_accum > &  lp_accum 
)
inline

Definition at line 11 of file get_lp.hpp.

void stan::math::grad2F1 ( double &  gradA,
double &  gradC,
double  a,
double  b,
double  c,
double  z,
double  precision = 1e-6 
)

Definition at line 102 of file internal_math.hpp.

void stan::math::gradF32 ( double *  g,
double  a,
double  b,
double  c,
double  d,
double  e,
double  z,
double  precision = 1e-6 
)

Definition at line 50 of file internal_math.hpp.

void stan::math::gradIncBeta ( double &  g1,
double &  g2,
double  a,
double  b,
double  z 
)

Definition at line 140 of file internal_math.hpp.

void stan::math::gradRegIncBeta ( double &  g1,
double &  g2,
double  a,
double  b,
double  z,
double  digammaA,
double  digammaB,
double  digammaSum,
double  betaAB 
)

Definition at line 161 of file internal_math.hpp.

double stan::math::gradRegIncGamma ( double  a,
double  z,
double  g,
double  dig,
double  precision = 1e-6 
)

Definition at line 181 of file internal_math.hpp.

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

Definition at line 24 of file head.hpp.

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

Definition at line 42 of file head.hpp.

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

Definition at line 58 of file head.hpp.

double stan::math::ibeta ( const double  a,
const double  b,
const 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 23 of file ibeta.hpp.

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.

template<typename T >
void stan::math::initialize ( T &  x,
const T &  v 
)
inline

Definition at line 17 of file initialize.hpp.

template<typename T , typename V >
boost::enable_if_c<boost::is_arithmetic<V>::value, void>::type stan::math::initialize ( T &  x,
v 
)
inline

Definition at line 23 of file initialize.hpp.

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 27 of file initialize.hpp.

template<typename T , typename V >
void stan::math::initialize ( std::vector< T > &  x,
const V &  v 
)
inline

Definition at line 32 of file initialize.hpp.

template<typename T >
unsigned int stan::math::int_step ( const T  y)

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} \]

Parameters
yValue to test.
Returns
1 if value is greater than 0 and 0 otherwise
Template Parameters
TScalar argument type.

Definition at line 25 of file int_step.hpp.

template<typename F , typename T1 , typename T2 >
std::vector<std::vector<typename stan::return_type<T1,T2>::type> > stan::math::integrate_ode ( const F &  f,
const std::vector< T1 >  y0,
const double  t0,
const std::vector< double > &  ts,
const std::vector< T2 > &  theta,
const std::vector< double > &  x,
const std::vector< int > &  x_int,
std::ostream *  msgs 
)

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::agrad 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.
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.
[in,out]msgsthe print stream for warning messages.
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 61 of file integrate_ode.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::inv ( const T  x)
inline

Definition at line 12 of file inv.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::inv_cloglog ( 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 49 of file inv_cloglog.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::inv_logit ( const T  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 stan::math::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 52 of file inv_logit.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::inv_sqrt ( const T  x)
inline

Definition at line 12 of file inv_sqrt.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::inv_square ( const T  x)
inline

Definition at line 12 of file inv_square.hpp.

template<typename T >
Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> stan::math::inverse ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)
inline

Returns the inverse of the specified matrix.

Parameters
mSpecified matrix.
Returns
Inverse of the matrix.

Definition at line 18 of file inverse.hpp.

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 stan::math::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 stan::math::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 34 of file inverse_softmax.hpp.

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 19 of file inverse_spd.hpp.

int stan::math::is_inf ( const double  x)
inline

Returns 1 if the input is infinite and 0 otherwise.

Delegates to boost::math::isinf.

Parameters
xValue to test.
Returns
1 if the value is infinite.

Definition at line 19 of file is_inf.hpp.

int stan::math::is_nan ( const double  x)
inline

Returns 1 if the input is NaN and 0 otherwise.

Delegates to boost::math::isnan.

Parameters
xValue to test.
Returns
1 if the value is NaN.

Definition at line 19 of file is_nan.hpp.

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.

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 boost::math::lgamma() for the double-based and stan::agrad 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 59 of file lbeta.hpp.

double stan::math::lgamma ( double  x)

\[ \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} \]

Definition at line 31 of file lgamma.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::lmgamma ( const 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 57 of file lmgamma.hpp.

template<typename T , int Rows, int Cols>
Eigen::Matrix<T,Rows,Cols> stan::math::log ( const Eigen::Matrix< T, Rows, Cols > &  m)
inline

Return the element-wise logarithm of the matrix or vector.

Parameters
mThe matrix or vector.
Returns
ret(i,j) = log(m(i,j))

Definition at line 16 of file log.hpp.

double stan::math::log10 ( )
inline

Return natural logarithm of ten.

Returns
Natural logarithm of ten.

Definition at line 105 of file constants.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::log1m ( 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
xSpecified value.
Returns
Natural log of one minus x.

Definition at line 40 of file log1m.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::log1m_exp ( const T  a)
inline

Calculates the log of 1 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} \]

Definition at line 40 of file log1m_exp.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::log1m_inv_logit ( const T  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} \]

Template Parameters
TScalar type
Parameters
uInput.
Returns
log of 1 minus the inverse logit of the input.

Definition at line 36 of file log1m_inv_logit.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::log1p ( const T  x)
inline

Return the natural logarithm of one plus the specified value.

The main use of this function is to cut down on intermediate values during algorithmic differentiation.

\[ \mbox{log1p}(x) = \begin{cases} \textrm{NaN} & \mbox{if } x < -1\\ \ln(1+x)& \mbox{if } x\geq -1 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

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

Parameters
xSpecified value.
Returns
Natural log of one plus x.

Definition at line 39 of file log1p.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::log1p_exp ( const T  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 44 of file log1p_exp.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::log2 ( const T  a)
inline

Returns the base 2 logarithm of the argument (C99).

The function is defined by:

log2(a) = log(a) / std::log(2.0).

Template Parameters
Ttype of scalar
Parameters
aValue.
Returns
Base 2 logarithm of the value.

Definition at line 25 of file log2.hpp.

double stan::math::log2 ( )
inline

Return natural logarithm of two.

Returns
Natural logarithm of two.

Definition at line 35 of file log2.hpp.

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.

template<int R, int C, typename T >
T stan::math::log_determinant_ldlt ( stan::math::LDLT_factor< T, R, C > &  A)
inline

Definition at line 12 of file log_determinant_ldlt.hpp.

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 20 of file log_determinant_spd.hpp.

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 49 of file log_diff_exp.hpp.

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1,T2>::type stan::math::log_falling_factorial ( const T1  x,
const T2  n 
)
inline

\[ \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} \]

Definition at line 41 of file log_falling_factorial.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::log_inv_logit ( const T &  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} \]

Template Parameters
TScalar type
Parameters
uInput.
Returns
log of the inverse logit of the input.

Definition at line 36 of file log_inv_logit.hpp.

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1,T2>::type stan::math::log_rising_factorial ( const T1  x,
const T2  n 
)
inline

\[ \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} \]

Definition at line 41 of file log_rising_factorial.hpp.

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 44 of file log_softmax.hpp.

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 29 of file log_sum_exp.hpp.

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 49 of file log_sum_exp.hpp.

double stan::math::log_sum_exp ( const std::vector< double > &  x)

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 68 of file log_sum_exp.hpp.

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.

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.

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.

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.

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 20 of file logical_lt.hpp.

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.

template<typename T >
int stan::math::logical_negation ( const T  x)
inline

The logical negation function which returns 1 if the input is equal to zero and 0 otherwise.

Template Parameters
TType to compare to zero.
Parameters
xValue to compare to zero.
Returns
1 if input is equal to zero.

Definition at line 17 of file logical_negation.hpp.

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.

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.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::logit ( const T  a)
inline

Returns the logit function applied to 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 stan::math::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
aArgument.
Returns
Logit of the argument.

Definition at line 44 of file logit.hpp.

double stan::math::machine_precision ( )
inline

Returns the difference between 1.0 and the next value representable.

Returns
Minimum positive number.

Definition at line 142 of file constants.hpp.

double stan::math::max ( const double  a,
const double  b 
)
inline

Definition at line 7 of file max.hpp.

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 19 of file max.hpp.

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 37 of file max.hpp.

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 54 of file max.hpp.

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.

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 stan::math::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 24 of file mdivide_left_ldlt.hpp.

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.

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.

Parameters
ATriangular matrix. Specify upper or lower with TriView being Eigen::Upper or Eigen::Lower.
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_tri.hpp.

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.

Parameters
ATriangular matrix. Specify upper or lower with TriView being Eigen::Upper or Eigen::Lower.
Returns
x = A^-1 .
Exceptions
std::domain_errorif A is not square

Definition at line 48 of file mdivide_left_tri.hpp.

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

Definition at line 16 of file mdivide_left_tri_low.hpp.

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 31 of file mdivide_left_tri_low.hpp.

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 25 of file mdivide_right.hpp.

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 stan::math::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.

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 stan::math::LDLT_factor< double, R2, C2 > &  A 
)
inline

Definition at line 36 of file mdivide_right_ldlt.hpp.

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.

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.

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.

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 23 of file mean.hpp.

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 40 of file mean.hpp.

double stan::math::min ( const double  a,
const double  b 
)
inline

Definition at line 7 of file min.hpp.

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 18 of file min.hpp.

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 36 of file min.hpp.

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 53 of file min.hpp.

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 16 of file minus.hpp.

template<typename T2 >
T2 stan::math::modified_bessel_first_kind ( const 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 39 of file modified_bessel_first_kind.hpp.

template<typename T2 >
T2 stan::math::modified_bessel_second_kind ( const 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.

int stan::math::modulus ( const int  x,
const int  y 
)
inline

Definition at line 11 of file modulus.hpp.

template<int R, int C, typename T >
boost::enable_if_c<boost::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 25 of file multiply.hpp.

template<int R, int C, typename T >
boost::enable_if_c<boost::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 45 of file multiply.hpp.

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 61 of file multiply.hpp.

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 79 of file multiply.hpp.

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.

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.

double stan::math::negative_infinity ( )
inline

Return negative infinity.

Returns
Negative infinity.

Definition at line 123 of file constants.hpp.

double stan::math::not_a_number ( )
inline

Return (quiet) not-a-number.

Returns
Quiet not-a-number.

Definition at line 132 of file constants.hpp.

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 19 of file num_elements.hpp.

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 31 of file num_elements.hpp.

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
margument vector
Returns
number of contained arguments

Definition at line 45 of file num_elements.hpp.

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1,T2>::type stan::math::owens_t ( const T1 &  h,
const T2 &  a 
)
inline

The Owen's T function of h and a.

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)} \]

Template Parameters
T1Type of first argument.
T2Type of second argument.
Parameters
hFirst argument
aSecond argument
Returns
The Owen's T function.

Definition at line 64 of file owens_t.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::Phi ( const T  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 31 of file Phi.hpp.

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::Phi_approx ( x)
inline

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 23 of file Phi_approx.hpp.

double stan::math::pi ( )
inline

Return the value of pi.

Returns
Pi.

Definition at line 77 of file constants.hpp.

double stan::math::positive_infinity ( )
inline

Return positive infinity.

Returns
Positive infinity.

Definition at line 114 of file constants.hpp.

template<typename T >
boost::enable_if<boost::is_arithmetic<T>, 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 Boost's is_arithmetic trait metaprogram.

This function differs from stan::math::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 30 of file primitive_value.hpp.

template<typename T >
boost::disable_if<boost::is_arithmetic<T>, 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 Boost's is_arithmetic trait metaprogram.

Template Parameters
Ttype of non-arithmetic input.
Parameters
xinput.
Returns
value of input.

Definition at line 47 of file primitive_value.hpp.

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.

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 32 of file prod.hpp.

template<typename T1 , typename T2 , typename F >
common_type<T1,T2>::type stan::math::promote_common ( const F &  u)
inline

Definition at line 14 of file promote_common.hpp.

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 103 of file promote_scalar.hpp.

template<typename T >
Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> stan::math::qr_Q ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)

Definition at line 14 of file qr_Q.hpp.

template<typename T >
Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> stan::math::qr_R ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m)

Definition at line 14 of file qr_R.hpp.

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 21 of file quad_form.hpp.

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 33 of file quad_form.hpp.

template<typename T1 , typename T2 , int R, int C>
Matrix<typename promote_args<T1,T2>::type, Dynamic, Dynamic> stan::math::quad_form_diag ( const Matrix< T1, Dynamic, Dynamic > &  mat,
const Matrix< T2, R, C > &  vec 
)
inline

Definition at line 20 of file quad_form_diag.hpp.

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 47 of file quad_form.hpp.

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 62 of file quad_form.hpp.

template<typename T >
size_t stan::math::rank ( const std::vector< T > &  v,
int  s 
)
inline

Return the number of components of v less than v[s].

Returns
Number of components of v less than v[s].
Template Parameters
TType of elements of the vector.

Definition at line 18 of file rank.hpp.

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

Return the number of components of v less than v[s].

Returns
Number of components of v less than v[s].
Template Parameters
TType of elements of the vector.

Definition at line 36 of file rank.hpp.

template<typename T >
std::vector<T> stan::math::rep_array ( const T &  x,
int  n 
)
inline

Definition at line 14 of file rep_array.hpp.

template<typename T >
std::vector<std::vector<T> > stan::math::rep_array ( const T &  x,
int  m,
int  n 
)
inline

Definition at line 21 of file rep_array.hpp.

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 30 of file rep_array.hpp.

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 16 of file rep_matrix.hpp.

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 25 of file rep_matrix.hpp.

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 34 of file rep_matrix.hpp.

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 15 of file rep_row_vector.hpp.

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 16 of file rep_vector.hpp.

template<typename T >
void stan::math::resize ( T &  x,
std::vector< size_t >  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 63 of file resize.hpp.

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1,T2>::type stan::math::rising_factorial ( const T1  x,
const T2  n 
)
inline

\[ \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 53 of file rising_factorial.hpp.

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.

Definition at line 26 of file row.hpp.

template<typename T , int R, int C>
size_t stan::math::rows ( const Eigen::Matrix< T, R, C > &  m)
inline

Definition at line 12 of file rows.hpp.

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 22 of file rows_dot_product.hpp.

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 16 of file rows_dot_self.hpp.

void stan::math::scaled_add ( std::vector< double > &  x,
const std::vector< double > &  y,
const double  lambda 
)
inline

Definition at line 11 of file scaled_add.hpp.

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 22 of file sd.hpp.

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 37 of file sd.hpp.

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 20 of file segment.hpp.

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 34 of file segment.hpp.

template<typename T >
std::vector<T> stan::math::segment ( const std::vector< T > &  sv,
size_t  i,
size_t  n 
)

Definition at line 49 of file segment.hpp.

template<typename T >
int stan::math::sign ( const T &  z)
inline

Definition at line 9 of file sign.hpp.

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 19 of file singular_values.hpp.

template<typename T >
int stan::math::size ( const std::vector< T > &  x)
inline

Definition at line 11 of file size.hpp.

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] - \mbox{softmax}(y)[k] \times \mbox{softmax}(y)[m] & \mbox{ if } m = k, \mbox{ and} \\[6pt] \mbox{softmax}(y)[k] * \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 46 of file softmax.hpp.

template<typename T >
std::vector<T> stan::math::sort_asc ( std::vector< T >  xs)
inline

Return the specified standard vector in ascending order.

Parameters
xsStandard vector to order.
Returns
Standard vector ordered.
Template Parameters
TType of elements of the vector.

Definition at line 20 of file sort.hpp.

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 eigen vector in ascending order.

Parameters
xsEigen vector to order.
Returns
Eigen vector ordered.
Template Parameters
TType of elements of the vector.

Definition at line 46 of file sort.hpp.

template<typename T >
std::vector<T> stan::math::sort_desc ( std::vector< T >  xs)
inline

Return the specified standard vector in descending order.

Parameters
xsStandard vector to order.
Returns
Standard vector ordered.
Template Parameters
TType of elements of the vector.

Definition at line 33 of file sort.hpp.

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 eigen vector in descending order.

Parameters
xsEigen vector to order.
Returns
Eigen vector ordered.
Template Parameters
TType of elements of the vector.

Definition at line 59 of file sort.hpp.

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 86 of file sort_indices.hpp.

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 98 of file sort_indices.hpp.

double stan::math::sqrt2 ( )
inline

Return the square root of two.

Returns
Square root of two.

Definition at line 95 of file constants.hpp.

template<typename T >
T stan::math::square ( const T  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.
Template Parameters
TType of scalar.

Definition at line 22 of file square.hpp.

template<int R1, int C1, int R2, int C2, typename T1 , typename T2 >
boost::math::tools::promote_args<T1,T2>::type stan::math::squared_distance ( const Eigen::Matrix< T1, R1, C1 > &  v1,
const Eigen::Matrix< T2, R2, C2 > &  v2 
)
inline

Returns the squared 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 22 of file squared_distance.hpp.

template<typename T >
void stan::math::stan_print ( std::ostream *  o,
const T &  x 
)

Definition at line 12 of file stan_print.hpp.

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.

template<typename T >
void stan::math::stan_print ( std::ostream *  o,
const Eigen::Matrix< T, Eigen::Dynamic, 1 > &  x 
)

Definition at line 27 of file stan_print.hpp.

template<typename T >
void stan::math::stan_print ( std::ostream *  o,
const Eigen::Matrix< T, 1, Eigen::Dynamic > &  x 
)

Definition at line 37 of file stan_print.hpp.

template<typename T >
void stan::math::stan_print ( std::ostream *  o,
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  x 
)

Definition at line 47 of file stan_print.hpp.

template<typename T >
int 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} \]

Parameters
yScalar argument.
Returns
1 if the specified argument is greater than or equal to 0.0, and 0 otherwise.

Definition at line 29 of file step.hpp.

void stan::math::sub ( std::vector< double > &  x,
std::vector< double > &  y,
std::vector< double > &  result 
)
inline

Definition at line 10 of file sub.hpp.

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

Definition at line 22 of file sub_col.hpp.

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
iStarting row + 1
jStarting column + 1
ncolsNumber of columns in block

Definition at line 23 of file sub_row.hpp.

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.

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 41 of file subtract.hpp.

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 53 of file subtract.hpp.

double stan::math::sum ( std::vector< double > &  x)
inline

Definition at line 10 of file sum.hpp.

template<typename T >
T stan::math::sum ( const std::vector< T > &  xs)
inline

Return the sum of the values in the specified standard vector.

Parameters
xsStandard vector to sum.
Returns
Sum of elements.
Template Parameters
TType of elements summed.

Definition at line 19 of file sum.hpp.

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

Returns the sum of the coefficients of the specified column vector.

Parameters
vSpecified vector.
Returns
Sum of coefficients of vector.

Definition at line 34 of file sum.hpp.

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.

Definition at line 22 of file tail.hpp.

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.

Definition at line 37 of file tail.hpp.

template<typename T >
std::vector<T> stan::math::tail ( const std::vector< T > &  sv,
size_t  n 
)

Definition at line 45 of file tail.hpp.

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 17 of file tcrossprod.hpp.

template<typename T , int R, int C>
vector<T> stan::math::to_array_1d ( const Matrix< T, R, C > &  matrix)
inline

Definition at line 131 of file containers_conversion.hpp.

template<typename T >
vector<T> stan::math::to_array_1d ( const vector< T > &  x)
inline

Definition at line 143 of file containers_conversion.hpp.

template<typename T >
vector<typename scalar_type<T>::type> stan::math::to_array_1d ( const vector< vector< T > > &  x)
inline

Definition at line 150 of file containers_conversion.hpp.

template<typename T >
vector< vector<T> > stan::math::to_array_2d ( const Matrix< T, Dynamic, Dynamic > &  matrix)
inline

Definition at line 116 of file containers_conversion.hpp.

template<typename T , int R, int C>
Matrix<T, Dynamic, Dynamic> stan::math::to_matrix ( Matrix< T, R, C >  matrix)
inline

Definition at line 20 of file containers_conversion.hpp.

template<typename T >
Matrix<T, Dynamic, Dynamic> stan::math::to_matrix ( const vector< vector< T > > &  vec)
inline

Definition at line 27 of file containers_conversion.hpp.

Matrix<double, Dynamic, Dynamic> stan::math::to_matrix ( const vector< vector< int > > &  vec)
inline

Definition at line 44 of file containers_conversion.hpp.

template<typename T , int R, int C>
Matrix<T, 1, Dynamic> stan::math::to_row_vector ( const Matrix< T, R, C > &  matrix)
inline

Definition at line 91 of file containers_conversion.hpp.

template<typename T >
Matrix<T, 1, Dynamic> stan::math::to_row_vector ( const vector< T > &  vec)
inline

Definition at line 98 of file containers_conversion.hpp.

Matrix<double, 1, Dynamic> stan::math::to_row_vector ( const vector< int > &  vec)
inline

Definition at line 104 of file containers_conversion.hpp.

template<typename T , int R, int C>
Matrix<T, Dynamic, 1> stan::math::to_vector ( const Matrix< T, R, C > &  matrix)
inline

Definition at line 64 of file containers_conversion.hpp.

template<typename T >
Matrix<T, Dynamic, 1> stan::math::to_vector ( const vector< T > &  vec)
inline

Definition at line 71 of file containers_conversion.hpp.

Matrix<double, Dynamic, 1> stan::math::to_vector ( const vector< int > &  vec)
inline

Definition at line 77 of file containers_conversion.hpp.

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 20 of file trace.hpp.

template<typename T >
T stan::math::trace ( const T &  m)
inline

Definition at line 26 of file trace.hpp.

template<typename T1 , typename T2 , typename T3 , int R1, int C1, int R2, int C2, int R3, int C3>
boost::enable_if_c<!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 stan::math::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.

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 17 of file trace_gen_quad_form.hpp.

template<typename T1 , typename T2 , int R2, int C2, int R3, int C3>
boost::enable_if_c<!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 stan::math::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.

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 17 of file trace_quad_form.hpp.

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 12 of file transpose.hpp.

template<typename T >
T stan::math::trigamma ( x)
inline

\[ \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} \]

Definition at line 49 of file trigamma.hpp.

void stan::math::validate_non_negative_index ( const std::string &  var_name,
const std::string &  expr,
int  val 
)
inline

Definition at line 12 of file validate_non_negative_index.hpp.

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 stan::math::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.hpp.

template<>
double stan::math::value_of< double > ( const 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.hpp.

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 24 of file variance.hpp.

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 46 of file variance.hpp.

Variable Documentation

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 11 of file constraint_tolerance.hpp.

const double stan::math::E = boost::math::constants::e<double>()

The base of the natural logarithm, $ e $.

Definition at line 14 of file constants.hpp.

const double stan::math::EPSILON = std::numeric_limits<double>::epsilon()

Smallest positive value.

Definition at line 58 of file constants.hpp.

const double stan::math::INFTY = std::numeric_limits<double>::infinity()

Positive infinity.

Definition at line 43 of file constants.hpp.

const double stan::math::INV_SQRT_2 = 1.0 / SQRT_2

The value of 1 over the square root of 2, $ 1 / \sqrt{2} $.

Definition at line 26 of file constants.hpp.

const double stan::math::INV_SQRT_TWO_PI = 1.0 / std::sqrt(2.0 * boost::math::constants::pi<double>())

Definition at line 150 of file constants.hpp.

const double stan::math::LOG_10 = std::log(10.0)

The natural logarithm of 10, $ \log 10 $.

Definition at line 38 of file constants.hpp.

const double stan::math::LOG_2 = std::log(2.0)

The natural logarithm of 2, $ \log 2 $.

Definition at line 32 of file constants.hpp.

const double stan::math::LOG_PI_OVER_FOUR = std::log(boost::math::constants::pi<double>()) / 4.0

Definition at line 70 of file constants.hpp.

const double stan::math::NEG_TWO_OVER_SQRT_PI = -TWO_OVER_SQRT_PI

Definition at line 148 of file constants.hpp.

const double stan::math::NEGATIVE_EPSILON = - std::numeric_limits<double>::epsilon()

Largest negative value (i.e., smallest absolute value).

Definition at line 63 of file constants.hpp.

const double stan::math::NEGATIVE_INFTY = - std::numeric_limits<double>::infinity()

Negative infinity.

Definition at line 48 of file constants.hpp.

const double stan::math::NOT_A_NUMBER = std::numeric_limits<double>::quiet_NaN()

(Quiet) not-a-number value.

Definition at line 53 of file constants.hpp.

const double stan::math::SQRT_2 = std::sqrt(2.0)

The value of the square root of 2, $ \sqrt{2} $.

Definition at line 20 of file constants.hpp.

const double stan::math::TWO_OVER_SQRT_PI = 2.0 / std::sqrt(boost::math::constants::pi<double>())

Definition at line 146 of file constants.hpp.


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