Stan Math Library  2.12.0
reverse mode automatic differentiation
log_determinant.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_FWD_MAT_FUN_LOG_DETERMINANT_HPP
2 #define STAN_MATH_FWD_MAT_FUN_LOG_DETERMINANT_HPP
3 
5 #include <stan/math/fwd/core.hpp>
11 #include <boost/math/tools/promotion.hpp>
12 #include <vector>
13 
14 namespace stan {
15  namespace math {
16 
17  template<typename T, int R, int C>
18  inline
19  fvar<T>
20  log_determinant(const Eigen::Matrix<fvar<T>, R, C>& m) {
21  check_square("log_determinant", "m", m);
22 
23  return log(fabs(determinant(m)));
24  }
25 
26  }
27 }
28 #endif
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:14
fvar< T > log_determinant(const Eigen::Matrix< fvar< T >, R, C > &m)
fvar< T > determinant(const Eigen::Matrix< fvar< T >, R, C > &m)
Definition: determinant.hpp:21
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.

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