rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWQRDecompServer< TypeT, QRCalc > Class Template Reference
[Decomposition]

Used to construct instances of the QR decomposition class, RWQRDecomp<T,QRCalc> . More...

#include <rw/lapack/qr.h>

List of all members.

Public Member Functions

 RWQRDecompServer ()
void setPivoting (bool)
void setInitialIndex (int i)
void setFreeIndex (int i)
RWQRDecomp< TypeT, QRCalc > operator() (const RWGenMat< TypeT > &) const

Detailed Description

template<class TypeT, class QRCalc>
class RWQRDecompServer< TypeT, QRCalc >

The QR decomposition server class, RWQRDecompServer<T,QRCalc>, is used to construct instances of the QR decomposition class, RWQRDecomp<T,QRCalc>. Using a server rather than the standard QR decomposition constructor gives you control over how pivoting is done.

Normally, columns in the input matrix may be moved in order to increase the robustness of the computation of the QR decomposition. This is called pivoting. In some cases, you may want to ensure that certain columns of the input matrix are kept at the front of the QR decomposition, or you may want to disable pivoting altogether. Using a server object gives you this control.

Note:
For greater flexibility, 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.

Synopsis

 #include <rw/lapack/qr.h>
 #include <rw/lapack/qrcalcp3.h>
 
 RWQRDecompServer<double, RWQRCalcP3<double> > server;

Examples

 // Read a matrix from standard input and print its
 //  QR decomposition.
 // Use a QR decomposition server to prevent pivoting.
 
 #include <iostream>
 #include <rw/math/genmat.h>
 #include <rw/lapack/qr.h>
 #include <rw/lapack/qrcalcp3.h>
 
 int main()
 {
     RWGenMat<double> A;
     std::cin >> A;
     RWQRDecompServer<double, RWQRCalcP3<double> >
                              server;
     server.setPivoting(false);
     RWQRDecomp<double, RWQRCalcP3<double> > QR =
                        server(A);
     std::cout << "Q=" << QR.Q() << std::endl;
     std::cout << "R=" << QR.R() << std::endl;
     return 0;
 }

Constructor & Destructor Documentation

template<class TypeT, class QRCalc>
RWQRDecompServer< TypeT, QRCalc >::RWQRDecompServer (  ) 

Default constructor. Builds a new server, which does pivoting by default.


Member Function Documentation

template<class TypeT, class QRCalc>
RWQRDecomp<TypeT,QRCalc> RWQRDecompServer< TypeT, QRCalc >::operator() ( const RWGenMat< TypeT > &   )  const

Computes a QR decomposition.

template<class TypeT, class QRCalc>
void RWQRDecompServer< TypeT, QRCalc >::setFreeIndex ( int  i  ) 

Makes i a free index, so that it may be pivoted to any column of the decomposition. Initially, all indices are free.

template<class TypeT, class QRCalc>
void RWQRDecompServer< TypeT, QRCalc >::setInitialIndex ( int  i  ) 

Moves i to an initial position in the decomposition.

template<class TypeT, class QRCalc>
void RWQRDecompServer< TypeT, QRCalc >::setPivoting ( bool   ) 

Controls whether pivoting is done.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.