00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TDecompLU
00013 #define ROOT_TDecompLU
00014
00015
00016
00017
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;
00030
00031 Int_t fNIndex;
00032 Int_t *fIndex;
00033 Double_t fSign;
00034 TMatrixD fLU;
00035
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;
00074
00075 TDecompLU &operator= (const TDecompLU &source);
00076
00077 ClassDef(TDecompLU,1)
00078 };
00079
00080 #endif