Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TDecompLU.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/matrix:$Id$
0002 // Authors: Fons Rademakers, Eddy Offermann   Dec 2003
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TDecompLU
0013 #define ROOT_TDecompLU
0014 
0015 ///////////////////////////////////////////////////////////////////////////
0016 //                                                                       //
0017 // LU Decomposition class                                                //
0018 //                                                                       //
0019 ///////////////////////////////////////////////////////////////////////////
0020 
0021 #include "TDecompBase.h"
0022 
0023 class TDecompLU : public TDecompBase
0024 {
0025 protected :
0026 
0027    Int_t     fImplicitPivot; // control to determine implicit row scale before
0028                              //  deciding on the pivot (Crout method)
0029    Int_t     fNIndex;        // size of row permutation index
0030    Int_t    *fIndex;         //[fNIndex] row permutation index
0031    Double_t  fSign;          // = +/- 1 reflecting even/odd row permutations, resp.
0032    TMatrixD  fLU;            // decomposed matrix so that a = l u where
0033                              // l is stored lower left and u upper right side
0034 
0035    static Bool_t DecomposeLUCrout(TMatrixD &lu,Int_t *index,Double_t &sign,Double_t tol,Int_t &nrZeros);
0036    static Bool_t DecomposeLUGauss(TMatrixD &lu,Int_t *index,Double_t &sign,Double_t tol,Int_t &nrZeros);
0037 
0038    const TMatrixDBase &GetDecompMatrix() const override { return fLU; }
0039 
0040 public :
0041 
0042    TDecompLU();
0043    explicit TDecompLU(Int_t nrows);
0044    TDecompLU(Int_t row_lwb,Int_t row_upb);
0045    TDecompLU(const TMatrixD &m,Double_t tol = 0.0,Int_t implicit = 1);
0046    TDecompLU(const TDecompLU &another);
0047    ~TDecompLU() override {if (fIndex) delete [] fIndex; fIndex = nullptr; }
0048 
0049            const TMatrixD  GetMatrix ();
0050          Int_t     GetNrows  () const override { return fLU.GetNrows(); }
0051          Int_t     GetNcols  () const override { return fLU.GetNcols(); }
0052            const TMatrixD &GetLU     ()       { if ( !TestBit(kDecomposed) ) Decompose();
0053                                                 return fLU; }
0054 
0055    virtual       void      SetMatrix (const TMatrixD &a);
0056 
0057    Bool_t   Decompose  () override;
0058    Bool_t   Solve      (      TVectorD &b) override;
0059    TVectorD Solve      (const TVectorD& b,Bool_t &ok) override { TVectorD x = b; ok = Solve(x); return x; }
0060    Bool_t   Solve      (      TMatrixDColumn &b) override;
0061    Bool_t   TransSolve (      TVectorD &b) override;
0062    TVectorD TransSolve (const TVectorD& b,Bool_t &ok) override { TVectorD x = b; ok = TransSolve(x); return x; }
0063    Bool_t   TransSolve (      TMatrixDColumn &b) override;
0064    void     Det        (Double_t &d1,Double_t &d2) override;
0065 
0066    static  Bool_t   InvertLU  (TMatrixD &a,Double_t tol,Double_t *det = nullptr);
0067    Bool_t           Invert    (TMatrixD &inv);
0068    TMatrixD         Invert    (Bool_t &status);
0069    TMatrixD         Invert    () { Bool_t status; return Invert(status); }
0070 
0071    void Print(Option_t *opt ="") const override; // *MENU*
0072 
0073    TDecompLU &operator= (const TDecompLU &source);
0074 
0075    ClassDefOverride(TDecompLU,1) // Matrix Decompositition LU
0076 };
0077 
0078 #endif