DGtal  0.9.4beta
Public Types | Static Public Member Functions | Static Public Attributes | Private Member Functions
DGtal::EigenDecomposition< TN, TComponent, TMatrix > Class Template Reference

#include <DGtal/math/linalg/EigenDecomposition.h>

Public Types

typedef TComponent Component
 
typedef Component Quantity
 
typedef PointVector< N, ComponentRowVector
 
typedef PointVector< M, ComponentColumnVector
 
typedef ColumnVector Vector
 
typedef TMatrix Matrix
 

Static Public Member Functions

static void tridiagonalize (Matrix &V, Vector &d, Vector &e)
 
static void decomposeQL (Matrix &V, Vector &d, Vector e)
 
static void getEigenDecomposition (const Matrix &matrix, Matrix &eigenVectors, Vector &eigenValues)
 

Static Public Attributes

static const DGtal::Dimension M = TN
 
static const DGtal::Dimension N = TN
 
static const DGtal::Dimension dimension = TN
 
static const DGtal::Dimension dimensionMinusOne = TN - 1
 

Private Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CEuclideanRing< TComponent >))
 
 BOOST_STATIC_ASSERT (TN > 0)
 

Detailed Description

template<DGtal::Dimension TN, typename TComponent, typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
class DGtal::EigenDecomposition< TN, TComponent, TMatrix >

Aim: This class provides methods to compute the eigen decomposition of a matrix. Its objective is to replace a specialized matrix library when none are available.

Description of template class 'EigenDecomposition'

This class provides static services and is not really supposed to be instantiated.

Note
This is derived from the Algol procedures tred2 and tql2 by Bowdler, Martin, Reinsch and Wilkinson, Handbook for Auto. Comp., Vol.ii-Linear Algebra, and the corresponding Fortran subroutine in EISPACK.
Template Parameters
TNthe size TN of the matrix TN x TN.
TComponentthe type of each component of the matrix. For now, should be some double or float type.
TMatrixa model of CMatrix, for instance SimpleMatrix.
Examples:
examples/tutorial-examples/polyhedralizer.cpp, geometry/volumes/dvcm-2d.cpp, and tutorial-examples/polyhedralizer.cpp.

Definition at line 86 of file EigenDecomposition.h.

Member Typedef Documentation

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
typedef PointVector<M,Component> DGtal::EigenDecomposition< TN, TComponent, TMatrix >::ColumnVector

the type for column vectors (Nx1)

Definition at line 99 of file EigenDecomposition.h.

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
typedef TComponent DGtal::EigenDecomposition< TN, TComponent, TMatrix >::Component

the type of each coefficient, i.e. scalar

Definition at line 94 of file EigenDecomposition.h.

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
typedef TMatrix DGtal::EigenDecomposition< TN, TComponent, TMatrix >::Matrix

the type for matrices (NxN)

Definition at line 101 of file EigenDecomposition.h.

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
typedef Component DGtal::EigenDecomposition< TN, TComponent, TMatrix >::Quantity

the type of scalar (i.e. Component)

Definition at line 97 of file EigenDecomposition.h.

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
typedef PointVector<N,Component> DGtal::EigenDecomposition< TN, TComponent, TMatrix >::RowVector

the type for row vectors (1xN)

Definition at line 98 of file EigenDecomposition.h.

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
typedef ColumnVector DGtal::EigenDecomposition< TN, TComponent, TMatrix >::Vector

an alias for column vectors (Nx1)

Definition at line 100 of file EigenDecomposition.h.

Member Function Documentation

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
DGtal::EigenDecomposition< TN, TComponent, TMatrix >::BOOST_CONCEPT_ASSERT ( (concepts::CEuclideanRing< TComponent >)  )
private
template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
DGtal::EigenDecomposition< TN, TComponent, TMatrix >::BOOST_STATIC_ASSERT ( TN  ,
 
)
private
template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
static void DGtal::EigenDecomposition< TN, TComponent, TMatrix >::decomposeQL ( Matrix V,
Vector d,
Vector  e 
)
static

finds the eigenvalues and eigenvectors of a symmetric tridiagonal matrix by the QL method. The eigenvectors of a full symmetric matric can also be found if tridiagonalize() has been used to reduce this full matrix to tridiagonal form.

This is derived from the Algol procedures tred2 and tql2 by Bowdler, Martin, Reinsch and Wilkinson, Handbook for Auto. Comp., Vol.ii-Linear Algebra, and the corresponding Fortran subroutine in EISPACK.

Parameters
[in]econtains the subdiagonal elements of the input matrix in its last n-1 positions. e(0) is arbitrary.
[in,out]dinput: the diagonal elements of the input matrix / output: orthonormal eigenvalues in ascending order.
[in,out]Vinput: transformation matrix produced in the reduction by tridiagonalize(), if performed. If the eigenvectors of the tridiagonal matrix are desired, V must contain the identity matrix / output: orthonormal eigenvectors of the symmetric tridiagonal (or full) transformation matrix.
Todo:
Sorting the eigenvalues is done by selection sort. This could be improved for big values of TN.
template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
static void DGtal::EigenDecomposition< TN, TComponent, TMatrix >::getEigenDecomposition ( const Matrix matrix,
Matrix eigenVectors,
Vector eigenValues 
)
static

Compute both eigen vectors and eigen values from an input matrix.

This is derived from the Algol procedures tred2 and tql2 by Bowdler, Martin, Reinsch and Wilkinson, Handbook for Auto. Comp., Vol.ii-Linear Algebra, and the corresponding Fortran subroutine in EISPACK.

Parameters
[in]matrix3D matrix whose eigen values/vectors are computed (size = dimension * dimension).
[out]eigenVectorsmatrix of eigenvectors (size = dimension * dimension). Eigenvectors are put in column.
[out]eigenValuesvector of eigenvalues (size = dimension), sorted in ascending order (smallest to highest).

Referenced by DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::eval().

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
static void DGtal::EigenDecomposition< TN, TComponent, TMatrix >::tridiagonalize ( Matrix V,
Vector d,
Vector e 
)
static

Reduces a real symmetric matrix to a symmetric tridiagonal matrix using and accumulating orthogonal similarity transformations.

This is derived from the Algol procedures tred2 and tql2 by Bowdler, Martin, Reinsch and Wilkinson, Handbook for Auto. Comp., Vol.ii-Linear Algebra, and the corresponding Fortran subroutine in EISPACK.

Parameters
[in,out]Vinput: symmetric matrix / output: the orthogonal transformation matrix produced in the reduction.
[out]dcontains the diagonal elements of the tridiagonal matrix.
[out]econtains the subdiagonal elements of the tridiagonal matrix in its last n-1 positions. e[0] is set to 0.

Field Documentation

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
const DGtal::Dimension DGtal::EigenDecomposition< TN, TComponent, TMatrix >::dimension = TN
static

Usual static constant for dimension.

Definition at line 107 of file EigenDecomposition.h.

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
const DGtal::Dimension DGtal::EigenDecomposition< TN, TComponent, TMatrix >::dimensionMinusOne = TN - 1
static

Static constant for dimension - 1.

Definition at line 109 of file EigenDecomposition.h.

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
const DGtal::Dimension DGtal::EigenDecomposition< TN, TComponent, TMatrix >::M = TN
static

Definition at line 95 of file EigenDecomposition.h.

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
const DGtal::Dimension DGtal::EigenDecomposition< TN, TComponent, TMatrix >::N = TN
static

Definition at line 96 of file EigenDecomposition.h.


The documentation for this class was generated from the following file: