Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TDecompChol.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_TDecompChol
0013 #define ROOT_TDecompChol
0014 
0015 ///////////////////////////////////////////////////////////////////////////
0016 //                                                                       //
0017 // Cholesky Decomposition class                                          //
0018 //                                                                       //
0019 ///////////////////////////////////////////////////////////////////////////
0020 
0021 #include "TDecompBase.h"
0022 #include "TMatrixDSym.h"
0023 
0024 class TDecompChol : public TDecompBase
0025 {
0026 protected :
0027 
0028    TMatrixD fU; // decomposed matrix fU so that a = fU^T fU
0029 
0030    const TMatrixDBase &GetDecompMatrix() const override { return fU; }
0031 
0032 public :
0033 
0034    TDecompChol() : fU() {}
0035    explicit TDecompChol(Int_t nrows);
0036    TDecompChol(Int_t row_lwb,Int_t row_upb);
0037    TDecompChol(const TMatrixDSym &a,Double_t tol = 0.0);
0038    TDecompChol(const TMatrixD    &a,Double_t tol = 0.0);
0039    TDecompChol(const TDecompChol &another);
0040    ~TDecompChol() override {}
0041 
0042            const TMatrixDSym GetMatrix ();
0043          Int_t       GetNrows  () const override { return fU.GetNrows(); }
0044          Int_t       GetNcols  () const override { return fU.GetNcols(); }
0045            const TMatrixD   &GetU      () const { return fU; }
0046 
0047    virtual       void        SetMatrix (const TMatrixDSym &a);
0048 
0049    Bool_t   Decompose  () override;
0050    Bool_t   Solve      (      TVectorD &b) override;
0051    TVectorD Solve      (const TVectorD& b,Bool_t &ok) override { TVectorD x = b; ok = Solve(x); return x; }
0052    Bool_t   Solve      (      TMatrixDColumn &b) override;
0053    Bool_t   TransSolve (      TVectorD &b) override            { return Solve(b); }
0054    TVectorD TransSolve (const TVectorD& b,Bool_t &ok) override { TVectorD x = b; ok = Solve(x); return x; }
0055    Bool_t   TransSolve (      TMatrixDColumn &b) override      { return Solve(b); }
0056    void     Det        (Double_t &d1,Double_t &d2) override;
0057 
0058            Bool_t      Invert  (TMatrixDSym &inv);
0059            TMatrixDSym Invert  (Bool_t &status);
0060            TMatrixDSym Invert  () { Bool_t status; return Invert(status); }
0061 
0062    void Print(Option_t *opt ="") const override; // *MENU*
0063 
0064    TDecompChol &operator= (const TDecompChol &source);
0065 
0066    ClassDefOverride(TDecompChol,2) // Matrix Decompositition Cholesky
0067 };
0068 
0069 TVectorD NormalEqn(const TMatrixD &A,const TVectorD &b);
0070 TVectorD NormalEqn(const TMatrixD &A,const TVectorD &b,const TVectorD &std);
0071 TMatrixD NormalEqn(const TMatrixD &A,const TMatrixD &b);
0072 TMatrixD NormalEqn(const TMatrixD &A,const TMatrixD &B,const TVectorD &std);
0073 
0074 #endif