All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
eigenvalues_sym.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_MAT_FUN_EIGENVALUES_SYM_HPP
#define STAN_MATH_PRIM_MAT_FUN_EIGENVALUES_SYM_HPP
#include <stan/math/prim/scal/err/check_nonzero_size.hpp>
#include <stan/math/prim/mat/err/check_symmetric.hpp>
#include <stan/math/prim/mat/fun/Eigen.hpp>
namespace stan {
namespace math {
template <typename T>
Eigen::Matrix<T, Eigen::Dynamic, 1>
eigenvalues_sym(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& m) {
stan::math::check_nonzero_size("eigenvalues_sym", "m", m);
stan::math::check_symmetric("eigenvalues_sym", "m", m);
Eigen::SelfAdjointEigenSolver
<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> >
solver(m, Eigen::EigenvaluesOnly);
return solver.eigenvalues();
}
}
}
#endif
stan::math::check_symmetric
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.
Definition: check_symmetric.hpp:38
check_symmetric.hpp
stan::math::check_nonzero_size
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.
Definition: check_nonzero_size.hpp:31
Eigen.hpp
stan::math::eigenvalues_sym
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.
Definition: eigenvalues_sym.hpp:22
check_nonzero_size.hpp

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