![]() |
Stan
1.1
probability, sampling & optimization
|
Function gradients via reverse-mode automatic differentiation. More...
Classes | |
| class | chainable |
| Abstract base class for variable implementations that handles memory management and applying the chain rule. More... | |
| class | vari |
| The variable implementation base class. More... | |
| class | var |
| Independent (input) and dependent (output) variables for gradients. More... | |
| class | gevv_vvv_vari |
| class | mdivide_left_vv_vari |
| class | mdivide_left_dv_vari |
| class | mdivide_left_vd_vari |
| class | mdivide_left_tri_vv_vari |
| class | mdivide_left_tri_dv_vari |
| class | mdivide_left_tri_vd_vari |
| class | determinant_vari |
| class | log_determinant_vari |
| struct | needs_promotion |
| struct | assigner |
| struct | assigner< false, LHS, RHS > |
| struct | assigner< true, LHS, RHS > |
| class | partials_vari |
| struct | OperandsAndPartials |
| A variable implementation that stores operands and derivatives with respect to the variable. More... | |
Typedefs | |
| typedef Eigen::Matrix< var, Eigen::Dynamic, Eigen::Dynamic > | matrix_v |
The type of a matrix holding stan::agrad::var values. | |
| typedef Eigen::Matrix< var, Eigen::Dynamic, 1 > | vector_v |
The type of a (column) vector holding stan::agrad::var values. | |
| typedef Eigen::Matrix< var, 1, Eigen::Dynamic > | row_vector_v |
The type of a row vector holding stan::agrad::var values. | |
Functions | |
| static void | recover_memory () |
| Recover memory used for all variables for reuse. | |
| static void | grad (chainable *vi) |
| Compute the gradient for all variables starting from the specified root variable implementation. | |
| void | print_stack (std::ostream &o) |
| Prints the auto-dif variable stack. | |
| bool | operator== (const var &a, const var &b) |
| Equality operator comparing two variables' values (C++). | |
| bool | operator== (const var &a, const double b) |
| Equality operator comparing a variable's value and a double (C++). | |
| bool | operator== (const double a, const var &b) |
| Equality operator comparing a scalar and a variable's value (C++). | |
| bool | operator!= (const var &a, const var &b) |
| Inequality operator comparing two variables' values (C++). | |
| bool | operator!= (const var &a, const double b) |
| Inequality operator comparing a variable's value and a double (C++). | |
| bool | operator!= (const double a, const var &b) |
| Inequality operator comparing a double and a variable's value (C++). | |
| bool | operator< (const var &a, const var &b) |
| Less than operator comparing variables' values (C++). | |
| bool | operator< (const var &a, const double b) |
| Less than operator comparing variable's value and a double (C++). | |
| bool | operator< (const double a, const var &b) |
| Less than operator comparing a double and variable's value (C++). | |
| bool | operator> (const var &a, const var &b) |
| Greater than operator comparing variables' values (C++). | |
| bool | operator> (const var &a, const double b) |
| Greater than operator comparing variable's value and double (C++). | |
| bool | operator> (const double a, const var &b) |
| Greater than operator comparing a double and a variable's value (C++). | |
| bool | operator<= (const var &a, const var &b) |
| Less than or equal operator comparing two variables' values (C++). | |
| bool | operator<= (const var &a, const double b) |
| Less than or equal operator comparing a variable's value and a scalar (C++). | |
| bool | operator<= (const double a, const var &b) |
| Less than or equal operator comparing a double and variable's value (C++). | |
| bool | operator>= (const var &a, const var &b) |
| Greater than or equal operator comparing two variables' values (C++). | |
| bool | operator>= (const var &a, const double b) |
| Greater than or equal operator comparing variable's value and double (C++). | |
| bool | operator>= (const double a, const var &b) |
| Greater than or equal operator comparing double and variable's value (C++). | |
| bool | operator! (const var &a) |
| Prefix logical negation for the value of variables (C++). | |
| var | operator+ (const var &a) |
| Unary plus operator for variables (C++). | |
| var | operator- (const var &a) |
| Unary negation operator for variables (C++). | |
| var | operator+ (const var &a, const var &b) |
| Addition operator for variables (C++). | |
| var | operator+ (const var &a, const double b) |
| Addition operator for variable and scalar (C++). | |
| var | operator+ (const double a, const var &b) |
| Addition operator for scalar and variable (C++). | |
| var | operator- (const var &a, const var &b) |
| Subtraction operator for variables (C++). | |
| var | operator- (const var &a, const double b) |
| Subtraction operator for variable and scalar (C++). | |
| var | operator- (const double a, const var &b) |
| Subtraction operator for scalar and variable (C++). | |
| var | operator* (const var &a, const var &b) |
| Multiplication operator for two variables (C++). | |
| var | operator* (const var &a, const double b) |
| Multiplication operator for a variable and a scalar (C++). | |
| var | operator* (const double a, const var &b) |
| Multiplication operator for a scalar and a variable (C++). | |
| var | operator/ (const var &a, const var &b) |
| Division operator for two variables (C++). | |
| var | operator/ (const var &a, const double b) |
| Division operator for dividing a variable by a scalar (C++). | |
| var | operator/ (const double a, const var &b) |
| Division operator for dividing a scalar by a variable (C++). | |
| var & | operator++ (var &a) |
| Prefix increment operator for variables (C++). | |
| var | operator++ (var &a, int) |
| Postfix increment operator for variables (C++). | |
| var & | operator-- (var &a) |
| Prefix decrement operator for variables (C++). | |
| var | operator-- (var &a, int) |
| Postfix decrement operator for variables (C++). | |
| var | exp (const var &a) |
| Return the exponentiation of the specified variable (cmath). | |
| var | log (const var &a) |
| Return the natural log of the specified variable (cmath). | |
| var | log10 (const var &a) |
| Return the base 10 log of the specified variable (cmath). | |
| var | sqrt (const var &a) |
| Return the square root of the specified variable (cmath). | |
| var | pow (const var &base, const var &exponent) |
| Return the base raised to the power of the exponent (cmath). | |
| var | pow (const var &base, const double exponent) |
| Return the base variable raised to the power of the exponent scalar (cmath). | |
| var | pow (const double base, const var &exponent) |
| Return the base scalar raised to the power of the exponent variable (cmath). | |
| var | cos (const var &a) |
| Return the cosine of a radian-scaled variable (cmath). | |
| var | sin (const var &a) |
| Return the sine of a radian-scaled variable (cmath). | |
| var | tan (const var &a) |
| Return the tangent of a radian-scaled variable (cmath). | |
| var | acos (const var &a) |
| Return the principal value of the arc cosine of a variable, in radians (cmath). | |
| var | asin (const var &a) |
| Return the principal value of the arc sine, in radians, of the specified variable (cmath). | |
| var | atan (const var &a) |
| Return the principal value of the arc tangent, in radians, of the specified variable (cmath). | |
| var | atan2 (const var &a, const var &b) |
| Return the principal value of the arc tangent, in radians, of the first variable divided by the second (cmath). | |
| var | atan2 (const var &a, const double b) |
| Return the principal value of the arc tangent, in radians, of the first variable divided by the second scalar (cmath). | |
| var | atan2 (const double a, const var &b) |
| Return the principal value of the arc tangent, in radians, of the first scalar divided by the second variable (cmath). | |
| var | cosh (const var &a) |
| Return the hyperbolic cosine of the specified variable (cmath). | |
| var | sinh (const var &a) |
| Return the hyperbolic sine of the specified variable (cmath). | |
| var | tanh (const var &a) |
| Return the hyperbolic tangent of the specified variable (cmath). | |
| var | fabs (const var &a) |
| Return the absolute value of the variable (cmath). | |
| var | floor (const var &a) |
| Return the floor of the specified variable (cmath). | |
| var | ceil (const var &a) |
| Return the ceiling of the specified variable (cmath). | |
| var | fmod (const var &a, const var &b) |
| Return the floating point remainder after dividing the first variable by the second (cmath). | |
| var | fmod (const var &a, const double b) |
| Return the floating point remainder after dividing the the first variable by the second scalar (cmath). | |
| var | fmod (const double a, const var &b) |
| Return the floating point remainder after dividing the first scalar by the second variable (cmath). | |
| var | abs (const var &a) |
| Return the absolute value of the variable (std). | |
| static void | free_memory () |
| Return all memory used for gradients back to the system. | |
| static void | set_zero_all_adjoints () |
| Reset all adjoint values in the stack to zero. | |
| void | jacobian (std::vector< var > &dependents, std::vector< var > &independents, std::vector< std::vector< double > > &jacobian) |
| Return the Jacobian of the function producing the specified dependent variables with respect to the specified independent variables. | |
| bool | operator== (const var &a, const double &b) |
| Equality operator comparing a variable's value and a double (C++). | |
| bool | operator== (const double &a, const var &b) |
| Equality operator comparing a scalar and a variable's value (C++). | |
| bool | operator!= (const var &a, const double &b) |
| Inequality operator comparing a variable's value and a double (C++). | |
| bool | operator!= (const double &a, const var &b) |
| Inequality operator comparing a double and a variable's value (C++). | |
| bool | operator< (const var &a, const double &b) |
| Less than operator comparing variable's value and a double (C++). | |
| bool | operator< (const double &a, const var &b) |
| Less than operator comparing a double and variable's value (C++). | |
| bool | operator> (const var &a, const double &b) |
| Greater than operator comparing variable's value and double (C++). | |
| bool | operator> (const double &a, const var &b) |
| Greater than operator comparing a double and a variable's value (C++). | |
| bool | operator<= (const var &a, const double &b) |
| Less than or equal operator comparing a variable's value and a scalar (C++). | |
| bool | operator<= (const double &a, const var &b) |
| Less than or equal operator comparing a double and variable's value (C++). | |
| bool | operator>= (const var &a, const double &b) |
| Greater than or equal operator comparing variable's value and double (C++). | |
| bool | operator>= (const double &a, const var &b) |
| Greater than or equal operator comparing double and variable's value (C++). | |
| var | operator+ (const var &a, const double &b) |
| Addition operator for variable and scalar (C++). | |
| var | operator+ (const double &a, const var &b) |
| Addition operator for scalar and variable (C++). | |
| var | operator- (const var &a, const double &b) |
| Subtraction operator for variable and scalar (C++). | |
| var | operator- (const double &a, const var &b) |
| Subtraction operator for scalar and variable (C++). | |
| var | operator* (const var &a, const double &b) |
| Multiplication operator for a variable and a scalar (C++). | |
| var | operator* (const double &a, const var &b) |
| Multiplication operator for a scalar and a variable (C++). | |
| var | operator/ (const var &a, const double &b) |
| Division operator for dividing a variable by a scalar (C++). | |
| var | operator/ (const double &a, const var &b) |
| Division operator for dividing a scalar by a variable (C++). | |
| var | pow (const var &base, const double &exponent) |
| Return the base variable raised to the power of the exponent scalar (cmath). | |
| var | pow (const double &base, const var &exponent) |
| Return the base scalar raised to the power of the exponent variable (cmath). | |
| var | atan2 (const var &a, const double &b) |
| Return the principal value of the arc tangent, in radians, of the first variable divided by the second scalar (cmath). | |
| var | atan2 (const double &a, const var &b) |
| Return the principal value of the arc tangent, in radians, of the first scalar divided by the second variable (cmath). | |
| var | fmod (const var &a, const double &b) |
| Return the floating point remainder after dividing the the first variable by the second scalar (cmath). | |
| var | fmod (const double &a, const var &b) |
| Return the floating point remainder after dividing the first scalar by the second variable (cmath). | |
| template<class F > | |
| double | hessian (const F &f, const std::vector< double > &x, const std::vector< double > &v, std::vector< double > &Hv) |
| void | fill (var &x, const var &y) |
| template<typename T > | |
| void | fill (std::vector< T > &x, const var &y) |
| template<int R, int C> | |
| void | fill (Eigen::Matrix< var, R, C > &x, const var &y) |
| void | initialize_variable (var &variable, const var &value) |
| Initialize variable to value. | |
| template<int R, int C> | |
| void | initialize_variable (Eigen::Matrix< var, R, C > &matrix, const var &value) |
| Initialize every cell in the matrix to the specified value. | |
| template<typename T > | |
| void | initialize_variable (std::vector< T > &variables, const var &value) |
| Initialize the variables in the standard vector recursively. | |
| var | to_var (const double &x) |
| Converts argument to an automatic differentiation variable. | |
| var | to_var (const var &x) |
| Converts argument to an automatic differentiation variable. | |
| matrix_v | to_var (const stan::math::matrix_d &m) |
| Converts argument to an automatic differentiation variable. | |
| matrix_v | to_var (const matrix_v &m) |
| Converts argument to an automatic differentiation variable. | |
| vector_v | to_var (const stan::math::vector_d &v) |
| Converts argument to an automatic differentiation variable. | |
| vector_v | to_var (const vector_v &v) |
| Converts argument to an automatic differentiation variable. | |
| row_vector_v | to_var (const stan::math::row_vector_d &rv) |
| Converts argument to an automatic differentiation variable. | |
| row_vector_v | to_var (const row_vector_v &rv) |
| Converts argument to an automatic differentiation variable. | |
| template<int R, int C> | |
| var | dot_self (const Eigen::Matrix< var, R, C > &v) |
| Returns the dot product of a vector with itself. | |
| template<int R, int C> | |
| Eigen::Matrix< var, 1, C > | columns_dot_self (const Eigen::Matrix< var, R, C > &x) |
| Returns the dot product of each column of a matrix with itself. | |
| template<int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, 1, C1 > | columns_dot_product (const Eigen::Matrix< var, R1, C1 > &v1, const Eigen::Matrix< var, R2, C2 > &v2) |
| template<int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, 1, C1 > | columns_dot_product (const Eigen::Matrix< var, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2) |
| template<int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, 1, C1 > | columns_dot_product (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< var, R2, C2 > &v2) |
| template<int R1, int C1, int R2, int C2> | |
| var | dot_product (const Eigen::Matrix< var, R1, C1 > &v1, const Eigen::Matrix< var, R2, C2 > &v2) |
| Returns the dot product. | |
| template<int R1, int C1, int R2, int C2> | |
| var | dot_product (const Eigen::Matrix< var, R1, C1 > &v1, const Eigen::Matrix< double, R2, C2 > &v2) |
| Returns the dot product. | |
| template<int R1, int C1, int R2, int C2> | |
| var | dot_product (const Eigen::Matrix< double, R1, C1 > &v1, const Eigen::Matrix< var, R2, C2 > &v2) |
| Returns the dot product. | |
| var | dot_product (const var *v1, const var *v2, size_t length) |
| Returns the dot product. | |
| var | dot_product (const var *v1, const double *v2, size_t length) |
| Returns the dot product. | |
| var | dot_product (const double *v1, const var *v2, size_t length) |
| Returns the dot product. | |
| var | dot_product (const std::vector< var > &v1, const std::vector< var > &v2) |
| Returns the dot product. | |
| var | dot_product (const std::vector< var > &v1, const std::vector< double > &v2) |
| Returns the dot product. | |
| var | dot_product (const std::vector< double > &v1, const std::vector< var > &v2) |
| Returns the dot product. | |
| template<int R, int C> | |
| var | sum (const Eigen::Matrix< var, R, C > &m) |
| Returns the sum of the coefficients of the specified matrix, column vector or row vector. | |
| template<int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, R1, C2 > | mdivide_left (const Eigen::Matrix< var, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b) |
| template<int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, R1, C2 > | mdivide_left (const Eigen::Matrix< var, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b) |
| template<int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, R1, C2 > | mdivide_left (const Eigen::Matrix< double, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b) |
| template<int TriView, int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, R1, C2 > | mdivide_left_tri (const Eigen::Matrix< var, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b) |
| template<int TriView, int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, R1, C2 > | mdivide_left_tri (const Eigen::Matrix< double, R1, C1 > &A, const Eigen::Matrix< var, R2, C2 > &b) |
| template<int TriView, int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, R1, C2 > | mdivide_left_tri (const Eigen::Matrix< var, R1, C1 > &A, const Eigen::Matrix< double, R2, C2 > &b) |
| template<int R, int C> | |
| var | determinant (const Eigen::Matrix< var, R, C > &m) |
| template<int R, int C> | |
| var | log_determinant (const Eigen::Matrix< var, R, C > &m) |
| double | divide (double x, double y) |
| Return the division of the first scalar by the second scalar. | |
| template<typename T1 , typename T2 > | |
| var | divide (const T1 &v, const T2 &c) |
| template<typename T1 , typename T2 , int R, int C> | |
| Eigen::Matrix< var, R, C > | divide (const Eigen::Matrix< T1, R, C > &v, const T2 &c) |
| Return the division of the specified column vector by the specified scalar. | |
| template<typename T1 , typename T2 > | |
| boost::math::tools::promote_args < T1, T2 >::type | multiply (const T1 &v, const T2 &c) |
| Return the product of two scalars. | |
| template<typename T1 , typename T2 , int R2, int C2> | |
| Eigen::Matrix< var, R2, C2 > | multiply (const T1 &c, const Eigen::Matrix< T2, R2, C2 > &m) |
| Return the product of scalar and matrix. | |
| template<typename T1 , int R1, int C1, typename T2 > | |
| Eigen::Matrix< var, R1, C1 > | multiply (const Eigen::Matrix< T1, R1, C1 > &m, const T2 &c) |
| Return the product of scalar and matrix. | |
| template<int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, R1, C2 > | multiply (const Eigen::Matrix< var, R1, C1 > &m1, const Eigen::Matrix< var, R2, C2 > &m2) |
| Return the product of the specified matrices. | |
| template<int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, R1, C2 > | multiply (const Eigen::Matrix< double, R1, C1 > &m1, const Eigen::Matrix< var, R2, C2 > &m2) |
| Return the product of the specified matrices. | |
| template<int R1, int C1, int R2, int C2> | |
| Eigen::Matrix< var, R1, C2 > | multiply (const Eigen::Matrix< var, R1, C1 > &m1, const Eigen::Matrix< double, R2, C2 > &m2) |
| Return the product of the specified matrices. | |
| template<int C1, int R2> | |
| var | multiply (const Eigen::Matrix< var, 1, C1 > &rv, const Eigen::Matrix< var, R2, 1 > &v) |
| Return the scalar product of the specified row vector and specified column vector. | |
| template<int C1, int R2> | |
| var | multiply (const Eigen::Matrix< double, 1, C1 > &rv, const Eigen::Matrix< var, R2, 1 > &v) |
| Return the scalar product of the specified row vector and specified column vector. | |
| template<int C1, int R2> | |
| var | multiply (const Eigen::Matrix< var, 1, C1 > &rv, const Eigen::Matrix< double, R2, 1 > &v) |
| Return the scalar product of the specified row vector and specified column vector. | |
| matrix_v | multiply_lower_tri_self_transpose (const matrix_v &L) |
| matrix_v | tcrossprod (const matrix_v &M) |
| Returns the result of post-multiplying a matrix by its own transpose. | |
| matrix_v | crossprod (const matrix_v &M) |
| Returns the result of pre-multiplying a matrix by its own transpose. | |
| void | assign_to_var (stan::agrad::var &var, const double &val) |
| void | assign_to_var (stan::agrad::var &var, const stan::agrad::var &val) |
| void | assign_to_var (int &n_lhs, const int &n_rhs) |
| void | assign_to_var (double &n_lhs, const double &n_rhs) |
| template<typename LHS , typename RHS > | |
| void | assign_to_var (std::vector< LHS > &x, const std::vector< RHS > &y) |
| template<typename LHS , typename RHS , int R, int C> | |
| void | assign_to_var (Eigen::Matrix< LHS, R, C > &x, const Eigen::Matrix< RHS, R, C > &y) |
| template<typename LHS , typename RHS > | |
| void | assign (LHS &var, const RHS &val) |
| void | stan_print (std::ostream *o, const var &x) |
| template<typename T_result , class Policy > | |
| bool | check_pos_definite (const char *function, const Eigen::Matrix< var, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result, const Policy &) |
| var | acosh (const stan::agrad::var &a) |
| The inverse hyperbolic cosine function for variables (C99). | |
| var | asinh (const stan::agrad::var &a) |
| The inverse hyperbolic sine function for variables (C99). | |
| var | atanh (const stan::agrad::var &a) |
| The inverse hyperbolic tangent function for variables (C99). | |
| var | erf (const stan::agrad::var &a) |
| The error function for variables (C99). | |
| var | erfc (const stan::agrad::var &a) |
| The complementary error function for variables (C99). | |
| var | exp2 (const stan::agrad::var &a) |
| Exponentiation base 2 function for variables (C99). | |
| var | expm1 (const stan::agrad::var &a) |
| The exponentiation of the specified variable minus 1 (C99). | |
| var | lgamma (const stan::agrad::var &a) |
| The log gamma function for variables (C99). | |
| var | log1p (const stan::agrad::var &a) |
| The log (1 + x) function for variables (C99). | |
| var | log1m (const stan::agrad::var &a) |
| The log (1 - x) function for variables. | |
| var | fma (const stan::agrad::var &a, const stan::agrad::var &b, const stan::agrad::var &c) |
| The fused multiply-add function for three variables (C99). | |
| var | fma (const stan::agrad::var &a, const stan::agrad::var &b, const double &c) |
| The fused multiply-add function for two variables and a value (C99). | |
| var | fma (const stan::agrad::var &a, const double &b, const stan::agrad::var &c) |
| The fused multiply-add function for a variable, value, and variable (C99). | |
| var | fma (const stan::agrad::var &a, const double &b, const double &c) |
| The fused multiply-add function for a variable and two values (C99). | |
| var | fma (const double &a, const stan::agrad::var &b, const double &c) |
| The fused multiply-add function for a value, variable, and value (C99). | |
| var | fma (const double &a, const double &b, const stan::agrad::var &c) |
| The fused multiply-add function for two values and a variable, and value (C99). | |
| var | fma (const double &a, const stan::agrad::var &b, const stan::agrad::var &c) |
| The fused multiply-add function for a value and two variables (C99). | |
| var | fmax (const stan::agrad::var &a, const stan::agrad::var &b) |
| Returns the maximum of the two variable arguments (C99). | |
| var | fmax (const stan::agrad::var &a, const double &b) |
| Returns the maximum of the variable and scalar, promoting the scalar to a variable if it is larger (C99). | |
| var | fmax (const double &a, const stan::agrad::var &b) |
| Returns the maximum of a scalar and variable, promoting the scalar to a variable if it is larger (C99). | |
| var | fmin (const stan::agrad::var &a, const stan::agrad::var &b) |
| Returns the minimum of the two variable arguments (C99). | |
| var | fmin (const stan::agrad::var &a, const double &b) |
| Returns the minimum of the variable and scalar, promoting the scalar to a variable if it is larger (C99). | |
| var | fmin (const double &a, const stan::agrad::var &b) |
| Returns the minimum of a scalar and variable, promoting the scalar to a variable if it is larger (C99). | |
| var | hypot (const stan::agrad::var &a, const stan::agrad::var &b) |
| Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99). | |
| var | hypot (const stan::agrad::var &a, const double &b) |
| Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99). | |
| var | hypot (const double &a, const stan::agrad::var &b) |
| Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99). | |
| var | log2 (const stan::agrad::var &a) |
| Returns the base 2 logarithm of the specified variable (C99). | |
| var | cbrt (const stan::agrad::var &a) |
| Returns the cube root of the specified variable (C99). | |
| var | round (const stan::agrad::var &a) |
| Returns the rounded form of the specified variable (C99). | |
| var | trunc (const stan::agrad::var &a) |
| Returns the truncatation of the specified variable (C99). | |
| var | fdim (const stan::agrad::var &a, const stan::agrad::var &b) |
| Return the positive difference between the first variable's the value and the second's (C99). | |
| var | fdim (const double &a, const stan::agrad::var &b) |
| Return the positive difference between the first value and the value of the second variable (C99). | |
| var | fdim (const stan::agrad::var &a, const double &b) |
| Return the positive difference between the first variable's value and the second value (C99). | |
| var | tgamma (const stan::agrad::var &a) |
| Return the Gamma function applied to the specified variable (C99). | |
| var | step (const stan::agrad::var &a) |
| Return the step, or heaviside, function applied to the specified variable (stan). | |
| var | inv_cloglog (const stan::agrad::var &a) |
| Return the inverse complementary log-log function applied specified variable (stan). | |
| var | Phi (const stan::agrad::var &a) |
| The unit normal cumulative density function for variables (stan). | |
| var | inv_logit (const stan::agrad::var &a) |
| The inverse logit function for variables (stan). | |
| var | Phi_approx (const stan::agrad::var &a) |
| Approximation of the unit normal CDF for variables (stan). | |
| var | log_loss (const int &y, const stan::agrad::var &y_hat) |
| The log loss function for variables (stan). | |
| var | log1p_exp (const stan::agrad::var &a) |
| Return the log of 1 plus the exponential of the specified variable. | |
| var | log_sum_exp (const stan::agrad::var &a, const stan::agrad::var &b) |
| Returns the log sum of exponentials. | |
| var | log_sum_exp (const stan::agrad::var &a, const double &b) |
| Returns the log sum of exponentials. | |
| var | log_sum_exp (const double &a, const stan::agrad::var &b) |
| Returns the log sum of exponentials. | |
| var | log_sum_exp (const std::vector< var > &x) |
| Returns the log sum of exponentials. | |
| var | square (const var &x) |
| Return the square of the input variable. | |
| var | multiply_log (const var &a, const var &b) |
| Return the value of a*log(b). | |
| var | multiply_log (const var &a, const double b) |
| Return the value of a*log(b). | |
| var | multiply_log (const double a, const var &b) |
| Return the value of a*log(b). | |
| var | if_else (bool c, const var &y_true, const var &y_false) |
| If the specified condition is true, return the first variable, otherwise return the second variable. | |
| var | if_else (bool c, double y_true, const var &y_false) |
| If the specified condition is true, return a new variable constructed from the first scalar, otherwise return the second variable. | |
| var | if_else (bool c, const var &y_true, const double y_false) |
| If the specified condition is true, return the first variable, otherwise return a new variable constructed from the second scalar. | |
| var | ibeta (const var &a, const var &b, const var &x) |
| The normalized incomplete beta function of a, b, and x. | |
| double | value_of (const agrad::var &v) |
| Return the value of the specified variable. | |
| int | as_bool (const agrad::var &v) |
| Return 1 if the argument is unequal to zero and 0 otherwise. | |
Variables | |
| std::vector< chainable * > | var_stack_ |
| std::vector< chainable * > | var_nochain_stack_ |
| memory::stack_alloc | memalloc_ |
Function gradients via reverse-mode automatic differentiation.
| typedef Eigen::Matrix<var,Eigen::Dynamic,Eigen::Dynamic> stan::agrad::matrix_v |
The type of a matrix holding stan::agrad::var values.
Definition at line 261 of file matrix.hpp.
| typedef Eigen::Matrix<var,1,Eigen::Dynamic> stan::agrad::row_vector_v |
The type of a row vector holding stan::agrad::var values.
Definition at line 277 of file matrix.hpp.
| typedef Eigen::Matrix<var,Eigen::Dynamic,1> stan::agrad::vector_v |
The type of a (column) vector holding stan::agrad::var values.
Definition at line 269 of file matrix.hpp.
|
inline |
|
inline |
|
inline |
The inverse hyperbolic cosine function for variables (C99).
For non-variable function, see boost::math::acosh().
The derivative is defined by
.
| a | The variable. |
Definition at line 661 of file special_functions.hpp.
|
inline |
Return 1 if the argument is unequal to zero and 0 otherwise.
| x | Value. |
Definition at line 1611 of file special_functions.hpp.
|
inline |
|
inline |
The inverse hyperbolic sine function for variables (C99).
For non-variable function, see boost::math::asinh().
The derivative is defined by
.
| a | The variable. |
Definition at line 677 of file special_functions.hpp.
|
inline |
Definition at line 1908 of file matrix.hpp.
|
inline |
Definition at line 1848 of file matrix.hpp.
|
inline |
Definition at line 1851 of file matrix.hpp.
|
inline |
Definition at line 1855 of file matrix.hpp.
|
inline |
Definition at line 1859 of file matrix.hpp.
|
inline |
Definition at line 1864 of file matrix.hpp.
|
inline |
Definition at line 1870 of file matrix.hpp.
|
inline |
|
inline |
Return the principal value of the arc tangent, in radians, of the first variable divided by the second scalar (cmath).
The derivative with respect to the variable is
$
.
| a | Numerator variable. |
| b | Denominator scalar. |
Definition at line 1790 of file agrad_thread_safe.hpp.
|
inline |
Return the principal value of the arc tangent, in radians, of the first scalar divided by the second variable (cmath).
The derivative with respect to the variable is
$
.
| a | Numerator scalar. |
| b | Denominator variable. |
Definition at line 1806 of file agrad_thread_safe.hpp.
|
inline |
Return the principal value of the arc tangent, in radians, of the first variable divided by the second (cmath).
The partial derivatives are defined by
$
, and
$
.
| a | Numerator variable. |
| b | Denominator variable. |
|
inline |
Return the principal value of the arc tangent, in radians, of the first variable divided by the second scalar (cmath).
The derivative with respect to the variable is
$
.
| a | Numerator variable. |
| b | Denominator scalar. |
|
inline |
Return the principal value of the arc tangent, in radians, of the first scalar divided by the second variable (cmath).
The derivative with respect to the variable is
$
.
| a | Numerator scalar. |
| b | Denominator variable. |
|
inline |
The inverse hyperbolic tangent function for variables (C99).
For non-variable function, see boost::math::atanh().
The derivative is defined by
.
| a | The variable. |
Definition at line 693 of file special_functions.hpp.
|
inline |
Returns the cube root of the specified variable (C99).
See boost::math::cbrt() for the double-based version.
The derivative is
.
| a | Specified variable. |
Definition at line 1178 of file special_functions.hpp.
|
inline |
Return the ceiling of the specified variable (cmath).
The derivative of the ceiling function is defined and zero everywhere but at integers, and we set them to zero for convenience,
.
The ceiling function rounds up. For double values, this is the smallest integral value that is not less than the specified value. Although this function is not differentiable because it is discontinuous at integral values, its gradient is returned as zero everywhere.
| a | Input variable. |
|
inline |
Definition at line 11 of file matrix_error_handling.hpp.
|
inline |
Definition at line 756 of file matrix.hpp.
|
inline |
Definition at line 769 of file matrix.hpp.
|
inline |
Definition at line 782 of file matrix.hpp.
|
inline |
Returns the dot product of each column of a matrix with itself.
| x | Matrix. |
| T | scalar type |
Definition at line 745 of file matrix.hpp.
|
inline |
|
inline |
|
inline |
Returns the result of pre-multiplying a matrix by its own transpose.
| M | Matrix to multiply. |
Definition at line 1842 of file matrix.hpp.
|
inline |
Definition at line 1466 of file matrix.hpp.
|
inline |
Return the division of the first scalar by the second scalar.
| [in] | v | Specified vector. |
| [in] | c | Specified scalar. |
Definition at line 1523 of file matrix.hpp.
|
inline |
Definition at line 1528 of file matrix.hpp.
|
inline |
Return the division of the specified column vector by the specified scalar.
| [in] | v | Specified vector. |
| [in] | c | Specified scalar. |
Definition at line 1540 of file matrix.hpp.
|
inline |
Returns the dot product.
| [in] | v1 | First column vector. |
| [in] | v2 | Second column vector. |
| std::domain_error | if length of v1 is not equal to length of v2. |
Definition at line 802 of file matrix.hpp.
|
inline |
Returns the dot product.
| [in] | v1 | First column vector. |
| [in] | v2 | Second column vector. |
| std::domain_error | if length of v1 is not equal to length of v2 or either v1 or v2 are not vectors. |
Definition at line 819 of file matrix.hpp.
|
inline |
Returns the dot product.
| [in] | v1 | First column vector. |
| [in] | v2 | Second column vector. |
| std::domain_error | if length of v1 is not equal to length of v2 or either v1 or v2 are not vectors. |
Definition at line 836 of file matrix.hpp.
|
inline |
Returns the dot product.
| [in] | v1 | First array. |
| [in] | v2 | Second array. |
| [in] | length | Length of both arrays. |
Definition at line 851 of file matrix.hpp.
|
inline |
Returns the dot product.
| [in] | v1 | First array. |
| [in] | v2 | Second array. |
| [in] | length | Length of both arrays. |
Definition at line 862 of file matrix.hpp.
|
inline |
Returns the dot product.
| [in] | v1 | First array. |
| [in] | v2 | Second array. |
| [in] | length | Length of both arrays. |
Definition at line 873 of file matrix.hpp.
|
inline |
Returns the dot product.
| [in] | v1 | First vector. |
| [in] | v2 | Second vector. |
| std::domain_error | if sizes of v1 and v2 do not match. |
Definition at line 884 of file matrix.hpp.
|
inline |
Returns the dot product.
| [in] | v1 | First vector. |
| [in] | v2 | Second vector. |
| std::domain_error | if sizes of v1 and v2 do not match. |
Definition at line 897 of file matrix.hpp.
|
inline |
Returns the dot product.
| [in] | v1 | First vector. |
| [in] | v2 | Second vector. |
| std::domain_error | if sizes of v1 and v2 do not match. |
Definition at line 910 of file matrix.hpp.
|
inline |
Returns the dot product of a vector with itself.
| [in] | v | Vector. |
| R | number of rows or Eigen::Dynamic for dynamic; one of R or C must be 1 |
| C | number of rows or Eigen::Dyanmic for dynamic; one of R or C must be 1 |
Definition at line 733 of file matrix.hpp.
|
inline |
The error function for variables (C99).
For non-variable function, see boost::math::erf()
The derivative is
.
| a | The variable. |
Definition at line 709 of file special_functions.hpp.
|
inline |
The complementary error function for variables (C99).
For non-variable function, see boost::math::erfc().
The derivative is
.
| a | The variable. |
Definition at line 725 of file special_functions.hpp.
|
inline |
|
inline |
Exponentiation base 2 function for variables (C99).
For non-variable function, see boost::math::exp2().
The derivatie is
.
| a | The variable. |
Definition at line 741 of file special_functions.hpp.
|
inline |
The exponentiation of the specified variable minus 1 (C99).
For non-variable function, see boost::math::expm1().
The derivative is given by
.
| a | The variable. |
Definition at line 757 of file special_functions.hpp.
|
inline |
Return the absolute value of the variable (cmath).
Choosing an arbitrary value at the non-differentiable point 0,
.
where
is the signum function, taking values -1 if
, 0 if
, and 1 if
.
The function abs() provides the same behavior, with abs() defined in stdlib.h and fabs() defined in cmath.
| a | Input variable. |
|
inline |
Return the positive difference between the first variable's the value and the second's (C99).
See stan::math::fdim() for the double-based version.
The partial derivative with respect to the first argument is
if
, and
if
.
With respect to the second argument, the partial is
if
, and
if
.
| a | First variable. |
| b | Second variable. |
Definition at line 1241 of file special_functions.hpp.
|
inline |
Return the positive difference between the first value and the value of the second variable (C99).
See fdim(var,var) for definitions of values and derivatives.
The derivative with respect to the variable is
if
, and
if
.
| a | First value. |
| b | Second variable. |
Definition at line 1266 of file special_functions.hpp.
|
inline |
Return the positive difference between the first variable's value and the second value (C99).
See fdim(var,var) for definitions of values and derivatives.
The derivative with respect to the variable is
if
, and
if
.
| a | First value. |
| b | Second variable. |
Definition at line 1289 of file special_functions.hpp.
| void stan::agrad::fill | ( | var & | x, |
| const var & | y | ||
| ) |
Definition at line 13 of file matrix.hpp.
| void stan::agrad::fill | ( | std::vector< T > & | x, |
| const var & | y | ||
| ) |
Definition at line 17 of file matrix.hpp.
| void stan::agrad::fill | ( | Eigen::Matrix< var, R, C > & | x, |
| const var & | y | ||
| ) |
Definition at line 22 of file matrix.hpp.
|
inline |
Return the floor of the specified variable (cmath).
The derivative of the floor function is defined and zero everywhere but at integers, so we set these derivatives to zero for convenience,
.
The floor function rounds down. For double values, this is the largest integral value that is not greater than the specified value. Although this function is not differentiable because it is discontinuous at integral values, its gradient is returned as zero everywhere.
| a | Input variable. |
|
inline |
The fused multiply-add function for three variables (C99).
This function returns the product of the first two arguments plus the third argument.
See boost::math::fma() for the double-based version.
The partial derivatives are
, and
, and
.
| a | First multiplicand. |
| b | Second multiplicand. |
| c | Summand. |
Definition at line 824 of file special_functions.hpp.
|
inline |
The fused multiply-add function for two variables and a value (C99).
This function returns the product of the first two arguments plus the third argument.
See boost::math::fma() for the double-based version.
The partial derivatives are
, and
.
| a | First multiplicand. |
| b | Second multiplicand. |
| c | Summand. |
Definition at line 848 of file special_functions.hpp.
|
inline |
The fused multiply-add function for a variable, value, and variable (C99).
This function returns the product of the first two arguments plus the third argument.
See boost::math::fma() for the double-based version.
The partial derivatives are
, and
.
| a | First multiplicand. |
| b | Second multiplicand. |
| c | Summand. |
Definition at line 872 of file special_functions.hpp.
|
inline |
The fused multiply-add function for a variable and two values (C99).
This function returns the product of the first two arguments plus the third argument.
See boost::math::fma() for the double-based version.
The derivative is
.
| a | First multiplicand. |
| b | Second multiplicand. |
| c | Summand. |
Definition at line 894 of file special_functions.hpp.
|
inline |
The fused multiply-add function for a value, variable, and value (C99).
This function returns the product of the first two arguments plus the third argument.
See boost::math::fma() for the double-based version.
The derivative is
, and
| a | First multiplicand. |
| b | Second multiplicand. |
| c | Summand. |
Definition at line 916 of file special_functions.hpp.
|
inline |
The fused multiply-add function for two values and a variable, and value (C99).
This function returns the product of the first two arguments plus the third argument.
See boost::math::fma() for the double-based version.
The derivative is
.
| a | First multiplicand. |
| b | Second multiplicand. |
| c | Summand. |
Definition at line 938 of file special_functions.hpp.
|
inline |
The fused multiply-add function for a value and two variables (C99).
This function returns the product of the first two arguments plus the third argument.
See boost::math::fma() for the double-based version.
The partial derivaties are
, and
.
| a | First multiplicand. |
| b | Second multiplicand. |
| c | Summand. |
Definition at line 962 of file special_functions.hpp.
|
inline |
Returns the maximum of the two variable arguments (C99).
See boost::math::fmax() for the double-based version.
No new variable implementations are created, with this function defined as if by
fmax(a,b) = a if a's value is greater than b's, and .
fmax(a,b) = b if b's value is greater than or equal to a's.
| a | First variable. |
| b | Second variable. |
Definition at line 986 of file special_functions.hpp.
|
inline |
Returns the maximum of the variable and scalar, promoting the scalar to a variable if it is larger (C99).
See boost::math::fmax() for the double-based version.
For fmax(a,b), if a's value is greater than b, then a is returned, otherwise a fesh variable implementation wrapping the value b is returned.
| a | First variable. |
| b | Second value |
Definition at line 1007 of file special_functions.hpp.
|
inline |
Returns the maximum of a scalar and variable, promoting the scalar to a variable if it is larger (C99).
See boost::math::fmax() for the double-based version.
For fmax(a,b), if a is greater than b's value, then a fresh variable implementation wrapping a is returned, otherwise b is returned.
| a | First value. |
| b | Second variable. |
Definition at line 1028 of file special_functions.hpp.
|
inline |
Returns the minimum of the two variable arguments (C99).
See boost::math::fmin() for the double-based version.
For fmin(a,b), if a's value is less than b's, then a is returned, otherwise b is returned.
| a | First variable. |
| b | Second variable. |
Definition at line 1046 of file special_functions.hpp.
|
inline |
Returns the minimum of the variable and scalar, promoting the scalar to a variable if it is larger (C99).
See boost::math::fmin() for the double-based version.
For fmin(a,b), if a's value is less than b, then a is returned, otherwise a fresh variable wrapping b is returned.
| a | First variable. |
| b | Second value |
Definition at line 1065 of file special_functions.hpp.
|
inline |
Returns the minimum of a scalar and variable, promoting the scalar to a variable if it is larger (C99).
See boost::math::fmin() for the double-based version.
For fmin(a,b), if a is less than b's value, then a fresh variable implementation wrapping a is returned, otherwise b is returned.
| a | First value. |
| b | Second variable. |
Definition at line 1086 of file special_functions.hpp.
|
inline |
Return the floating point remainder after dividing the the first variable by the second scalar (cmath).
The derivative with respect to the variable is
.
| a | First variable. |
| b | Second scalar. |
Definition at line 1960 of file agrad_thread_safe.hpp.
|
inline |
Return the floating point remainder after dividing the first scalar by the second variable (cmath).
The derivative with respect to the variable is
.
| a | First scalar. |
| b | Second variable. |
Definition at line 1977 of file agrad_thread_safe.hpp.
|
inline |
Return the floating point remainder after dividing the first variable by the second (cmath).
The partial derivatives with respect to the variables are defined everywhere but where
, but we set these to match other values, with
, and
.
| a | First variable. |
| b | Second variable. |
|
inline |
Return the floating point remainder after dividing the the first variable by the second scalar (cmath).
The derivative with respect to the variable is
.
| a | First variable. |
| b | Second scalar. |
|
inline |
Return the floating point remainder after dividing the first scalar by the second variable (cmath).
The derivative with respect to the variable is
.
| a | First scalar. |
| b | Second variable. |
|
static |
|
static |
Compute the gradient for all variables starting from the specified root variable implementation.
Does not recover memory. This chainable variable's adjoint is initialized using the method init_dependent() and then the chain rule is applied working down the stack from this chainable and calling each chainable's chain() method in turn.
| vi | Variable implementation for root of partial derivative propagation. |
| double stan::agrad::hessian | ( | const F & | f, |
| const std::vector< double > & | x, | ||
| const std::vector< double > & | v, | ||
| std::vector< double > & | Hv | ||
| ) |
Definition at line 21 of file hessian.hpp.
|
inline |
Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99).
See boost::math::hypot() for double-based function.
The partial derivatives are given by
, and
.
| a | Length of first side. |
| b | Length of second side. |
Definition at line 1107 of file special_functions.hpp.
|
inline |
Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99).
See boost::math::hypot() for double-based function.
The derivative is
.
| a | Length of first side. |
| b | Length of second side. |
Definition at line 1126 of file special_functions.hpp.
|
inline |
Returns the length of the hypoteneuse of a right triangle with sides of the specified lengths (C99).
See boost::math::hypot() for double-based function.
The derivative is
.
| a | Length of first side. |
| b | Length of second side. |
Definition at line 1145 of file special_functions.hpp.
|
inline |
The normalized incomplete beta function of a, b, and x.
Used to compute the cumulative density function for the beta distribution.
Partial derivatives are those specified by wolfram alpha. The values were checked using both finite differences and by independent code for calculating the derivatives found in JSS (paper by Boik and Robison-Cox).
| a | Shape parameter. |
| b | Shape parameter. |
| x | Random variate. |
Definition at line 1582 of file special_functions.hpp.
|
inline |
If the specified condition is true, return the first variable, otherwise return the second variable.
| c | Boolean condition. |
| y_true | Variable to return if condition is true. |
| y_false | Variable to return if condition is false. |
Definition at line 1531 of file special_functions.hpp.
|
inline |
If the specified condition is true, return a new variable constructed from the first scalar, otherwise return the second variable.
| c | Boolean condition. |
| y_true | Value to promote to variable and return if condition is true. |
| y_false | Variable to return if condition is false. |
Definition at line 1543 of file special_functions.hpp.
|
inline |
If the specified condition is true, return the first variable, otherwise return a new variable constructed from the second scalar.
| c | Boolean condition. |
| y_true | Variable to return if condition is true. |
| y_false | Value to promote to variable and return if condition is false. |
Definition at line 1558 of file special_functions.hpp.
|
inline |
Initialize variable to value.
(Function may look pointless, but its needed to bottom out recursion.)
Definition at line 283 of file matrix.hpp.
|
inline |
Initialize every cell in the matrix to the specified value.
Definition at line 292 of file matrix.hpp.
|
inline |
Initialize the variables in the standard vector recursively.
Definition at line 301 of file matrix.hpp.
|
inline |
Return the inverse complementary log-log function applied specified variable (stan).
See stan::math::inv_cloglog() for the double-based version.
The derivative is given by
.
| a | Variable argument. |
Definition at line 1350 of file special_functions.hpp.
|
inline |
The inverse logit function for variables (stan).
See stan::math::inv_logit() for the double-based version.
The derivative of inverse logit is
.
| a | Argument variable. |
Definition at line 1382 of file special_functions.hpp.
|
inline |
Return the Jacobian of the function producing the specified dependent variables with respect to the specified independent variables.
A typical use case would be to take the Jacobian of a function from independent variables to dependentant variables. For instance,
std::vector<var> f(std::vector<var>& x) { ... }
std::vector<var> x = ...;
std::vector<var> y = f(x);
std::vector<std::vector<double> > J;
jacobian(y,x,J);
After executing this code, J will contain the Jacobian, stored as a standard vector of gradients. Specifically, J[m] will be the gradient of y[m] with respect to x, and thus J[m][n] will be dy[m]/dx[n].
| [in] | dependents | Dependent (output) variables. |
| [in] | independents | Indepent (input) variables. |
| [out] | jacobian | Jacobian of the transform. |
|
inline |
The log gamma function for variables (C99).
The derivatie is the digamma function,
.
| a | The variable. |
Definition at line 771 of file special_functions.hpp.
|
inline |
|
inline |
|
inline |
The log (1 - x) function for variables.
The derivative is given by
.
| a | The variable. |
Definition at line 800 of file special_functions.hpp.
|
inline |
The log (1 + x) function for variables (C99).
The derivative is given by
.
| a | The variable. |
Definition at line 786 of file special_functions.hpp.
|
inline |
Return the log of 1 plus the exponential of the specified variable.
Definition at line 1431 of file special_functions.hpp.
|
inline |
Returns the base 2 logarithm of the specified variable (C99).
See stan::math::log2() for the double-based version.
The derivative is
.
| a | Specified variable. |
Definition at line 1162 of file special_functions.hpp.
|
inline |
Definition at line 1510 of file matrix.hpp.
|
inline |
The log loss function for variables (stan).
See stan::math::log_loss() for the double-based version.
The derivative with respect to the variable
is
, and
.
| y | Reference value. |
| y_hat | Response variable. |
Definition at line 1420 of file special_functions.hpp.
|
inline |
Returns the log sum of exponentials.
Definition at line 1438 of file special_functions.hpp.
|
inline |
Returns the log sum of exponentials.
Definition at line 1445 of file special_functions.hpp.
|
inline |
Returns the log sum of exponentials.
Definition at line 1452 of file special_functions.hpp.
|
inline |
Returns the log sum of exponentials.
Definition at line 1459 of file special_functions.hpp.
|
inline |
Definition at line 1100 of file matrix.hpp.
|
inline |
Definition at line 1124 of file matrix.hpp.
|
inline |
Definition at line 1148 of file matrix.hpp.
|
inline |
Definition at line 1360 of file matrix.hpp.
|
inline |
Definition at line 1383 of file matrix.hpp.
|
inline |
Definition at line 1406 of file matrix.hpp.
|
inline |
Return the product of two scalars.
| [in] | v | First scalar. |
| [in] | c | Specified scalar. |
Definition at line 1555 of file matrix.hpp.
|
inline |
Return the product of scalar and matrix.
| [in] | c | Specified scalar. |
| [in] | m | Matrix. |
Definition at line 1566 of file matrix.hpp.
|
inline |
Return the product of scalar and matrix.
| [in] | m | Matrix. |
| [in] | c | Specified scalar. |
Definition at line 1580 of file matrix.hpp.
|
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.
| [in] | m1 | First matrix. |
| [in] | m2 | Second matrix. |
| std::domain_error | if the number of columns of m1 does not match the number of rows of m2. |
Definition at line 1596 of file matrix.hpp.
|
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.
| [in] | m1 | First matrix. |
| [in] | m2 | Second matrix. |
| std::domain_error | if the number of columns of m1 does not match the number of rows of m2. |
Definition at line 1640 of file matrix.hpp.
|
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.
| [in] | m1 | First matrix. |
| [in] | m2 | Second matrix. |
| std::domain_error | if the number of columns of m1 does not match the number of rows of m2. |
Definition at line 1685 of file matrix.hpp.
|
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.
| [in] | rv | Row vector. |
| [in] | v | Column vector. |
| std::domain_error | if rv and v are not the same size |
Definition at line 1729 of file matrix.hpp.
|
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.
| [in] | rv | Row vector. |
| [in] | v | Column vector. |
| std::domain_error | if rv and v are not the same size |
Definition at line 1745 of file matrix.hpp.
|
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.
| [in] | rv | Row vector. |
| [in] | v | Column vector. |
| std::domain_error | if rv and v are not the same size |
Definition at line 1760 of file matrix.hpp.
|
inline |
Return the value of a*log(b).
When both a and b are 0, the value returned is 0. The partial deriviative with respect to a is log(b). The partial deriviative with respect to b is a/b. When a and b are both 0, this is set to Inf.
| a | First variable. |
| b | Second variable. |
Definition at line 1489 of file special_functions.hpp.
|
inline |
Return the value of a*log(b).
When both a and b are 0, the value returned is 0. The partial deriviative with respect to a is log(b).
| a | First variable. |
| b | Second scalar. |
Definition at line 1502 of file special_functions.hpp.
|
inline |
Return the value of a*log(b).
When both a and b are 0, the value returned is 0. The partial deriviative with respect to b is a/b. When a and b are both 0, this is set to Inf.
| a | First scalar. |
| b | Second variable. |
Definition at line 1516 of file special_functions.hpp.
|
inline |
Definition at line 1767 of file matrix.hpp.
|
inline |
Prefix logical negation for the value of variables (C++).
The expression (!a) is equivalent to negating the scalar value of the variable a.
Note that this is the only logical operator defined for variables. Overridden logical conjunction (&&) and disjunction (||) operators do not apply the same "short circuit" rules as the built-in logical operators.
| a | Variable to negate. |
|
inline |
Inequality operator comparing a variable's value and a double (C++).
| a | First variable. |
| b | Second value. |
Definition at line 1085 of file agrad_thread_safe.hpp.
|
inline |
Inequality operator comparing a double and a variable's value (C++).
| a | First value. |
| b | Second variable. |
Definition at line 1098 of file agrad_thread_safe.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Multiplication operator for a variable and a scalar (C++).
The partial derivative for the variable is
, and
| a | Variable operand. |
| b | Scalar operand. |
Definition at line 1426 of file agrad_thread_safe.hpp.
|
inline |
Multiplication operator for a scalar and a variable (C++).
The partial derivative for the variable is
.
| a | Scalar operand. |
| b | Variable operand. |
Definition at line 1441 of file agrad_thread_safe.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Addition operator for variable and scalar (C++).
The derivative with respect to the variable is
.
| a | First variable operand. |
| b | Second scalar operand. |
Definition at line 1331 of file agrad_thread_safe.hpp.
|
inline |
Addition operator for scalar and variable (C++).
The derivative with respect to the variable is
.
| a | First scalar operand. |
| b | Second variable operand. |
Definition at line 1346 of file agrad_thread_safe.hpp.
|
inline |
Unary plus operator for variables (C++).
The function simply returns its input, because
.
The effect of unary plus on a built-in C++ scalar type is integer promotion. Because variables are all double-precision floating point already, promotion is not necessary.
| a | Argument variable. |
|
inline |
|
inline |
|
inline |
|
inline |
Prefix increment operator for variables (C++).
Following C++, (++a) is defined to behave exactly as (a = a + 1.0) does, but is faster and uses less memory. In particular, the result is an assignable lvalue.
| a | Variable to increment. |
|
inline |
Postfix increment operator for variables (C++).
Following C++, the expression (a++) is defined to behave like the sequence of operations
var temp = a; a = a + 1.0; return temp;
| a | Variable to increment. |
Following C++, the expression (a++) i s defined to behave like the sequence of operations
var temp = a; a = a + 1.0; return temp;
| a | Variable to increment. |
| dummy | Unused dummy variable used to distinguish postfix operator from prefix operator. |
|
inline |
Subtraction operator for variable and scalar (C++).
The derivative for the variable is
, and
| a | First variable operand. |
| b | Second scalar operand. |
Definition at line 1379 of file agrad_thread_safe.hpp.
|
inline |
Subtraction operator for scalar and variable (C++).
The derivative for the variable is
, and
| a | First scalar operand. |
| b | Second variable operand. |
Definition at line 1394 of file agrad_thread_safe.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Prefix decrement operator for variables (C++).
Following C++, (–a) is defined to behave exactly as
a = a - 1.0)
does, but is faster and uses less memory. In particular, the result is an assignable lvalue.
| a | Variable to decrement. |
|
inline |
Postfix decrement operator for variables (C++).
Following C++, the expression (a–) is defined to behave like the sequence of operations
var temp = a; a = a - 1.0; return temp;
| a | Variable to decrement. |
Following C++, the expression (a–) is defined to behave like the sequence of operations
var temp = a; a = a - 1.0; return temp;
| a | Variable to decrement. |
| dummy | Unused dummy variable used to distinguish suffix operator from prefix operator. |
|
inline |
Division operator for dividing a variable by a scalar (C++).
The derivative with respect to the variable is
.
| a | Variable operand. |
| b | Scalar operand. |
Definition at line 1474 of file agrad_thread_safe.hpp.
|
inline |
Division operator for dividing a scalar by a variable (C++).
The derivative with respect to the variable is
.
| a | Scalar operand. |
| b | Variable operand. |
Definition at line 1489 of file agrad_thread_safe.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Less than operator comparing variable's value and a double (C++).
| a | First variable. |
| b | Second value. |
Definition at line 1121 of file agrad_thread_safe.hpp.
|
inline |
Less than operator comparing a double and variable's value (C++).
| a | First value. |
| b | Second variable. |
Definition at line 1133 of file agrad_thread_safe.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Less than or equal operator comparing a variable's value and a scalar (C++).
| a | First variable. |
| b | Second value. |
Definition at line 1194 of file agrad_thread_safe.hpp.
|
inline |
Less than or equal operator comparing a double and variable's value (C++).
| a | First value. |
| b | Second variable. |
Definition at line 1207 of file agrad_thread_safe.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Equality operator comparing a variable's value and a double (C++).
| a | First variable. |
| b | Second value. |
Definition at line 1048 of file agrad_thread_safe.hpp.
|
inline |
Equality operator comparing a scalar and a variable's value (C++).
| a | First scalar. |
| b | Second variable. |
Definition at line 1060 of file agrad_thread_safe.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Greater than operator comparing variable's value and double (C++).
| a | First variable. |
| b | Second value. |
Definition at line 1156 of file agrad_thread_safe.hpp.
|
inline |
Greater than operator comparing a double and a variable's value (C++).
| a | First value. |
| b | Second variable. |
Definition at line 1168 of file agrad_thread_safe.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Greater than or equal operator comparing variable's value and double (C++).
| a | First variable. |
| b | Second value. |
Definition at line 1233 of file agrad_thread_safe.hpp.
|
inline |
Greater than or equal operator comparing double and variable's value (C++).
| a | First value. |
| b | Second variable. |
Definition at line 1246 of file agrad_thread_safe.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
The unit normal cumulative density function for variables (stan).
See stan::math::Phi() for the double-based version.
The derivative is the unit normal density function,
.
| a | Variable argument. |
Definition at line 1366 of file special_functions.hpp.
|
inline |
Approximation of the unit normal CDF for variables (stan).
http://www.jiem.org/index.php/jiem/article/download/60/27
| a | Variable argument. |
Definition at line 1394 of file special_functions.hpp.
|
inline |
Return the base variable raised to the power of the exponent scalar (cmath).
The derivative for the variable is
.
| base | Base variable. |
| exponent | Exponent scalar. |
Definition at line 1649 of file agrad_thread_safe.hpp.
|
inline |
Return the base scalar raised to the power of the exponent variable (cmath).
The derivative for the variable is
.
| base | Base scalar. |
| exponent | Exponent variable. |
Definition at line 1665 of file agrad_thread_safe.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
|
inline |
Returns the rounded form of the specified variable (C99).
See boost::math::round() for the double-based version.
The derivative is zero everywhere but numbers half way between whole numbers, so for convenience the derivative is defined to be everywhere zero,
.
| a | Specified variable. |
Definition at line 1196 of file special_functions.hpp.
|
static |
|
inline |
|
inline |
|
inline |
|
inline |
Return the square of the input variable.
Using square(x) is more efficient than using x * x.
| x | Variable to square. |
Definition at line 1472 of file special_functions.hpp.
| void stan::agrad::stan_print | ( | std::ostream * | o, |
| const var & | x | ||
| ) |
Definition at line 1912 of file matrix.hpp.
|
inline |
Return the step, or heaviside, function applied to the specified variable (stan).
See stan::math::step() for the double-based version.
The derivative of the step function is zero everywhere but at 0, so for convenience, it is taken to be everywhere zero,
.
| a | Variable argument. |
Definition at line 1332 of file special_functions.hpp.
|
inline |
Returns the sum of the coefficients of the specified matrix, column vector or row vector.
| m | Specified matrix or vector. |
Definition at line 923 of file matrix.hpp.
|
inline |
|
inline |
|
inline |
Returns the result of post-multiplying a matrix by its own transpose.
| M | Matrix to multiply. |
Definition at line 1804 of file matrix.hpp.
|
inline |
Return the Gamma function applied to the specified variable (C99).
See boost::math::tgamma() for the double-based version.
The derivative with respect to the argument is

