Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TDecompBK.h
Go to the documentation of this file.
1 // @(#)root/matrix:$Id$
2 // Authors: Fons Rademakers, Eddy Offermann Sep 2004
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_TDecompBK
13 #define ROOT_TDecompBK
14 
15 ///////////////////////////////////////////////////////////////////////////
16 // //
17 // Bunch-Kaufman Decomposition class //
18 // //
19 ///////////////////////////////////////////////////////////////////////////
20 
21 #include "Rtypes.h"
22 #include "TDecompBase.h"
23 #include "TMatrixDSym.h"
24 #include "TVectorD.h"
25 
26 class TDecompBK : public TDecompBase
27 {
28 protected :
29 
30  Int_t fNIpiv; // size of row permutation index
31  Int_t *fIpiv; //[fNIpiv] row permutation index
32  TMatrixD fU; // decomposed matrix so that a = u d u^T
33 
34  virtual const TMatrixDBase &GetDecompMatrix() const { return fU; }
35 
36 public :
37 
38  TDecompBK();
39  explicit TDecompBK(Int_t nrows);
40  TDecompBK(Int_t row_lwb,Int_t row_upb);
41  TDecompBK(const TMatrixDSym &m,Double_t tol = 0.0);
42  TDecompBK(const TDecompBK &another);
43  virtual ~TDecompBK() {if (fIpiv) delete [] fIpiv; fIpiv = 0; }
44 
45  virtual Int_t GetNrows () const { return fU.GetNrows(); }
46  virtual Int_t GetNcols () const { return fU.GetNcols(); }
47  const TMatrixD &GetU () { if ( !TestBit(kDecomposed) ) Decompose();
48  return fU; }
49 
50  virtual void SetMatrix (const TMatrixDSym &a);
51 
52  virtual Bool_t Decompose ();
53  virtual Bool_t Solve ( TVectorD &b);
54  virtual TVectorD Solve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
55  virtual Bool_t Solve ( TMatrixDColumn &b);
56  virtual Bool_t TransSolve ( TVectorD &b) { return Solve(b); }
57  virtual TVectorD TransSolve (const TVectorD& b,Bool_t &ok) { TVectorD x = b; ok = Solve(x); return x; }
58  virtual Bool_t TransSolve ( TMatrixDColumn &b) { return Solve(b); }
59  virtual void Det (Double_t &/*d1*/,Double_t &/*d2*/)
60  { MayNotUse("Det(Double_t&,Double_t&)"); }
61 
62  Bool_t Invert (TMatrixDSym &inv);
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  TDecompBK &operator= (const TDecompBK &source);
69 
70  ClassDef(TDecompBK,1) // Matrix Decomposition Bunch-Kaufman
71 };
72 
73 #endif