diff --git a/Eigen/src/Eigenvalues/HessenbergDecomposition.h b/Eigen/src/Eigenvalues/HessenbergDecomposition.h index afa636ffa..3db0c0106 100644 --- a/Eigen/src/Eigenvalues/HessenbergDecomposition.h +++ b/Eigen/src/Eigenvalues/HessenbergDecomposition.h @@ -82,7 +82,7 @@ template class HessenbergDecomposition typedef Matrix CoeffVectorType; /** \brief Return type of matrixQ() */ - typedef typename HouseholderSequence::ConjugateReturnType HouseholderSequenceType; + typedef HouseholderSequence::type> HouseholderSequenceType; typedef internal::HessenbergDecompositionMatrixHReturnType MatrixHReturnType; diff --git a/Eigen/src/Eigenvalues/Tridiagonalization.h b/Eigen/src/Eigenvalues/Tridiagonalization.h index b55a01d3a..192278d68 100644 --- a/Eigen/src/Eigenvalues/Tridiagonalization.h +++ b/Eigen/src/Eigenvalues/Tridiagonalization.h @@ -96,7 +96,7 @@ template class Tridiagonalization >::type SubDiagonalReturnType; /** \brief Return type of matrixQ() */ - typedef typename HouseholderSequence::ConjugateReturnType HouseholderSequenceType; + typedef HouseholderSequence::type> HouseholderSequenceType; /** \brief Default constructor. * diff --git a/Eigen/src/Householder/HouseholderSequence.h b/Eigen/src/Householder/HouseholderSequence.h index 0de2a0084..d800ca1fa 100644 --- a/Eigen/src/Householder/HouseholderSequence.h +++ b/Eigen/src/Householder/HouseholderSequence.h @@ -125,7 +125,9 @@ template class HouseholderS typedef typename VectorsType::Index Index; typedef HouseholderSequence< - VectorsType, + typename internal::conditional::IsComplex, + typename internal::remove_all::type, + VectorsType>::type, typename internal::conditional::IsComplex, typename internal::remove_all::type, CoeffsType>::type, @@ -206,7 +208,7 @@ template class HouseholderS /** \brief Complex conjugate of the Householder sequence. */ ConjugateReturnType conjugate() const { - return ConjugateReturnType(m_vectors, m_coeffs.conjugate()) + return ConjugateReturnType(m_vectors.conjugate(), m_coeffs.conjugate()) .setTrans(m_trans) .setLength(m_length) .setShift(m_shift); diff --git a/Eigen/src/QR/ColPivHouseholderQR.h b/Eigen/src/QR/ColPivHouseholderQR.h index 7d475b936..8a7c9b9e2 100644 --- a/Eigen/src/QR/ColPivHouseholderQR.h +++ b/Eigen/src/QR/ColPivHouseholderQR.h @@ -55,7 +55,7 @@ template class ColPivHouseholderQR typedef typename internal::plain_row_type::type IntRowVectorType; typedef typename internal::plain_row_type::type RowVectorType; typedef typename internal::plain_row_type::type RealRowVectorType; - typedef typename HouseholderSequence::ConjugateReturnType HouseholderSequenceType; + typedef HouseholderSequence::type> HouseholderSequenceType; private: diff --git a/Eigen/src/QR/HouseholderQR.h b/Eigen/src/QR/HouseholderQR.h index 5a620f495..abc61bcbb 100644 --- a/Eigen/src/QR/HouseholderQR.h +++ b/Eigen/src/QR/HouseholderQR.h @@ -57,7 +57,7 @@ template class HouseholderQR typedef Matrix MatrixQType; typedef typename internal::plain_diag_type::type HCoeffsType; typedef typename internal::plain_row_type::type RowVectorType; - typedef typename HouseholderSequence::ConjugateReturnType HouseholderSequenceType; + typedef HouseholderSequence::type> HouseholderSequenceType; /** * \brief Default Constructor. diff --git a/Eigen/src/SVD/UpperBidiagonalization.h b/Eigen/src/SVD/UpperBidiagonalization.h index 213b3100d..587de37a5 100644 --- a/Eigen/src/SVD/UpperBidiagonalization.h +++ b/Eigen/src/SVD/UpperBidiagonalization.h @@ -39,7 +39,7 @@ template class UpperBidiagonalization CwiseUnaryOp, const Diagonal > > HouseholderUSequenceType; typedef HouseholderSequence< - const MatrixType, + const typename internal::remove_all::type, Diagonal, OnTheRight > HouseholderVSequenceType; @@ -74,7 +74,7 @@ template class UpperBidiagonalization const HouseholderVSequenceType householderV() // const here gives nasty errors and i'm lazy { eigen_assert(m_isInitialized && "UpperBidiagonalization is not initialized."); - return HouseholderVSequenceType(m_householder, m_householder.const_derived().template diagonal<1>()) + return HouseholderVSequenceType(m_householder.conjugate(), m_householder.const_derived().template diagonal<1>()) .setLength(m_householder.cols()-1) .setShift(1); } diff --git a/test/householder.cpp b/test/householder.cpp index d10cadd6c..c5f6b5e4f 100644 --- a/test/householder.cpp +++ b/test/householder.cpp @@ -89,12 +89,29 @@ template void householder(const MatrixType& m) hseq.setLength(hc.size()).setShift(shift); VERIFY(hseq.length() == hc.size()); VERIFY(hseq.shift() == shift); - + MatrixType m5 = m2; m5.block(shift,0,brows,cols).template triangularView().setZero(); VERIFY_IS_APPROX(hseq * m5, m1); // test applying hseq directly m3 = hseq; VERIFY_IS_APPROX(m3 * m5, m1); // test evaluating hseq to a dense matrix, then applying + + SquareMatrixType hseq_mat = hseq; + SquareMatrixType hseq_mat_conj = hseq.conjugate(); + SquareMatrixType hseq_mat_adj = hseq.adjoint(); + SquareMatrixType hseq_mat_trans = hseq.transpose(); + SquareMatrixType m6 = SquareMatrixType::Random(rows, rows); + VERIFY_IS_APPROX(hseq_mat.adjoint(), hseq_mat_adj); + VERIFY_IS_APPROX(hseq_mat.conjugate(), hseq_mat_conj); + VERIFY_IS_APPROX(hseq_mat.transpose(), hseq_mat_trans); + VERIFY_IS_APPROX(hseq_mat * m6, hseq_mat * m6); + VERIFY_IS_APPROX(hseq_mat.adjoint() * m6, hseq_mat_adj * m6); + VERIFY_IS_APPROX(hseq_mat.conjugate() * m6, hseq_mat_conj * m6); + VERIFY_IS_APPROX(hseq_mat.transpose() * m6, hseq_mat_trans * m6); + VERIFY_IS_APPROX(m6 * hseq_mat, m6 * hseq_mat); + VERIFY_IS_APPROX(m6 * hseq_mat.adjoint(), m6 * hseq_mat_adj); + VERIFY_IS_APPROX(m6 * hseq_mat.conjugate(), m6 * hseq_mat_conj); + VERIFY_IS_APPROX(m6 * hseq_mat.transpose(), m6 * hseq_mat_trans); // test householder sequence on the right with a shift diff --git a/test/upperbidiagonalization.cpp b/test/upperbidiagonalization.cpp index 5897cffab..d15bf588b 100644 --- a/test/upperbidiagonalization.cpp +++ b/test/upperbidiagonalization.cpp @@ -16,6 +16,7 @@ template void upperbidiag(const MatrixType& m) const typename MatrixType::Index cols = m.cols(); typedef Matrix RealMatrixType; + typedef Matrix TransposeMatrixType; MatrixType a = MatrixType::Random(rows,cols); internal::UpperBidiagonalization ubd(a); @@ -24,6 +25,8 @@ template void upperbidiag(const MatrixType& m) b.block(0,0,cols,cols) = ubd.bidiagonal(); MatrixType c = ubd.householderU() * b * ubd.householderV().adjoint(); VERIFY_IS_APPROX(a,c); + TransposeMatrixType d = ubd.householderV() * b.adjoint() * ubd.householderU().adjoint(); + VERIFY_IS_APPROX(a.adjoint(),d); } void test_upperbidiagonalization()