Stan  1.0
probability, sampling & optimization
Namespaces | Classes | Typedefs | Functions | Variables
stan::math Namespace Reference

Matrices and templated mathematical functions. More...

Namespaces

 policies
 Extending boost functionality.
 

Classes

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  common_type
 
struct  common_type< std::vector< T1 >, std::vector< T2 > >
 
struct  common_type< Eigen::Matrix< T1, R, C >, Eigen::Matrix< T2, R, C > >
 
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...
 

Typedefs

typedef boost::math::policies::policy default_policy
 Default error-handling policy from Boost. 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

template<typename T_y , typename T_result , class Policy >
bool check_not_nan (const char *function, const T_y &y, const char *name, T_result *result, const Policy &)
 Checks if the variable y is nan. More...
 
template<typename T_y , typename T_result >
bool check_not_nan (const char *function, const T_y &y, const char *name, T_result *result=0)
 Checks if the variable y is nan. More...
 
template<typename T >
bool check_not_nan (const char *function, const T &y, const char *name)
 
template<typename T_y , typename T_result , class Policy >
bool check_finite (const char *function, const T_y &y, const char *name, T_result *result, const Policy &)
 Checks if the variable y is finite. More...
 
template<typename T_y , typename T_result >
bool check_finite (const char *function, const T_y &y, const char *name, T_result *result)
 
template<typename T >
bool check_finite (const char *function, const T &y, const char *name)
 
template<typename T_y , typename T_low , typename T_result , class Policy >
bool check_greater (const char *function, const T_y &y, const T_low &low, const char *name, T_result *result, const Policy &)
 
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 >
bool check_greater (const char *function, const T_y &y, const T_low &low, const char *name)
 
template<typename T_y , typename T_low , typename T_result , class Policy >
bool check_greater_or_equal (const char *function, const T_y &y, const T_low &low, const char *name, T_result *result, const Policy &)
 
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_low >
bool check_greater_or_equal (const char *function, const T_y &y, const T_low &low, const char *name)
 
template<typename T_y , typename T_high , typename T_result , class Policy >
bool check_less (const char *function, const T_y &y, const T_high &high, const char *name, T_result *result, const Policy &)
 
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 >
bool check_less (const char *function, const T_y &y, const T_high &high, const char *name)
 
template<typename T_y , typename T_high , typename T_result , class Policy >
bool check_less_or_equal (const char *function, const T_y &y, const T_high &high, const char *name, T_result *result, const Policy &)
 
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_high >
bool check_less_or_equal (const char *function, const T_y &y, const T_high &high, const char *name)
 
template<typename T_y , typename T_low , typename T_high , typename T_result , class Policy >
bool check_bounded (const char *function, const T_y &y, const T_low &low, const T_high &high, const char *name, T_result *result, const Policy &)
 
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_y , typename T_low , typename T_high >
bool check_bounded (const char *function, const T_y &y, const T_low &low, const T_high &high, const char *name)
 
template<typename T_y , typename T_result , class Policy >
bool check_nonnegative (const char *function, const T_y &y, const char *name, T_result *result, const Policy &)
 
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 >
bool check_nonnegative (const char *function, const T_y &y, const char *name)
 
template<typename T_y , typename T_result , class Policy >
bool check_positive (const char *function, const T_y &y, const char *name, T_result *result, const Policy &)
 
template<typename T_x , typename T_result >
bool check_positive (const char *function, const T_x &x, const char *name, T_result *result)
 
template<typename T >
bool check_positive (const char *function, const T &x, const char *name)
 
template<typename T , typename T_result , class Policy >
bool check_consistent_size (size_t max_size, const char *function, const T &x, const char *name, T_result *result, const Policy &)
 
template<typename T1 , typename T2 , typename T_result , class Policy >
bool check_consistent_sizes (const char *function, const T1 &x1, const T2 &x2, const char *name1, const char *name2, T_result *result, const Policy &)
 
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 , class Policy >
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, const Policy &)
 
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 , class Policy >
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, const Policy &)
 
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 T1 , typename T2 , typename F >
common_type< T1, T2 >::type promote_common (const F &u)
 
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 >
T & get_base1 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 , int R, int C>
size_t rows (const Eigen::Matrix< T, R, C > &m)
 
template<typename T , int R, int C>
size_t cols (const Eigen::Matrix< T, R, C > &m)
 
template<typename T1 , typename T2 >
void validate_less_or_equal (const T1 &x, const T2 &y, const char *x_name, const char *y_name, const char *fun_name)
 
template<typename T1 , typename T2 >
void validate_less (const T1 &x, const T2 &y, const char *x_name, const char *y_name, const char *fun_name)
 
template<typename T1 , typename T2 >
void validate_greater_or_equal (const T1 &x, const T2 &y, const char *x_name, const char *y_name, const char *fun_name)
 
template<typename T1 , typename T2 >
void validate_greater (const T1 &x, const T2 &y, const char *x_name, const char *y_name, const char *fun_name)
 
template<typename T , int R, int C>
void validate_column_index (const Eigen::Matrix< T, R, C > &m, size_t j, const char *msg)
 
template<typename T , int R, int C>
void validate_row_index (const Eigen::Matrix< T, R, C > &m, size_t i, const char *msg)
 
template<typename T , int R, int C>
void validate_square (const Eigen::Matrix< T, R, C > &x, const char *msg)
 
template<typename T , int R, int C>
void validate_symmetric (const Eigen::Matrix< T, R, C > &x, const char *msg)
 
template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
void validate_matching_dims (const Eigen::Matrix< T1, R1, C1 > &x1, const Eigen::Matrix< T2, R2, C2 > &x2, const char *msg)
 
template<typename T1 , typename T2 >
void validate_matching_sizes (const std::vector< T1 > &x1, const std::vector< T2 > &x2, const char *msg)
 
template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
void validate_matching_sizes (const Eigen::Matrix< T1, R1, C1 > &x1, const Eigen::Matrix< T2, R2, C2 > &x2, const char *msg)
 
template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
void validate_multiplicable (const Eigen::Matrix< T1, R1, C1 > &x1, const Eigen::Matrix< T2, R2, C2 > &x2, const char *msg)
 
template<typename T >
void validate_nonzero_size (const T &x, const char *msg)
 
template<typename T , int R, int C>
void validate_vector (const Eigen::Matrix< T, R, C > &x, const char *msg)
 
