TDecompChol.h

Go to the documentation of this file.
00001 // @(#)root/matrix:$Id: TDecompChol.h 22428 2008-03-03 18:17:03Z brun $
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_TDecompChol
00013 #define ROOT_TDecompChol
00014 
00015 ///////////////////////////////////////////////////////////////////////////
00016 //                                                                       //
00017 // Cholesky 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 
00028 class TDecompChol : public TDecompBase
00029 {
00030 protected :
00031 
00032    TMatrixD fU; // decomposed matrix fU so that a = fU^T fU
00033 
00034    virtual const TMatrixDBase &GetDecompMatrix() const { return fU; }
00035 
00036 public :
00037 
00038    TDecompChol() : fU() {}
00039    explicit TDecompChol(Int_t nrows);
00040    TDecompChol(Int_t row_lwb,Int_t row_upb);
00041    TDecompChol(const TMatrixDSym &a,Double_t tol = 0.0);
00042    TDecompChol(const TMatrixD    &a,Double_t tol = 0.0);
00043    TDecompChol(const TDecompChol &another);
00044    virtual ~TDecompChol() {}
00045 
00046            const TMatrixDSym GetMatrix ();
00047    virtual       Int_t       GetNrows  () const { return fU.GetNrows(); }
00048    virtual       Int_t       GetNcols  () const { return fU.GetNcols(); }
00049            const TMatrixD   &GetU      () const { return fU; }
00050 
00051    virtual       void        SetMatrix (const TMatrixDSym &a);
00052 
00053    virtual Bool_t   Decompose  ();
00054    virtual Bool_t   Solve      (      TVectorD &b);
00055    virtual TVectorD Solve      (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
00056    virtual Bool_t   Solve      (      TMatrixDColumn &b);
00057    virtual Bool_t   TransSolve (      TVectorD &b)            { return Solve(b); }
00058    virtual TVectorD TransSolve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
00059    virtual Bool_t   TransSolve (      TMatrixDColumn &b)      { return Solve(b); }
00060    virtual void     Det        (Double_t &d1,Double_t &d2);
00061 
00062            Bool_t      Invert  (TMatrixDSym &inv);
00063            TMatrixDSym Invert  (Bool_t &status);
00064            TMatrixDSym Invert  () { Bool_t status; return Invert(status); }
00065 
00066    void Print(Option_t *opt ="") const; // *MENU*
00067 
00068    TDecompChol &operator= (const TDecompChol &source);
00069 
00070    ClassDef(TDecompChol,2) // Matrix Decompositition Cholesky
00071 };
00072 
00073 TVectorD NormalEqn(const TMatrixD &A,const TVectorD &b);
00074 TVectorD NormalEqn(const TMatrixD &A,const TVectorD &b,const TVectorD &std);
00075 TMatrixD NormalEqn(const TMatrixD &A,const TMatrixD &b);
00076 TMatrixD NormalEqn(const TMatrixD &A,const TMatrixD &B,const TVectorD &std);
00077 
00078 #endif

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