last update 20 Sep 2009 |
#include <cvrSymmetricEigenSystem.h>
Classes | |
class | parameters |
eigenSystem parameter class More... | |
Public Member Functions | |
symmetricEigenSystem () | |
symmetricEigenSystem (const parameters ¶ms) | |
virtual bool | apply (const matrix< T > &theMatrix, vector< T > &eigenvalues, matrix< T > &eigenvectors) const |
virtual bool | reducedEigenSystem (const matrix< T > &theMatrix, vector< T > &eigenvalues, matrix< T > &eigenvectors, const int dimensions) const |
const std::string & | name () const |
virtual symmetricEigenSystem * | clone () const |
virtual symmetricEigenSystem * | newInstance () const |
const parameters & | getParameters () const |
The most common source of such matrices is a covariance matrix (see cvr::secondOrderStatistics).
This class uses the LAPACK functions by default if they are installed on your system. Otherwise a simple Jacobi algorithm is used. This can also be chosen deliberately by setting parameters::useLapack to false.
The eigenvectors can be sorted according to their eigenvalues by setting parameters::sort. A fixed number of eigenvectors can be set via parameters::dimension. For LAPACK this also reduces computation time.
Please note that the eigenvector matrices will contain the eigenvectors in the COLUMNS and not in the rows, as could be expected. This avoids the requirement of transposing matrices in eigenvector-based transformations like PCA!
,
cvr::symmetricEigenSystem< T >::symmetricEigenSystem | ( | ) |
Default constructor.
cvr::symmetricEigenSystem< T >::symmetricEigenSystem | ( | const parameters & | params | ) |
Default constructor with parameters.
virtual bool cvr::symmetricEigenSystem< T >::apply | ( | const matrix< T > & | theMatrix, | |
vector< T > & | eigenvalues, | |||
matrix< T > & | eigenvectors | |||
) | const [virtual] |
Calculate the Eigensystem with eigenvalues and eigenvalues from the given data in theMatrix (Samples in rows).
Due to the symmetricity of the data it suffices if theMatrix is upper triangular.
theMatrix | Real symmetric matrix to be transformed. Only the diagonal and above diagonal elements have to be set. | |
eigenvalues | Elements will contain the eigenvalues. | |
eigenvectors | Columns will contain the eigenvectors corresponding to the eigenvalues. returns true if successful, false otherwise. |
virtual symmetricEigenSystem* cvr::symmetricEigenSystem< T >::clone | ( | ) | const [virtual] |
const parameters& cvr::symmetricEigenSystem< T >::getParameters | ( | ) | const |
const std::string& cvr::symmetricEigenSystem< T >::name | ( | ) | const [virtual] |
virtual symmetricEigenSystem* cvr::symmetricEigenSystem< T >::newInstance | ( | ) | const [virtual] |
virtual bool cvr::symmetricEigenSystem< T >::reducedEigenSystem | ( | const matrix< T > & | theMatrix, | |
vector< T > & | eigenvalues, | |||
matrix< T > & | eigenvectors, | |||
const int | dimensions | |||
) | const [virtual] |
Convenience function that calculates the Eigensystem like apply, but uses the given argument dimensions instead of those given in parameters::dimensions.
theMatrix | Real symmetric matrix to be transformed. Only the diagonal and above diagonal elements have to be set. | |
eigenvalues | Elements will contain the eigenvalues. | |
eigenvectors | Columns will contain the eigenvectors corresponding to the eigenvalues. | |
dimensions | number of dimensions in eigenspace returns true if successful, false otherwise. |