TDecompLU.h

Go to the documentation of this file.
00001 // @(#)root/matrix:$Id: TDecompLU.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_TDecompLU
00013 #define ROOT_TDecompLU
00014 
00015 ///////////////////////////////////////////////////////////////////////////
00016 //                                                                       //
00017 // LU Decomposition class                                                //
00018 //                                                                       //
00019 ///////////////////////////////////////////////////////////////////////////
00020 
00021 #ifndef ROOT_TDecompBase
00022 #include "TDecompBase.h"
00023 #endif
00024 
00025 class TDecompLU : public TDecompBase
00026 {
00027 protected :
00028 
00029    Int_t     fImplicitPivot; // control to determine implicit row scale before
00030                              //  deciding on the pivot (Crout method)
00031    Int_t     fNIndex;        // size of row permutation index
00032    Int_t    *fIndex;         //[fNIndex] row permutation index
00033    Double_t  fSign;          // = +/- 1 reflecting even/odd row permutations, resp.
00034    TMatrixD  fLU;            // decomposed matrix so that a = l u where
00035                              // l is stored lower left and u upper right side
00036 
00037    static Bool_t DecomposeLUCrout(TMatrixD &lu,Int_t *index,Double_t &sign,Double_t tol,Int_t &nrZeros);
00038    static Bool_t DecomposeLUGauss(TMatrixD &lu,Int_t *index,Double_t &sign,Double_t tol,Int_t &nrZeros);
00039 
00040    virtual const TMatrixDBase &GetDecompMatrix() const { return fLU; }
00041 
00042 public :
00043 
00044    TDecompLU();
00045    explicit TDecompLU(Int_t nrows);
00046    TDecompLU(Int_t row_lwb,Int_t row_upb);
00047    TDecompLU(const TMatrixD &m,Double_t tol = 0.0,Int_t implicit = 1);
00048    TDecompLU(const TDecompLU &another);
00049    virtual ~TDecompLU() {if (fIndex) delete [] fIndex; fIndex = 0; }
00050 
00051            const TMatrixD  GetMatrix ();
00052    virtual       Int_t     GetNrows  () const { return fLU.GetNrows(); }
00053    virtual       Int_t     GetNcols  () const { return fLU.GetNcols(); }
00054            const TMatrixD &GetLU     ()       { if ( !TestBit(kDecomposed) ) Decompose();
00055                                                 return fLU; }
00056 
00057    virtual       void      SetMatrix (const TMatrixD &a);
00058 
00059    virtual Bool_t   Decompose  ();
00060    virtual Bool_t   Solve      (      TVectorD &b);
00061    virtual TVectorD Solve      (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
00062    virtual Bool_t   Solve      (      TMatrixDColumn &b);
00063    virtual Bool_t   TransSolve (      TVectorD &b);
00064    virtual TVectorD TransSolve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = TransSolve(x); return x; }
00065    virtual Bool_t   TransSolve (      TMatrixDColumn &b);
00066    virtual void     Det        (Double_t &d1,Double_t &d2);
00067 
00068    static  Bool_t   InvertLU  (TMatrixD &a,Double_t tol,Double_t *det=0);
00069    Bool_t           Invert    (TMatrixD &inv);
00070    TMatrixD         Invert    (Bool_t &status);
00071    TMatrixD         Invert    () { Bool_t status; return Invert(status); }
00072 
00073    void Print(Option_t *opt ="") const; // *MENU*
00074 
00075    TDecompLU &operator= (const TDecompLU &source);
00076 
00077    ClassDef(TDecompLU,1) // Matrix Decompositition LU
00078 };
00079 
00080 #endif

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