Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Linear Algebra Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWLeastSqCh<T>, RWLeastSqQR<T,QRCalc>, RWLeastSqSV<T,SVDCalc>

Module:  Linear Algebra   Group:  Least Squares Factorization classes


Does not inherit

Local Index

Members

Synopsis

#include <rw/lapack/lsch.h>
#include <rw/lapack/lsqr.h>
#include <rw/lapack/lssv.h>
#include <rw/lapack/dvddccalc.h>

RWLeastSqSV<double, RWSVDDivConqCalc<double> > SVD(A);   // A is
// an RWGenMat<double> RWMathVec<double> x = SVD.solve(b); // b is an RWMathVec<double>

Description

A linear system of equations has the form Ax=b, where A contains more rows than columns and generally has no exact solution; it is overdetermined. The best that we can do is to find a solution vector x such that the norm of the residual vector, Ax-b, is made as small as possible. The vector x is then a solution in the least squares sense, and this sort of problem is called a least squares problem.

There are three classes in the Linear Algebra Module for solving least squares problems. The approach is to construct a factorization of the matrix A that can be used to solve the problem. The classes RWLeastSqCh<T>, RWLeastSqQR<T,QRCalc>, and RWLeastSqSV<T,SVDCalc> encapsulate this factorization object. There are three methods provided:

Which method you choose depends on the trade-off between speed and robustness that you want to make. As you move down the list, the methods decrease in speed, but increase in accuracy and robustness.

A system of equations Ax=b is underdetermined if the columns of A are linearly dependent. In this case, there are infinitely many solutions. Often, the one that is desired is the one with minimum norm. The classes RWLeastSqQR<T,QRCalc> and RWLeastSqSV<T> allow you to compute this solution.

Note that the classes RWLeastSqQR<T,QRCalc> and RWLeastSqSV<T> are publicly derived from their underlying decomposition types, so that advanced users can manipulate the underlying decomposition directly.


NOTE -- For greater flexibility with RWLeastSqQR<T,QRCalc>, the user can implement this method, or the Linear Algebra Module provides two classes to perform this function - RWQRCalc<T> and RWQRCalcP3<T>. Please see their descriptions in this reference guide for more information.

Example

Public Constructors

RWLeastSqCh();
RWLeastSqQR();
RWLeastSqSV();
RWLeastSqCh(const RWGenMat<T>& A);
RWLeastSqQR(const RWGenMat<float>& A, float tol=0);
RWLeastSqQR(const RWGenMat<double>& A, double tol=0);
RWLeastSqQR(const RWGenMat<DComplex>& A, double
tol=0); RWLeastSqSV(const RWGenMat<float>& A, float tol=0); RWLeastSqSV(const RWGenMat<double>& A, double tol=0); RWLeastSqSV(const RWGenMat<DComplex>& A, double
tol=0);
RWLeastSqQR(const RWCODecomp<T,QRCalc>& A);
RWLeastSqQR(const RWQRDecomp<float,SVDCalc>& A, float
tol=0); RWLeastSqQR(const RWQRDecomp<double,SVDCalc>& A,
double tol=0); RWLeastSqQR(const RWQRDecomp<DComplex,SVDCalc>& A,
double tol=0); RWLeastSqSV(const RWSVDecomp<float,SVDCalc>& A, float
tol=0); RWLeastSqSV(const RWSVDecomp<double,SVDCalc>& A,
double tol=0); RWLeastSqSV(const RWSVDecomp<DComplex,SVDCalc>& A,
double tol=0);

Public Member Functions

unsigned    
cols
();
void
RWLeastSqCh<T>::factor(const RWGenMat<T>& A);
void
RWLeastSqQR<float,QRCalc>::factor(const
RWGenMat<float>& A, float tol=0); RWLeastSqQR<double,QRCalc>::factor(const
RWGenMat<double>& A, double tol=0); RWLeastSqQR<DComplex>::factor(const
RWGenMat<DComplex>& A, double tol=0); void RWLeastSqSV<float,SVDCalc>::factor(const
RWGenMat<float>& A, float tol=0); void RWLeastSqSV<double,SVDCalc>::factor(const
RWGenMat<double>& A, double tol=0); void RWLeastSqSV<DComplex,SVDCalc>::factor(const
RWGenMat<DComplex>& A, double tol=0);
void
RWLeastSqQR<float,QRCalc>::factor(const
RWQRDecomp<float>& A, float tol=0); RWLeastSqQR<double,QRCalc>::factor(const
RWQRDecomp<double>& A, double tol=0); RWLeastSqQR<DComplex,QRCalc>::factor(const
RWQRDecomp<DComplex>& A, double tol=0); void RWLeastSqQR<T>::factor(const RWCODecomp<T>& A); void RWLeastSqSV<float,SVDCalc>::factor(const
RWSVDecomp<float>& A, float tol=0); RWLeastSqSV<double,SVDCalc>::factor(const
RWSVDecomp<double>& A, double tol=0); RWLeastSqSV<DComplex,SVDCalc>::factor(const
RWSVDecomp<DComplex>& A, double tol=0);
unsigned    
RWLeastSqCh<T>::fail(); unsigned
RWLeastSqSV<T,SVDCalc>::fail(); unsigned
RWLeastSqCh<T>::good(); unsigned
RWLeastSqSV<T,SVDCalc>::good();
unsigned    
rank
();
unsigned    
rows();
void
RWLeastSqSV<T,SVDCalc>::truncate(float tol);
unsigned 
residual(const RWMathVec<T>& b);
unsigned 
residualNorm(const RWMathVec<T>& b);
RWMathVec<T>
solve(const RWMathVec<T>& b);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.