where
is the digamma function.
See boost::math::digamma() for the double-based version.
| a | Argument to function. |
Definition at line 1312 of file special_functions.hpp.
|
inline |
Converts argument to an automatic differentiation variable.
Returns a stan::agrad::var variable with the input value.
| [in] | x | A scalar value |
Definition at line 315 of file matrix.hpp.
|
inline |
Converts argument to an automatic differentiation variable.
Returns a stan::agrad::var variable with the input value.
| [in] | x | An automatic differentiation variable. |
Definition at line 326 of file matrix.hpp.
|
inline |
Converts argument to an automatic differentiation variable.
Returns a stan::agrad::var variable with the input value.
| [in] | m | A Matrix with scalars |
Definition at line 337 of file matrix.hpp.
|
inline |
Converts argument to an automatic differentiation variable.
Returns a stan::agrad::var variable with the input value.
| [in] | m | A Matrix with automatic differentiation variables. |
Definition at line 352 of file matrix.hpp.
|
inline |
Converts argument to an automatic differentiation variable.
Returns a stan::agrad::var variable with the input value.
| [in] | v | A Vector of scalars |
Definition at line 364 of file matrix.hpp.
|
inline |
Converts argument to an automatic differentiation variable.
Returns a stan::agrad::var variable with the input value.
| [in] | v | A Vector of automatic differentiation variables |
Definition at line 379 of file matrix.hpp.
|
inline |
Converts argument to an automatic differentiation variable.
Returns a stan::agrad::var variable with the input value.
| [in] | rv | A row vector of scalars |
Definition at line 391 of file matrix.hpp.
|
inline |
Converts argument to an automatic differentiation variable.
Returns a stan::agrad::var variable with the input value.
| [in] | rv | A row vector with automatic differentiation variables |
Definition at line 406 of file matrix.hpp.
|
inline |
Returns the truncatation of the specified variable (C99).
See boost::math::trunc() for the double-based version.
The derivative is zero everywhere but at integer values, so for convenience the derivative is defined to be everywhere zero,
.
| a | Specified variable. |
Definition at line 1213 of file special_functions.hpp.
|
inline |
Return the value of the specified variable.
This function is used internally by auto-dif functions along with stan::math::value_of(T x) to extract the double value of either a scalar or an auto-dif variable. This function will be called when the argument is a stan::agrad::var even if the function is not referred to by namespace because of argument-dependent lookup.
| v | Variable. |
Definition at line 1601 of file special_functions.hpp.
| memory::stack_alloc stan::agrad::memalloc_ |