SourcePro® API Reference Guide

Product Documentation:
   SourcePro
Documentation Home
List of all members | Public Types | Public Member Functions
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,
norm_type tolerance,
int numLeftVectors = -1,
int numRightVectors = -1);

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>
Example
// Read a matrix from standard input and print its singular
// values. Use a SV decomposition server to prevent computing
// the singular vectors.
#include <iostream>
#include <rw/math/genmat.h>
#include <rw/lapack/sv.h>
#include <rw/lapack/svddccalc.h>
int main()
{
std::cin >> A;
server.computeVectors(0); // compute zero vectors
std::cout << "Singular values are " << SV.SingularValues()
<< std::endl;
return 0;
}

Member Typedef Documentation

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

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

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

Configures the server to compute all left singular vectors.

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

Configures the server to compute all right singular vectors.

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.

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.

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.

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

Configures the server to compute all singular vectors.

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

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

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

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

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

Configures the server to compute the first n singular vectors.

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

Computes a singular value decomposition.

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

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

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