CCCoreLib 31 May 2022
CloudCompare Core algorithms
Public Types | Static Public Member Functions | List of all members
CCCoreLib::Jacobi< Scalar > Class Template Reference

Jacobi eigen vectors/values decomposition. More...

#include <Jacobi.h>

Public Types

using SquareMatrix = SquareMatrixTpl< Scalar >
 
using EigenValues = std::vector< Scalar >
 

Static Public Member Functions

static bool ComputeEigenValuesAndVectors2 (const SquareMatrix &matrix, SquareMatrix &eigenVectors, EigenValues &eigenValues, unsigned maxIterationCount=50)
 Computes the eigenvalues and eigenvectors of a given square matrix. More...
 
static bool ComputeEigenValuesAndVectors (const SquareMatrix &matrix, SquareMatrix &eigenVectors, EigenValues &eigenValues, bool absoluteValues=true, unsigned maxIterationCount=50)
 Computes eigen vectors (and values) with the Jacobian method. More...
 
static bool SortEigenValuesAndVectors (SquareMatrix &eigenVectors, EigenValues &eigenValues)
 Sorts the eigenvectors in the decreasing order of their associated eigenvalues. More...
 
static bool GetEigenVector (const SquareMatrix &eigenVectors, unsigned index, Scalar eigenVector[])
 Returns the given eigenvector. More...
 
static bool GetMaxEigenValueAndVector (const SquareMatrix &eigenVectors, const EigenValues &eigenValues, Scalar &maxEigenValue, Scalar maxEigenVector[])
 Returns the biggest eigenvalue and its associated eigenvector. More...
 
static bool GetMinEigenValueAndVector (const SquareMatrix &eigenVectors, const EigenValues &eigenValues, Scalar &minEigenValue, Scalar minEigenVector[])
 Returns the smallest eigenvalue and its associated eigenvector. More...
 

Detailed Description

template<typename Scalar>
class CCCoreLib::Jacobi< Scalar >

Jacobi eigen vectors/values decomposition.

Member Function Documentation

◆ ComputeEigenValuesAndVectors()

template<typename Scalar >
static bool CCCoreLib::Jacobi< Scalar >::ComputeEigenValuesAndVectors ( const SquareMatrix matrix,
SquareMatrix eigenVectors,
EigenValues &  eigenValues,
bool  absoluteValues = true,
unsigned  maxIterationCount = 50 
)
inlinestatic

Computes eigen vectors (and values) with the Jacobian method.

See the Numerical Recipes.

◆ ComputeEigenValuesAndVectors2()

template<typename Scalar >
static bool CCCoreLib::Jacobi< Scalar >::ComputeEigenValuesAndVectors2 ( const SquareMatrix matrix,
SquareMatrix eigenVectors,
EigenValues &  eigenValues,
unsigned  maxIterationCount = 50 
)
inlinestatic

Computes the eigenvalues and eigenvectors of a given square matrix.

It uses Rutishauser's modfications of the classical Jacobi rotation method with threshold pivoting.

Note: this code is inspired from John Burkardt's 'jacobi_eigenvalue' code See https://people.sc.fsu.edu/~jburkardt/cpp_src/jacobi_eigenvalue/jacobi_eigenvalue.cpp

Warning
DGM: this method gives strange results in some particular cases!!!
Parameters
[in]matrixinput square matrix
[out]eigenVectorseigenvectors (as a square matrix)
[out]eigenValueseigenvalues
[in]maxIterationCountmax number of iteration (optional)
Returns
success

◆ GetEigenVector()

template<typename Scalar >
static bool CCCoreLib::Jacobi< Scalar >::GetEigenVector ( const SquareMatrix eigenVectors,
unsigned  index,
Scalar  eigenVector[] 
)
inlinestatic

Returns the given eigenvector.

Parameters
eigenVectorseigenvectors (as a square matrix)
indexrequested eigenvector index (< eigenvectors matrix size)
eigenVectoroutput vector (size = matrix size)
Returns
success

◆ GetMaxEigenValueAndVector()

template<typename Scalar >
static bool CCCoreLib::Jacobi< Scalar >::GetMaxEigenValueAndVector ( const SquareMatrix eigenVectors,
const EigenValues &  eigenValues,
Scalar &  maxEigenValue,
Scalar  maxEigenVector[] 
)
inlinestatic

Returns the biggest eigenvalue and its associated eigenvector.

Parameters
eigenVectorseigenvectors (as a square matrix)
eigenValueseigenvalues
maxEigenValuebiggest eigenvalue
maxEigenVectoreigenvector vector corresponding to the biggest eigenvalue
Returns
success

◆ GetMinEigenValueAndVector()

template<typename Scalar >
static bool CCCoreLib::Jacobi< Scalar >::GetMinEigenValueAndVector ( const SquareMatrix eigenVectors,
const EigenValues &  eigenValues,
Scalar &  minEigenValue,
Scalar  minEigenVector[] 
)
inlinestatic

Returns the smallest eigenvalue and its associated eigenvector.

Parameters
eigenVectorseigenvectors (as a square matrix)
eigenValueseigenvalues
minEigenValuesmallest eigenvalue
minEigenVectoreigenvector vector corresponding to the smallest eigenvalue
Returns
success

◆ SortEigenValuesAndVectors()

template<typename Scalar >
static bool CCCoreLib::Jacobi< Scalar >::SortEigenValuesAndVectors ( SquareMatrix eigenVectors,
EigenValues &  eigenValues 
)
inlinestatic

Sorts the eigenvectors in the decreasing order of their associated eigenvalues.

Parameters
eigenVectorseigenvectors (as a square matrix)
eigenValueseigenvalues
Returns
success

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