Document (non)sorting of eigenvalues.

Also, update docs for (Generalized)SelfAdjointEigenSolver to reflect that these
two classes were split apart.
This commit is contained in:
Jitse Niesen 2011-02-27 14:06:55 +00:00
parent 58abf0eb98
commit a8f5ef9388
5 changed files with 22 additions and 26 deletions

View File

@ -186,7 +186,8 @@ template<typename _MatrixType> class ComplexEigenSolver
* This function returns a column vector containing the * This function returns a column vector containing the
* eigenvalues. Eigenvalues are repeated according to their * eigenvalues. Eigenvalues are repeated according to their
* algebraic multiplicity, so there are as many eigenvalues as * algebraic multiplicity, so there are as many eigenvalues as
* rows in the matrix. * rows in the matrix. The eigenvalues are not sorted in any particular
* order.
* *
* Example: \include ComplexEigenSolver_eigenvalues.cpp * Example: \include ComplexEigenSolver_eigenvalues.cpp
* Output: \verbinclude ComplexEigenSolver_eigenvalues.out * Output: \verbinclude ComplexEigenSolver_eigenvalues.out

View File

@ -228,6 +228,7 @@ template<typename _MatrixType> class EigenSolver
* block-diagonal. The blocks on the diagonal are either 1-by-1 or 2-by-2 * block-diagonal. The blocks on the diagonal are either 1-by-1 or 2-by-2
* blocks of the form * blocks of the form
* \f$ \begin{bmatrix} u & v \\ -v & u \end{bmatrix} \f$. * \f$ \begin{bmatrix} u & v \\ -v & u \end{bmatrix} \f$.
* These blocks are not sorted in any particular order.
* The matrix \f$ D \f$ and the matrix \f$ V \f$ returned by * The matrix \f$ D \f$ and the matrix \f$ V \f$ returned by
* pseudoEigenvectors() satisfy \f$ AV = VD \f$. * pseudoEigenvectors() satisfy \f$ AV = VD \f$.
* *
@ -244,7 +245,8 @@ template<typename _MatrixType> class EigenSolver
* compute(const MatrixType&, bool) has been called before. * compute(const MatrixType&, bool) has been called before.
* *
* The eigenvalues are repeated according to their algebraic multiplicity, * The eigenvalues are repeated according to their algebraic multiplicity,
* so there are as many eigenvalues as rows in the matrix. * so there are as many eigenvalues as rows in the matrix. The eigenvalues
* are not sorted in any particular order.
* *
* Example: \include EigenSolver_eigenvalues.cpp * Example: \include EigenSolver_eigenvalues.cpp
* Output: \verbinclude EigenSolver_eigenvalues.out * Output: \verbinclude EigenSolver_eigenvalues.out

View File

@ -70,13 +70,9 @@ class GeneralizedSelfAdjointEigenSolver : public SelfAdjointEigenSolver<_MatrixT
/** \brief Default constructor for fixed-size matrices. /** \brief Default constructor for fixed-size matrices.
* *
* 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 compute(const MatrixType&, bool) or * perform decompositions via compute(). This constructor
* compute(const MatrixType&, const MatrixType&, bool). This constructor
* can only be used if \p _MatrixType is a fixed-size matrix; use * can only be used if \p _MatrixType is a fixed-size matrix; use
* SelfAdjointEigenSolver(Index) for dynamic-size matrices. * GeneralizedSelfAdjointEigenSolver(Index) for dynamic-size matrices.
*
* Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp
* Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver.out
*/ */
GeneralizedSelfAdjointEigenSolver() : Base() {} GeneralizedSelfAdjointEigenSolver() : Base() {}
@ -86,12 +82,11 @@ class GeneralizedSelfAdjointEigenSolver : public SelfAdjointEigenSolver<_MatrixT
* eigenvalues and eigenvectors will be computed. * eigenvalues and eigenvectors will be computed.
* *
* This constructor is useful for dynamic-size matrices, when the user * This constructor is useful for dynamic-size matrices, when the user
* intends to perform decompositions via compute(const MatrixType&, bool) * intends to perform decompositions via compute(). The \p size
* or compute(const MatrixType&, const MatrixType&, bool). The \p size
* parameter is only used as a hint. It is not an error to give a wrong * parameter is only used as a hint. It is not an error to give a wrong
* \p size, but it may impair performance. * \p size, but it may impair performance.
* *
* \sa compute(const MatrixType&, bool) for an example * \sa compute() for an example
*/ */
GeneralizedSelfAdjointEigenSolver(Index size) GeneralizedSelfAdjointEigenSolver(Index size)
: Base(size) : Base(size)

View File

