Make HouseholderSequence::setTrans() protected (cf. bug #50).

Users can call .transpose() instead.
This commit is contained in:
Jitse Niesen 2011-01-06 11:30:19 +00:00
parent 934720c4ba
commit 2cc75f4922
3 changed files with 18 additions and 17 deletions

View File

@ -341,20 +341,6 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
template<typename _VectorsType, typename _CoeffsType, int _Side> friend struct internal::hseq_side_dependent_impl;
/** \brief Sets the transpose flag.
* \param [in] trans New value of the transpose 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$.
*
* \sa trans()
*/
HouseholderSequence& setTrans(bool trans)
{
m_trans = trans;
return *this;
}
/** \brief Sets the length of the Householder sequence.
* \param [in] length New value for the length.
*
@ -387,11 +373,27 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
return *this;
}
bool trans() const { return m_trans; } /**< \brief Returns the transpose flag. */
Index length() const { return m_length; } /**< \brief Returns the length of the Householder sequence. */
Index shift() const { return m_shift; } /**< \brief Returns the shift of the Householder sequence. */
protected:
/** \brief Sets the transpose flag.
* \param [in] trans New value of the transpose 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$.
*
* \sa trans()
*/
HouseholderSequence& setTrans(bool trans)
{
m_trans = trans;
return *this;
}
bool trans() const { return m_trans; } /**< \brief Returns the transpose flag. */
typename VectorsType::Nested m_vectors;
typename CoeffsType::Nested m_coeffs;
bool m_trans;

View File

@ -484,8 +484,8 @@ struct solve_retval<ColPivHouseholderQR<_MatrixType>, Rhs>
// Note that the matrix Q = H_0^* H_1^*... so its inverse is Q^* = (H_0 H_1 ...)^T
c.applyOnTheLeft(householderSequence(dec().matrixQR(), dec().hCoeffs())
.setTrans(true)
.setLength(dec().nonzeroPivots())
.transpose()
);
dec().matrixQR()

View File

@ -104,7 +104,6 @@ template<typename MatrixType> void householder(const MatrixType& m)
HCoeffsVectorType hc = qr.hCoeffs().conjugate();
HouseholderSequence<MatrixType, HCoeffsVectorType> hseq(m2, hc);
hseq.setLength(hc.size()).setShift(shift);
VERIFY(hseq.trans() == false);
VERIFY(hseq.length() == hc.size());
VERIFY(hseq.shift() == shift);