# class TDecompBK: public TDecompBase

```
The Bunch-Kaufman diagonal pivoting method decomposes a real
symmetric matrix A using

A = U*D*U^T

where U is a product of permutation and unit upper triangular
matrices, U^T is the transpose of U, and D is symmetric and block
diagonal with 1-by-1 and 2-by-2 diagonal blocks.

U = P(n-1)*U(n-1)* ... *P(k)U(k)* ...,
i.e., U is a product of terms P(k)*U(k), where k decreases from n-1
to 0 in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
defined by IPIV(k), and U(k) is a unit upper triangular matrix, such
that if the diagonal block D(k) is of order s (s = 1 or 2), then

(   I    v    0   )   k-s
U(k) =  (   0    I    0   )   s
(   0    0    I   )   n-k
k-s   s   n-k

If s = 1, D(k) overwrites A(k,k), and v overwrites A(0:k-1,k).
If s = 2, the upper triangle of D(k) overwrites A(k-1,k-1), A(k-1,k),
and A(k,k), and v overwrites A(0:k-2,k-1:k).

fU contains on entry the symmetric matrix A of which only the upper
triangular part is referenced . On exit fU contains the block diagonal
matrix D and the multipliers used to obtain the factor U, see above .

fIpiv if dimension n contains details of the interchanges and the
the block structure of D . If (fIPiv(k) > 0, then rows and columns k
and fIPiv(k) were interchanged and D(k,k) is a 1-by-1 diagonal block.
If IPiv(k) = fIPiv(k-1) < 0, rows and columns k-1 and -IPiv(k) were
interchanged and D(k-1:k,k-1:k) is a 2-by-2 diagonal block.

```

## Function Members (Methods)

public:
 TDecompBK() TDecompBK(Int_t nrows) TDecompBK(const TDecompBK& another) TDecompBK(Int_t row_lwb, Int_t row_upb) TDecompBK(const TMatrixDSym& m, Double_t tol = 0.0) virtual ~TDecompBK() 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 const TMatrixD& GetU() 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 TMatrixDSym Invert() Bool_t Invert(TMatrixDSym& inv) TMatrixDSym Invert(Bool_t& status) 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) TDecompBK& operator=(const TDecompBK& 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 TMatrixDSym& a) static void TObject::SetObjectStat(Bool_t stat) Double_t TDecompBase::SetTol(Double_t newTol) virtual void TObject::SetUniqueID(UInt_t uid) 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& b) virtual TVectorD 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& b) 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 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 virtual const TMatrixDBase& GetDecompMatrix() const virtual const TMatrixDBase& TDecompBase::GetDecompMatrix() const Int_t TDecompBase::Hager(Double_t& est, Int_t iter = 5) void TObject::MakeZombie() void TDecompBase::ResetStatus()

## 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:
 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 Int_t* fIpiv [fNIpiv] row permutation index Int_t fNIpiv size of row permutation index 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 TMatrixD fU decomposed matrix so that a = u d u^T

## Function documentation

``` Default constructor
```
TDecompBK(Int_t nrows)
``` Constructor for (nrows x nrows) symmetric matrix
```
TDecompBK(Int_t row_lwb,Int_t row_upb)
``` Constructor for ([row_lwb..row_upb] x [row_lwb..row_upb]) symmetric matrix
```
TDecompBK(const TMatrixDSym &a,Double_t tol)
``` Constructor for symmetric matrix A
```
TDecompBK(const TDecompBK &another)
``` Copy constructor
```

``` Matrix A is decomposed in components U and D so that A = U*D*U^T
If the decomposition succeeds, bit kDecomposed is set , otherwise kSingular
```
void SetMatrix(const TMatrixDSym& a)
``` Set the matrix to be decomposed, decomposition status is reset.
```

``` Solve Ax=b assuming the BK form of A is stored in fU . Solution returned in b.
```

``` Solve Ax=b assuming the BK form of A is stored in fU . Solution returned in b.
```
Bool_t Invert(TMatrixDSym &inv)
``` For a symmetric matrix A(m,m), its inverse A_inv(m,m) is returned .
```
TMatrixDSym Invert(Bool_t &status)
``` For a symmetric matrix A(m,m), its inverse A_inv(m,m) is returned .
```
void Print(Option_t* opt = "") const
``` Print the class members
```
TDecompBK & operator=(const TDecompBK& source)
``` Assigment operator
```
const TMatrixDBase & GetDecompMatrix() const
`{ return fU; }`
virtual ~TDecompBK()
`{if (fIpiv) delete [] fIpiv; fIpiv = 0; }`
Int_t GetNrows() const
`{ return fU.GetNrows(); }`
Int_t GetNcols() const
`{ return fU.GetNcols(); }`
const TMatrixD & GetU()

`{ return Solve(b); }`
TVectorD TransSolve(const TVectorD& b, Bool_t& ok)
`{ TVectorD x = b; ok = Solve(x); return x; }`

`{ return Solve(b); }`
void Det(Double_t& , Double_t& )
`{ MayNotUse("Det(Double_t&,Double_t&)"); }`
Bool_t Invert(TMatrixDSym &inv)