DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::EigenDecomposition< TN, TComponent, TMatrix > Class Template Reference

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. More...

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

Public Types

typedef TComponent Component
 the type of each coefficient, i.e. scalar
 
typedef Component Quantity
 the type of scalar (i.e. Component)
 
typedef PointVector< N, ComponentRowVector
 the type for row vectors (1xN)
 
typedef PointVector< M, ComponentColumnVector
 the type for column vectors (Nx1)
 
typedef ColumnVector Vector
 an alias for column vectors (Nx1)
 
typedef TMatrix Matrix
 the type for matrices (NxN)
 

Static Public Member Functions

static void tridiagonalize (Matrix &V, Vector &d, Vector &e)
 Reduces a real symmetric matrix to a symmetric tridiagonal matrix using and accumulating orthogonal similarity transformations.
 
static void decomposeQL (Matrix &V, Vector &d, Vector e)
 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.
 
static void getEigenDecomposition (const Matrix &matrix, Matrix &eigenVectors, Vector &eigenValues)
 Compute both eigen vectors and eigen values from an input matrix.
 

Static Public Attributes

static const DGtal::Dimension M = TN
 
static const DGtal::Dimension N = TN
 
static const DGtal::Dimension dimension = TN
 Usual static constant for dimension.
 
static const DGtal::Dimension dimensionMinusOne = TN - 1
 Static constant for dimension - 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

◆ ColumnVector

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.

◆ Component

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.

◆ Matrix

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.

◆ Quantity

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.

◆ RowVector

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.

◆ Vector

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

◆ BOOST_CONCEPT_ASSERT()

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
DGtal::EigenDecomposition< TN, TComponent, TMatrix >::BOOST_CONCEPT_ASSERT ( (concepts::CEuclideanRing< TComponent >) )
private

◆ BOOST_STATIC_ASSERT()

template<DGtal::Dimension TN, typename TComponent , typename TMatrix = SimpleMatrix<TComponent, TN, TN>>
DGtal::EigenDecomposition< TN, TComponent, TMatrix >::BOOST_STATIC_ASSERT ( TN ,
0  )
private

◆ decomposeQL()

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.

◆ getEigenDecomposition()

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(), LSF(), DGtal::CorrectedNormalCurrentComputer< TRealPoint, TRealVector >::principalCurvatures(), and DGtal::NormalCycleComputer< TRealPoint, TRealVector >::principalCurvatures().

◆ tridiagonalize()

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

◆ dimension

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.

◆ dimensionMinusOne

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.

◆ M

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.

◆ N

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: