# class TDecompSparse: public TDecompBase

```
Sparse Symmetric Decomposition class

Solve a sparse symmetric system of linear equations using a method
based on Gaussian elimination as discussed in Duff and Reid,
ACM Trans. Math. Software 9 (1983), 302-325.

```

## Function Members (Methods)

public:
 TDecompSparse() TDecompSparse(const TDecompSparse& another) TDecompSparse(const TMatrixDSparse& a, Int_t verbose) TDecompSparse(Int_t nRows, Int_t nr_nonZeros, Int_t verbose) TDecompSparse(Int_t row_lwb, Int_t row_upb, Int_t nr_nonZeros, Int_t verbose) virtual ~TDecompSparse() void TObject::AbstractMethod(const char* method) const virtual void TObject::AppendPad(Option_t* option = "") virtual void TObject::Browse(TBrowser* b) static TClass* Class() static TClass* TDecompBase::Class() static TClass* TObject::Class() virtual const char* TObject::ClassName() const virtual void TObject::Clear(Option_t* = "") virtual TObject* TObject::Clone(const char* newname = "") const virtual Int_t TObject::Compare(const TObject* obj) const virtual Double_t TDecompBase::Condition() virtual void TObject::Copy(TObject& object) const virtual Bool_t Decompose() virtual Bool_t TDecompBase::Decompose() virtual void TObject::Delete(Option_t* option = "")MENU virtual void Det(Double_t&, Double_t&) virtual void TDecompBase::Det(Double_t& d1, Double_t& d2) virtual Int_t TObject::DistancetoPrimitive(Int_t px, Int_t py) virtual void TObject::Draw(Option_t* option = "") virtual void TObject::DrawClass() constMENU virtual TObject* TObject::DrawClone(Option_t* option = "") constMENU virtual void TObject::Dump() constMENU virtual void TObject::Error(const char* method, const char* msgfmt) const virtual void TObject::Execute(const char* method, const char* params, Int_t* error = 0) virtual void TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) virtual void TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) virtual void TObject::Fatal(const char* method, const char* msgfmt) const virtual TObject* TObject::FindObject(const char* name) const virtual TObject* TObject::FindObject(const TObject* obj) const Int_t TDecompBase::GetColLwb() const Double_t TDecompBase::GetCondition() const Double_t TDecompBase::GetDet1() const Double_t TDecompBase::GetDet2() const virtual Option_t* TObject::GetDrawOption() const static Long_t TObject::GetDtorOnly() virtual const char* TObject::GetIconName() const virtual const char* TObject::GetName() const virtual Int_t GetNcols() const virtual Int_t TDecompBase::GetNcols() const virtual Int_t GetNrows() const virtual Int_t TDecompBase::GetNrows() const virtual char* TObject::GetObjectInfo(Int_t px, Int_t py) const static Bool_t TObject::GetObjectStat() virtual Option_t* TObject::GetOption() const Int_t TDecompBase::GetRowLwb() const virtual const char* TObject::GetTitle() const Double_t TDecompBase::GetTol() const virtual UInt_t TObject::GetUniqueID() const virtual Bool_t TObject::HandleTimer(TTimer* timer) virtual ULong_t TObject::Hash() const virtual void TObject::Info(const char* method, const char* msgfmt) const virtual Bool_t TObject::InheritsFrom(const char* classname) const virtual Bool_t TObject::InheritsFrom(const TClass* cl) const virtual void TObject::Inspect() constMENU void TObject::InvertBit(UInt_t f) virtual TClass* IsA() const virtual TClass* TDecompBase::IsA() const virtual TClass* TObject::IsA() const virtual Bool_t TObject::IsEqual(const TObject* obj) const virtual Bool_t TObject::IsFolder() const Bool_t TObject::IsOnHeap() const virtual Bool_t TObject::IsSortable() const Bool_t TObject::IsZombie() const virtual void TObject::ls(Option_t* option = "") const void TObject::MayNotUse(const char* method) const virtual Bool_t TDecompBase::MultiSolve(TMatrixD& B) virtual Bool_t TObject::Notify() static void TObject::operator delete(void* ptr) static void TObject::operator delete(void* ptr, void* vp) static void TObject::operator delete[](void* ptr) static void TObject::operator delete[](void* ptr, void* vp) void* TObject::operator new(size_t sz) void* TObject::operator new(size_t sz, void* vp) void* TObject::operator new[](size_t sz) void* TObject::operator new[](size_t sz, void* vp) TDecompSparse& operator=(const TDecompSparse& source) TDecompBase& TDecompBase::operator=(const TDecompBase& source) TObject& TObject::operator=(const TObject& rhs) virtual void TObject::Paint(Option_t* option = "") virtual void TObject::Pop() virtual void Print(Option_t* opt = "") constMENU virtual void TDecompBase::Print(Option_t* opt = "") const virtual void TObject::Print(Option_t* option = "") const virtual Int_t TObject::Read(const char* name) virtual void TObject::RecursiveRemove(TObject* obj) void TObject::ResetBit(UInt_t f) virtual void TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU virtual void TObject::SavePrimitive(basic_ostream >& out, Option_t* option = "") void TObject::SetBit(UInt_t f) void TObject::SetBit(UInt_t f, Bool_t set) virtual void TObject::SetDrawOption(Option_t* option = "")MENU static void TObject::SetDtorOnly(void* obj) virtual void SetMatrix(const TMatrixDSparse& a) static void TObject::SetObjectStat(Bool_t stat) Double_t TDecompBase::SetTol(Double_t newTol) virtual void TObject::SetUniqueID(UInt_t uid) void SetVerbose(Int_t v) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void TDecompBase::ShowMembers(TMemberInspector& insp, char* parent) virtual void TObject::ShowMembers(TMemberInspector& insp, char* parent) virtual Bool_t Solve(TVectorD& b) virtual Bool_t Solve(TMatrixDColumn&) virtual Bool_t TDecompBase::Solve(TVectorD& b) virtual Bool_t TDecompBase::Solve(TMatrixDColumn& b) virtual TVectorD Solve(const TVectorD& b, Bool_t& ok) virtual TVectorD TDecompBase::Solve(const TVectorD& b, Bool_t& ok) virtual void Streamer(TBuffer& b) virtual void TDecompBase::Streamer(TBuffer& b) virtual void TObject::Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) void TDecompBase::StreamerNVirtual(TBuffer& b) void TObject::StreamerNVirtual(TBuffer& b) virtual void TObject::SysError(const char* method, const char* msgfmt) const Bool_t TObject::TestBit(UInt_t f) const Int_t TObject::TestBits(UInt_t f) const virtual Bool_t TransSolve(TVectorD& b) virtual Bool_t TransSolve(TMatrixDColumn&) virtual Bool_t TDecompBase::TransSolve(TVectorD& b) virtual Bool_t TDecompBase::TransSolve(TMatrixDColumn& b) virtual TVectorD TransSolve(const TVectorD& b, Bool_t& ok) virtual TVectorD TDecompBase::TransSolve(const TVectorD& b, Bool_t& ok) virtual void TObject::UseCurrentStyle() virtual void TObject::Warning(const char* method, const char* msgfmt) const virtual Int_t TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) virtual Int_t TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
 static void CopyUpperTriang(const TMatrixDSparse& a, Double_t* b) static void TDecompBase::DiagProd(const TVectorD& diag, Double_t tol, Double_t& d1, Double_t& d2) virtual void TObject::DoError(int level, const char* location, const char* fmt, va_list va) const Int_t ErrorFlag() static void Factor(const Int_t n, const Int_t nz, TArrayI& Airn, TArrayI& Aicn, TArrayD& Aa, TArrayI& Aiw, TArrayI& Aikeep, const Int_t nsteps, Int_t& maxfrt, TArrayI& Aiw1, Int_t* icntl, Double_t* cntl, Int_t* info) static void Factor_sub1(const Int_t n, const Int_t nz, Int_t& nz1, Double_t* a, const Int_t la, Int_t* irn, Int_t* icn, Int_t* iw, const Int_t liw, Int_t* perm, Int_t* iw2, Int_t* icntl, Int_t* info) static void Factor_sub2(const Int_t n, const Int_t nz, Double_t* a, const Int_t la, Int_t* iw, const Int_t liw, Int_t* perm, Int_t* nstk, const Int_t nsteps, Int_t& maxfrt, Int_t* nelim, Int_t* iw2, Int_t* icntl, Double_t* cntl, Int_t* info) static void Factor_sub3(Double_t* a, Int_t* iw, Int_t& j1, Int_t& j2, const Int_t itop, const Int_t ireal, Int_t& ncmpbr, Int_t& ncmpbi) virtual const TMatrixDBase& GetDecompMatrix() const virtual const TMatrixDBase& TDecompBase::GetDecompMatrix() const Double_t GetThresholdPivoting() Double_t GetTreatAsZero() Int_t TDecompBase::Hager(Double_t& est, Int_t iter = 5) static Int_t IDiag(Int_t ix, Int_t iy) Int_t IError() void InitParam() static void InitPivot(const Int_t n, const Int_t nz, TArrayI& Airn, TArrayI& Aicn, TArrayI& Aiw, TArrayI& Aikeep, TArrayI& Aiw1, Int_t& nsteps, const Int_t iflag, Int_t* icntl, Double_t* cntl, Int_t* info, Double_t& ops) static void InitPivot_sub1(const Int_t n, const Int_t nz, Int_t* irn, Int_t* icn, Int_t* iw, Int_t* ipe, Int_t* iq, Int_t* flag, Int_t& iwfr, Int_t* icntl, Int_t* info) static void InitPivot_sub2(const Int_t n, Int_t* ipe, Int_t* iw, const Int_t lw, Int_t& iwfr, Int_t* nv, Int_t* nxt, Int_t* lst, Int_t* ipd, Int_t* flag, const Int_t iovflo, Int_t& ncmpa, const Double_t fratio) static void InitPivot_sub2a(const Int_t n, Int_t* ipe, Int_t* iw, const Int_t lw, Int_t& iwfr, Int_t& ncmpa) static void InitPivot_sub3(const Int_t n, const Int_t nz, Int_t* irn, Int_t* icn, Int_t* perm, Int_t* iw, Int_t* ipe, Int_t* iq, Int_t* flag, Int_t& iwfr, Int_t* icntl, Int_t* info) static void InitPivot_sub4(const Int_t n, Int_t* ipe, Int_t* iw, const Int_t lw, Int_t& iwfr, Int_t* ips, Int_t* ipv, Int_t* nv, Int_t* flag, Int_t& ncmpa) static void InitPivot_sub5(const Int_t n, Int_t* ipe, Int_t* nv, Int_t* ips, Int_t* ne, Int_t* na, Int_t* nd, Int_t& nsteps, const Int_t nemin) static void InitPivot_sub6(const Int_t n, const Int_t nz, Int_t* irn, Int_t* icn, Int_t* perm, Int_t* na, Int_t* ne, Int_t* nd, const Int_t nsteps, Int_t* lstki, Int_t* lstkr, Int_t* iw, Int_t* info, Double_t& ops) void TObject::MakeZombie() Int_t MinIntWorkspace() Int_t MinRealWorkspace() static Int_t NonZerosUpperTriang(const TMatrixDSparse& a) void TDecompBase::ResetStatus() void SetThresholdPivoting(Double_t piv) void SetTreatAsZero(Double_t tol) static void Solve(const Int_t n, TArrayD& Aa, TArrayI& Aiw, TArrayD& Aw, const Int_t maxfrt, TVectorD& b, TArrayI& Aiw1, const Int_t nsteps, Int_t* icntl, Int_t* info) static void Solve_sub1(const Int_t n, Double_t* a, Int_t* iw, Double_t* w, Double_t* rhs, Int_t* iw2, const Int_t nblk, Int_t& latop, Int_t* icntl) static void Solve_sub2(const Int_t n, Double_t* a, Int_t* iw, Double_t* w, Double_t* rhs, Int_t* iw2, const Int_t nblk, const Int_t latop, Int_t* icntl)

