Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TDecompBK.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   Sep 2004
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_TDecompBK
0013 #define ROOT_TDecompBK
0014 
0015 ///////////////////////////////////////////////////////////////////////////
0016 //                                                                       //
0017 // Bunch-Kaufman Decomposition class                                     //
0018 //                                                                       //
0019 ///////////////////////////////////////////////////////////////////////////
0020 
0021 #include "Rtypes.h"
0022 #include "TDecompBase.h"
0023 #include "TMatrixDSym.h"
0024 #include "TVectorD.h"
0025 
0026 class TDecompBK : public TDecompBase
0027 {
0028 protected :
0029 
0030    Int_t     fNIpiv;    // size of row permutation index
0031    Int_t    *fIpiv;     //[fNIpiv] row permutation index
0032    TMatrixD  fU;        // decomposed matrix so that a = u d u^T
0033 
0034    const TMatrixDBase &GetDecompMatrix() const override { return fU; }
0035 
0036 public :
0037 
0038    TDecompBK();
0039    explicit TDecompBK(Int_t nrows);
0040    TDecompBK(Int_t row_lwb,Int_t row_upb);
0041    TDecompBK(const TMatrixDSym &m,Double_t tol = 0.0);
0042    TDecompBK(const TDecompBK &another);
0043    ~TDecompBK() override {if (fIpiv) delete [] fIpiv; fIpiv = nullptr; }
0044 
0045          Int_t     GetNrows  () const override { return fU.GetNrows(); }
0046          Int_t     GetNcols  () const override { return fU.GetNcols(); }
0047    const TMatrixD &GetU      ()       { if ( !TestBit(kDecomposed) ) Decompose();
0048                                                   return fU; }
0049 
0050    virtual       void      SetMatrix (const TMatrixDSym &a);
0051 
0052    Bool_t   Decompose  () override;
0053    Bool_t   Solve      (      TVectorD &b) override;
0054    TVectorD Solve      (const TVectorD& b,Bool_t &ok) override { TVectorD x = b; ok = Solve(x); return x; }
0055    Bool_t   Solve      (      TMatrixDColumn &b) override;
0056    Bool_t   TransSolve (      TVectorD &b) override            { return Solve(b); }
0057    TVectorD TransSolve (const TVectorD& b,Bool_t &ok) override { TVectorD x = b; ok = Solve(x); return x; }
0058    Bool_t   TransSolve (      TMatrixDColumn &b) override      { return Solve(b); }
0059    void     Det        (Double_t &/*d1*/,Double_t &/*d2*/) override
0060                                 { MayNotUse("Det(Double_t&,Double_t&)"); }
0061 
0062    Bool_t      Invert  (TMatrixDSym &inv);
0063    TMatrixDSym Invert  (Bool_t &status);
0064    TMatrixDSym Invert  () { Bool_t status; return Invert(status); }
0065 
0066    void        Print(Option_t *opt ="") const override; // *MENU*
0067 
0068    TDecompBK &operator= (const TDecompBK &source);
0069 
0070    ClassDefOverride(TDecompBK,1) // Matrix Decomposition Bunch-Kaufman
0071 };
0072 
0073 #endif