Stan Math Library  2.9.0
reverse mode automatic differentiation
trace_gen_inv_quad_form_ldlt.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_MAT_FUN_TRACE_GEN_INV_QUAD_FORM_LDLT_HPP
2 #define STAN_MATH_REV_MAT_FUN_TRACE_GEN_INV_QUAD_FORM_LDLT_HPP
3 
5 #include <stan/math/rev/core.hpp>
8 #include <boost/utility/enable_if.hpp>
12 
13 namespace stan {
14  namespace math {
15 
21  template <typename T1, int R1, int C1, typename T2, int R2, int C2,
22  typename T3, int R3, int C3>
23  inline typename
24  boost::enable_if_c<stan::is_var<T1>::value ||
26  stan::is_var<T3>::value, var>::type
27  trace_gen_inv_quad_form_ldlt(const Eigen::Matrix<T1, R1, C1> &D,
29  const Eigen::Matrix<T3, R3, C3> &B) {
30  stan::math::check_square("trace_gen_inv_quad_form_ldlt", "D", D);
31  stan::math::check_multiplicable("trace_gen_inv_quad_form_ldlt",
32  "A", A,
33  "B", B);
34  stan::math::check_multiplicable("trace_gen_inv_quad_form_ldlt",
35  "B", B,
36  "D", D);
37 
38  trace_inv_quad_form_ldlt_impl<T2, R2, C2, T3, R3, C3> *_impl
39  = new trace_inv_quad_form_ldlt_impl<T2, R2, C2, T3, R3, C3>(D, A, B);
40 
41  return var(new trace_inv_quad_form_ldlt_vari<T2, R2, C2, T3, R3, C3>
42  (_impl));
43  }
44 
45 
46  }
47 }
48 
49 #endif
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:31
boost::enable_if_c<!stan::is_var< T1 >::value &&!stan::is_var< T2 >::value &&!stan::is_var< T3 >::value, typename boost::math::tools::promote_args< T1, T2, T3 >::type >::type trace_gen_inv_quad_form_ldlt(const Eigen::Matrix< T1, R1, C1 > &D, const stan::math::LDLT_factor< T2, R2, C2 > &A, const Eigen::Matrix< T3, R3, C3 > &B)
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.
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.
quad_form_vari_alloc< TA, RA, CA, TB, RB, CB > * _impl
Definition: quad_form.hpp:115

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