Module: Linear Algebra Group: Decomposition classes
Does not inherit
#include <rw/lapack/qr.h> #include <rw/lapack/qrcalcp3.h> RWQRDecompServer<double, RWQRCalcP3<double> > server;
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.
// 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; }
RWQRDecompServer();
Default constructor. Builds a new server, which does pivoting by default.
void 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.
void setInitialIndex(int i);
Moves i to an initial position in the decomposition.
void setPivoting(bool);
Controls whether pivoting is done.
RWQRDecomp<T,QRCalc>
operator()(const RWGenMat<T>&);
Computes a QR decomposition.
© 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.