Automatic Differentiation
 
Loading...
Searching...
No Matches
singular_values.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_SINGULAR_VALUES_HPP
2#define STAN_MATH_PRIM_FUN_SINGULAR_VALUES_HPP
3
7
8namespace stan {
9namespace math {
10
21template <typename EigMat, require_eigen_matrix_dynamic_t<EigMat>* = nullptr,
22 require_not_st_var<EigMat>* = nullptr>
23auto singular_values(const EigMat& m) {
24 if (unlikely(m.size() == 0)) {
25 return Eigen::Matrix<base_type_t<EigMat>, Eigen::Dynamic, 1>(0, 1);
26 }
27 return Eigen::JacobiSVD<Eigen::Matrix<value_type_t<EigMat>, Eigen::Dynamic,
28 Eigen::Dynamic> >(m)
29 .singularValues();
30}
31
32} // namespace math
33} // namespace stan
34
35#endif
#define unlikely(x)
auto singular_values(const EigMat &m)
Return the vector of the singular values of the specified matrix in decreasing order of magnitude.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...