diff --git a/Eigen/src/Householder/BlockHouseholder.h b/Eigen/src/Householder/BlockHouseholder.h index 9dec1aaa6..a5c809544 100644 --- a/Eigen/src/Householder/BlockHouseholder.h +++ b/Eigen/src/Householder/BlockHouseholder.h @@ -87,7 +87,7 @@ void make_block_householder_triangular_factor(TriangularFactorType& triFactor, c template void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs, bool forward) { - enum { TFactorSize = MatrixType::ColsAtCompileTime }; + enum { TFactorSize = VectorsType::ColsAtCompileTime }; Index nbVecs = vectors.cols(); Matrix T(nbVecs,nbVecs); diff --git a/Eigen/src/Householder/HouseholderSequence.h b/Eigen/src/Householder/HouseholderSequence.h index 73d7495a0..dee7ae70b 100644 --- a/Eigen/src/Householder/HouseholderSequence.h +++ b/Eigen/src/Householder/HouseholderSequence.h @@ -391,14 +391,18 @@ template class HouseholderS Side==OnTheRight ? m_vectors.cols()-start : bs); std::conditional_t, SubVectorsType&> sub_vecs(sub_vecs1); - Index dstStart = dst.rows()-rows()+m_shift+k; Index dstRows = rows()-m_shift-k; - Block sub_dst(dst, - dstStart, - inputIsIdentity ? dstStart : 0, - dstRows, - inputIsIdentity ? dstRows : dst.cols()); - apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_reverse); + + if (inputIsIdentity) + { + Block sub_dst = dst.bottomRightCorner(dstRows, dstRows); + apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_reverse); + } + else + { + Block sub_dst = dst.bottomRows(dstRows); + apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_reverse); + } } } else @@ -407,9 +411,18 @@ template class HouseholderS for(Index k = 0; k < m_length; ++k) { Index actual_k = m_reverse ? k : m_length-k-1; - Index dstStart = rows()-m_shift-actual_k; - dst.template bottomRightCorner(dstStart, inputIsIdentity ? dstStart : dst.cols()) - .applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data()); + Index dstRows = rows()-m_shift-actual_k; + + if (inputIsIdentity) + { + Block sub_dst = dst.bottomRightCorner(dstRows, dstRows); + sub_dst.applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data()); + } + else + { + Block sub_dst = dst.bottomRows(dstRows); + sub_dst.applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data()); + } } } }