Fix bug #599: add missing documentation of some members in QR module.

This commit is contained in:
Gael Guennebaud 2013-06-10 11:58:28 +02:00
parent 2b6528effc
commit 0525874a03
3 changed files with 77 additions and 5 deletions

View File

@ -94,6 +94,18 @@ template<typename _MatrixType> class ColPivHouseholderQR
m_isInitialized(false), m_isInitialized(false),
m_usePrescribedThreshold(false) {} m_usePrescribedThreshold(false) {}
/** \brief Constructs a QR factorization from a given matrix
*
* This constructor computes the QR factorization of the matrix \a matrix by calling
* the method compute(). It is a short cut for:
*
* \code
* ColPivHouseholderQR<MatrixType> qr(matrix.rows(), matrix.cols());
* qr.compute(matrix);
* \endcode
*
* \sa compute()
*/
ColPivHouseholderQR(const MatrixType& matrix) ColPivHouseholderQR(const MatrixType& matrix)
: m_qr(matrix.rows(), matrix.cols()), : m_qr(matrix.rows(), matrix.cols()),
m_hCoeffs((std::min)(matrix.rows(),matrix.cols())), m_hCoeffs((std::min)(matrix.rows(),matrix.cols())),
@ -163,6 +175,7 @@ template<typename _MatrixType> class ColPivHouseholderQR
ColPivHouseholderQR& compute(const MatrixType& matrix); ColPivHouseholderQR& compute(const MatrixType& matrix);
/** \returns a const reference to the column permutation matrix */
const PermutationType& colsPermutation() const const PermutationType& colsPermutation() const
{ {
eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
@ -281,6 +294,11 @@ template<typename _MatrixType> class ColPivHouseholderQR
inline Index rows() const { return m_qr.rows(); } inline Index rows() const { return m_qr.rows(); }
inline Index cols() const { return m_qr.cols(); } inline Index cols() const { return m_qr.cols(); }
/** \returns a const reference to the vector of Householder coefficients used to represent the factor \c Q.
*
* For advanced uses only.
*/
const HCoeffsType& hCoeffs() const { return m_hCoeffs; } const HCoeffsType& hCoeffs() const { return m_hCoeffs; }
/** Allows to prescribe a threshold to be used by certain methods, such as rank(), /** Allows to prescribe a threshold to be used by certain methods, such as rank(),
@ -394,6 +412,12 @@ typename MatrixType::RealScalar ColPivHouseholderQR<MatrixType>::logAbsDetermina
return m_qr.diagonal().cwiseAbs().array().log().sum(); return m_qr.diagonal().cwiseAbs().array().log().sum();
} }
/** Performs the QR factorization of the given matrix \a matrix. The result of
* the factorization is stored into \c *this, and a reference to \c *this
* is returned.
*
* \sa class ColPivHouseholderQR, ColPivHouseholderQR(const MatrixType&)
*/
template<typename MatrixType> template<typename MatrixType>
ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix) ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
{ {

View File

@ -100,6 +100,18 @@ template<typename _MatrixType> class FullPivHouseholderQR
m_isInitialized(false), m_isInitialized(false),
m_usePrescribedThreshold(false) {} m_usePrescribedThreshold(false) {}
/** \brief Constructs a QR factorization from a given matrix
*
* This constructor computes the QR factorization of the matrix \a matrix by calling
* the method compute(). It is a short cut for:
*
* \code
* FullPivHouseholderQR<MatrixType> qr(matrix.rows(), matrix.cols());
* qr.compute(matrix);
* \endcode
*
* \sa compute()
*/
FullPivHouseholderQR(const MatrixType& matrix) FullPivHouseholderQR(const MatrixType& matrix)
: m_qr(matrix.rows(), matrix.cols()), : m_qr(matrix.rows(), matrix.cols()),
m_hCoeffs((std::min)(matrix.rows(), matrix.cols())), m_hCoeffs((std::min)(matrix.rows(), matrix.cols())),
@ -152,12 +164,14 @@ template<typename _MatrixType> class FullPivHouseholderQR
FullPivHouseholderQR& compute(const MatrixType& matrix); FullPivHouseholderQR& compute(const MatrixType& matrix);
/** \returns a const reference to the column permutation matrix */
const PermutationType& colsPermutation() const const PermutationType& colsPermutation() const
{ {
eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_cols_permutation; return m_cols_permutation;
} }
/** \returns a const reference to the vector of indices representing the rows transpositions */
const IntColVectorType& rowsTranspositions() const const IntColVectorType& rowsTranspositions() const
{ {
eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
@ -275,6 +289,11 @@ template<typename _MatrixType> class FullPivHouseholderQR
inline Index rows() const { return m_qr.rows(); } inline Index rows() const { return m_qr.rows(); }
inline Index cols() const { return m_qr.cols(); } inline Index cols() const { return m_qr.cols(); }
/** \returns a const reference to the vector of Householder coefficients used to represent the factor \c Q.
*
* For advanced uses only.
*/
const HCoeffsType& hCoeffs() const { return m_hCoeffs; } const HCoeffsType& hCoeffs() const { return m_hCoeffs; }
/** Allows to prescribe a threshold to be used by certain methods, such as rank(), /** Allows to prescribe a threshold to be used by certain methods, such as rank(),
@ -377,6 +396,12 @@ typename MatrixType::RealScalar FullPivHouseholderQR<MatrixType>::logAbsDetermin
return m_qr.diagonal().cwiseAbs().array().log().sum(); return m_qr.diagonal().cwiseAbs().array().log().sum();
} }
/** Performs the QR factorization of the given matrix \a matrix. The result of
* the factorization is stored into \c *this, and a reference to \c *this
* is returned.
*
* \sa class FullPivHouseholderQR, FullPivHouseholderQR(const MatrixType&)
*/
template<typename MatrixType> template<typename MatrixType>
FullPivHouseholderQR<MatrixType>& FullPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix) FullPivHouseholderQR<MatrixType>& FullPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
{ {

View File

@ -60,11 +60,11 @@ template<typename _MatrixType> class HouseholderQR
typedef typename HouseholderSequence<MatrixType,HCoeffsType>::ConjugateReturnType HouseholderSequenceType; typedef typename HouseholderSequence<MatrixType,HCoeffsType>::ConjugateReturnType HouseholderSequenceType;
/** /**
* \brief Default Constructor. * \brief Default Constructor.
* *
* The default constructor is useful in cases in which the user intends to * The default constructor is useful in cases in which the user intends to
* perform decompositions via HouseholderQR::compute(const MatrixType&). * perform decompositions via HouseholderQR::compute(const MatrixType&).
*/ */
HouseholderQR() : m_qr(), m_hCoeffs(), m_temp(), m_isInitialized(false) {} HouseholderQR() : m_qr(), m_hCoeffs(), m_temp(), m_isInitialized(false) {}
/** \brief Default Constructor with memory preallocation /** \brief Default Constructor with memory preallocation
@ -79,6 +79,18 @@ template<typename _MatrixType> class HouseholderQR
m_temp(cols), m_temp(cols),
m_isInitialized(false) {} m_isInitialized(false) {}
/** \brief Constructs a QR factorization from a given matrix
*
* This constructor computes the QR factorization of the matrix \a matrix by calling
* the method compute(). It is a short cut for:
*
* \code
* HouseholderQR<MatrixType> qr(matrix.rows(), matrix.cols());
* qr.compute(matrix);
* \endcode
*
* \sa compute()
*/
HouseholderQR(const MatrixType& matrix) HouseholderQR(const MatrixType& matrix)
: m_qr(matrix.rows(), matrix.cols()), : m_qr(matrix.rows(), matrix.cols()),
m_hCoeffs((std::min)(matrix.rows(),matrix.cols())), m_hCoeffs((std::min)(matrix.rows(),matrix.cols())),
@ -169,6 +181,11 @@ template<typename _MatrixType> class HouseholderQR
inline Index rows() const { return m_qr.rows(); } inline Index rows() const { return m_qr.rows(); }
inline Index cols() const { return m_qr.cols(); } inline Index cols() const { return m_qr.cols(); }
/** \returns a const reference to the vector of Householder coefficients used to represent the factor \c Q.
*
* For advanced uses only.
*/
const HCoeffsType& hCoeffs() const { return m_hCoeffs; } const HCoeffsType& hCoeffs() const { return m_hCoeffs; }
protected: protected:
@ -317,6 +334,12 @@ struct solve_retval<HouseholderQR<_MatrixType>, Rhs>
} // end namespace internal } // end namespace internal
/** Performs the QR factorization of the given matrix \a matrix. The result of
* the factorization is stored into \c *this, and a reference to \c *this
* is returned.
*
* \sa class HouseholderQR, HouseholderQR(const MatrixType&)
*/
template<typename MatrixType> template<typename MatrixType>
HouseholderQR<MatrixType>& HouseholderQR<MatrixType>::compute(const MatrixType& matrix) HouseholderQR<MatrixType>& HouseholderQR<MatrixType>::compute(const MatrixType& matrix)
{ {