Logo ROOT   6.10/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 #include "TDecompBase.h"
22 #include "TMatrixDSym.h"
23 
24 class TDecompChol : public TDecompBase
25 {
26 protected :
27 
28  TMatrixD fU; // decomposed matrix fU so that a = fU^T fU
29 
30  virtual const TMatrixDBase &GetDecompMatrix() const { return fU; }
31 
32 public :
33 
34  TDecompChol() : fU() {}
35  explicit TDecompChol(Int_t nrows);
36  TDecompChol(Int_t row_lwb,Int_t row_upb);
37  TDecompChol(const TMatrixDSym &a,Double_t tol = 0.0);
38  TDecompChol(const TMatrixD &a,Double_t tol = 0.0);
39  TDecompChol(const TDecompChol &another);
40  virtual ~TDecompChol() {}
41 
42  const TMatrixDSym GetMatrix ();
43  virtual Int_t GetNrows () const { return fU.GetNrows(); }
44  virtual Int_t GetNcols () const { return fU.GetNcols(); }
45  const TMatrixD &GetU () const { return fU; }
46 
47  virtual void SetMatrix (const TMatrixDSym &a);
48 
49  virtual Bool_t Decompose ();
50  virtual Bool_t Solve ( TVectorD &b);
51  virtual TVectorD Solve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
52  virtual Bool_t Solve ( TMatrixDColumn &b);
53  virtual Bool_t TransSolve ( TVectorD &b) { return Solve(b); }
54  virtual TVectorD TransSolve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
55  virtual Bool_t TransSolve ( TMatrixDColumn &b) { return Solve(b); }
56  virtual void Det (Double_t &d1,Double_t &d2);
57 
59  TMatrixDSym Invert (Bool_t &status);
60  TMatrixDSym Invert () { Bool_t status; return Invert(status); }
61 
62  void Print(Option_t *opt ="") const; // *MENU*
63 
64  TDecompChol &operator= (const TDecompChol &source);
65 
66  ClassDef(TDecompChol,2) // Matrix Decompositition Cholesky
67 };
68 
69 TVectorD NormalEqn(const TMatrixD &A,const TVectorD &b);
70 TVectorD NormalEqn(const TMatrixD &A,const TVectorD &b,const TVectorD &std);
71 TMatrixD NormalEqn(const TMatrixD &A,const TMatrixD &b);
72 TMatrixD NormalEqn(const TMatrixD &A,const TMatrixD &B,const TVectorD &std);
73 
74 #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[]
void Print(Option_t *opt="") const
Print class members .
const char Option_t
Definition: RtypesCore.h:62
virtual TVectorD Solve(const TVectorD &b, Bool_t &ok)
Definition: TDecompChol.h:51
Int_t GetNcols() const
Definition: TMatrixTBase.h:125
Decomposition Base class.
Definition: TDecompBase.h:33
TMatrixD fU
Definition: TDecompChol.h:28
virtual const TMatrixDBase & GetDecompMatrix() const
Definition: TDecompChol.h:30
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.
virtual Int_t GetNcols() const
Definition: TDecompChol.h:44
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:297
TMatrixDSym Invert()
Definition: TDecompChol.h:60
virtual void SetMatrix(const TMatrixDSym &a)
Set the matrix to be decomposed, decomposition status is reset.
const TMatrixD & GetU() const
Definition: TDecompChol.h:45
virtual Int_t GetNrows() const
Definition: TDecompChol.h:43
Cholesky Decomposition class.
Definition: TDecompChol.h:24
const double tol
virtual Bool_t Solve(TVectorD &b)
Solve equations Ax=b assuming A has been factored by Cholesky.
void inv(rsa_NUMBER *, rsa_NUMBER *, rsa_NUMBER *)
Definition: rsaaux.cxx:949
virtual TVectorD TransSolve(const TVectorD &b, Bool_t &ok)
Definition: TDecompChol.h:54
Linear Algebra Package.
Int_t GetNrows() const
Definition: TMatrixTBase.h:122
double Double_t
Definition: RtypesCore.h:55
virtual Bool_t TransSolve(TMatrixDColumn &b)
Definition: TDecompChol.h:55
virtual ~TDecompChol()
Definition: TDecompChol.h:40
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
virtual Bool_t TransSolve(TVectorD &b)
Definition: TDecompChol.h:53