Automatic Differentiation
 
Loading...
Searching...
No Matches
eigenvectors_sym.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_EIGENVECTORS_SYM_HPP
2#define STAN_MATH_PRIM_FUN_EIGENVECTORS_SYM_HPP
3
7
8namespace stan {
9namespace math {
10
11template <typename EigMat, require_eigen_t<EigMat>* = nullptr,
12 require_not_st_var<EigMat>* = nullptr>
13Eigen::Matrix<value_type_t<EigMat>, Eigen::Dynamic, Eigen::Dynamic>
14eigenvectors_sym(const EigMat& m) {
15 if (unlikely(m.size() == 0)) {
16 return Eigen::Matrix<value_type_t<EigMat>, -1, -1>(0, 0);
17 }
18 using PlainMat = plain_type_t<EigMat>;
19 const PlainMat& m_eval = m;
20 check_symmetric("eigenvalues_sym", "m", m_eval);
21
22 Eigen::SelfAdjointEigenSolver<PlainMat> solver(m_eval);
23 return solver.eigenvectors();
24}
25
26} // namespace math
27} // namespace stan
28#endif
#define unlikely(x)
void check_symmetric(const char *function, const char *name, const matrix_cl< T > &y)
Check if the matrix_cl is symmetric.
matrix_cl< double > eigenvectors_sym(const matrix_cl< double > &m)
typename plain_type< T >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...