Stan Math Library: stan/math/prim/mat/fun/trace.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5
6
7 namespace stan {
8 namespace math {
9
19 template <typename T>
20 inline T trace(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& m) {
21 return m.trace();
22 }
23
24 template <typename T>
25 inline T
26 trace(const T& m) {
27 return m;
28 }
29 }
30 }
31 #endif
stan
Definition: log_sum_exp.hpp:8
Eigen.hpp
stan::math::trace
T trace(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
Returns the trace of the specified matrix.
Definition: trace.hpp:20

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