SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWSVServer< TypeT, SVDCalc > Class Template Reference

Used to construct instances of the singular value decomposition class, RWSVDecomp. More...

#include <rw/lapack/sv.h>

Inherits SVDCalc.

Public Types

typedef rw_numeric_traits< TypeT >::norm_type norm_type
 

Public Member Functions

 RWSVServer ()
 
void computeAllLeftVectors ()
 
void computeAllRightVectors ()
 
void computeAllVectors ()
 
void computeDefaultLeftVectors ()
 
void computeDefaultRightVectors ()
 
void computeDefaultVectors ()
 
void computeLeftVectors (unsigned n)
 
void computeRightVectors (unsigned n)
 
void computeVectors (unsigned n)
 
virtual RWSVDecomp< TypeT, SVDCalc > operator() (const RWGenMat< TypeT > &) const
 
void setTolerance (norm_type)
 

Detailed Description

template<class TypeT, class SVDCalc>
class RWSVServer< TypeT, SVDCalc >

The singular value decomposition server class, RWSVServer, is used to construct instances of the singular value decomposition class, RWSVDecomp. Using a server rather than the standard singular value decomposition constructor gives you control over what is computed.

The template parameter <SVDCalc> determines the algorithm used by the RWSVDecomp class to compute the singular value decomposition and must implement the following method:

Note
For greater flexibility, the user can implement this method, or the Linear Algebra Module provides two classes to perform this function — RWSVDCalc and RWSVDDivConqCalc. Please see their descriptions for more information.
bool computeSVD(const RWGenMat<T>& A, RWGenMat<T>& U, RWGenMat<T>& VT,
RWMathVec<norm_type>& sigma, norm_type tolerance,
int numLeftVectors = -1, int numRightVectors = -1);
A templatized general matrix class.
Definition genmat.h:741
A templatized vector class.
Definition mathvec.h:667
rw_numeric_traits< TypeT >::norm_type norm_type
Definition sv.h:376

where norm_type is a typedef for rw_numeric_traits<T>::norm_type.

Parameters:

A - The input matrix for which the singular value decomposition is being computed.

U - The output matrix of left singular victors (the columns of U are the left singular vectors).

VT - The output matrix of right singular victors (the rows of VT are the right singular victors).

sigma - The output vector of singular values in descending order.

tolerance - The input singular values with magnitude less than tolerance will be set to zero.

numLeftVectors - The input number of left vectors to compute. If the number is less than zero, the default number of vectors will be computed (it is up to the developer to determine what the default is).

numRightVectors - The input number of right vectors to compute. If the number is less than zero, the default number of vectors will be computed (it is up to the developer to determine what the default is).

The return value is true if the decomposition was successfully computed.

Synopsis
#include <rw/lapack/sv.h>
#include <rw/lapack/svddccalc.h>
Used to construct instances of the singular value decomposition class, RWSVDecomp.
Definition sv.h:370
Example
// Read a matrix from standard input and print its singular
// values. Use a SV decomposition server to prevent computing
// the singular vectors.
#include <rw/lapack/sv.h>
#include <rw/lapack/svddccalc.h>
#include <rw/math/genmat.h>
#include <iostream>
int main() {
std::cin >> A;
server.computeVectors(0); // compute zero vectors
std::cout << "Singular values are " << SV.SingularValues()
<< std::endl;
return 0;
}
Used to construct and work with singular value decompositions.
Definition sv.h:148
void computeVectors(unsigned n)

Member Typedef Documentation

◆ norm_type

template<class TypeT , class SVDCalc >
typedef rw_numeric_traits<TypeT>::norm_type RWSVServer< TypeT, SVDCalc >::norm_type

Typedef for the usual return type of numerical norm-like functions. For more information, see rw_numeric_traits<T>::norm_type.

Constructor & Destructor Documentation

◆ RWSVServer()

template<class TypeT , class SVDCalc >
RWSVServer< TypeT, SVDCalc >::RWSVServer ( )

Default constructor. Builds a new server, which computes all singular vectors by default.

Member Function Documentation

◆ computeAllLeftVectors()

template<class TypeT , class SVDCalc >
void RWSVServer< TypeT, SVDCalc >::computeAllLeftVectors ( )

Configures the server to compute all left singular vectors.

◆ computeAllRightVectors()

template<class TypeT , class SVDCalc >
void RWSVServer< TypeT, SVDCalc >::computeAllRightVectors ( )

Configures the server to compute all right singular vectors.

◆ computeAllVectors()

template<class TypeT , class SVDCalc >
void RWSVServer< TypeT, SVDCalc >::computeAllVectors ( )

Configures the server to compute the first min(m,n) singular vectors, where m x n is the size of the input matrix.

◆ computeDefaultLeftVectors()

template<class TypeT , class SVDCalc >
void RWSVServer< TypeT, SVDCalc >::computeDefaultLeftVectors ( )

Configures the server to compute the first min(m,n) left singular vectors, where m x n is the size of the input matrix.

◆ computeDefaultRightVectors()

template<class TypeT , class SVDCalc >
void RWSVServer< TypeT, SVDCalc >::computeDefaultRightVectors ( )

Configures the server to compute the first min(m,n) right singular vectors, where m x n is the size of the input matrix.

◆ computeDefaultVectors()

template<class TypeT , class SVDCalc >
void RWSVServer< TypeT, SVDCalc >::computeDefaultVectors ( )

Configures the server to compute all singular vectors.

◆ computeLeftVectors()

template<class TypeT , class SVDCalc >
void RWSVServer< TypeT, SVDCalc >::computeLeftVectors ( unsigned n)

Configures the server to compute the first n left singular vectors.

◆ computeRightVectors()

template<class TypeT , class SVDCalc >
void RWSVServer< TypeT, SVDCalc >::computeRightVectors ( unsigned n)

Configures the server to compute the first n right singular vectors.

◆ computeVectors()

template<class TypeT , class SVDCalc >
void RWSVServer< TypeT, SVDCalc >::computeVectors ( unsigned n)

Configures the server to compute the first n singular vectors.

◆ operator()()

template<class TypeT , class SVDCalc >
virtual RWSVDecomp< TypeT, SVDCalc > RWSVServer< TypeT, SVDCalc >::operator() ( const RWGenMat< TypeT > & ) const
virtual

Computes a singular value decomposition.

◆ setTolerance()

template<class TypeT , class SVDCalc >
void RWSVServer< TypeT, SVDCalc >::setTolerance ( norm_type )

Specifies an accuracy to which the singular values should be computed.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.