Stan Math Library  2.14.0
reverse mode automatic differentiation
trace.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_TRACE_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_TRACE_HPP
3 
5 
6 namespace stan {
7  namespace math {
8 
18  template <typename T>
19  inline T trace(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& m) {
20  return m.trace();
21  }
22 
23  template <typename T>
24  inline T
25  trace(const T& m) {
26  return m;
27  }
28  }
29 }
30 #endif
T trace(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
Returns the trace of the specified matrix.
Definition: trace.hpp:19

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