Module: Linear Algebra Group: Decomposition classes
Does not inherit
cols() factor() P() PTx() Px() |
Q() QTx() Qx() rank() rows() |
RWCODecomp() T() Tinvx() TTinvx() TTx() |
Tx() Z() ZTx() Zx() |
#include <rw/lapack/qrcalc3.h> #include <rw/lapack/co.h> RWCODecomp<double, RWQRCalcP3<double> > QTZ(A); // A is an RWGenMat<double>
The class RWCODecomp<T,QRCalc> encapsulates a complete orthogonal decomposition. A complete orthogonal decomposition decomposes a general rectangular matrix A into the form:
where P is a permutation, Q and Z are orthogonal matrices, and T is an upper triangular matrix. This transformation is closely related to the QR transformation. The difference is that an extra orthogonal transformation, Z, is applied to zero out the columns to the right of T.
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.
This decomposition is commonly used in the solution of least squares problems. The implementation of the Linear Algebra Module class RWLeastSqQR<T> uses the complete orthogonal transformation.
#include <rw/lapack/qrcalc3.h> #include <iostream> #include <rw/lapack/co.h> int main() { RWGenMat<double> A; std::cin >> A; RWCODecomp<double, RWQRCalcP3<double> > co(A); std::cout << "Input matrix: " << A << endl; std::cout << "Permutation: " << co.P() << std::endl; std::cout << "Q: " << co.Q() << endl; std::cout << "Z: " << co.Z() << endl; std::cout << "T: " << co.T() << endl; return 0; }
RWCODecomp();
Default constructor. Builds a decomposition of size 0 x 0.
RWCODecomp(const RWCODecomp<T>& A);
Copy constructor. References the data in the original decomposition for efficiency.
RWCODecomp(const RWQRDecomp<T>& A, double tol=0);
Builds a complete orthogonal representation of the matrix represented by the QR decomposition. Entries along the diagonal of the R factor of the QR decomposition that are smaller in magnitude than tol are treated
as 0.
RWCODecomp(const RWGenMat<T>& A, double tol=0);
Builds a complete orthogonal decomposition of A. Entries along the diagonal of T that would be smaller in magnitude than tol are treated as 0.
unsigned cols();
Returns the number of columns in the matrix that the decomposition represents.
void factor(const DoubleQRDecomp& A, double tol=0); void factor(const FloatQRDecomp& A, double tol=0); void factor(const DComplexQRDecomp& A, double tol=0);
Builds a complete orthogonal representation of the matrix represented by the QR decomposition. Entries along the diagonal of the R factor of the QR decomposition that are smaller in magnitude than tol are treated
as 0. The current contents of the decomposition are lost.
void factor(const RWGenMat<T>& A, double tol=0);
Builds a complete orthogonal decomposition of A. Entries along the diagonal of T that would be smaller in magnitude than tol are treated as 0. The current contents of the decomposition are lost.
RWGenMat<T> P();
Computes an explicit representation of the permutation matrix.
RWMathVec<T> Px(const RWMathVec<T>& x); RWMathVec<T> PTx(const RWMathVec<T>& x);
Computes the inner product of the permutation, or its transpose, and the vector x.
RWGenMat<T> Q();
Computes an explicit representation of the orthogonal matrix Q.
RWMathVec<T> Qx(const RWMathVec<T>& x); RWMathVec<T> QTx(const RWMathVec<T>& x);
Computes the inner product of the orthogonal matrix Q, or its (conjugate) transpose, and the vector x.
unsigned rank();
Returns the rank of the matrix that the decomposition represents. The rank is also the number of rows and columns in the factor T.
unsigned rows();
Returns the number of rows in the matrix that the decomposition represents.
RWGenMat<T> T();
Returns an explicit representation of the triangular matrix T.
RWMathVec<T> Tx(const RWMathVec<T>& x); RWMathVec<T> TTx(const RWMathVec<T>& x); RWMathVec<T> Tinvx(const RWMathVec<T>& x); RWMathVec<T> TTinvx(const RWMathVec<T>& x);
Computes the inner product of the matrix T, its (conjugate) transpose, its inverse, or its (conjugate) transpose inverse, and the vector x.
RWGenMat<T> Z();
Computes an explicit representation of the orthogonal matrix Z.
RWMathVec<T> Zx(const RWMathVec<T>& x); RWMathVec<T> ZTx(const RWMathVec<T>& x);
Computes the inner product of the orthogonal matrix Z, or its (conjugate) transpose, and the vector x.
© 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.