Automatic Differentiation
 
Loading...
Searching...
No Matches
svd_U.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_SVD_U_HPP
2#define STAN_MATH_PRIM_FUN_SVD_U_HPP
3
6
7namespace stan {
8namespace math {
9
17template <typename EigMat, require_eigen_matrix_dynamic_t<EigMat>* = nullptr,
18 require_not_st_var<EigMat>* = nullptr>
19Eigen::Matrix<value_type_t<EigMat>, Eigen::Dynamic, Eigen::Dynamic> svd_U(
20 const EigMat& m) {
21 using MatType
22 = Eigen::Matrix<value_type_t<EigMat>, Eigen::Dynamic, Eigen::Dynamic>;
23 if (unlikely(m.size() == 0)) {
24 return MatType(0, 0);
25 }
26 return Eigen::JacobiSVD<MatType>(m, Eigen::ComputeThinU).matrixU();
27}
28
29} // namespace math
30} // namespace stan
31
32#endif
#define unlikely(x)
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > svd_U(const EigMat &m)
Given input matrix m, return matrix U where m = UDV^{T}
Definition svd_U.hpp:19
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...