## Data Members

private:
 enum TDecompBase::EMatrixDecompStat { kInit kPatternSet kValuesSet kMatrixSet kDecomposed kDetermined kCondition kSingular }; enum TDecompBase::[unnamed] { kWorkMax }; enum TObject::EStatusBits { kCanDelete kMustCleanup kObjInCanvas kIsReferenced kHasUUID kCannotPick kNoContextMenu kInvalidObject }; enum TObject::[unnamed] { kIsOnHeap kNotDeleted kZombie kBitMask kSingleKey kOverwrite kWriteDelete };
protected:
 TMatrixDSparse fA original matrix; needed for the iterative solving procedure Double_t fCntl[6] float control numbers TArrayI fColFact Int_t TDecompBase::fColLwb Column lower bound of decomposed matrix Double_t TDecompBase::fCondition matrix condition number Double_t TDecompBase::fDet1 determinant mantissa Double_t TDecompBase::fDet2 determinant exponent for powers of 2 TArrayD fFact size of fFact array; may be increased during the numerical factorization Double_t fIPessimism amounts by which to increase allocated factorization space when Int_t fIcntl[31] integer control numbers TArrayI fIkeep pivot sequence and temporary storage information Int_t fInfo[21] array used for communication between programs TArrayI fIw TArrayI fIw1 TArrayI fIw2 Int_t fMaxfrt Int_t fNnonZeros Int_t fNrows Int_t fNsteps Double_t fPrecision precision we demand from the linear system solver. If it isn't Double_t fRPessimism inadequate space is detected. fIPessimism is for array "fIw", TArrayI fRowFact Int_t TDecompBase::fRowLwb Row lower bound of decomposed matrix Double_t TDecompBase::fTol sqrt(epsilon); epsilon is smallest number number so that 1+epsilon > 1 Int_t fVerbose TArrayD fW temporary storage for the factorization

