Document member functions and types of ComplexEigenSolver.

This commit is contained in:
Jitse Niesen 2010-03-18 13:42:17 +00:00
parent 04a4e22c58
commit 0ee10f7da4
2 changed files with 56 additions and 10 deletions

View File

@ -31,9 +31,11 @@
* *
* \class ComplexEigenSolver * \class ComplexEigenSolver
* *
* \brief Eigen values/vectors solver for general complex matrices * \brief Computes eigenvalues and eigenvectors of general complex matrices
* *
* \param MatrixType the type of the matrix of which we are computing the eigen decomposition * \tparam _MatrixType the type of the matrix of which we are
* computing the eigendecomposition; this is expected to be an
* instantiation of the Matrix class template.
* *
* \sa class EigenSolver, class SelfAdjointEigenSolver * \sa class EigenSolver, class SelfAdjointEigenSolver
*/ */
@ -48,21 +50,47 @@ template<typename _MatrixType> class ComplexEigenSolver
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
}; };
/** \brief Scalar type for matrices of type \p _MatrixType. */
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar; typedef typename NumTraits<Scalar>::Real RealScalar;
/** \brief Complex scalar type for \p _MatrixType.
*
* This is \c std::complex<Scalar> if #Scalar is real (e.g.,
* \c float or \c double) and just \c Scalar if #Scalar is
* complex.
*/
typedef std::complex<RealScalar> Complex; typedef std::complex<RealScalar> Complex;
/** \brief Type for vector of eigenvalues as returned by eigenvalues().
*
* This is a column vector with entries of type #Complex.
* The length of the vector is the size of \p _MatrixType.
*/
typedef Matrix<Complex, ColsAtCompileTime, 1, Options, MaxColsAtCompileTime, 1> EigenvalueType; typedef Matrix<Complex, ColsAtCompileTime, 1, Options, MaxColsAtCompileTime, 1> EigenvalueType;
/** \brief Type for matrix of eigenvectors as returned by eigenvectors().
*
* This is a square matrix with entries of type #Complex.
* The size is the same as the size of \p _MatrixType.
*/
typedef Matrix<Complex, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, ColsAtCompileTime> EigenvectorType; typedef Matrix<Complex, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, ColsAtCompileTime> EigenvectorType;
/** /** \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 compute().
* perform decompositions via ComplexEigenSolver::compute(const MatrixType&). */
*/
ComplexEigenSolver() : m_eivec(), m_eivalues(), m_isInitialized(false) ComplexEigenSolver() : m_eivec(), m_eivalues(), m_isInitialized(false)
{} {}
/** \brief Constructor; computes eigendecomposition of given matrix.
*
* This constructor calls compute() to compute the eigendecomposition.
*
* \param[in] matrix %Matrix whose eigendecomposition is to be computed.
*/
ComplexEigenSolver(const MatrixType& matrix) ComplexEigenSolver(const MatrixType& matrix)
: m_eivec(matrix.rows(),matrix.cols()), : m_eivec(matrix.rows(),matrix.cols()),
m_eivalues(matrix.cols()), m_eivalues(matrix.cols()),
@ -71,18 +99,36 @@ template<typename _MatrixType> class ComplexEigenSolver
compute(matrix); compute(matrix);
} }
EigenvectorType eigenvectors(void) const /** \brief Returns the eigenvectors of given matrix. */
EigenvectorType eigenvectors() const
{ {
ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized."); ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
return m_eivec; return m_eivec;
} }
/** \brief Returns the eigenvalues of given matrix. */
EigenvalueType eigenvalues() const EigenvalueType eigenvalues() const
{ {
ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized."); ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
return m_eivalues; return m_eivalues;
} }
/** \brief Computes eigendecomposition of given matrix.
*
* This function computes the eigenvalues and eigenvectors of \p
* matrix. The eigenvalues() and eigenvectors() functions can be
* used to retrieve the computed eigendecomposition.
*
* The matrix is first reduced to Schur form using the
* ComplexSchur class. The Schur decomposition is then used to
* compute the eigenvalues and eigenvectors.
*
* The cost of the computation is dominated by the cost of the
* Schur decomposition, which is \f$ O(n^3) \f$ where \f$ n \f$
* is the size of the matrix.
*
* \param[in] matrix %Matrix whose eigendecomposition is to be computed.
*/
void compute(const MatrixType& matrix); void compute(const MatrixType& matrix);
protected: protected:

View File

@ -29,7 +29,7 @@
/** \eigenvalues_module \ingroup Eigenvalues_Module /** \eigenvalues_module \ingroup Eigenvalues_Module
* \nonstableyet * \nonstableyet
* *
* \class ComplexShur * \class ComplexSchur
* *
* \brief Performs a complex Schur decomposition of a real or complex square matrix * \brief Performs a complex Schur decomposition of a real or complex square matrix
* *