template<typename T >
determinant (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Returns the determinant of the specified square matrix. 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 > columns_dot_self (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &x)
 Returns the dot product of each column of a matrix with itself. 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...
 
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...
 
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 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...
 
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 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 >
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 >
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 T >
trace (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
 Returns the trace of the specified 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 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<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 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 >
minus (const T &x)
 Returns the negation of the specified scalar or matrix. More...
 
template<int R, int C>
Eigen::Matrix< double, R, C > divide (const Eigen::Matrix< double, R, C > &m, double c)
 Return specified matrix divided by 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_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 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 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 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 matrices. More...
 
template<int R, int C>
Eigen::Matrix< double, R, C > multiply (const Eigen::Matrix< double, R, C > &m, double c)
 Return specified matrix multiplied by specified scalar. More...
 
template<int R, int C>
Eigen::Matrix< double, R, C > multiply (double 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...
 
matrix_d tcrossprod (const matrix_d &M)
 Returns the result of post-multiplying a matrix by its own transpose. More...
 
matrix_d crossprod (const matrix_d &M)
 Returns the result of pre-multiplying a matrix by its own transpose. 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 >
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 >
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,j). More...
 
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 >
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 T , int R, int C>
Eigen::Matrix< T, C, R > transpose (const Eigen::Matrix< T, R, C > &m)
 
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, 1 > softmax (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v)
 Return the softmax of the specified vector. 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 >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > mdivide_left_tri_low (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &A)
 
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 >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > mdivide_left_tri (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &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 (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 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 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 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 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 > 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_size1 , typename T_size2 , typename T_result , class Policy >
bool check_size_match (const char *function, T_size1 i, T_size2 j, T_result *result, const Policy &)
 
template<typename T_size1 , typename T_size2 , typename T_result >
bool check_size_match (const char *function, T_size1 i, T_size2 j, T_result *result)
 
template<typename T_size1 , typename T_size2 >
bool check_size_match (const char *function, T_size1 i, T_size2 j, T_size1 *result=0)
 
template<typename T_y , typename T_result , class Policy >
bool check_symmetric (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result, const Policy &)
 Return true if the specified matrix is symmetric. 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)
 
template<typename T >
bool check_symmetric (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 , class Policy >
bool check_pos_definite (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result, const Policy &)
 Return true if the specified matrix is positive definite. More...
 
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)
 
template<typename T >
bool check_pos_definite (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 , class Policy >
bool check_cov_matrix (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result, const Policy &)
 Return true if the specified matrix is a valid covariance 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)
 
template<typename T >
bool check_cov_matrix (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 , class Policy >
bool check_corr_matrix (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result, const Policy &)
 Return true if the specified matrix is a valid correlation 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)
 
template<typename T >
bool check_corr_matrix (const char *function, const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T *result=0)
 
template<typename T_covar , typename T_result , class Policy >
bool check_cov_matrix (const char *function, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &Sigma, T_result *result, const Policy &)
 Return true if the specified matrix is a valid covariance matrix. More...
 
template<typename T_covar , typename T_result >
bool check_cov_matrix (const char *function, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &Sigma, T_result *result)
 
template<typename T >
bool check_cov_matrix (const char *function, const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &Sigma, T *result=0)
 
template<typename T_prob , typename T_result , class Policy >
bool check_simplex (const char *function, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta, const char *name, T_result *result, const Policy &)
 Return true if the specified vector is simplex. More...
 
template<typename T_y , typename T_result >
bool check_simplex (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &theta, const char *name, T_result *result)
 
template<typename T >
bool check_simplex (const char *function, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &theta, const char *name, T *result=0)
 
template<typename T_y , typename T_result , class Policy >
bool check_ordered (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &y, const char *name, T_result *result, const Policy &)
 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 Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &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_y , typename T_result , class Policy >
bool check_positive_ordered (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &y, const char *name, T_result *result, const Policy &)
 Return true if the specified vector contains only non-negative values and is sorted into increasing order. 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)
 
template<typename T >
bool check_positive_ordered (const char *function, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &y, const char *name, T *result=0)
 
template<typename T_y , typename T_result , class Policy >
bool check_not_nan (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result, const Policy &)
 
template<typename T_y , typename T_result >
bool check_not_nan (const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
 
template<typename T >
bool check_not_nan (const char *function, const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T *result=0)
 
template<typename T >
boost::math::tools::promote_args< T >::type exp2 (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 fdim (T1 a, T2 b)
 The positive difference function (C99). More...
 
template<typename T1 , typename T2 , typename T3 >
boost::math::tools::promote_args< T1, T2, T3 >::type fma (T1 a, T2 b, T3 c)
 The fused multiply-add operation (C99). More...
 
template<typename T >
boost::math::tools::promote_args< T >::type log2 (T a)
 Returns the base 2 logarithm of the argument (C99). More...
 
template<typename T >
unsigned int int_step (T y)
 The integer step, or Heaviside, function. More...
 
template<typename T >
int step (T y)
 The step, or Heaviside, function. More...
 
template<typename T1 , typename T2 >
boost::math::tools::promote_args< T1, T2 >::type lbeta (T1 a, T2 b)
 Return the log of the beta function applied to the specified arguments. More...
 
template<typename T_N , typename T_n >
boost::math::tools::promote_args< T_N, T_n >::type binomial_coefficient_log (T_N N, T_n n)
 Return the log of the binomial coefficient for the specified arguments. More...
 
template<typename T >
boost::math::tools::promote_args< T >::type inv_logit (T a)
 Returns the inverse logit function applied to the argument. More...
 
template<typename T >
boost::math::tools::promote_args< T >::type logit (T a)
 Returns the logit function applied to the argument. More...
 
template<typename T >
boost::math::tools::promote_args< T >::type Phi (T x)
 The unit normal cumulative distribution function. More...
 
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 binary_log_loss (int y, T y_hat)
 Returns the log loss function for binary classification with specified reference and response values. More...
 
template<typename Vector , typename Scalar >
void softmax (const Vector &x, Vector &simplex)
 Write the values of the softmax transformed first argument into the second argument. More...
 
template<typename Vector >
void inverse_softmax (const Vector &simplex, Vector &y)
 Writes the inverse softmax of the simplex argument into the second argument. More...
 
template<typename T >
boost::math::tools::promote_args< T >::type log1p (T x)
 Return the natural logarithm of one plus the specified value. 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 lmgamma (unsigned int k, T x)
 Return the natural logarithm of the multivariate gamma function with the speciifed dimensions and argument. More...
 
double if_else (bool c, double y_true, double y_false)
 Return the second argument if the first argument is true and otherwise return the second argument. More...
 
template<typename T >
square (T x)
 Return the square of the specified argument. More...
 
template<typename T_a , typename T_b >
boost::math::tools::promote_args< T_a, T_b >::type multiply_log (T_a a, T_b b)
 
double log1p_exp (const double &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 log_inv_logit (const T &u)
 Returns the natural logarithm of the inverse logit of the specified argument. 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...
 
double log_sum_exp (const double &a, const double &b)
 Calculates the log sum of exponetials without overflow. More...
 
double ibeta (const double &a, const double &b, const double &x)
 The normalized incomplete beta function of a, b, and x. More...
 
double log_sum_exp (const std::vector< double > &x)
 Return the log of the sum of the exponentiated values of the specified sequence of values. More...
 
template<typename T >
int logical_negation (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_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 T1 , typename T2 >
int logical_and (T1 x1, 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 (T1 x1, T2 x2)
 Return 1 if the first argument is equal to the second. More...
 
template<typename T1 , typename T2 >
int logical_neq (T1 x1, T2 x2)
 Return 1 if the first argument is unequal 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 (T1 x1, T2 x2)
 Return 1 if the first argument is less than or equal to the second. More...
 
template<typename T1 , typename T2 >
int logical_gt (T1 x1, T2 x2)
 Return 1 if the first argument is strictly greater than the second. More...
 
template<typename T1 , typename T2 >
int logical_gte (T1 x1, T2 x2)
 Return 1 if the first argument is greater than or equal to the second. More...
 
template<typename T1 , typename T2 , typename T3 >
double simple_var (double v, const T1 &, const T1 &, const T2 &, const T2 &, const T3 &, const T3 &)
 Return the scalar value and ignore the remaining arguments. More...
 
template<typename T >
double value_of (T x)
 Return the value of the specified scalar argument converted to a double value. More...
 
template<>
double value_of< double > (double x)
 Return the specified argument. More...
 
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 log2 ()
 Return natural logarithm 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 epsilon ()
 Return minimum positive number representable. More...
 
double negative_epsilon ()
 Return maximum negative number (i.e., negative number with smallest absolute value). More...
 
int as_bool (int x)
 Return an integer with an equivalent boolean value to specified input. More...
 
int as_bool (double x)
 Return 1 if the argument is unequal to zero and 0 otherwise. More...
 
double max (double a, double b)
 
double max (std::vector< double > &x)
 
double min (double a, double b)
 
double dot (std::vector< double > &x, std::vector< double > &y)
 
double dot_self (std::vector< double > &x)
 
void scaled_add (std::vector< double > &x, std::vector< double > &y, double lambda)
 
void sub (std::vector< double > &x, std::vector< double > &y, std::vector< double > &result)
 
double dist (const std::vector< double > &x, const std::vector< double > &y)
 
double sum (std::vector< double > &x)
 

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 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 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

◆ default_policy

typedef boost::math::policies::policy stan::math::default_policy

Default error-handling policy from Boost.

Definition at line 30 of file error_handling.hpp.

◆ matrix_d

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

Type for matrix of double values.

Definition at line 151 of file matrix.hpp.

◆ row_vector_d

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

Type for (row) vector of double values.

Definition at line 165 of file matrix.hpp.

◆ vector_d

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

Type for (column) vector of double values.

Definition at line 158 of file matrix.hpp.

Function Documentation

◆ add() [1/3]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type,R,C> stan::math::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.
Parameters
T2Type of scalar.
mMatrix.
cScalar.
Returns
The matrix plus the scalar.

Definition at line 1254 of file matrix.hpp.

◆ add() [2/3]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type,R,C> stan::math::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 1233 of file matrix.hpp.

◆ add() [3/3]

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

Return the sum of the specified scalar and specified matrix.

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

Definition at line 1274 of file matrix.hpp.

◆ as_bool() [1/2]

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

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

Parameters
xValue.
Returns
1 if argument is equal to zero and 0 otherwise.

Definition at line 971 of file special_functions.hpp.

◆ as_bool() [2/2]

int stan::math::as_bool ( int  x)
inline

Return an integer with an equivalent boolean value to specified input.

For integers, this reduces to the identity function.

Parameters
xvalue.
Returns
The value.

Definition at line 962 of file special_functions.hpp.

◆ binary_log_loss()

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::binary_log_loss ( int  y,
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 292 of file special_functions.hpp.

◆ binomial_coefficient_log()

template<typename T_N , typename T_n >
boost::math::tools::promote_args<T_N, T_n>::type stan::math::binomial_coefficient_log ( T_N  N,
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)$.

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

Definition at line 176 of file special_functions.hpp.

◆ block()

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

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

Parameters
mMatrix
iStarting row
jStarting column
nrowsNumber of rows in block
ncolsNumber of columns in block

Definition at line 1622 of file matrix.hpp.

◆ check_bounded() [1/3]

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

Definition at line 623 of file error_handling.hpp.

◆ check_bounded() [2/3]

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 614 of file error_handling.hpp.

◆ check_bounded() [3/3]

template<typename T_y , typename T_low , typename T_high , typename T_result , class Policy >
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,
const Policy &   
)
inline

Definition at line 604 of file error_handling.hpp.

◆ check_consistent_size()

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

Definition at line 763 of file error_handling.hpp.

◆ check_consistent_sizes() [1/6]

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 795 of file error_handling.hpp.

◆ check_consistent_sizes() [2/6]

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

Definition at line 782 of file error_handling.hpp.

◆ check_consistent_sizes() [3/6]

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 823 of file error_handling.hpp.

◆ check_consistent_sizes() [4/6]

template<typename T1 , typename T2 , typename T3 , typename T_result , class Policy >
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,
const Policy &   
)
inline

Definition at line 807 of file error_handling.hpp.

◆ check_consistent_sizes() [5/6]

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 857 of file error_handling.hpp.

◆ check_consistent_sizes() [6/6]

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T_result , class Policy >
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,
const Policy &   
)
inline

Definition at line 837 of file error_handling.hpp.

◆ check_corr_matrix() [1/3]

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

Definition at line 300 of file matrix_error_handling.hpp.

◆ check_corr_matrix() [2/3]

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

Definition at line 292 of file matrix_error_handling.hpp.

◆ check_corr_matrix() [3/3]

template<typename T_y , typename T_result , class Policy >
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,
const Policy &   
)
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.
Template Parameters
TType of scalar.

Definition at line 258 of file matrix_error_handling.hpp.

◆ check_cov_matrix() [1/6]

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

Definition at line 341 of file matrix_error_handling.hpp.

◆ check_cov_matrix() [2/6]

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

Definition at line 232 of file matrix_error_handling.hpp.

◆ check_cov_matrix() [3/6]

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

Definition at line 334 of file matrix_error_handling.hpp.

◆ check_cov_matrix() [4/6]

template<typename T_covar , typename T_result , class Policy >
bool stan::math::check_cov_matrix ( const char *  function,
const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &  Sigma,
T_result *  result,
const Policy &   
)
inline

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

A valid covariance matrix must be symmetric and positive definite.

Parameters
function
SigmaMatrix to test.
result
Returns
true if the matrix is a valid covariance matrix.
Template Parameters
TType of scalar.

Definition at line 320 of file matrix_error_handling.hpp.

◆ check_cov_matrix() [5/6]

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

Definition at line 223 of file matrix_error_handling.hpp.

◆ check_cov_matrix() [6/6]

template<typename T_y , typename T_result , class Policy >
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,
const Policy &   
)
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.
Template Parameters
TType of scalar.

Definition at line 206 of file matrix_error_handling.hpp.

◆ check_finite() [1/3]

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

Definition at line 241 of file error_handling.hpp.

◆ check_finite() [2/3]

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

Definition at line 233 of file error_handling.hpp.

◆ check_finite() [3/3]

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

Checks if the variable y is finite.

Definition at line 224 of file error_handling.hpp.

◆ check_greater() [1/3]

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

Definition at line 316 of file error_handling.hpp.

◆ check_greater() [2/3]

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 308 of file error_handling.hpp.

◆ check_greater() [3/3]

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

Definition at line 298 of file error_handling.hpp.

◆ check_greater_or_equal() [1/3]

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

Definition at line 391 of file error_handling.hpp.

◆ check_greater_or_equal() [2/3]

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 382 of file error_handling.hpp.

◆ check_greater_or_equal() [3/3]

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

Definition at line 373 of file error_handling.hpp.

◆ check_less() [1/3]

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

Definition at line 465 of file error_handling.hpp.

◆ check_less() [2/3]

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 457 of file error_handling.hpp.

◆ check_less() [3/3]

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

Definition at line 448 of file error_handling.hpp.

◆ check_less_or_equal() [1/3]

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

Definition at line 539 of file error_handling.hpp.

◆ check_less_or_equal() [2/3]

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 531 of file error_handling.hpp.

◆ check_less_or_equal() [3/3]

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

Definition at line 522 of file error_handling.hpp.

◆ check_nonnegative() [1/3]

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

Definition at line 689 of file error_handling.hpp.

◆ check_nonnegative() [2/3]

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 682 of file error_handling.hpp.

◆ check_nonnegative() [3/3]

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

Definition at line 674 of file error_handling.hpp.

◆ check_not_nan() [1/6]

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

Definition at line 601 of file matrix_error_handling.hpp.

◆ check_not_nan() [2/6]

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

Definition at line 594 of file matrix_error_handling.hpp.

◆ check_not_nan() [3/6]

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

Definition at line 570 of file matrix_error_handling.hpp.

◆ check_not_nan() [4/6]

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

Definition at line 173 of file error_handling.hpp.

◆ check_not_nan() [5/6]

template<typename T_y , typename T_result , class Policy >
bool stan::math::check_not_nan ( const char *  function,
const T_y &  y,
const char *  name,
T_result *  result,
const Policy &   
)
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.
PolicyError handling policy.

Definition at line 144 of file error_handling.hpp.

◆ check_not_nan() [6/6]

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 = 0 
)
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.
PolicyError handling policy.

Definition at line 165 of file error_handling.hpp.

◆ check_ordered() [1/3]

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 488 of file matrix_error_handling.hpp.

◆ check_ordered() [2/3]

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 
)

Definition at line 481 of file matrix_error_handling.hpp.

◆ check_ordered() [3/3]

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

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

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

Parameters
function
yVector to test.
name
result
Template Parameters
PolicyOnly the policy's type matters.
Returns
true if the vector has positive, ordered values.

Definition at line 452 of file matrix_error_handling.hpp.

◆ check_pos_definite() [1/3]

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

Definition at line 182 of file matrix_error_handling.hpp.

◆ check_pos_definite() [2/3]

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

Definition at line 173 of file matrix_error_handling.hpp.

◆ check_pos_definite() [3/3]

template<typename T_y , typename T_result , class Policy >
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,
const Policy &   
)
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.
Template Parameters
TType of scalar.

