Stan Math Library  2.8.0
reverse mode automatic differentiation
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
eigenvalues_sym.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_EIGENVALUES_SYM_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_EIGENVALUES_SYM_HPP
3 
7 
8 namespace stan {
9  namespace math {
10 
20  template <typename T>
21  Eigen::Matrix<T, Eigen::Dynamic, 1>
22  eigenvalues_sym(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& m) {
23  stan::math::check_nonzero_size("eigenvalues_sym", "m", m);
24  stan::math::check_symmetric("eigenvalues_sym", "m", m);
25 
26  Eigen::SelfAdjointEigenSolver
27  <Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> >
28  solver(m, Eigen::EigenvaluesOnly);
29  return solver.eigenvalues();
30  }
31 
32  }
33 }
34 #endif
bool check_symmetric(const char *function, const char *name, const Eigen::Matrix< T_y, Dynamic, Dynamic > &y)
Return true if the specified matrix is symmetric.
bool check_nonzero_size(const char *function, const char *name, const T_y &y)
Return true if the specified matrix/vector is of non-zero size.
Eigen::Matrix< T, Eigen::Dynamic, 1 > eigenvalues_sym(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
Return the eigenvalues of the specified symmetric matrix in descending order of magnitude.

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