mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-23 10:09:36 +08:00
Make HouseholderSequence::setTrans() protected (cf. bug #50).
Users can call .transpose() instead.
This commit is contained in:
parent
934720c4ba
commit
2cc75f4922
@ -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;
|
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.
|
/** \brief Sets the length of the Householder sequence.
|
||||||
* \param [in] length New value for the length.
|
* \param [in] length New value for the length.
|
||||||
*
|
*
|
||||||
@ -387,11 +373,27 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
|
|||||||
return *this;
|
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 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. */
|
Index shift() const { return m_shift; } /**< \brief Returns the shift of the Householder sequence. */
|
||||||
|
|
||||||
protected:
|
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 VectorsType::Nested m_vectors;
|
||||||
typename CoeffsType::Nested m_coeffs;
|
typename CoeffsType::Nested m_coeffs;
|
||||||
bool m_trans;
|
bool m_trans;
|
||||||
|
@ -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
|
// 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())
|
c.applyOnTheLeft(householderSequence(dec().matrixQR(), dec().hCoeffs())
|
||||||
.setTrans(true)
|
|
||||||
.setLength(dec().nonzeroPivots())
|
.setLength(dec().nonzeroPivots())
|
||||||
|
.transpose()
|
||||||
);
|
);
|
||||||
|
|
||||||
dec().matrixQR()
|
dec().matrixQR()
|
||||||
|
@ -104,7 +104,6 @@ template<typename MatrixType> void householder(const MatrixType& m)
|
|||||||
HCoeffsVectorType hc = qr.hCoeffs().conjugate();
|
HCoeffsVectorType hc = qr.hCoeffs().conjugate();
|
||||||
HouseholderSequence<MatrixType, HCoeffsVectorType> hseq(m2, hc);
|
HouseholderSequence<MatrixType, HCoeffsVectorType> hseq(m2, hc);
|
||||||
hseq.setLength(hc.size()).setShift(shift);
|
hseq.setLength(hc.size()).setShift(shift);
|
||||||
VERIFY(hseq.trans() == false);
|
|
||||||
VERIFY(hseq.length() == hc.size());
|
VERIFY(hseq.length() == hc.size());
|
||||||
VERIFY(hseq.shift() == shift);
|
VERIFY(hseq.shift() == shift);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user