DGtal  1.5.beta
EigenDecomposition.h
1 
17 #pragma once
18 
40 #if defined(EigenDecomposition_RECURSES)
41 #error Recursive header files inclusion detected in EigenDecomposition.h
42 #else // defined(EigenDecomposition_RECURSES)
44 #define EigenDecomposition_RECURSES
45 
46 #if !defined EigenDecomposition_h
48 #define EigenDecomposition_h
49 
51 // Inclusions
52 #include <iostream>
53 #include "DGtal/base/Common.h"
54 #include "DGtal/kernel/PointVector.h"
55 #include "DGtal/math/linalg/SimpleMatrix.h"
57 
58 namespace DGtal
59 {
61  // template class EigenDecomposition
85  template <DGtal::Dimension TN, typename TComponent, typename TMatrix=SimpleMatrix<TComponent, TN, TN> >
87  {
88  // BOOST_CONCEPT_ASSERT(( CMatrix<TMatrix> ));
91 
92  // ----------------------- Public types -----------------------------------
93  public:
94  typedef TComponent Component;
95  static const DGtal::Dimension M = TN;
96  static const DGtal::Dimension N = TN;
97  typedef Component Quantity;
101  typedef TMatrix Matrix;
102 
103 
104  // ----------------------- Static constants ------------------------------
105  public:
107  static const DGtal::Dimension dimension = TN;
109  static const DGtal::Dimension dimensionMinusOne = TN - 1;
110 
111  // ----------------------- Static services ------------------------------
112  public:
113 
127  static void tridiagonalize( Matrix& V, Vector& d, Vector& e );
128 
151  static void decomposeQL( Matrix& V, Vector& d, Vector e );
152 
165  static void getEigenDecomposition( const Matrix& matrix, Matrix& eigenVectors, Vector& eigenValues );
166 
167 
168  // ------------------------- Protected Datas ------------------------------
169  private:
170  // ------------------------- Private Datas --------------------------------
171  private:
172 
173  // ------------------------- Hidden services ------------------------------
174  protected:
175 
176 
177  // ------------------------- Internals ------------------------------------
178  private:
179 
180  }; // end of class EigenDecomposition
181 
182 } // namespace DGtal
183 
184 
186 // Includes inline functions.
187 #include "DGtal/math/linalg/EigenDecomposition.ih"
188 
189 // //
191 
192 #endif // !defined EigenDecomposition_h
193 
194 #undef EigenDecomposition_RECURSES
195 #endif // else defined(EigenDecomposition_RECURSES)
Aim: This class provides methods to compute the eigen decomposition of a matrix. Its objective is to ...
static void getEigenDecomposition(const Matrix &matrix, Matrix &eigenVectors, Vector &eigenValues)
Compute both eigen vectors and eigen values from an input matrix.
TComponent Component
the type of each coefficient, i.e. scalar
PointVector< M, Component > ColumnVector
the type for column vectors (Nx1)
ColumnVector Vector
an alias for column vectors (Nx1)
static const DGtal::Dimension dimensionMinusOne
Static constant for dimension - 1.
static const DGtal::Dimension N
PointVector< N, Component > RowVector
the type for row vectors (1xN)
static void tridiagonalize(Matrix &V, Vector &d, Vector &e)
Reduces a real symmetric matrix to a symmetric tridiagonal matrix using and accumulating orthogonal s...
Component Quantity
the type of scalar (i.e. Component)
static void decomposeQL(Matrix &V, Vector &d, Vector e)
finds the eigenvalues and eigenvectors of a symmetric tridiagonal matrix by the QL method....
BOOST_CONCEPT_ASSERT((concepts::CEuclideanRing< TComponent >))
static const DGtal::Dimension dimension
Usual static constant for dimension.
TMatrix Matrix
the type for matrices (NxN)
static const DGtal::Dimension M
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Definition: Common.h:136
Aim: Defines the mathematical concept equivalent to a unitary commutative ring with a division operat...