Definition at line 136 of file matrix_error_handling.hpp.

◆ check_positive() [1/3]

template<typename T >
bool stan::math::check_positive ( const char *  function,
const T &  x,
const char *  name 
)
inline

Definition at line 755 of file error_handling.hpp.

◆ check_positive() [2/3]

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

Definition at line 748 of file error_handling.hpp.

◆ check_positive() [3/3]

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

Definition at line 740 of file error_handling.hpp.

◆ check_positive_ordered() [1/3]

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

Definition at line 558 of file matrix_error_handling.hpp.

◆ check_positive_ordered() [2/3]

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 
)

Definition at line 551 of file matrix_error_handling.hpp.

◆ check_positive_ordered() [3/3]

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

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

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

Parameters
function
yVector to test.
name
result
Template Parameters
PolicyOnly the policy's type matters.
Returns
true if the vector has positive, ordered values.

Definition at line 510 of file matrix_error_handling.hpp.

◆ check_simplex() [1/3]

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

Definition at line 427 of file matrix_error_handling.hpp.

◆ check_simplex() [2/3]

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

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.

Definition at line 368 of file matrix_error_handling.hpp.

◆ check_simplex() [3/3]

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

Definition at line 420 of file matrix_error_handling.hpp.

◆ check_size_match() [1/3]

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

Definition at line 39 of file matrix_error_handling.hpp.

◆ check_size_match() [2/3]

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

Definition at line 16 of file matrix_error_handling.hpp.

◆ check_size_match() [3/3]

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

Definition at line 48 of file matrix_error_handling.hpp.

◆ check_symmetric() [1/3]

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

Definition at line 112 of file matrix_error_handling.hpp.

◆ check_symmetric() [2/3]

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

Definition at line 104 of file matrix_error_handling.hpp.

◆ check_symmetric() [3/3]

template<typename T_y , typename T_result , class Policy >
bool stan::math::check_symmetric ( const char *  function,
const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &  y,
const char *  name,
T_result *  result,
const Policy &   
)
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.
Template Parameters
TType of scalar.

Definition at line 70 of file matrix_error_handling.hpp.

◆ cholesky_decompose()

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 1914 of file matrix.hpp.

◆ col()

template<typename T >
Eigen::Matrix<T,Eigen::Dynamic,1> stan::math::col ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m,
size_t  j 
)
inline

Return the specified column of the specified matrix using start-at-1 indexing.

This is equivalent to calling m.col(i - 1) and assigning the resulting template expression to a column vector.

Parameters
mMatrix.
jColumn index (count from 1).
Returns
Specified column of the matrix.

Definition at line 1604 of file matrix.hpp.

◆ cols()

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

Definition at line 628 of file matrix.hpp.

◆ columns_dot_self()

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

Returns the dot product of each column of a matrix with itself.

Parameters
xMatrix.
Template Parameters
Tscalar type

Definition at line 861 of file matrix.hpp.

◆ crossprod()

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 1565 of file matrix.hpp.

◆ determinant()

template<typename T >
T stan::math::determinant ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  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 832 of file matrix.hpp.

◆ diag_matrix()

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

Return a square diagonal matrix with the specified vector of coefficients as the diagonal values.

Parameters
[in]vSpecified vector.
Returns
Diagonal matrix with vector as diagonal values.

Definition at line 1654 of file matrix.hpp.

◆ diag_post_multiply()

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R1, C1> stan::math::diag_post_multiply ( const Eigen::Matrix< T1, R1, C1 > &  m1,
const Eigen::Matrix< T2, R2, C2 > &  m2 
)

Definition at line 1409 of file matrix.hpp.

◆ diag_pre_multiply()

template<typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R2, C2> stan::math::diag_pre_multiply ( const Eigen::Matrix< T1, R1, C1 > &  m1,
const Eigen::Matrix< T2, R2, C2 > &  m2 
)

Definition at line 1393 of file matrix.hpp.

◆ diagonal()

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

Return a column vector of the diagonal elements of the specified matrix.

The matrix is not required to be square.

Parameters
mSpecified matrix.
Returns
Diagonal of the matrix.

Definition at line 1641 of file matrix.hpp.

◆ dist()

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

Definition at line 61 of file util.hpp.

◆ divide()

template<int R, int C>
Eigen::Matrix<double,R,C> stan::math::divide ( const Eigen::Matrix< double, R, C > &  m,
double  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 1362 of file matrix.hpp.

◆ dot()

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

Definition at line 30 of file util.hpp.

◆ dot_product() [1/3]

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 891 of file matrix.hpp.

◆ dot_product() [2/3]

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 875 of file matrix.hpp.

◆ dot_product() [3/3]

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 904 of file matrix.hpp.

◆ dot_self() [1/2]

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 846 of file matrix.hpp.

◆ dot_self() [2/2]

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

Definition at line 39 of file util.hpp.

◆ e()

double stan::math::e ( )
inline

Return the base of the natural logarithm.

Returns
Base of natural logarithm.

Definition at line 878 of file special_functions.hpp.

◆ eigenvalues_sym()

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

Return the eigenvalues of the specified symmetric matrix in descending order of magnitude.

This function is more efficient than the general eigenvalues function for symmetric matrices.

See eigen_decompose() for more information.

Parameters
mSpecified matrix.
Returns
Eigenvalues of matrix.

Definition at line 1881 of file matrix.hpp.

◆ eigenvectors_sym()

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

Definition at line 1891 of file matrix.hpp.

◆ elt_divide()

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 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 1438 of file matrix.hpp.

◆ elt_multiply()

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

Return the elementwise multiplication of the specified matrices.


Template Parameters
T1Type of scalars in first matrix.
T2Type of scalars in second matrix.
RRow type of both matrices.
CColumn type of both matrices.
Parameters
m1First matrix
m2Second matrix
Returns
Elementwise product of matrices.

Definition at line 1381 of file matrix.hpp.

◆ epsilon()

double stan::math::epsilon ( )
inline

Return minimum positive number representable.

Returns
Minimum positive number.

Definition at line 941 of file special_functions.hpp.

◆ exp()

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 1209 of file matrix.hpp.

◆ exp2()

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

◆ fdim()

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 52 of file special_functions.hpp.

◆ fma()

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

The fused multiply-add operation (C99).


The function is defined by

fma(a,b,c) = (a * b) + c.

Parameters
aFirst value.
bSecond value.
cThird value.
Returns
Product of the first two values plust the third.

Definition at line 70 of file special_functions.hpp.

◆ get_base1() [1/12]

template<typename T >
T& stan::math::get_base1 ( 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 608 of file matrix.hpp.

◆ get_base1() [2/12]

template<typename T >
T& stan::math::get_base1 ( 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 583 of file matrix.hpp.

◆ get_base1() [3/12]

template<typename T >
Eigen::Matrix<T,1,Eigen::Dynamic> stan::math::get_base1 ( 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 531 of file matrix.hpp.

◆ get_base1() [4/12]

template<typename T >
T& stan::math::get_base1 ( 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 557 of file matrix.hpp.

◆ get_base1() [5/12]

template<typename T >
T& stan::math::get_base1 ( 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 492 of file matrix.hpp.

◆ get_base1() [6/12]

template<typename T >
T& stan::math::get_base1 ( 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 454 of file matrix.hpp.

◆ get_base1() [7/12]

template<typename T >
T& stan::math::get_base1 ( 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 418 of file matrix.hpp.

◆ get_base1() [8/12]

template<typename T >
T& stan::math::get_base1 ( 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 385 of file matrix.hpp.

◆ get_base1() [9/12]

template<typename T >
T& stan::math::get_base1 ( 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 354 of file matrix.hpp.

◆ get_base1() [10/12]

template<typename T >
T& stan::math::get_base1 ( 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 325 of file matrix.hpp.

◆ get_base1() [11/12]

template<typename T >
T& stan::math::get_base1 ( 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 298 of file matrix.hpp.

◆ get_base1() [12/12]

template<typename T >
T& stan::math::get_base1 ( 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 273 of file matrix.hpp.

◆ ibeta()

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.
bShape parameter.
xRandom variate.
Returns
The normalized incomplete beta function.

Definition at line 610 of file special_functions.hpp.

◆ if_else()

double stan::math::if_else ( bool  c,
double  y_true,
double  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 491 of file special_functions.hpp.

◆ int_step()

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

The integer step, or Heaviside, function.


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

Definition at line 103 of file special_functions.hpp.

◆ inv_cloglog()

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) = -exp(-exp(x)).

This function can be used to implement the inverse link function for complenentary-log-log regression.

Parameters
xArgument.
Returns
Inverse complementary log-log of the argument.

Definition at line 270 of file special_functions.hpp.

◆ inv_logit()

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

Parameters
aArgument.
Returns
Inverse logit of argument.

Definition at line 205 of file special_functions.hpp.

◆ inverse()

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 1673 of file matrix.hpp.

◆ inverse_softmax()

template<typename Vector >
void stan::math::inverse_softmax ( const Vector &  simplex,
Vector &  y 
)

Writes the inverse softmax of the simplex argument into the second argument.

See 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 399 of file special_functions.hpp.

◆ lbeta()

template<typename T1 , typename T2 >
boost::math::tools::promote_args<T1,T2>::type stan::math::lbeta ( T1  a,
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.

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 150 of file special_functions.hpp.

◆ lmgamma()

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::lmgamma ( unsigned 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.

Parameters
kNumber of dimensions.
xFunction argument.
Returns
Natural log of the multivariate gamma function.
Template Parameters
TType of scalar.

Definition at line 468 of file special_functions.hpp.

◆ log()

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 1198 of file matrix.hpp.

◆ log10()

double stan::math::log10 ( )
inline

Return natural logarithm of ten.

Returns
Natural logarithm of ten.

Definition at line 905 of file special_functions.hpp.

◆ log1m()

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.

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

Definition at line 442 of file special_functions.hpp.

◆ log1m_inv_logit()

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.

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

Definition at line 573 of file special_functions.hpp.

◆ log1p()

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::log1p ( 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.

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

Definition at line 418 of file special_functions.hpp.

◆ log1p_exp()

double stan::math::log1p_exp ( const double &  a)
inline

Calculates the log of 1 plus the exponential of the specified value without overflow.


This function is related to other special functions by:

log_1p_exp(x)

= log1p(exp(a))

= log(1 + exp(x))

= log_sum_exp(0,x).

Definition at line 537 of file special_functions.hpp.

◆ log2() [1/2]

double stan::math::log2 ( )
inline

Return natural logarithm of two.

Returns
Natural logarithm of two.

Definition at line 896 of file special_functions.hpp.

◆ log2() [2/2]

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

◆ log_inv_logit()

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.

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

Definition at line 555 of file special_functions.hpp.

◆ log_sum_exp() [1/2]

double stan::math::log_sum_exp ( const double &  a,
const double &  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)$.

Parameters
athe first variable
bthe second variable

Definition at line 591 of file special_functions.hpp.

◆ log_sum_exp() [2/2]

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
xarray of specified values

Definition at line 629 of file special_functions.hpp.

◆ logical_and()

template<typename T1 , typename T2 >
int stan::math::logical_and ( T1  x1,
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.

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 694 of file special_functions.hpp.

◆ logical_eq()

template<typename T1 , typename T2 >
int stan::math::logical_eq ( T1  x1,
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 713 of file special_functions.hpp.

◆ logical_gt()

template<typename T1 , typename T2 >
int stan::math::logical_gt ( T1  x1,
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 781 of file special_functions.hpp.

◆ logical_gte()

template<typename T1 , typename T2 >
int stan::math::logical_gte ( T1  x1,
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 798 of file special_functions.hpp.

◆ logical_lt()

template<typename T1 , typename T2 >
int stan::math::logical_lt ( T1  x1,
T2  x2 
)
inline

Return 1 if the first argument is strictly less than the second.

Equivalent to x1 < x2.

Template Parameters
T1Type of first argument.
T2Type of second argument.
Parameters
x1First argument
x2Second argument
Returns
true iff x1 < x2

Definition at line 747 of file special_functions.hpp.

◆ logical_lte()

template<typename T1 , typename T2 >
int stan::math::logical_lte ( T1  x1,
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 764 of file special_functions.hpp.

◆ logical_negation()

template<typename T >
int stan::math::logical_negation ( 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 657 of file special_functions.hpp.

◆ logical_neq()

template<typename T1 , typename T2 >
int stan::math::logical_neq ( T1  x1,
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 730 of file special_functions.hpp.

◆ logical_or()

template<typename T1 , typename T2 >
int stan::math::logical_or ( T1  x1,
T2  x2 
)
inline

The logical or function which returns 1 if either argument is unequal to zero and 0 otherwise.

Equivalent to x1 != 0 || x2 != 0.

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 675 of file special_functions.hpp.

◆ logit()

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::logit ( 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.

Parameters
aArgument.
Returns
Logit of the argument.

Definition at line 226 of file special_functions.hpp.

◆ max() [1/5]

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
vSpecified vector, row vector, or matrix.
Returns
Maximum coefficient value in the vector.

Definition at line 1003 of file matrix.hpp.

◆ max() [2/5]

int stan::math::max ( const std::vector< int > &  x)
inline

Returns the maximum coefficient in the specified column vector.

Parameters
vSpecified 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 968 of file matrix.hpp.

◆ max() [3/5]

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

Returns the maximum coefficient in the specified column vector.

Parameters
vSpecified vector.
Returns
Maximum coefficient value in the vector.
Template Parameters
TType of values being compared and returned

Definition at line 986 of file matrix.hpp.

◆ max() [4/5]

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

Definition at line 12 of file util.hpp.

◆ max() [5/5]

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

Definition at line 16 of file util.hpp.

◆ mdivide_left()

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 1785 of file matrix.hpp.

◆ mdivide_left_tri() [1/2]

template<int TriView, typename T >
Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> stan::math::mdivide_left_tri ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  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 1765 of file matrix.hpp.

◆ mdivide_left_tri() [2/2]

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 1746 of file matrix.hpp.

◆ mdivide_left_tri_low() [1/2]

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

Definition at line 1721 of file matrix.hpp.

◆ mdivide_left_tri_low() [2/2]

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

Definition at line 1708 of file matrix.hpp.

◆ mdivide_right()

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 1856 of file matrix.hpp.

◆ mdivide_right_tri()

template<int TriView, typename T1 , typename T2 , int R1, int C1, int R2, int C2>
Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type,R1,C2> stan::math::mdivide_right_tri ( const Eigen::Matrix< T1, R1, C1 > &  b,
const Eigen::Matrix< T2, R2, C2 > &  A 
)
inline

Returns the solution of the system Ax=b when A is triangular.

Parameters
ATriangular matrix. Specify upper or lower with TriView being Eigen::Upper or Eigen::Lower.
bRight hand side matrix or vector.
Returns
x = b A^-1, solution of the linear system.
Exceptions
std::domain_errorif A is not square or the rows of b don't match the size of A.

Definition at line 1809 of file matrix.hpp.

◆ mdivide_right_tri_low()

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 1834 of file matrix.hpp.

◆ mean() [1/2]

template<typename T , int R, int C>
boost::math::tools::promote_args<T>::type stan::math::mean ( const Eigen::Matrix< T, R, C > &  m)
inline

Returns the sample mean (i.e., average) of the coefficients in the specified vector, row vector, or matrix.

Parameters
mSpecified vector, row vector, or matrix.
Returns
Sample mean of vector coefficients.

Definition at line 1037 of file matrix.hpp.

◆ mean() [2/2]

template<typename T >
boost::math::tools::promote_args<T>::type stan::math::mean ( const std::vector< T > &  v)
inline

Returns the sample mean (i.e., average) of the coefficients in the specified standard vector.

Parameters
vSpecified vector.
Returns
Sample mean of vector coefficients.
Exceptions
std::domain_errorif the size of the vector is less than 1.

Definition at line 1020 of file matrix.hpp.

◆ min() [1/4]

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
vSpecified matrix, vector, or row vector.
Returns
Minimum coefficient value in the vector.

Definition at line 952 of file matrix.hpp.

◆ min() [2/4]

int stan::math::min ( const std::vector< int > &  x)
inline

Returns the minimum coefficient in the specified column vector.

Parameters
vSpecified vector.
Returns
Minimum coefficient value in the vector.
Template Parameters
Typeof values being compared and returned

Definition at line 917 of file matrix.hpp.

◆ min() [3/4]

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

Returns the minimum coefficient in the specified column vector.

Parameters
vSpecified vector.
Returns
Minimum coefficient value in the vector.
Template Parameters
Typeof values being compared and returned

Definition at line 935 of file matrix.hpp.

◆ min() [4/4]

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

Definition at line 25 of file util.hpp.

◆ minus()

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

Returns the negation of the specified scalar or matrix.

Template Parameters
TType of subtrahend.
Parameters
xSubtrahend.
Returns
Negation of subtrahend.

Definition at line 1346 of file matrix.hpp.

◆ multiply() [1/4]

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 1508 of file matrix.hpp.

◆ multiply() [2/4]

template<int R, int C>
Eigen::Matrix<double,R,C> stan::math::multiply ( const Eigen::Matrix< double, R, C > &  m,
double  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 1460 of file matrix.hpp.

◆ multiply() [3/4]

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 1492 of file matrix.hpp.

◆ multiply() [4/4]

template<int R, int C>
Eigen::Matrix<double,R,C> stan::math::multiply ( double  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 1475 of file matrix.hpp.

◆ multiply_log()

template<typename T_a , typename T_b >
boost::math::tools::promote_args<T_a,T_b>::type stan::math::multiply_log ( T_a  a,
T_b  b 
)
inline

Definition at line 516 of file special_functions.hpp.

◆ multiply_lower_tri_self_transpose()

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 1525 of file matrix.hpp.

◆ negative_epsilon()

double stan::math::negative_epsilon ( )
inline

Return maximum negative number (i.e., negative number with smallest absolute value).

Returns
Maximum negative number.

Definition at line 951 of file special_functions.hpp.

◆ negative_infinity()

double stan::math::negative_infinity ( )
inline

Return negative infinity.

Returns
Negative infinity.

Definition at line 923 of file special_functions.hpp.

◆ not_a_number()

double stan::math::not_a_number ( )
inline

Return (quiet) not-a-number.

Returns
Quiet not-a-number.

Definition at line 932 of file special_functions.hpp.

◆ Phi()

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

Parameters
xArgument.
Returns
Probability random sample is less than or equal to argument.

Definition at line 250 of file special_functions.hpp.

◆ pi()

double stan::math::pi ( )
inline

Return the value of pi.

Returns
Pi.

Definition at line 869 of file special_functions.hpp.

◆ positive_infinity()

double stan::math::positive_infinity ( )
inline

Return positive infinity.

Returns
Positive infinity.

Definition at line 914 of file special_functions.hpp.

◆ prod() [1/2]

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

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

Parameters
vSpecified vector.
Returns
Product of coefficients of vector.

Definition at line 1172 of file matrix.hpp.

◆ prod() [2/2]

template<typename T >
T stan::math::prod ( const std::vector< T > &  v)
inline

Returns the product of the coefficients of the specified standard vector.

Parameters
vSpecified vector.
Returns
Product of coefficients of vector.

Definition at line 1157 of file matrix.hpp.

◆ promote_common()

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

Definition at line 117 of file matrix.hpp.

◆ resize()

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 220 of file matrix.hpp.

◆ row()

template<typename T >
Eigen::Matrix<T,1,Eigen::Dynamic> stan::math::row ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  m,
size_t  i 
)
inline

Return the specified row of the specified matrix, using start-at-1 indexing.


This is equivalent to calling m.row(i - 1) and assigning the resulting template expression to a row vector.

Template Parameters
TScalar value type for matrix.
Parameters
mMatrix.
iRow index (count from 1).
Returns
Specified row of the matrix.

Definition at line 1584 of file matrix.hpp.

◆ rows()

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

Definition at line 622 of file matrix.hpp.

◆ scaled_add()

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

Definition at line 47 of file util.hpp.

◆ sd() [1/2]

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 1115 of file matrix.hpp.

◆ sd() [2/2]

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 1100 of file matrix.hpp.

◆ simple_var()

template<typename T1 , typename T2 , typename T3 >
double stan::math::simple_var ( double  v,
const T1 &  ,
const T1 &  ,
const T2 &  ,
const T2 &  ,
const T3 &  ,
const T3 &   
)
inline

Return the scalar value and ignore the remaining arguments.

This function provides an overload of simple_var to use with primitive values for which the type and derivative type are the same. The other overloads are for stan::agrad::var arguments; the definitions can be found in stan/agrad/partials_vari.hpp.

Template Parameters
T1Type of first dummy argument and derivative.
T2Type of second dummy argument and derivative.
T3Type of third dummy argument and derivative.
Parameters
vValue to return.
Returns
Value.

Definition at line 822 of file special_functions.hpp.

◆ singular_values()

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

Return the vector of the singular values of the specified matrix in decreasing order of magnitude.

See the documentation for svd() for information on the signular values.

Parameters
mSpecified matrix.
Returns
Singular values of the matrix.

Definition at line 1931 of file matrix.hpp.

◆ softmax() [1/2]

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.

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 1688 of file matrix.hpp.

◆ softmax() [2/2]

template<typename Vector , typename Scalar >
void stan::math::softmax ( const Vector &  x,
Vector &  simplex 
)

Write the values of the softmax transformed first argument into the second argument.

Values in the first argument are unbounded and values in the output form a simplex.

The softmax transformed generalizes the inverse logistic function by transforming a vector $x$ of length $K$ as

$\mbox{softmax}(x)[i] = \frac{\exp(x[i])}{\sum_{k=1}^{K} \exp(x[k])}$.

By construction, the result is a simplex, which means the values are all non-negative and sum to 1.0,

$ \sum_{k=1}^{K} \mbox{softmax}(x)[k] = 1$.

The type Vector is for a vector with values of type Scalar. Vectors x must support x.size() and return assignable references of type Scalar through x[int]. Variables a of type Scalar need to support division (in context x[i] /= a) and exponentiation (exp(a)). Conforming examples include

Vector = std::vector<double> and Scalar = double,

Vector = std::vector<stan::agrad::var> and Scalar = stan::agrad::var,

Vector = Eigen::Matrix<double,Eigen::Dynamic,1><double> and Scalar = double,

and so on.

The function stan::math::inverse_softmax provides an inverse of this operation up to an additive constant. Specifically, if x is a simplex argument, then

softmax(inv_softmax(x)) = x.

If y is an arbitrary vector, then we only have identification up to an additive constant c, as in

inv_softmax(softmax(y)) = y + c * I.

Parameters
xInput vector of unbounded parameters.
simplexOutput vector of simplex values.
Exceptions
std::invalid_argumentif size of the input and output vectors differ.

Definition at line 362 of file special_functions.hpp.

◆ sqrt2()

double stan::math::sqrt2 ( )
inline

Return the square root of two.

Returns
Square root of two.

Definition at line 887 of file special_functions.hpp.

◆ square()

template<typename T >
T stan::math::square ( 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 510 of file special_functions.hpp.

◆ step()

template<typename T >
int stan::math::step ( y)
inline

The step, or Heaviside, function.


The function is defined by

step(y) = (y < 0.0) ? 0 : 1.

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

Definition at line 120 of file special_functions.hpp.

◆ sub()

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

Definition at line 54 of file util.hpp.

◆ subtract() [1/3]

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

Definition at line 1325 of file matrix.hpp.

◆ subtract() [2/3]

template<typename T1 , typename T2 , int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R, C> stan::math::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 1300 of file matrix.hpp.

◆ subtract() [3/3]

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

Definition at line 1313 of file matrix.hpp.

◆ sum() [1/3]

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 1146 of file matrix.hpp.

◆ sum() [2/3]

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 1131 of file matrix.hpp.

◆ sum() [3/3]

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

Definition at line 71 of file util.hpp.

◆ tcrossprod()

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 1546 of file matrix.hpp.

◆ trace()

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 1187 of file matrix.hpp.

◆ transpose()

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 1661 of file matrix.hpp.

◆ validate_column_index()

template<typename T , int R, int C>
void stan::math::validate_column_index ( const Eigen::Matrix< T, R, C > &  m,
size_t  j,
const char *  msg 
)

Definition at line 688 of file matrix.hpp.

◆ validate_greater()

template<typename T1 , typename T2 >
void stan::math::validate_greater ( const T1 &  x,
const T2 &  y,
const char *  x_name,
const char *  y_name,
const char *  fun_name 
)
inline

Definition at line 673 of file matrix.hpp.

◆ validate_greater_or_equal()

template<typename T1 , typename T2 >
void stan::math::validate_greater_or_equal ( const T1 &  x,
const T2 &  y,
const char *  x_name,
const char *  y_name,
const char *  fun_name 
)
inline

Definition at line 660 of file matrix.hpp.

◆ validate_less()

template<typename T1 , typename T2 >
void stan::math::validate_less ( const T1 &  x,
const T2 &  y,
const char *  x_name,
const char *  y_name,
const char *  fun_name 
)
inline

Definition at line 647 of file matrix.hpp.

◆ validate_less_or_equal()

template<typename T1 , typename T2 >
void stan::math::validate_less_or_equal ( const T1 &  x,
const T2 &  y,
const char *  x_name,
const char *  y_name,
const char *  fun_name 
)
inline

Definition at line 634 of file matrix.hpp.

◆ validate_matching_dims()

template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
void stan::math::validate_matching_dims ( const Eigen::Matrix< T1, R1, C1 > &  x1,
const Eigen::Matrix< T2, R2, C2 > &  x2,
const char *  msg 
)
inline

Definition at line 743 of file matrix.hpp.

◆ validate_matching_sizes() [1/2]

template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
void stan::math::validate_matching_sizes ( const Eigen::Matrix< T1, R1, C1 > &  x1,
const Eigen::Matrix< T2, R2, C2 > &  x2,
const char *  msg 
)
inline

Definition at line 769 of file matrix.hpp.

◆ validate_matching_sizes() [2/2]

template<typename T1 , typename T2 >
void stan::math::validate_matching_sizes ( const std::vector< T1 > &  x1,
const std::vector< T2 > &  x2,
const char *  msg 
)
inline

Definition at line 757 of file matrix.hpp.

◆ validate_multiplicable()

template<typename T1 , int R1, int C1, typename T2 , int R2, int C2>
void stan::math::validate_multiplicable ( const Eigen::Matrix< T1, R1, C1 > &  x1,
const Eigen::Matrix< T2, R2, C2 > &  x2,
const char *  msg 
)
inline

Definition at line 784 of file matrix.hpp.

◆ validate_nonzero_size()

template<typename T >
void stan::math::validate_nonzero_size ( const T &  x,
const char *  msg 
)
inline

Definition at line 797 of file matrix.hpp.

◆ validate_row_index()

template<typename T , int R, int C>
void stan::math::validate_row_index ( const Eigen::Matrix< T, R, C > &  m,
size_t  i,
const char *  msg 
)

Definition at line 700 of file matrix.hpp.

◆ validate_square()

template<typename T , int R, int C>
void stan::math::validate_square ( const Eigen::Matrix< T, R, C > &  x,
const char *  msg 
)

Definition at line 712 of file matrix.hpp.

◆ validate_symmetric()

template<typename T , int R, int C>
void stan::math::validate_symmetric ( const Eigen::Matrix< T, R, C > &  x,
const char *  msg 
)

Definition at line 724 of file matrix.hpp.

◆ validate_vector()

template<typename T , int R, int C>
void stan::math::validate_vector ( const Eigen::Matrix< T, R, C > &  x,
const char *  msg 
)
inline

Definition at line 806 of file matrix.hpp.

◆ value_of()

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

Return the value of the specified scalar argument converted to a double value.

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 842 of file special_functions.hpp.

◆ value_of< double >()

template<>
double stan::math::value_of< double > ( double  x)
inline

Return the specified argument.

See value_of(T) for a polymorphic implementation using static casts.

This inline pass-through no-op should be compiled away.

Parameters
xSpecified value.
Returns
Specified value.

Definition at line 858 of file special_functions.hpp.

◆ variance() [1/2]

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
vSpecified vector.
Returns
Sample variance of vector.

Definition at line 1075 of file matrix.hpp.

◆ variance() [2/2]

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 1053 of file matrix.hpp.

Variable Documentation

◆ CONSTRAINT_TOLERANCE

const double stan::math::CONSTRAINT_TOLERANCE = 1E-8

The tolerance for checking arithmetic bounds In rank and in simplexes.

The default value is 1E-8.

Definition at line 24 of file error_handling.hpp.

◆ E

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.

◆ EPSILON

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

Smallest positive value.

Definition at line 52 of file constants.hpp.

◆ INFTY

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

Positive infinity.

Definition at line 37 of file constants.hpp.

◆ LOG_10

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

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

Definition at line 32 of file constants.hpp.

◆ LOG_2

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

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

Definition at line 26 of file constants.hpp.

◆ NEGATIVE_EPSILON

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

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

Definition at line 57 of file constants.hpp.

◆ NEGATIVE_INFTY

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

Negative infinity.

Definition at line 42 of file constants.hpp.

◆ NOT_A_NUMBER

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

(Quiet) not-a-number value.

Definition at line 47 of file constants.hpp.

◆ SQRT_2

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.


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