TDecompBK.h

Go to the documentation of this file.
00001 // @(#)root/matrix:$Id: TDecompBK.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Authors: Fons Rademakers, Eddy Offermann   Sep 2004
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_TDecompBK
00013 #define ROOT_TDecompBK
00014 
00015 ///////////////////////////////////////////////////////////////////////////
00016 //                                                                       //
00017 // Bunch-Kaufman Decomposition class                                     //
00018 //                                                                       //
00019 ///////////////////////////////////////////////////////////////////////////
00020 
00021 #ifndef ROOT_TDecompBase
00022 #include "TDecompBase.h"
00023 #endif
00024 #ifndef ROOT_TMatrixDSym
00025 #include "TMatrixDSym.h"
00026 #endif
00027 #ifndef ROOT_TVectorD
00028 #include "TVectorD.h"
00029 #endif
00030 
00031 class TDecompBK : public TDecompBase
00032 {
00033 protected :
00034 
00035    Int_t     fNIpiv;    // size of row permutation index
00036    Int_t    *fIpiv;     //[fNIpiv] row permutation index
00037    TMatrixD  fU;        // decomposed matrix so that a = u d u^T
00038 
00039    virtual const TMatrixDBase &GetDecompMatrix() const { return fU; }
00040 
00041 public :
00042 
00043    TDecompBK();
00044    explicit TDecompBK(Int_t nrows);
00045    TDecompBK(Int_t row_lwb,Int_t row_upb);
00046    TDecompBK(const TMatrixDSym &m,Double_t tol = 0.0);
00047    TDecompBK(const TDecompBK &another);
00048    virtual ~TDecompBK() {if (fIpiv) delete [] fIpiv; fIpiv = 0; }
00049 
00050    virtual       Int_t     GetNrows  () const { return fU.GetNrows(); }
00051    virtual       Int_t     GetNcols  () const { return fU.GetNcols(); }
00052    const TMatrixD &GetU      ()       { if ( !TestBit(kDecomposed) ) Decompose();
00053                                                   return fU; }
00054 
00055    virtual       void      SetMatrix (const TMatrixDSym &a);
00056 
00057    virtual Bool_t   Decompose  ();    
00058    virtual Bool_t   Solve      (      TVectorD &b);
00059    virtual TVectorD Solve      (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
00060    virtual Bool_t   Solve      (      TMatrixDColumn &b);     
00061    virtual Bool_t   TransSolve (      TVectorD &b)            { return Solve(b); } 
00062    virtual TVectorD TransSolve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
00063    virtual Bool_t   TransSolve (      TMatrixDColumn &b)      { return Solve(b); }
00064    virtual void     Det        (Double_t &/*d1*/,Double_t &/*d2*/)
00065                                 { MayNotUse("Det(Double_t&,Double_t&)"); }
00066 
00067    Bool_t      Invert  (TMatrixDSym &inv);
00068    TMatrixDSym Invert  (Bool_t &status);
00069    TMatrixDSym Invert  () { Bool_t status; return Invert(status); }
00070 
00071    void        Print(Option_t *opt ="") const; // *MENU*
00072 
00073    TDecompBK &operator= (const TDecompBK &source);
00074 
00075    ClassDef(TDecompBK,1) // Matrix Decomposition Bunch-Kaufman
00076 };
00077 
00078 #endif

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