aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2011-01-06 11:30:19 +0000
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2011-01-06 11:30:19 +0000
commit2cc75f492234ead80c2707f6338cb6f33686da43 (patch)
tree352355fe7fcf7235a3c154fc80690aa5cc2c5632
parent934720c4ba287e6e1b1e398cf78e99d1f174705e (diff)
Make HouseholderSequence::setTrans() protected (cf. bug #50).
Users can call .transpose() instead.
-rw-r--r--Eigen/src/Householder/HouseholderSequence.h32
-rw-r--r--Eigen/src/QR/ColPivHouseholderQR.h2
-rw-r--r--test/householder.cpp1
3 files changed, 18 insertions, 17 deletions
diff --git a/Eigen/src/Householder/HouseholderSequence.h b/Eigen/src/Householder/HouseholderSequence.h
index 4b4def02e..a1d332f76 100644
--- a/Eigen/src/Householder/HouseholderSequence.h
+++ b/Eigen/src/Householder/HouseholderSequence.h
@@ -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;
diff --git a/Eigen/src/QR/ColPivHouseholderQR.h b/Eigen/src/QR/ColPivHouseholderQR.h
index c8ecf2c43..6c7d1d486 100644
--- a/Eigen/src/QR/ColPivHouseholderQR.h
+++ b/Eigen/src/QR/ColPivHouseholderQR.h
@@ -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()
diff --git a/test/householder.cpp b/test/householder.cpp
index fe865b6ce..8031025e5 100644
--- a/test/householder.cpp
+++ b/test/householder.cpp
@@ -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);