Stan Math Library: stan/math/rev/mat/fun/quad_form_sym.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

quad_form_sym.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_MAT_FUN_QUAD_FORM_SYM_HPP
2 #define STAN_MATH_REV_MAT_FUN_QUAD_FORM_SYM_HPP
3
4 #include <boost/utility/enable_if.hpp>
5 #include <boost/type_traits.hpp>
6 #include <stan/math/rev/core.hpp>
7 #include <stan/math/prim/mat/fun/Eigen.hpp>
8 #include <stan/math/prim/mat/fun/typedefs.hpp>
9 #include <stan/math/rev/mat/fun/typedefs.hpp>
10 #include <stan/math/prim/mat/fun/value_of.hpp>
11 #include <stan/math/prim/mat/fun/quad_form.hpp>
12 #include <stan/math/prim/mat/err/check_multiplicable.hpp>
13 #include <stan/math/prim/mat/err/check_square.hpp>
14 #include <stan/math/prim/mat/err/check_symmetric.hpp>
15 #include <stan/math/rev/mat/fun/quad_form.hpp>
16
17 namespace stan {
18 namespace math {
19
20 template <typename TA, int RA, int CA, typename TB, int RB, int CB>
21 inline typename
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
25 quad_form_sym(const Eigen::Matrix<TA, RA, CA>& A,
26 const Eigen::Matrix<TB, RB, CB>& B) {
27 stan::math::check_square("quad_form", "A", A);
28 stan::math::check_symmetric("quad_form_sym", "A", A);
29 stan::math::check_multiplicable("quad_form_sym",
30 "A", A,
31 "B", B);
32
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);
35
36 return baseVari->_impl->C_;
37 }
38 template <typename TA, int RA, int CA, typename TB, int RB>
39 inline typename
40 boost::enable_if_c< boost::is_same<TA, var>::value ||
41 boost::is_same<TB, var>::value,
42 var >::type
43 quad_form_sym(const Eigen::Matrix<TA, RA, CA>& A,
44 const Eigen::Matrix<TB, RB, 1>& B) {
45 stan::math::check_square("quad_form", "A", A);
46 stan::math::check_symmetric("quad_form_sym", "A", A);
47 stan::math::check_multiplicable("quad_form_sym",
48 "A", A,
49 "B", B);
50
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);
53
54 return baseVari->_impl->C_(0, 0);
55 }
56 }
57 }
58
59 #endif
core.hpp
check_multiplicable.hpp
stan
Definition: log_sum_exp.hpp:8
check_symmetric.hpp
typedefs.hpp
stan::math::check_multiplicable
bool check_multiplicable(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Return true if the matrices can be multiplied.
Definition: check_multiplicable.hpp:33
Eigen.hpp
value_of.hpp
stan::math::quad_form_sym
Eigen::Matrix< fvar< T >, CB, CB > quad_form_sym(const Eigen::Matrix< fvar< T >, RA, CA > &A, const Eigen::Matrix< double, RB, CB > &B)
Definition: quad_form_sym.hpp:14
stan::math::check_symmetric
bool check_symmetric(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is symmetric.
Definition: check_symmetric.hpp:37
quad_form.hpp
quad_form.hpp
stan::math::check_square
bool check_square(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is square.
Definition: check_square.hpp:28
typedefs.hpp
check_square.hpp

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