ROOT logo
// @(#)root/matrix:$Id: TDecompChol.h 22428 2008-03-03 18:17:03Z brun $
// Authors: Fons Rademakers, Eddy Offermann   Dec 2003

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TDecompChol
#define ROOT_TDecompChol

///////////////////////////////////////////////////////////////////////////
//                                                                       //
// Cholesky Decomposition class                                          //
//                                                                       //
///////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TDecompBase
#include "TDecompBase.h"
#endif
#ifndef ROOT_TMatrixDSym
#include "TMatrixDSym.h"
#endif

class TDecompChol : public TDecompBase
{
protected :

   TMatrixD fU; // decomposed matrix fU so that a = fU^T fU

   virtual const TMatrixDBase &GetDecompMatrix() const { return fU; }

public :

   TDecompChol() : fU() {}
   explicit TDecompChol(Int_t nrows);
   TDecompChol(Int_t row_lwb,Int_t row_upb);
   TDecompChol(const TMatrixDSym &a,Double_t tol = 0.0);
   TDecompChol(const TMatrixD    &a,Double_t tol = 0.0);
   TDecompChol(const TDecompChol &another);
   virtual ~TDecompChol() {}

           const TMatrixDSym GetMatrix ();
   virtual       Int_t       GetNrows  () const { return fU.GetNrows(); }
   virtual       Int_t       GetNcols  () const { return fU.GetNcols(); }
           const TMatrixD   &GetU      () const { return fU; }

   virtual       void        SetMatrix (const TMatrixDSym &a);

   virtual Bool_t   Decompose  ();
   virtual Bool_t   Solve      (      TVectorD &b);
   virtual TVectorD Solve      (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
   virtual Bool_t   Solve      (      TMatrixDColumn &b);
   virtual Bool_t   TransSolve (      TVectorD &b)            { return Solve(b); }
   virtual TVectorD TransSolve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
   virtual Bool_t   TransSolve (      TMatrixDColumn &b)      { return Solve(b); }
   virtual void     Det        (Double_t &d1,Double_t &d2);

           Bool_t      Invert  (TMatrixDSym &inv);
           TMatrixDSym Invert  (Bool_t &status);
           TMatrixDSym Invert  () { Bool_t status; return Invert(status); }

   void Print(Option_t *opt ="") const; // *MENU*

   TDecompChol &operator= (const TDecompChol &source);

   ClassDef(TDecompChol,2) // Matrix Decompositition Cholesky
};

TVectorD NormalEqn(const TMatrixD &A,const TVectorD &b);
TVectorD NormalEqn(const TMatrixD &A,const TVectorD &b,const TVectorD &std);
TMatrixD NormalEqn(const TMatrixD &A,const TMatrixD &b);
TMatrixD NormalEqn(const TMatrixD &A,const TMatrixD &B,const TVectorD &std);

#endif
 TDecompChol.h:1
 TDecompChol.h:2
 TDecompChol.h:3
 TDecompChol.h:4
 TDecompChol.h:5
 TDecompChol.h:6
 TDecompChol.h:7
 TDecompChol.h:8
 TDecompChol.h:9
 TDecompChol.h:10
 TDecompChol.h:11
 TDecompChol.h:12
 TDecompChol.h:13
 TDecompChol.h:14
 TDecompChol.h:15
 TDecompChol.h:16
 TDecompChol.h:17
 TDecompChol.h:18
 TDecompChol.h:19
 TDecompChol.h:20
 TDecompChol.h:21
 TDecompChol.h:22
 TDecompChol.h:23
 TDecompChol.h:24
 TDecompChol.h:25
 TDecompChol.h:26
 TDecompChol.h:27
 TDecompChol.h:28
 TDecompChol.h:29
 TDecompChol.h:30
 TDecompChol.h:31
 TDecompChol.h:32
 TDecompChol.h:33
 TDecompChol.h:34
 TDecompChol.h:35
 TDecompChol.h:36
 TDecompChol.h:37
 TDecompChol.h:38
 TDecompChol.h:39
 TDecompChol.h:40
 TDecompChol.h:41
 TDecompChol.h:42
 TDecompChol.h:43
 TDecompChol.h:44
 TDecompChol.h:45
 TDecompChol.h:46
 TDecompChol.h:47
 TDecompChol.h:48
 TDecompChol.h:49
 TDecompChol.h:50
 TDecompChol.h:51
 TDecompChol.h:52
 TDecompChol.h:53
 TDecompChol.h:54
 TDecompChol.h:55
 TDecompChol.h:56
 TDecompChol.h:57
 TDecompChol.h:58
 TDecompChol.h:59
 TDecompChol.h:60
 TDecompChol.h:61
 TDecompChol.h:62
 TDecompChol.h:63
 TDecompChol.h:64
 TDecompChol.h:65
 TDecompChol.h:66
 TDecompChol.h:67
 TDecompChol.h:68
 TDecompChol.h:69
 TDecompChol.h:70
 TDecompChol.h:71
 TDecompChol.h:72
 TDecompChol.h:73
 TDecompChol.h:74
 TDecompChol.h:75
 TDecompChol.h:76
 TDecompChol.h:77
 TDecompChol.h:78