## Function documentation

``` Default constructor
```
TDecompSparse(Int_t nRows, Int_t nr_nonZeros, Int_t verbose)
``` Constructor for a matrix with nrows and unspecified number of columns .
nr_nonZeros is the total number of non-zero entries in the matrix .
```
TDecompSparse(Int_t row_lwb, Int_t row_upb, Int_t nr_nonZeros, Int_t verbose)
``` Constructor for a matrix with row range, [row_lwb..row_upb] and unspecified column
range . nr_nonZeros is the total number of non-zero entries in the matrix .
```
TDecompSparse(const TMatrixDSparse& a, Int_t verbose)
``` Constructor for matrix A .
```
TDecompSparse(const TDecompSparse& another)
``` Copy constructor
```
Int_t NonZerosUpperTriang(const TMatrixDSparse& a)
``` Static function, returning the number of non-zero entries in the upper triangular matrix .
```
void CopyUpperTriang(const TMatrixDSparse& a, Double_t* b)
``` Static function, copying the non-zero entries in the upper triangle to
array b . User should allocate enough memory for array b .
```
void SetMatrix(const TMatrixDSparse& a)
``` Set matrix to be decomposed .
```

``` Decomposition engine .
If the decomposition succeeds, bit kDecomposed is set .
```

``` Solve Ax=b . Solution returned in b.
```
void InitParam()
``` initializing control parameters
```
void InitPivot(const Int_t n, const Int_t nz, TArrayI& Airn, TArrayI& Aicn, TArrayI& Aiw, TArrayI& Aikeep, TArrayI& Aiw1, Int_t& nsteps, const Int_t iflag, Int_t* icntl, Double_t* cntl, Int_t* info, Double_t& ops)
``` Setup Pivoting variables
```
void Factor(const Int_t n, const Int_t nz, TArrayI& Airn, TArrayI& Aicn, TArrayD& Aa, TArrayI& Aiw, TArrayI& Aikeep, const Int_t nsteps, Int_t& maxfrt, TArrayI& Aiw1, Int_t* icntl, Double_t* cntl, Int_t* info)
``` Factorization routine, the workhorse for the decompostion step
```
void Solve(const Int_t n, TArrayD& Aa, TArrayI& Aiw, TArrayD& Aw, const Int_t maxfrt, TVectorD& b, TArrayI& Aiw1, const Int_t nsteps, Int_t* icntl, Int_t* info)
``` Main routine for solving Ax=b
```
void InitPivot_sub1(const Int_t n, const Int_t nz, Int_t* irn, Int_t* icn, Int_t* iw, Int_t* ipe, Int_t* iq, Int_t* flag, Int_t& iwfr, Int_t* icntl, Int_t* info)
``` Help routine for pivoting setup
```
void InitPivot_sub2(const Int_t n, Int_t* ipe, Int_t* iw, const Int_t lw, Int_t& iwfr, Int_t* nv, Int_t* nxt, Int_t* lst, Int_t* ipd, Int_t* flag, const Int_t iovflo, Int_t& ncmpa, const Double_t fratio)
``` Help routine for pivoting setup
```
void InitPivot_sub2a(const Int_t n, Int_t* ipe, Int_t* iw, const Int_t lw, Int_t& iwfr, Int_t& ncmpa)
``` Help routine for pivoting setup
```
void InitPivot_sub3(const Int_t n, const Int_t nz, Int_t* irn, Int_t* icn, Int_t* perm, Int_t* iw, Int_t* ipe, Int_t* iq, Int_t* flag, Int_t& iwfr, Int_t* icntl, Int_t* info)
``` Help routine for pivoting setup
```
void InitPivot_sub4(const Int_t n, Int_t* ipe, Int_t* iw, const Int_t lw, Int_t& iwfr, Int_t* ips, Int_t* ipv, Int_t* nv, Int_t* flag, Int_t& ncmpa)
``` Help routine for pivoting setup
```
void InitPivot_sub5(const Int_t n, Int_t* ipe, Int_t* nv, Int_t* ips, Int_t* ne, Int_t* na, Int_t* nd, Int_t& nsteps, const Int_t nemin)
``` Help routine for pivoting setup
```
void InitPivot_sub6(const Int_t n, const Int_t nz, Int_t* irn, Int_t* icn, Int_t* perm, Int_t* na, Int_t* ne, Int_t* nd, const Int_t nsteps, Int_t* lstki, Int_t* lstkr, Int_t* iw, Int_t* info, Double_t& ops)
``` Help routine for pivoting setup
```
void Factor_sub1(const Int_t n, const Int_t nz, Int_t& nz1, Double_t* a, const Int_t la, Int_t* irn, Int_t* icn, Int_t* iw, const Int_t liw, Int_t* perm, Int_t* iw2, Int_t* icntl, Int_t* info)
``` Help routine for factorization
```
void Factor_sub2(const Int_t n, const Int_t nz, Double_t* a, const Int_t la, Int_t* iw, const Int_t liw, Int_t* perm, Int_t* nstk, const Int_t nsteps, Int_t& maxfrt, Int_t* nelim, Int_t* iw2, Int_t* icntl, Double_t* cntl, Int_t* info)
``` Help routine for factorization
```
void Factor_sub3(Double_t* a, Int_t* iw, Int_t& j1, Int_t& j2, const Int_t itop, const Int_t ireal, Int_t& ncmpbr, Int_t& ncmpbi)
``` Help routine for factorization
```
void Solve_sub1(const Int_t n, Double_t* a, Int_t* iw, Double_t* w, Double_t* rhs, Int_t* iw2, const Int_t nblk, Int_t& latop, Int_t* icntl)
``` Help routine for solving
```
void Solve_sub2(const Int_t n, Double_t* a, Int_t* iw, Double_t* w, Double_t* rhs, Int_t* iw2, const Int_t nblk, const Int_t latop, Int_t* icntl)
``` Help routine for solving
```
void Print(Option_t* opt = "") const
``` Print class members
```
TDecompSparse & operator=(const TDecompSparse& source)
``` Assignment operator
```
void Solve(const Int_t n, TArrayD& Aa, TArrayI& Aiw, TArrayD& Aw, const Int_t maxfrt, TVectorD& b, TArrayI& Aiw1, const Int_t nsteps, Int_t* icntl, Int_t* info)
Int_t IDiag(Int_t ix, Int_t iy)
`{ return ((iy-1)*(2*ix-iy+2))/2; }`

`{ return fInfo[2]; }`

`{ return fInfo[5]; }`

`{ return fInfo[6]; }`

`{ return fInfo[1]; }`

``` Takes values in the range [0,1]. Larger values enforce greater stability in
the factorization as they insist on larger pivots. Smaller values preserve
sparsity at the cost of using smaller pivots.
```
`{ return fCntl[1]; }`

`{ return fCntl[3]; }`
void SetThresholdPivoting(Double_t piv)
``` The factorization will not accept a pivot whose absolute value is less than fCntl[3] as
a 1x1 pivot or as the off-diagonal in a 2x2 pivot.
```
`{ fCntl[1] = piv; }`
void SetTreatAsZero(Double_t tol)
`{ fCntl[3] = tol; }`
const TMatrixDBase & GetDecompMatrix() const
`{ MayNotUse("GetDecompMatrix()"); return fA; }`
virtual ~TDecompSparse()
`{}`
void SetVerbose(Int_t v)
Int_t GetNrows() const
`{ return fA.GetNrows(); }`
Int_t GetNcols() const
`{ return fA.GetNcols(); }`

`{ return Solve(b); }`
TVectorD TransSolve(const TVectorD& b, Bool_t& ok)
`{ TVectorD x = b; ok = Solve(x); return x; }`
Bool_t TransSolve( TMatrixDColumn & /*b*/)
`{ MayNotUse("TransSolve(TMatrixDColumn &)"); return kFALSE; }`
void Det(Double_t& , Double_t& )
`{ MayNotUse("Det(Double_t&,Double_t&)"); }`