Renamed .trans() et al. to .reverseFlag() et at. Adapted documentation of .setReverseFlag()

This commit is contained in:
Christoph Hertzberg 2018-04-17 11:30:27 +02:00
parent 39c2cba810
commit 50633d1a83

View File

@ -174,7 +174,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
* \sa setLength(), setShift()
*/
HouseholderSequence(const VectorsType& v, const CoeffsType& h)
: m_vectors(v), m_coeffs(h), m_trans(false), m_length(v.diagonalSize()),
: m_vectors(v), m_coeffs(h), m_reverse(false), m_length(v.diagonalSize()),
m_shift(0)
{
}
@ -183,7 +183,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
HouseholderSequence(const HouseholderSequence& other)
: m_vectors(other.m_vectors),
m_coeffs(other.m_coeffs),
m_trans(other.m_trans),
m_reverse(other.m_reverse),
m_length(other.m_length),
m_shift(other.m_shift)
{
@ -225,7 +225,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
TransposeReturnType transpose() const
{
return TransposeReturnType(m_vectors.conjugate(), m_coeffs)
.setTrans(!m_trans)
.setReverseFlag(!m_reverse)
.setLength(m_length)
.setShift(m_shift);
}
@ -234,7 +234,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
ConjugateReturnType conjugate() const
{
return ConjugateReturnType(m_vectors.conjugate(), m_coeffs.conjugate())
.setTrans(m_trans)
.setReverseFlag(m_reverse)
.setLength(m_length)
.setShift(m_shift);
}
@ -243,7 +243,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
AdjointReturnType adjoint() const
{
return AdjointReturnType(m_vectors, m_coeffs.conjugate())
.setTrans(!m_trans)
.setReverseFlag(!m_reverse)
.setLength(m_length)
.setShift(m_shift);
}
@ -273,7 +273,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
for(Index k = vecs-1; k >= 0; --k)
{
Index cornerSize = rows() - k - m_shift;
if(m_trans)
if(m_reverse)
dst.bottomRightCorner(cornerSize, cornerSize)
.applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), workspace.data());
else
@ -293,7 +293,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
for(Index k = vecs-1; k >= 0; --k)
{
Index cornerSize = rows() - k - m_shift;
if(m_trans)
if(m_reverse)
dst.bottomRightCorner(cornerSize, cornerSize)
.applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), workspace.data());
else
@ -317,7 +317,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
workspace.resize(dst.rows());
for(Index k = 0; k < m_length; ++k)
{
Index actual_k = m_trans ? m_length-k-1 : k;
Index actual_k = m_reverse ? m_length-k-1 : k;
dst.rightCols(rows()-m_shift-actual_k)
.applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
}
@ -340,8 +340,8 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
{
for(Index i = 0; i < m_length; i+=BlockSize)
{
Index end = m_trans ? (std::min)(m_length,i+BlockSize) : m_length-i;
Index k = m_trans ? i : (std::max)(Index(0),end-BlockSize);
Index end = m_reverse ? (std::min)(m_length,i+BlockSize) : m_length-i;
Index k = m_reverse ? i : (std::max)(Index(0),end-BlockSize);
Index bs = end-k;
Index start = k + m_shift;
@ -352,7 +352,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
Side==OnTheRight ? m_vectors.cols()-start : bs);
typename internal::conditional<Side==OnTheRight, Transpose<SubVectorsType>, SubVectorsType&>::type sub_vecs(sub_vecs1);
Block<Dest,Dynamic,Dynamic> sub_dst(dst,dst.rows()-rows()+m_shift+k,0, rows()-m_shift-k,dst.cols());
apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_trans);
apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_reverse);
}
}
else
@ -360,7 +360,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
workspace.resize(dst.cols());
for(Index k = 0; k < m_length; ++k)
{
Index actual_k = m_trans ? k : m_length-k-1;
Index actual_k = m_reverse ? k : m_length-k-1;
dst.bottomRows(rows()-m_shift-actual_k)
.applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
}
@ -425,25 +425,27 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
protected:
/** \brief Sets the transpose flag.
* \param [in] trans New value of the transpose flag.
/** \internal
* \brief Sets the reverse flag.
* \param [in] reverse New value of the reverse flag.
*
* By default, the transpose flag is not set. If the transpose flag is set, then this object represents
* \f$ H^T = H_{n-1}^T \ldots H_1^T H_0^T \f$ instead of \f$ H = H_0 H_1 \ldots H_{n-1} \f$.
* By default, the reverse flag is not set. If the reverse flag is set, then this object represents
* \f$ H^r = H_{n-1} \ldots H_1 H_0 \f$ instead of \f$ H = H_0 H_1 \ldots H_{n-1} \f$.
* \note For real valued HouseholderSequence this is equivalent to transposing \f$ H \f$.
*
* \sa trans()
* \sa reverseFlag(), transpose(), adjoint()
*/
HouseholderSequence& setTrans(bool trans)
HouseholderSequence& setReverseFlag(bool reverse)
{
m_trans = trans;
m_reverse = reverse;
return *this;
}
bool trans() const { return m_trans; } /**< \brief Returns the transpose flag. */
bool reverseFlag() const { return m_reverse; } /**< \internal \brief Returns the reverse flag. */
typename VectorsType::Nested m_vectors;
typename CoeffsType::Nested m_coeffs;
bool m_trans;
bool m_reverse;
Index m_length;
Index m_shift;
};