mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
bug #1493: Make representation of HouseholderSequence consistent and working for complex numbers. Made corresponding unit test actually test that. Also simplify implementation of QR decompositions
This commit is contained in:
@@ -595,11 +595,7 @@ void ColPivHouseholderQR<_MatrixType>::_solve_impl(const RhsType &rhs, DstType &
|
||||
|
||||
typename RhsType::PlainObject c(rhs);
|
||||
|
||||
// Note that the matrix Q = H_0^* H_1^*... so its inverse is Q^* = (H_0 H_1 ...)^T
|
||||
c.applyOnTheLeft(householderSequence(m_qr, m_hCoeffs)
|
||||
.setLength(nonzero_pivots)
|
||||
.transpose()
|
||||
);
|
||||
c.applyOnTheLeft(householderQ().setLength(nonzero_pivots).adjoint() );
|
||||
|
||||
m_qr.topLeftCorner(nonzero_pivots, nonzero_pivots)
|
||||
.template triangularView<Upper>()
|
||||
|
||||
@@ -452,7 +452,7 @@ void CompleteOrthogonalDecomposition<MatrixType>::computeInPlace()
|
||||
// Apply Z(k) to the first k rows of X_k
|
||||
m_cpqr.m_qr.topRightCorner(k, cols - rank + 1)
|
||||
.applyHouseholderOnTheRight(
|
||||
m_cpqr.m_qr.row(k).tail(cols - rank).transpose(), m_zCoeffs(k),
|
||||
m_cpqr.m_qr.row(k).tail(cols - rank).adjoint(), m_zCoeffs(k),
|
||||
&m_temp(0));
|
||||
}
|
||||
if (k != rank - 1) {
|
||||
@@ -500,11 +500,8 @@ void CompleteOrthogonalDecomposition<_MatrixType>::_solve_impl(
|
||||
}
|
||||
|
||||
// Compute c = Q^* * rhs
|
||||
// Note that the matrix Q = H_0^* H_1^*... so its inverse is
|
||||
// Q^* = (H_0 H_1 ...)^T
|
||||
typename RhsType::PlainObject c(rhs);
|
||||
c.applyOnTheLeft(
|
||||
householderSequence(matrixQTZ(), hCoeffs()).setLength(rank).transpose());
|
||||
c.applyOnTheLeft(matrixQ().setLength(rank).adjoint());
|
||||
|
||||
// Solve T z = c(1:rank, :)
|
||||
dst.topRows(rank) = matrixT()
|
||||
|
||||
@@ -353,11 +353,7 @@ void HouseholderQR<_MatrixType>::_solve_impl(const RhsType &rhs, DstType &dst) c
|
||||
|
||||
typename RhsType::PlainObject c(rhs);
|
||||
|
||||
// Note that the matrix Q = H_0^* H_1^*... so its inverse is Q^* = (H_0 H_1 ...)^T
|
||||
c.applyOnTheLeft(householderSequence(
|
||||
m_qr.leftCols(rank),
|
||||
m_hCoeffs.head(rank)).transpose()
|
||||
);
|
||||
c.applyOnTheLeft(householderQ().setLength(rank).adjoint() );
|
||||
|
||||
m_qr.topLeftCorner(rank, rank)
|
||||
.template triangularView<Upper>()
|
||||
|
||||
Reference in New Issue
Block a user