Stan Math Library  2.20.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 
4 #include <stan/math/rev/meta.hpp>
6 #include <stan/math/rev/core.hpp>
10 #include <type_traits>
11 
12 namespace stan {
13 namespace math {
14 
20 template <typename T1, int R1, int C1, typename T2, int R2, int C2, typename T3,
21  int R3, int C3>
22 inline
23  typename std::enable_if<stan::is_var<T1>::value || stan::is_var<T2>::value
25  var>::type
26  trace_gen_inv_quad_form_ldlt(const Eigen::Matrix<T1, R1, C1> &D,
27  const LDLT_factor<T2, R2, C2> &A,
28  const Eigen::Matrix<T3, R3, C3> &B) {
29  check_square("trace_gen_inv_quad_form_ldlt", "D", D);
30  check_multiplicable("trace_gen_inv_quad_form_ldlt", "A", A, "B", B);
31  check_multiplicable("trace_gen_inv_quad_form_ldlt", "B", B, "D", D);
32 
35  D, A, B);
36 
37  return var(
39  _impl));
40 }
41 
42 } // namespace math
43 } // namespace stan
44 #endif
Defines a public enum named value which is defined to be false as the primitive scalar types cannot b...
Definition: is_var.hpp:10
void check_square(const char *function, const char *name, const matrix_cl &y)
Check if the matrix_cl is square.
std::enable_if< !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 LDLT_factor< T2, R2, C2 > &A, const Eigen::Matrix< T3, R3, C3 > &B)
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:33
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.

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