move eigen values related stuff of the QR module to a new EigenSolver module.

- perhaps we can find a better name ?
- note that the QR module still includes the EigenSolver module for compatibility
This commit is contained in:
Gael Guennebaud
2009-09-03 11:39:44 +02:00
parent 9515b00876
commit a54b99fa72
18 changed files with 109 additions and 43 deletions

View File

@@ -9,3 +9,4 @@ ADD_SUBDIRECTORY(LeastSquares)
ADD_SUBDIRECTORY(Sparse)
ADD_SUBDIRECTORY(Jacobi)
ADD_SUBDIRECTORY(Householder)
ADD_SUBDIRECTORY(EigenSolver)

View File

@@ -0,0 +1,6 @@
FILE(GLOB Eigen_EIGENSOLVER_SRCS "*.h")
INSTALL(FILES
${Eigen_EIGENSOLVER_SRCS}
DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/EigenSolver COMPONENT Devel
)

View File

@@ -79,6 +79,7 @@ template<typename _MatrixType> class ComplexEigenSolver
template<typename MatrixType>
void ComplexEigenSolver<MatrixType>::compute(const MatrixType& matrix)
{
// this code is inspired from Jampack
assert(matrix.cols() == matrix.rows());
int n = matrix.cols();
m_eivalues.resize(n,1);

View File

@@ -120,6 +120,7 @@ std::complex<RealScalar> ei_sqrt(const std::complex<RealScalar> &z)
template<typename MatrixType>
void ComplexSchur<MatrixType>::compute(const MatrixType& matrix)
{
// this code is inspired from Jampack
assert(matrix.cols() == matrix.rows());
int n = matrix.cols();

View File

@@ -25,7 +25,7 @@
#ifndef EIGEN_EIGENSOLVER_H
#define EIGEN_EIGENSOLVER_H
/** \ingroup QR_Module
/** \ingroup EigenSolver_Module
* \nonstableyet
*
* \class EigenSolver
@@ -53,7 +53,7 @@ template<typename _MatrixType> class EigenSolver
typedef Matrix<RealScalar, MatrixType::ColsAtCompileTime, 1> RealVectorType;
typedef Matrix<RealScalar, Dynamic, 1> RealVectorTypeX;
/**
/**
* \brief Default Constructor.
*
* The default constructor is useful in cases in which the user intends to
@@ -103,19 +103,19 @@ template<typename _MatrixType> class EigenSolver
*
* \sa pseudoEigenvalueMatrix()
*/
const MatrixType& pseudoEigenvectors() const
{
const MatrixType& pseudoEigenvectors() const
{
ei_assert(m_isInitialized && "EigenSolver is not initialized.");
return m_eivec;
return m_eivec;
}
MatrixType pseudoEigenvalueMatrix() const;
/** \returns the eigenvalues as a column vector */
EigenvalueType eigenvalues() const
{
EigenvalueType eigenvalues() const
{
ei_assert(m_isInitialized && "EigenSolver is not initialized.");
return m_eivalues;
return m_eivalues;
}
EigenSolver& compute(const MatrixType& matrix);
@@ -265,7 +265,7 @@ void EigenSolver<MatrixType>::orthes(MatrixType& matH, RealVectorType& ort)
ort.segment(m+1, high-m) = matH.col(m-1).segment(m+1, high-m);
int bSize = high-m+1;
m_eivec.block(m, m, bSize, bSize).noalias() += ( (ort.segment(m, bSize) / (matH.coeff(m,m-1) * ort.coeff(m)))
m_eivec.block(m, m, bSize, bSize).noalias() += ( (ort.segment(m, bSize) / (matH.coeff(m,m-1) * ort.coeff(m)))
* (ort.segment(m, bSize).transpose() * m_eivec.block(m, m, bSize, bSize)) );
}
}

View File

@@ -25,7 +25,7 @@
#ifndef EIGEN_HESSENBERGDECOMPOSITION_H
#define EIGEN_HESSENBERGDECOMPOSITION_H
/** \ingroup QR_Module
/** \ingroup EigenSolver_Module
* \nonstableyet
*
* \class HessenbergDecomposition
@@ -156,7 +156,7 @@ void HessenbergDecomposition<MatrixType>::_compute(MatrixType& matA, CoeffVector
// Apply similarity transformation to remaining columns,
// i.e., compute A = H A H'
// A = H A
matA.corner(BottomRight, remainingSize, remainingSize)
.applyHouseholderOnTheLeft(matA.col(i).end(remainingSize-1), h, &temp.coeffRef(0));

View File

@@ -25,7 +25,7 @@
#ifndef EIGEN_SELFADJOINTEIGENSOLVER_H
#define EIGEN_SELFADJOINTEIGENSOLVER_H
/** \qr_module \ingroup QR_Module
/** \eigensolver_module \ingroup EigenSolver_Module
* \nonstableyet
*
* \class SelfAdjointEigenSolver
@@ -137,7 +137,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
/** \internal
*
* \qr_module
* \eigensolver_module
*
* Performs a QR step on a tridiagonal symmetric matrix represented as a
* pair of two vectors \a diag and \a subdiag.
@@ -266,7 +266,7 @@ compute(const MatrixType& matA, const MatrixType& matB, bool computeEigenvectors
#endif // EIGEN_HIDE_HEAVY_CODE
/** \qr_module
/** \eigensolver_module
*
* \returns a vector listing the eigenvalues of this matrix.
*/
@@ -307,7 +307,7 @@ template<typename Derived> struct ei_operatorNorm_selector<Derived, false>
}
};
/** \qr_module
/** \eigensolver_module
*
* \returns the matrix norm of this matrix.
*/

View File

@@ -25,7 +25,7 @@
#ifndef EIGEN_TRIDIAGONALIZATION_H
#define EIGEN_TRIDIAGONALIZATION_H
/** \ingroup QR_Module
/** \ingroup EigenSolver_Module
* \nonstableyet
*
* \class Tridiagonalization

View File

@@ -33,11 +33,6 @@
namespace Eigen
{
template static void ei_tridiagonal_qr_step(float* , float* , int, int, float* , int);
template static void ei_tridiagonal_qr_step(double* , double* , int, int, double* , int);
template static void ei_tridiagonal_qr_step(float* , float* , int, int, std::complex<float>* , int);
template static void ei_tridiagonal_qr_step(double* , double* , int, int, std::complex<double>* , int);
EIGEN_QR_MODULE_INSTANTIATE();
}