Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TDecompBase.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_TDecompBase
13#define ROOT_TDecompBase
14
15///////////////////////////////////////////////////////////////////////////
16// //
17// Decomposition Base class //
18// //
19// This class forms the base for all the decompositions methods in the //
20// linear algebra package . //
21// //
22///////////////////////////////////////////////////////////////////////////
23
24#include "Rtypes.h"
25
26#include "TMatrixD.h"
27#include "TMatrixDUtils.h"
28#include "TObject.h"
29#include "TVectorD.h"
30
31#include <limits>
32
33class TDecompBase : public TObject
34{
35protected :
36 Double_t fTol; // sqrt(epsilon); epsilon is smallest number number so that 1+epsilon > 1
37 Double_t fDet1; // determinant mantissa
38 Double_t fDet2; // determinant exponent for powers of 2
39 Double_t fCondition; // matrix condition number
40 Int_t fRowLwb; // Row lower bound of decomposed matrix
41 Int_t fColLwb; // Column lower bound of decomposed matrix
42
43 void ResetStatus() { for (Int_t i = 14; i < 22; i++) ResetBit(BIT(i)); }
44 Int_t Hager (Double_t& est,Int_t iter=5);
45 static void DiagProd (const TVectorD &diag,Double_t tol,Double_t &d1,Double_t &d2);
46
47 virtual const TMatrixDBase &GetDecompMatrix() const = 0;
48
50 kInit = BIT(14),
57 kSingular = BIT(21)
58 };
59
60 enum {kWorkMax = 100}; // size of work array's in several routines
61
62public :
64 TDecompBase(const TDecompBase &another);
65 virtual ~TDecompBase() {};
66
67 inline Double_t GetTol () const { return fTol; }
68 inline Double_t GetDet1 () const { return fDet1; }
69 inline Double_t GetDet2 () const { return fDet2; }
70 inline Double_t GetCondition () const { return fCondition; }
71 virtual Int_t GetNrows () const = 0;
72 virtual Int_t GetNcols () const = 0;
73 Int_t GetRowLwb () const { return fRowLwb; }
74 Int_t GetColLwb () const { return fColLwb; }
75 inline Double_t SetTol (Double_t tol);
76
77 virtual Double_t Condition ();
78 virtual void Det (Double_t &d1,Double_t &d2);
79 virtual Bool_t Decompose () = 0;
80 virtual Bool_t Solve ( TVectorD &b) = 0;
81 virtual TVectorD Solve (const TVectorD& b,Bool_t &ok) = 0;
82 virtual Bool_t Solve ( TMatrixDColumn& b) = 0;
83 virtual Bool_t TransSolve ( TVectorD &b) = 0;
84 virtual TVectorD TransSolve (const TVectorD &b,Bool_t &ok) = 0;
86
87 virtual Bool_t MultiSolve (TMatrixD &B);
88
89 void Print(Option_t *opt="") const;
90
91 TDecompBase &operator= (const TDecompBase &source);
92
93 ClassDef(TDecompBase,2) // Matrix Decomposition Base
94};
95
97{
98 const Double_t oldTol = fTol;
99 if (newTol >= 0.0)
100 fTol = newTol;
101 return oldTol;
102}
103
111
112#endif
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
int Int_t
Definition RtypesCore.h:45
bool Bool_t
Definition RtypesCore.h:63
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
#define BIT(n)
Definition Rtypes.h:85
Bool_t DefHouseHolder(const TVectorD &vc, Int_t lp, Int_t l, Double_t &up, Double_t &b, Double_t tol=0.0)
Define a Householder-transformation through the parameters up and b .
void ApplyGivens(Double_t &z1, Double_t &z2, Double_t c, Double_t s)
Apply a Givens transformation as defined by c and s to the vector components v1 and v2 .
void ApplyHouseHolder(const TVectorD &vc, Double_t up, Double_t b, Int_t lp, Int_t l, TMatrixDRow &cr)
Apply Householder-transformation.
void DefGivens(Double_t v1, Double_t v2, Double_t &c, Double_t &s)
Defines a Givens-rotation by calculating 2 rotation parameters c and s.
void DefAplGivens(Double_t &v1, Double_t &v2, Double_t &c, Double_t &s)
Define and apply a Givens-rotation by calculating 2 rotation parameters c and s.
Decomposition Base class.
Definition TDecompBase.h:34
static void DiagProd(const TVectorD &diag, Double_t tol, Double_t &d1, Double_t &d2)
Int_t GetRowLwb() const
Definition TDecompBase.h:73
Double_t fDet1
Definition TDecompBase.h:37
virtual Bool_t Decompose()=0
Double_t fDet2
Definition TDecompBase.h:38
virtual ~TDecompBase()
Definition TDecompBase.h:65
void ResetStatus()
Definition TDecompBase.h:43
virtual Bool_t Solve(TMatrixDColumn &b)=0
Int_t GetColLwb() const
Definition TDecompBase.h:74
virtual Bool_t MultiSolve(TMatrixD &B)
Solve set of equations with RHS in columns of B.
void Print(Option_t *opt="") const
Print class members.
virtual Int_t GetNrows() const =0
virtual const TMatrixDBase & GetDecompMatrix() const =0
virtual Bool_t Solve(TVectorD &b)=0
Int_t fRowLwb
Definition TDecompBase.h:40
Double_t GetDet2() const
Definition TDecompBase.h:69
virtual TVectorD TransSolve(const TVectorD &b, Bool_t &ok)=0
Double_t GetTol() const
Definition TDecompBase.h:67
Double_t fTol
Definition TDecompBase.h:36
TDecompBase & operator=(const TDecompBase &source)
Assignment operator.
virtual Int_t GetNcols() const =0
Double_t SetTol(Double_t tol)
Definition TDecompBase.h:96
Double_t GetCondition() const
Definition TDecompBase.h:70
virtual Bool_t TransSolve(TMatrixDColumn &b)=0
Double_t GetDet1() const
Definition TDecompBase.h:68
Int_t Hager(Double_t &est, Int_t iter=5)
virtual Double_t Condition()
Matrix condition number.
TDecompBase()
Default constructor.
Double_t fCondition
Definition TDecompBase.h:39
virtual Bool_t TransSolve(TVectorD &b)=0
Int_t fColLwb
Definition TDecompBase.h:41
virtual TVectorD Solve(const TVectorD &b, Bool_t &ok)=0
virtual void Det(Double_t &d1, Double_t &d2)
Matrix determinant det = d1*TMath::Power(2.,d2)
Mother of all ROOT objects.
Definition TObject.h:41
void ResetBit(UInt_t f)
Definition TObject.h:200
auto * l
Definition textangle.C:4