1 #ifndef STAN_MATH_REV_MAT_FUN_QUAD_FORM_SYM_HPP 2 #define STAN_MATH_REV_MAT_FUN_QUAD_FORM_SYM_HPP 4 #include <boost/utility/enable_if.hpp> 5 #include <boost/type_traits.hpp> 20 template <
typename TA,
int RA,
int CA,
typename TB,
int RB,
int CB>
22 boost::enable_if_c< boost::is_same<TA, var>::value ||
23 boost::is_same<TB, var>::value,
24 Eigen::Matrix<var, CB, CB> >::type
26 const Eigen::Matrix<TB, RB, CB>& B) {
33 quad_form_vari<TA, RA, CA, TB, RB, CB> *baseVari
34 =
new quad_form_vari<TA, RA, CA, TB, RB, CB>(A, B,
true);
36 return baseVari->impl_->C_;
38 template <
typename TA,
int RA,
int CA,
typename TB,
int RB>
40 boost::enable_if_c< boost::is_same<TA, var>::value ||
41 boost::is_same<TB, var>::value,
44 const Eigen::Matrix<TB, RB, 1>& B) {
51 quad_form_vari<TA, RA, CA, TB, RB, 1> *baseVari
52 =
new quad_form_vari<TA, RA, CA, TB, RB, 1>(A, B,
true);
54 return baseVari->impl_->C_(0, 0);
Independent (input) and dependent (output) variables for gradients.
void check_symmetric(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Check if the specified matrix is symmetric.
void check_multiplicable(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Check if the matrices can be multiplied.
void check_square(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Check if the specified matrix is square.
Eigen::Matrix< fvar< T >, CB, CB > quad_form_sym(const Eigen::Matrix< fvar< T >, RA, CA > &A, const Eigen::Matrix< double, RB, CB > &B)