1 #ifndef STAN_MATH_PRIM_FUN_EIGENVALUES_HPP
2 #define STAN_MATH_PRIM_FUN_EIGENVALUES_HPP
3
4 #include <stan/math/prim/fun/Eigen.hpp>
5 #include <stan/math/prim/err.hpp>
6
7 namespace stan {
8 namespace math {
9
10 template <typename T>
eigenvalues(const Eigen::Matrix<T,-1,-1> & m)11 Eigen::Matrix<std::complex<T>, -1, 1> eigenvalues(
12 const Eigen::Matrix<T, -1, -1>& m) {
13 check_nonzero_size("eigenvalues", "m", m);
14 check_square("eigenvalues", "m", m);
15
16 Eigen::EigenSolver<Eigen::Matrix<T, -1, -1>> solver(m);
17 return solver.eigenvalues();
18 }
19
20 } // namespace math
21 } // namespace stan
22 #endif
23