library: libMatrix #include "TDecompQRH.h"

# TDecompQRH

class description - source file - inheritance tree (.pdf)

## class TDecompQRH : public TDecompBase

| Inheritance Chart:

`TObject`

<-

`TDecompBase`

<-

`TDecompQRH`

        protected:

          virtual const TMatrixDBase& GetDecompMatrix() const
                        static Bool_t QRH(TMatrixD& q, TVectorD& diagR, TVectorD& up, TVectorD& w, Double_t tol)

        public:

                                  TDecompQRH()
                                  TDecompQRH(Int_t nrows, Int_t ncols)
                                  TDecompQRH(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb)
                                  TDecompQRH(const TMatrixD& m, Double_t tol = 0.0)
                                  TDecompQRH(const TDecompQRH& another)
                          virtual ~TDecompQRH()
                   static TClass* Class()
                   virtual Bool_t Decompose()
                     virtual void Det(Double_t& d1, Double_t& d2)
                    virtual Int_t GetNcols() const
                    virtual Int_t GetNrows() const
          virtual const TMatrixD& GetQ() const
          virtual const TMatrixD& GetR() const
          virtual const TVectorD& GetUp() const
          virtual const TVectorD& GetW() const
                             void Invert(TMatrixD& inv)
                         TMatrixD Invert()
                  virtual TClass* IsA() const
                      TDecompQRH& operator=(const TDecompQRH& source)
                     virtual void Print(Option_t* opt = "") const
                     virtual void SetMatrix(const TMatrixD& a)
                     virtual void ShowMembers(TMemberInspector& insp, char* parent)
                   virtual Bool_t Solve(TVectorD& b)
                 virtual TVectorD Solve(const TVectorD& b, Bool_t& ok)
                   virtual Bool_t Solve(TMatrixDColumn& b)
                     virtual void Streamer(TBuffer& b)
                             void StreamerNVirtual(TBuffer& b)
                   virtual Bool_t TransSolve(TVectorD& b)
                 virtual TVectorD TransSolve(const TVectorD& b, Bool_t& ok)
                   virtual Bool_t TransSolve(TMatrixDColumn& b)

### Data Members

        protected:

          TMatrixD fQ   (m x n) - orthogonal matrix
          TMatrixD fR   (n x n) - upper triangular matrix
          TVectorD fUp  (n) - vector with Householder up's
          TVectorD fW   (n) - vector with Householder beta's

        public:

          static const enum TDecompQRH:: kWorkMax

## Class Description

     QR Decomposition class

     Decompose  a general (m x n) matrix A into A = fQ fR H   where

      fQ : (m x n) - orthogonal matrix
      fR : (n x n) - upper triangular matrix
      H  : HouseHolder matrix which is stored through
      fUp: (n) - vector with Householder up's
      fW : (n) - vector with Householder beta's

      If row/column index of A starts at (rowLwb,colLwb) then
      the decomposed matrices start from :
      fQ  : (rowLwb,0)
      fR  : (0,colLwb)
      and the decomposed vectors start from :
      fUp : (0)
      fW  : (0)

     Errors arise from formation of reflectors i.e. singularity .
     Note it attempts to handle the cases where the nRow <= nCol .

TDecompQRH(Int_t nrows,Int_t ncols)

TDecompQRH(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb)

TDecompQRH(const TMatrixD &a,Double_t tol)

TDecompQRH(const TDecompQRH &another) : TDecompBase(another)

Bool_t Decompose()

     QR decomposition of matrix a by Householder transformations,
      see Golub & Loan first edition p41 & Sec 6.2.
     First fR is returned in upper triang of fQ and diagR. fQ returned in
     'u-form' in lower triang of fQ and fW, the latter containing the
      "Householder betas".

Bool_t QRH(TMatrixD &q,TVectorD &diagR,TVectorD &up,TVectorD &w,Double_t tol)

void SetMatrix(const TMatrixD &a)

Bool_t Solve(TVectorD &b)

     Solve Ax=b assuming the QR form of A is stored in fR,fQ and fW, but assume b
     has *not* been transformed.  Solution returned in b.

Bool_t Solve(TMatrixDColumn &cb)

Bool_t TransSolve(TVectorD &b)

     Solve A^T x=b assuming the QR form of A is stored in fR,fQ and fW, but assume b
     has *not* been transformed.  Solution returned in b.

Bool_t TransSolve(TMatrixDColumn &cb)

void Det(Double_t &d1,Double_t &d2)

     This routine calculates the absolute (!) value of the determinant

void Invert(TMatrixD &inv)

     For a matrix A(m,n), its inverse A_inv is defined as A * A_inv = A_inv * A = unit
     The user should always supply a matrix of size (m x m) !
     If m > n , only the (n x m) part of the returned (pseudo inverse) matrix
     should be used .

TMatrixD Invert()

     For a matrix A(m,n), its inverse A_inv is defined as A * A_inv = A_inv * A = unit
     (n x m) Ainv is returned .

void Print(Option_t *opt) const

### Inline Functions

                           void ~TDecompQRH()
            const TMatrixDBase& GetDecompMatrix() const
                     TDecompQRH TDecompQRH(const TDecompQRH& another)
                          Int_t GetNrows() const
                          Int_t GetNcols() const
                const TMatrixD& GetQ() const
                const TMatrixD& GetR() const
                const TVectorD& GetUp() const
                const TVectorD& GetW() const
                         Bool_t Solve(TMatrixDColumn& b)
                         Bool_t TransSolve(TMatrixDColumn& b)
                    TDecompQRH& operator=(const TDecompQRH& source)
                        TClass* Class()
                        TClass* IsA() const
                           void ShowMembers(TMemberInspector& insp, char* parent)
                           void Streamer(TBuffer& b)
                           void StreamerNVirtual(TBuffer& b)

Last update: root/matrix:$Name: $:$Id: TDecompQRH.cxx,v 1.17 2005/02/15 16:17:09 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *