1#ifndef STAN_MATH_PRIM_FUN_QR_THIN_Q_HPP
2#define STAN_MATH_PRIM_FUN_QR_THIN_Q_HPP
18template <
typename EigMat, require_eigen_t<EigMat>* =
nullptr>
19Eigen::Matrix<value_type_t<EigMat>, Eigen::Dynamic, Eigen::Dynamic>
qr_thin_Q(
22 = Eigen::Matrix<value_type_t<EigMat>, Eigen::Dynamic, Eigen::Dynamic>;
24 return matrix_t(0, 0);
26 Eigen::HouseholderQR<matrix_t>
qr(m.rows(), m.cols());
28 const int min_size = std::min(m.rows(), m.cols());
29 matrix_t Q =
qr.householderQ() * matrix_t::Identity(m.rows(), min_size);
30 for (
int i = 0; i < min_size; i++) {
31 if (
qr.matrixQR().coeff(i, i) < 0) {
matrix_cl< double > qr_thin_Q(T_m &&m)
Returns the orthogonal factor of the fat QR decomposition.
std::tuple< Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic >, Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > > qr(const EigMat &m)
Returns the fat QR decomposition.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...