69 typedef typename MatrixType::Scalar
Scalar;
71 typedef typename MatrixType::Index
Index;
73 typedef typename internal::plain_diag_type<MatrixType>::type
HCoeffsType;
74 typedef typename internal::plain_row_type<MatrixType>::type
RowVectorType;
123 template<
typename Rhs>
124 inline const internal::solve_retval<HouseholderQR, Rhs>
128 return internal::solve_retval<HouseholderQR, Rhs>(*
this, b.derived());
188 template<
typename MatrixType>
191 eigen_assert(m_isInitialized &&
"HouseholderQR is not initialized.");
192 eigen_assert(m_qr.rows() == m_qr.cols() &&
"You can't take the determinant of a non-square matrix!");
196 template<
typename MatrixType>
199 eigen_assert(m_isInitialized &&
"HouseholderQR is not initialized.");
200 eigen_assert(m_qr.rows() == m_qr.cols() &&
"You can't take the determinant of a non-square matrix!");
201 return m_qr.diagonal().cwiseAbs().array().log().sum();
207 template<
typename MatrixQR,
typename HCoeffs>
210 typedef typename MatrixQR::Index Index;
211 typedef typename MatrixQR::Scalar Scalar;
212 typedef typename MatrixQR::RealScalar RealScalar;
213 Index rows = mat.rows();
214 Index cols = mat.cols();
215 Index size = (std::min)(rows,cols);
224 tempData = tempVector.data();
227 for(Index k = 0; k < size; ++k)
229 Index remainingRows = rows - k;
230 Index remainingCols = cols - k - 1;
233 mat.col(k).tail(remainingRows).makeHouseholderInPlace(hCoeffs.coeffRef(k), beta);
234 mat.coeffRef(k,k) = beta;
237 mat.bottomRightCorner(remainingRows, remainingCols)
238 .applyHouseholderOnTheLeft(mat.col(k).tail(remainingRows-1), hCoeffs.coeffRef(k), tempData+k+1);
243 template<
typename MatrixQR,
typename HCoeffs>
245 typename MatrixQR::Index maxBlockSize=32,
246 typename MatrixQR::Scalar* tempData = 0)
248 typedef typename MatrixQR::Index Index;
249 typedef typename MatrixQR::Scalar Scalar;
250 typedef typename MatrixQR::RealScalar RealScalar;
253 Index rows = mat.
rows();
254 Index cols = mat.cols();
255 Index size = (std::min)(rows, cols);
262 tempData = tempVector.data();
265 Index blockSize = (std::min)(maxBlockSize,size);
268 for (k = 0; k < size; k += blockSize)
270 Index bs = (std::min)(size-k,blockSize);
271 Index tcols = cols - k - bs;
272 Index brows = rows-k;
282 BlockType A11_21 = mat.block(k,k,brows,bs);
289 BlockType A21_22 = mat.block(k,k+bs,brows,tcols);
295 template<
typename _MatrixType,
typename Rhs>
297 : solve_retval_base<HouseholderQR<_MatrixType>, Rhs>
301 template<typename Dest>
void evalTo(Dest& dst)
const
303 const Index rows = dec().rows(), cols = dec().cols();
304 const Index rank = (std::min)(rows, cols);
307 typename Rhs::PlainObject c(rhs());
312 dec().hCoeffs().head(rank)).transpose()
316 .topLeftCorner(rank, rank)
317 .template triangularView<Upper>()
318 .solveInPlace(c.topRows(rank));
320 dst.topRows(rank) = c.topRows(rank);
321 dst.bottomRows(cols-rank).setZero();
327 template<
typename MatrixType>
331 Index cols = matrix.cols();
332 Index size = (std::min)(rows,cols);
335 m_hCoeffs.resize(size);
341 m_isInitialized =
true;
349 template<
typename Derived>