mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-23 10:09:36 +08:00
Update HouseholderSequence.h
This commit is contained in:
parent
fc1d888415
commit
a4bb513b99
@ -87,7 +87,7 @@ void make_block_householder_triangular_factor(TriangularFactorType& triFactor, c
|
|||||||
template<typename MatrixType,typename VectorsType,typename CoeffsType>
|
template<typename MatrixType,typename VectorsType,typename CoeffsType>
|
||||||
void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs, bool forward)
|
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();
|
Index nbVecs = vectors.cols();
|
||||||
Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize, RowMajor> T(nbVecs,nbVecs);
|
Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize, RowMajor> T(nbVecs,nbVecs);
|
||||||
|
|
||||||
|
@ -391,15 +391,19 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
|
|||||||
Side==OnTheRight ? m_vectors.cols()-start : bs);
|
Side==OnTheRight ? m_vectors.cols()-start : bs);
|
||||||
std::conditional_t<Side==OnTheRight, Transpose<SubVectorsType>, SubVectorsType&> sub_vecs(sub_vecs1);
|
std::conditional_t<Side==OnTheRight, Transpose<SubVectorsType>, SubVectorsType&> sub_vecs(sub_vecs1);
|
||||||
|
|
||||||
Index dstStart = dst.rows()-rows()+m_shift+k;
|
|
||||||
Index dstRows = rows()-m_shift-k;
|
Index dstRows = rows()-m_shift-k;
|
||||||
Block<Dest,Dynamic,Dynamic> sub_dst(dst,
|
|
||||||
dstStart,
|
if (inputIsIdentity)
|
||||||
inputIsIdentity ? dstStart : 0,
|
{
|
||||||
dstRows,
|
Block<Dest, Dynamic, Dynamic> sub_dst = dst.bottomRightCorner(dstRows, dstRows);
|
||||||
inputIsIdentity ? dstRows : dst.cols());
|
|
||||||
apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_reverse);
|
apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_reverse);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Block<Dest, Dynamic, Dest::ColsAtCompileTime> sub_dst = dst.bottomRows(dstRows);
|
||||||
|
apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_reverse);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -407,9 +411,18 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
|
|||||||
for(Index k = 0; k < m_length; ++k)
|
for(Index k = 0; k < m_length; ++k)
|
||||||
{
|
{
|
||||||
Index actual_k = m_reverse ? k : m_length-k-1;
|
Index actual_k = m_reverse ? k : m_length-k-1;
|
||||||
Index dstStart = rows()-m_shift-actual_k;
|
Index dstRows = rows()-m_shift-actual_k;
|
||||||
dst.template bottomRightCorner<Dynamic, Dest::ColsAtCompileTime>(dstStart, inputIsIdentity ? dstStart : dst.cols())
|
|
||||||
.applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
|
if (inputIsIdentity)
|
||||||
|
{
|
||||||
|
Block<Dest, Dynamic, Dynamic> sub_dst = dst.bottomRightCorner(dstRows, dstRows);
|
||||||
|
sub_dst.applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Block<Dest, Dynamic, Dest::ColsAtCompileTime> sub_dst = dst.bottomRows(dstRows);
|
||||||
|
sub_dst.applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user