PCL
pcl::GenericInPlaceSVD< T > Class Template Reference

Generic in-place singular value decomposition algorithm. More...

#include <Algebra.h>

+ Inheritance diagram for pcl::GenericInPlaceSVD< T >:

Public Types

using matrix = GenericMatrix< T >
 
using matrix_element = typename matrix::element
 
using vector = GenericVector< T >
 
using vector_component = typename vector::component
 

Public Member Functions

 GenericInPlaceSVD (matrix &A)
 
int IndexOfLargestSingularValue () const
 
int IndexOfSmallestSingularValue () const
 

Public Attributes

matrix V
 
vector W
 

Detailed Description

template<typename T>
class pcl::GenericInPlaceSVD< T >

Definition at line 230 of file Algebra.h.

Member Typedef Documentation

◆ matrix

template<typename T >
using pcl::GenericInPlaceSVD< T >::matrix = GenericMatrix<T>

Represents a matrix involved in a singular value decomposition.

Definition at line 242 of file Algebra.h.

◆ matrix_element

template<typename T >
using pcl::GenericInPlaceSVD< T >::matrix_element = typename matrix::element

Represents a matrix element.

Definition at line 252 of file Algebra.h.

◆ vector

template<typename T >
using pcl::GenericInPlaceSVD< T >::vector = GenericVector<T>

Represents a vector involved in a singular value decomposition.

Definition at line 237 of file Algebra.h.

◆ vector_component

template<typename T >
using pcl::GenericInPlaceSVD< T >::vector_component = typename vector::component

Represents a vector component.

Definition at line 247 of file Algebra.h.

Constructor & Destructor Documentation

◆ GenericInPlaceSVD()

template<typename T >
pcl::GenericInPlaceSVD< T >::GenericInPlaceSVD ( matrix A)
inline

Singular Value Decomposition: A = U*W*Vt

The dimensions of A are n rows and m columns. U is an n x m matrix. The m components of W are the positive diagonal elements of W, and each column of V (m x m) is the eigenvector for the corresponding element of W.

On output, this constructor replaces the specified matrix A with the matrix U that results from the SVD decomposition (indeed that's why this is an in-place decomposition). W and V are stored in the corresponding members of this object.

Definition at line 280 of file Algebra.h.

Member Function Documentation

◆ IndexOfLargestSingularValue()

template<typename T >
int pcl::GenericInPlaceSVD< T >::IndexOfLargestSingularValue ( ) const
inline

Returns the column index of the largest eigenvector in matrix V. This is the index of the largest component of vector W.

Definition at line 291 of file Algebra.h.

◆ IndexOfSmallestSingularValue()

template<typename T >
int pcl::GenericInPlaceSVD< T >::IndexOfSmallestSingularValue ( ) const
inline

Returns the column index of the smallest eigenvector in matrix V. This is the index of the smallest nonzero component of vector W.

Before calling this function, you should edit the components of vector W to set to zero all singular values below a suitable tolerance. For example, using the machine epsilon:

...
InPlaceSVD svd( A );
for ( int i = 0; i < svd.W.Length(); ++i )
if ( 1 + svd.W[i] == 1 )
svd.W[i] = 0;
int i = svd.IndexOfSmallestSingularValue();
...
64-bit floating point real matrix.

Definition at line 315 of file Algebra.h.

Member Data Documentation

◆ V

template<typename T >
matrix pcl::GenericInPlaceSVD< T >::V

Each column of this m x m matrix is the eigenvector for the corresponding element of W in a singular value decomposition A=U*W*Vt. m is the number of columns in the decomposed matrix A.

Definition at line 266 of file Algebra.h.

◆ W

template<typename T >
vector pcl::GenericInPlaceSVD< T >::W

The components of this vector are the m (positive) diagonal elements of the matrix W in a singular value decomposition A=U*W*Vt. m is the number of columns in the decomposed matrix A.

Definition at line 259 of file Algebra.h.


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