1#ifndef STAN_MATH_PRIM_FUN_EIGENDECOMPOSE_HPP
2#define STAN_MATH_PRIM_FUN_EIGENDECOMPOSE_HPP
20template <
typename EigMat, require_eigen_matrix_dynamic_t<EigMat>* =
nullptr,
21 require_not_vt_complex<EigMat>* =
nullptr>
22inline std::tuple<Eigen::Matrix<complex_return_t<value_type_t<EigMat>>, -1, -1>,
23 Eigen::Matrix<complex_return_t<value_type_t<EigMat>>, -1, 1>>
26 return std::make_tuple(
33 const PlainMat& m_eval = m;
35 Eigen::EigenSolver<PlainMat> solver(m_eval);
36 return std::make_tuple(std::move(solver.eigenvectors()),
37 std::move(solver.eigenvalues()));
50template <
typename EigCplxMat,
53 Eigen::Matrix<complex_return_t<value_type_t<EigCplxMat>>, -1, -1>,
54 Eigen::Matrix<complex_return_t<value_type_t<EigCplxMat>>, -1, 1>>
57 return std::make_tuple(
63 using PlainMat = Eigen::Matrix<scalar_type_t<EigCplxMat>, -1, -1>;
64 const PlainMat& m_eval = m;
66 Eigen::ComplexEigenSolver<PlainMat> solver(m_eval);
68 return std::make_tuple(std::move(solver.eigenvectors()),
69 std::move(solver.eigenvalues()));
require_t< container_type_check_base< is_eigen_matrix_dynamic, value_type_t, TypeCheck, Check... > > require_eigen_matrix_dynamic_vt
Require type satisfies is_eigen_matrix_dynamic.
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
std::complex< real_return_t< Ts... > > complex_return_t
Convenience type to calculate the complex return type, which wraps std::complex around the return typ...
void check_square(const char *function, const char *name, const T_y &y)
Check if the specified matrix is square.
std::tuple< Eigen::Matrix< complex_return_t< value_type_t< EigMat > >, -1, -1 >, Eigen::Matrix< complex_return_t< value_type_t< EigMat > >, -1, 1 > > eigendecompose(const EigMat &m)
Return the eigendecomposition of a (real-valued) matrix.
typename plain_type< T >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...