42 template<
typename _MatrixType>
class HouseholderQR
54 typedef typename MatrixType::Scalar
Scalar;
56 typedef typename MatrixType::Index
Index;
120 template<
typename Rhs>
198 template<
typename MatrixType>
203 eigen_assert(
m_qr.rows() ==
m_qr.cols() &&
"You can't take the determinant of a non-square matrix!");
204 return abs(
m_qr.diagonal().prod());
207 template<
typename MatrixType>
211 eigen_assert(
m_qr.rows() ==
m_qr.cols() &&
"You can't take the determinant of a non-square matrix!");
212 return m_qr.diagonal().cwiseAbs().array().log().sum();
218 template<
typename MatrixQR,
typename HCoeffs>
221 typedef typename MatrixQR::Index
Index;
222 typedef typename MatrixQR::Scalar
Scalar;
223 typedef typename MatrixQR::RealScalar
RealScalar;
224 Index
rows = mat.rows();
225 Index
cols = mat.cols();
226 Index size = (std::min)(rows,cols);
235 tempData = tempVector.data();
238 for(Index k = 0; k < size; ++k)
240 Index remainingRows = rows - k;
241 Index remainingCols = cols - k - 1;
244 mat.col(k).tail(remainingRows).makeHouseholderInPlace(hCoeffs.coeffRef(k), beta);
245 mat.coeffRef(k,k) = beta;
248 mat.bottomRightCorner(remainingRows, remainingCols)
249 .applyHouseholderOnTheLeft(mat.col(k).tail(remainingRows-1), hCoeffs.coeffRef(k), tempData+k+1);
254 template<
typename MatrixQR,
typename HCoeffs>
256 typename MatrixQR::Index maxBlockSize=32,
257 typename MatrixQR::Scalar* tempData = 0)
259 typedef typename MatrixQR::Index
Index;
260 typedef typename MatrixQR::Scalar
Scalar;
263 Index
rows = mat.rows();
264 Index
cols = mat.cols();
265 Index size = (std::min)(rows, cols);
272 tempData = tempVector.data();
275 Index blockSize = (std::min)(maxBlockSize,size);
278 for (k = 0; k < size; k += blockSize)
280 Index bs = (std::min)(size-k,blockSize);
281 Index tcols = cols - k - bs;
282 Index brows = rows-k;
292 BlockType A11_21 = mat.block(k,k,brows,bs);
299 BlockType A21_22 = mat.block(k,k+bs,brows,tcols);
305 template<
typename _MatrixType,
typename Rhs>
311 template<typename Dest>
void evalTo(Dest& dst)
const 314 const Index rank = (std::min)(rows,
cols);
317 typename Rhs::PlainObject c(
rhs());
326 .topLeftCorner(rank, rank)
327 .template triangularView<Upper>()
328 .solveInPlace(c.topRows(rank));
330 dst.topRows(rank) = c.topRows(rank);
331 dst.bottomRows(
cols-rank).setZero();
343 template<
typename MatrixType>
348 Index size = (std::min)(rows,cols);
365 template<
typename Derived>
HouseholderQR(const MatrixType &matrix)
Constructs a QR factorization from a given matrix.
HouseholderSequenceType householderQ() const
HouseholderSequence< VectorsType, CoeffsType > householderSequence(const VectorsType &v, const CoeffsType &h)
Convenience function for constructing a Householder sequence.
HouseholderQR(Index rows, Index cols)
Default Constructor with memory preallocation.
void householder_qr_inplace_unblocked(MatrixQR &mat, HCoeffs &hCoeffs, typename MatrixQR::Scalar *tempData=0)
Matrix< Scalar, RowsAtCompileTime, RowsAtCompileTime,(MatrixType::Flags &RowMajorBit)?RowMajor:ColMajor, MaxRowsAtCompileTime, MaxRowsAtCompileTime > MatrixQType
ColsBlockXpr leftCols(Index n)
iterative scaling algorithm to equilibrate rows and column norms in matrices
const HCoeffsType & hCoeffs() const
const internal::solve_retval< HouseholderQR, Rhs > solve(const MatrixBase< Rhs > &b) const
Sequence of Householder reflections acting on subspaces with decreasing size.
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > abs() const
void householder_qr_inplace_blocked(MatrixQR &mat, HCoeffs &hCoeffs, typename MatrixQR::Index maxBlockSize=32, typename MatrixQR::Scalar *tempData=0)
MatrixType::RealScalar RealScalar
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
Provides a generic way to set and pass user-specified options.
internal::plain_row_type< MatrixType >::type RowVectorType
void rhs(const real_t *x, real_t *f)
SegmentReturnType head(Index vecSize)
void apply_block_householder_on_the_left(MatrixType &mat, const VectorsType &vectors, const CoeffsType &hCoeffs)
Expression of a fixed-size or dynamic-size block.
Householder QR decomposition of a matrix.
internal::plain_diag_type< MatrixType >::type HCoeffsType
#define EIGEN_MAKE_SOLVE_HELPERS(DecompositionType, Rhs)
HouseholderQR & compute(const MatrixType &matrix)
MatrixType::RealScalar logAbsDeterminant() const
HouseholderQR()
Default Constructor.
The matrix class, also used for vectors and row-vectors.
HouseholderSequence< MatrixType, typename internal::remove_all< typename HCoeffsType::ConjugateReturnType >::type > HouseholderSequenceType
Base class for all dense matrices, vectors, and expressions.
MatrixType::RealScalar absDeterminant() const
const HouseholderQR< PlainObject > householderQr() const
MatrixType::Scalar Scalar
const MatrixType & matrixQR() const