ROOT logo
// @(#)root/matrix:$Id: TDecompBK.h 20882 2007-11-19 11:31:26Z rdm $
// Authors: Fons Rademakers, Eddy Offermann   Sep 2004

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TDecompBK
#define ROOT_TDecompBK

///////////////////////////////////////////////////////////////////////////
//                                                                       //
// Bunch-Kaufman Decomposition class                                     //
//                                                                       //
///////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TDecompBase
#include "TDecompBase.h"
#endif
#ifndef ROOT_TMatrixDSym
#include "TMatrixDSym.h"
#endif
#ifndef ROOT_TVectorD
#include "TVectorD.h"
#endif

class TDecompBK : public TDecompBase
{
protected :

   Int_t     fNIpiv;    // size of row permutation index
   Int_t    *fIpiv;     //[fNIpiv] row permutation index
   TMatrixD  fU;        // decomposed matrix so that a = u d u^T

   virtual const TMatrixDBase &GetDecompMatrix() const { return fU; }

public :

   TDecompBK();
   explicit TDecompBK(Int_t nrows);
   TDecompBK(Int_t row_lwb,Int_t row_upb);
   TDecompBK(const TMatrixDSym &m,Double_t tol = 0.0);
   TDecompBK(const TDecompBK &another);
   virtual ~TDecompBK() {if (fIpiv) delete [] fIpiv; fIpiv = 0; }

   virtual       Int_t     GetNrows  () const { return fU.GetNrows(); }
   virtual       Int_t     GetNcols  () const { return fU.GetNcols(); }
   const TMatrixD &GetU      ()       { if ( !TestBit(kDecomposed) ) Decompose();
                                                  return fU; }

   virtual       void      SetMatrix (const TMatrixDSym &a);

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

   Bool_t      Invert  (TMatrixDSym &inv);
   TMatrixDSym Invert  (Bool_t &status);
   TMatrixDSym Invert  () { Bool_t status; return Invert(status); }

   void        Print(Option_t *opt ="") const; // *MENU*

   TDecompBK &operator= (const TDecompBK &source);

   ClassDef(TDecompBK,1) // Matrix Decomposition Bunch-Kaufman
};

#endif
 TDecompBK.h:1
 TDecompBK.h:2
 TDecompBK.h:3
 TDecompBK.h:4
 TDecompBK.h:5
 TDecompBK.h:6
 TDecompBK.h:7
 TDecompBK.h:8
 TDecompBK.h:9
 TDecompBK.h:10
 TDecompBK.h:11
 TDecompBK.h:12
 TDecompBK.h:13
 TDecompBK.h:14
 TDecompBK.h:15
 TDecompBK.h:16
 TDecompBK.h:17
 TDecompBK.h:18
 TDecompBK.h:19
 TDecompBK.h:20
 TDecompBK.h:21
 TDecompBK.h:22
 TDecompBK.h:23
 TDecompBK.h:24
 TDecompBK.h:25
 TDecompBK.h:26
 TDecompBK.h:27
 TDecompBK.h:28
 TDecompBK.h:29
 TDecompBK.h:30
 TDecompBK.h:31
 TDecompBK.h:32
 TDecompBK.h:33
 TDecompBK.h:34
 TDecompBK.h:35
 TDecompBK.h:36
 TDecompBK.h:37
 TDecompBK.h:38
 TDecompBK.h:39
 TDecompBK.h:40
 TDecompBK.h:41
 TDecompBK.h:42
 TDecompBK.h:43
 TDecompBK.h:44
 TDecompBK.h:45
 TDecompBK.h:46
 TDecompBK.h:47
 TDecompBK.h:48
 TDecompBK.h:49
 TDecompBK.h:50
 TDecompBK.h:51
 TDecompBK.h:52
 TDecompBK.h:53
 TDecompBK.h:54
 TDecompBK.h:55
 TDecompBK.h:56
 TDecompBK.h:57
 TDecompBK.h:58
 TDecompBK.h:59
 TDecompBK.h:60
 TDecompBK.h:61
 TDecompBK.h:62
 TDecompBK.h:63
 TDecompBK.h:64
 TDecompBK.h:65
 TDecompBK.h:66
 TDecompBK.h:67
 TDecompBK.h:68
 TDecompBK.h:69
 TDecompBK.h:70
 TDecompBK.h:71
 TDecompBK.h:72
 TDecompBK.h:73
 TDecompBK.h:74
 TDecompBK.h:75
 TDecompBK.h:76
 TDecompBK.h:77
 TDecompBK.h:78