Linear
Linear::SVD< T, M, N, Flags, Type > Struct Template Reference

Struct for SVD decomposition. More...

#include <Decomp.h>

Public Member Functions

template<size_t P, size_t Q, unsigned int Flags2>
 SVD (const Matrix< T, P, Q, Flags2 > &A)
 Constructor. More...
 
template<size_t P, size_t Q, unsigned int Flags2>
void Compute (const Matrix< T, P, Q, Flags2 > &A)
 Computes the SVD decomposition. More...
 

Public Attributes

std::conditional_t< Type==FULL_SVD, SquareMatrix< T, M, Flags >, Matrix< T, M,(M >N?N:M), Flags > > U
 
std::conditional_t< Type==FULL_SVD, Matrix< T, M, N, Flags >, SquareMatrix< T,(M >N?N:M), Flags > > S
 
std::conditional_t< Type==FULL_SVD, SquareMatrix< T, N, Flags >, Matrix< T,(M >N?N:M), N, Flags > > Vh
 

Detailed Description

template<typename T, size_t M, size_t N, unsigned int Flags = 0, SVDType Type = FULL_SVD>
struct Linear::SVD< T, M, N, Flags, Type >

Struct for SVD decomposition.

This struct finds MxM matrix U, MxN matrix S and NxN matrix V such that \(A=USV^*\) where U and V are both unitary, and S is a rectangular diagonal matrix containing the real non-negative singular values of A in decreasing order. If THIN_SVD is passed, then U is MxK, S is KxK, and Vh is KxN where K=min(M,N).

Parameters
TType to store matrix entries as.
MNumber of rows for U and S. Dynamic is allowed for M.
NNumber of columns for S and Vh. Dynamic is allowed for N.
FlagsFlags to pass to the matrices (default = row major).
TypeEither FULL_SVD or THIN_SVD (default = FULL_SVD).

Constructor & Destructor Documentation

◆ SVD()

template<typename T , size_t M, size_t N, unsigned int Flags = 0, SVDType Type = FULL_SVD>
template<size_t P, size_t Q, unsigned int Flags2>
Linear::SVD< T, M, N, Flags, Type >::SVD ( const Matrix< T, P, Q, Flags2 > &  A)
inline

Constructor.

Just calls Compute.

Parameters
APxQ Matrix

Member Function Documentation

◆ Compute()

template<typename T , size_t M, size_t N, unsigned int Flags = 0, SVDType Type = FULL_SVD>
template<size_t P, size_t Q, unsigned int Flags2>
void Linear::SVD< T, M, N, Flags, Type >::Compute ( const Matrix< T, P, Q, Flags2 > &  A)
inline

Computes the SVD decomposition.

If P != M or Q != N, then an exception is thrown. If the matrix is not diagonalizable, an exception will be thrown.

Parameters
APxQ Matrix

Member Data Documentation

◆ S

template<typename T , size_t M, size_t N, unsigned int Flags = 0, SVDType Type = FULL_SVD>
std::conditional_t<Type==FULL_SVD, Matrix<T,M,N,Flags>, SquareMatrix<T,(M>N?N:M),Flags> > Linear::SVD< T, M, N, Flags, Type >::S

Rectangular diagonal matrix containing the singular values of A in decreasing order

◆ U

template<typename T , size_t M, size_t N, unsigned int Flags = 0, SVDType Type = FULL_SVD>
std::conditional_t<Type==FULL_SVD, SquareMatrix<T,M,Flags>, Matrix<T,M,(M>N?N:M),Flags> > Linear::SVD< T, M, N, Flags, Type >::U

Unitary matrix containing the left singular vectors

◆ Vh

template<typename T , size_t M, size_t N, unsigned int Flags = 0, SVDType Type = FULL_SVD>
std::conditional_t<Type==FULL_SVD, SquareMatrix<T,N,Flags>, Matrix<T,(M>N?N:M),N,Flags> > Linear::SVD< T, M, N, Flags, Type >::Vh

Vh=V*


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