TDecompQRH.h

Go to the documentation of this file.
00001 // @(#)root/matrix:$Id: TDecompQRH.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Authors: Fons Rademakers, Eddy Offermann   Dec 2003
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TDecompQRH
00013 #define ROOT_TDecompQRH
00014 
00015 ///////////////////////////////////////////////////////////////////////////
00016 //                                                                       //
00017 // QR Decomposition class                                                //
00018 //                                                                       //
00019 ///////////////////////////////////////////////////////////////////////////
00020 
00021 #ifndef ROOT_TDecompBase
00022 #include "TDecompBase.h"
00023 #endif
00024 
00025 class TDecompQRH : public TDecompBase
00026 {
00027 protected :
00028 
00029    //  A = fQ fR H (m x n) matrix
00030    TMatrixD fQ;  // (m x n) - orthogonal matrix
00031    TMatrixD fR;  // (n x n) - upper triangular matrix
00032    TVectorD fUp; // (n) - vector with Householder up's
00033    TVectorD fW;  // (n) - vector with Householder beta's
00034 
00035    static Bool_t QRH(TMatrixD &q,TVectorD &diagR,TVectorD &up,TVectorD &w,Double_t tol);
00036 
00037    virtual const TMatrixDBase &GetDecompMatrix() const { return fR; }
00038 
00039 public :
00040 
00041    enum {kWorkMax = 100}; // size of work array
00042 
00043    TDecompQRH() {}
00044    TDecompQRH(Int_t nrows,Int_t ncols);
00045    TDecompQRH(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb);
00046    TDecompQRH(const TMatrixD &m,Double_t tol = 0.0); // be careful for slicing in operator=
00047    TDecompQRH(const TDecompQRH &another);
00048    virtual ~TDecompQRH() {}
00049 
00050    virtual       Int_t     GetNrows () const { return fQ.GetNrows(); }
00051    virtual       Int_t     GetNcols () const { return fQ.GetNcols(); }
00052    virtual const TMatrixD &GetQ     ()       { if ( !TestBit(kDecomposed) ) Decompose();
00053                                                return fQ; }
00054    virtual const TMatrixD &GetR     ()       { if ( !TestBit(kDecomposed) ) Decompose();
00055                                                return fR; }
00056    virtual const TVectorD &GetUp    ()       { if ( !TestBit(kDecomposed) ) Decompose();
00057                                                return fUp; }
00058    virtual const TVectorD &GetW     ()       { if ( !TestBit(kDecomposed) ) Decompose();
00059                                                return fW; }
00060 
00061    virtual       void      SetMatrix(const TMatrixD &a);
00062 
00063    virtual Bool_t   Decompose  ();
00064    virtual Bool_t   Solve      (      TVectorD &b);
00065    virtual TVectorD Solve      (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
00066    virtual Bool_t   Solve      (      TMatrixDColumn &b);
00067    virtual Bool_t   TransSolve (      TVectorD &b);
00068    virtual TVectorD TransSolve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = TransSolve(x); return x; }
00069    virtual Bool_t   TransSolve (      TMatrixDColumn &b);
00070    virtual void     Det        (Double_t &d1,Double_t &d2);
00071 
00072            Bool_t   Invert     (TMatrixD &inv);
00073            TMatrixD Invert     (Bool_t &status);
00074            TMatrixD Invert     () { Bool_t status; return Invert(status); }
00075 
00076    void Print(Option_t *opt ="") const; // *MENU*
00077 
00078    TDecompQRH &operator= (const TDecompQRH &source);
00079 
00080    ClassDef(TDecompQRH,1) // Matrix Decompositition QRH
00081 };
00082 
00083 #endif

Generated on Tue Jul 5 14:26:45 2011 for ROOT_528-00b_version by  doxygen 1.5.1