@ -62,12 +62,12 @@ class GeneralizedSelfAdjointEigenSolver;
* *
* Call the function compute() to compute the eigenvalues and eigenvectors of * Call the function compute() to compute the eigenvalues and eigenvectors of
* a given matrix. Alternatively, you can use the * a given matrix. Alternatively, you can use the
* SelfAdjointEigenSolver(const MatrixType&, bool) constructor which computes * SelfAdjointEigenSolver(const MatrixType&, int) constructor which computes
* the eigenvalues and eigenvectors at construction time. Once the eigenvalue * the eigenvalues and eigenvectors at construction time. Once the eigenvalue
* and eigenvectors are computed, they can be retrieved with the eigenvalues() * and eigenvectors are computed, they can be retrieved with the eigenvalues()
* and eigenvectors() functions. * and eigenvectors() functions.
* *
* The documentation for SelfAdjointEigenSolver(const MatrixType&, bool) * The documentation for SelfAdjointEigenSolver(const MatrixType&, int)
* contains an example of the typical use of this class. * contains an example of the typical use of this class.
* *
* To solve the \em generalized eigenvalue problem \f$ Av = \lambda Bv \f$ and * To solve the \em generalized eigenvalue problem \f$ Av = \lambda Bv \f$ and
@ -110,8 +110,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
/** \brief Default constructor for fixed-size matrices. /** \brief Default constructor for fixed-size matrices.
* *
* 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 compute(const MatrixType&, bool) or * perform decompositions via compute(). This constructor
* compute(const MatrixType&, const MatrixType&, bool). This constructor
* can only be used if \p _MatrixType is a fixed-size matrix; use * can only be used if \p _MatrixType is a fixed-size matrix; use
* SelfAdjointEigenSolver(Index) for dynamic-size matrices. * SelfAdjointEigenSolver(Index) for dynamic-size matrices.
* *
@ -131,12 +130,11 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
* eigenvalues and eigenvectors will be computed. * eigenvalues and eigenvectors will be computed.
* *
* This constructor is useful for dynamic-size matrices, when the user * This constructor is useful for dynamic-size matrices, when the user
* intends to perform decompositions via compute(const MatrixType&, bool) * intends to perform decompositions via compute(). The \p size
* or compute(const MatrixType&, const MatrixType&, bool). The \p size
* parameter is only used as a hint. It is not an error to give a wrong * parameter is only used as a hint. It is not an error to give a wrong
* \p size, but it may impair performance. * \p size, but it may impair performance.
* *
* \sa compute(const MatrixType&, bool) for an example * \sa compute() for an example
*/ */
SelfAdjointEigenSolver(Index size) SelfAdjointEigenSolver(Index size)
: m_eivec(size, size), : m_eivec(size, size),
@ -151,15 +149,14 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
* be computed. Only the lower triangular part of the matrix is referenced. * be computed. Only the lower triangular part of the matrix is referenced.
* \param[in] options Can be ComputeEigenvectors (default) or EigenvaluesOnly. * \param[in] options Can be ComputeEigenvectors (default) or EigenvaluesOnly.
* *
* This constructor calls compute(const MatrixType&, bool) to compute the * This constructor calls compute(const MatrixType&, int) to compute the
* eigenvalues of the matrix \p matrix. The eigenvectors are computed if * eigenvalues of the matrix \p matrix. The eigenvectors are computed if
* \p options equals ComputeEigenvectors. * \p options equals ComputeEigenvectors.
* *
* Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp * Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp
* Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.out * Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.out
* *
* \sa compute(const MatrixType&, bool), * \sa compute(const MatrixType&, int)
* SelfAdjointEigenSolver(const MatrixType&, const MatrixType&, bool)
*/ */
SelfAdjointEigenSolver(const MatrixType& matrix, int options = ComputeEigenvectors) SelfAdjointEigenSolver(const MatrixType& matrix, int options = ComputeEigenvectors)
: m_eivec(matrix.rows(), matrix.cols()), : m_eivec(matrix.rows(), matrix.cols()),
@ -198,11 +195,11 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
* Example: \include SelfAdjointEigenSolver_compute_MatrixType.cpp * Example: \include SelfAdjointEigenSolver_compute_MatrixType.cpp
* Output: \verbinclude SelfAdjointEigenSolver_compute_MatrixType.out * Output: \verbinclude SelfAdjointEigenSolver_compute_MatrixType.out
* *
* \sa SelfAdjointEigenSolver(const MatrixType&, bool) * \sa SelfAdjointEigenSolver(const MatrixType&, int)
*/ */
SelfAdjointEigenSolver& compute(const MatrixType& matrix, int options = ComputeEigenvectors); SelfAdjointEigenSolver& compute(const MatrixType& matrix, int options = ComputeEigenvectors);
/** \brief Returns the eigenvectors of given matrix (pencil). /** \brief Returns the eigenvectors of given matrix.
* *
* \returns A const reference to the matrix whose columns are the eigenvectors. * \returns A const reference to the matrix whose columns are the eigenvectors.
* *
@ -227,14 +224,15 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
return m_eivec; return m_eivec;
} }
/** \brief Returns the eigenvalues of given matrix (pencil). /** \brief Returns the eigenvalues of given matrix.
* *
* \returns A const reference to the column vector containing the eigenvalues. * \returns A const reference to the column vector containing the eigenvalues.
* *
* \pre The eigenvalues have been computed before. * \pre The eigenvalues have been computed before.
* *
* The eigenvalues are repeated according to their algebraic multiplicity, * The eigenvalues are repeated according to their algebraic multiplicity,
* so there are as many eigenvalues as rows in the matrix. * so there are as many eigenvalues as rows in the matrix. The eigenvalues
* are sorted in increasing order.
* *
* Example: \include SelfAdjointEigenSolver_eigenvalues.cpp * Example: \include SelfAdjointEigenSolver_eigenvalues.cpp
* Output: \verbinclude SelfAdjointEigenSolver_eigenvalues.out * Output: \verbinclude SelfAdjointEigenSolver_eigenvalues.out

View File

@ -452,7 +452,7 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
/** \returns the vector of singular values. /** \returns the vector of singular values.
* *
* For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, the * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, the
* returned vector has size \a m. * returned vector has size \a m. Singular values are always sorted in decreasing order.
*/ */
const SingularValuesType& singularValues() const const SingularValuesType& singularValues() const
{ {