Logo ROOT   6.07/09
Reference Guide
TDecompChol.h
Go to the documentation of this file.
1 // @(#)root/matrix:$Id$
2 // Authors: Fons Rademakers, Eddy Offermann Dec 2003
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TDecompChol
13 #define ROOT_TDecompChol
14 
15 ///////////////////////////////////////////////////////////////////////////
16 // //
17 // Cholesky Decomposition class //
18 // //
19 ///////////////////////////////////////////////////////////////////////////
20 
21 #ifndef ROOT_TDecompBase
22 #include "TDecompBase.h"
23 #endif
24 #ifndef ROOT_TMatrixDSym
25 #include "TMatrixDSym.h"
26 #endif
27 
28 class TDecompChol : public TDecompBase
29 {
30 protected :
31 
32  TMatrixD fU; // decomposed matrix fU so that a = fU^T fU
33 
34  virtual const TMatrixDBase &GetDecompMatrix() const { return fU; }
35 
36 public :
37 
38  TDecompChol() : fU() {}
39  explicit TDecompChol(Int_t nrows);
40  TDecompChol(Int_t row_lwb,Int_t row_upb);
41  TDecompChol(const TMatrixDSym &a,Double_t tol = 0.0);
42  TDecompChol(const TMatrixD &a,Double_t tol = 0.0);
43  TDecompChol(const TDecompChol &another);
44  virtual ~TDecompChol() {}
45 
46  const TMatrixDSym GetMatrix ();
47  virtual Int_t GetNrows () const { return fU.GetNrows(); }
48  virtual Int_t GetNcols () const { return fU.GetNcols(); }
49  const TMatrixD &GetU () const { return fU; }
50 
51  virtual void SetMatrix (const TMatrixDSym &a);
52 
53  virtual Bool_t Decompose ();
54  virtual Bool_t Solve ( TVectorD &b);
55  virtual TVectorD Solve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
56  virtual Bool_t Solve ( TMatrixDColumn &b);
57  virtual Bool_t TransSolve ( TVectorD &b) { return Solve(b); }
58  virtual TVectorD TransSolve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
59  virtual Bool_t TransSolve ( TMatrixDColumn &b) { return Solve(b); }
60  virtual void Det (Double_t &d1,Double_t &d2);
61 
63  TMatrixDSym Invert (Bool_t &status);
64  TMatrixDSym Invert () { Bool_t status; return Invert(status); }
65 
66  void Print(Option_t *opt ="") const; // *MENU*
67 
68  TDecompChol &operator= (const TDecompChol &source);
69 
70  ClassDef(TDecompChol,2) // Matrix Decompositition Cholesky
71 };
72 
73 TVectorD NormalEqn(const TMatrixD &A,const TVectorD &b);
74 TVectorD NormalEqn(const TMatrixD &A,const TVectorD &b,const TVectorD &std);
75 TMatrixD NormalEqn(const TMatrixD &A,const TMatrixD &b);
76 TMatrixD NormalEqn(const TMatrixD &A,const TMatrixD &B,const TVectorD &std);
77 
78 #endif
TVectorD NormalEqn(const TMatrixD &A, const TVectorD &b)
Solve min {(A .
virtual void Det(Double_t &d1, Double_t &d2)
Matrix determinant det = d1*TMath::Power(2.,d2) is square of diagProd of cholesky factor...
static double B[]
const char Option_t
Definition: RtypesCore.h:62
virtual TVectorD Solve(const TVectorD &b, Bool_t &ok)
Definition: TDecompChol.h:55
Decomposition Base class.
Definition: TDecompBase.h:36
double inv(double x)
For comparisons.
Definition: inv.h:58
TMatrixD fU
Definition: TDecompChol.h:32
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
STL namespace.
static double A[]
const TMatrixDSym GetMatrix()
Reconstruct the original matrix using the decomposition parts.
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
TMatrixDSym Invert()
Definition: TDecompChol.h:64
virtual void SetMatrix(const TMatrixDSym &a)
Set the matrix to be decomposed, decomposition status is reset.
virtual const TMatrixDBase & GetDecompMatrix() const
Definition: TDecompChol.h:34
Int_t GetNrows() const
Definition: TMatrixTBase.h:134
virtual Int_t GetNcols() const
Definition: TDecompChol.h:48
Cholesky Decomposition class.
Definition: TDecompChol.h:28
const double tol
virtual Bool_t Solve(TVectorD &b)
Solve equations Ax=b assuming A has been factored by Cholesky.
const TMatrixD & GetU() const
Definition: TDecompChol.h:49
virtual TVectorD TransSolve(const TVectorD &b, Bool_t &ok)
Definition: TDecompChol.h:58
Linear Algebra Package.
virtual Int_t GetNrows() const
Definition: TDecompChol.h:47
double Double_t
Definition: RtypesCore.h:55
virtual Bool_t TransSolve(TMatrixDColumn &b)
Definition: TDecompChol.h:59
Int_t GetNcols() const
Definition: TMatrixTBase.h:137
virtual ~TDecompChol()
Definition: TDecompChol.h:44
virtual Bool_t Decompose()
Matrix A is decomposed in component U so that A = U^T * U If the decomposition succeeds, bit kDecomposed is set , otherwise kSingular.
TDecompChol & operator=(const TDecompChol &source)
Assignment operator.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
void Print(Option_t *opt="") const
Print class members .
virtual Bool_t TransSolve(TVectorD &b)
Definition: TDecompChol.h:57