library: libMatrix #include "TMatrixF.h"

# TMatrixF

class description - source file - inheritance tree (.pdf)

## class TMatrixF : public TMatrixFBase

| Inheritance Chart:
`TObject`
| <- | `TMatrixFBase`
| <- | `TMatrixF` |
<- |
`TMatrix` |

        protected:

          virtual void Allocate(Int_t nrows, Int_t ncols, Int_t row_lwb = 0, Int_t col_lwb = 0, Int_t init = 0, Int_t nr_nonzeros = -1)
                  void AMultB(const TMatrixF& a, const TMatrixF& b, Int_t constr = 1)
                  void AMultB(const TMatrixF& a, const TMatrixFSym& b, Int_t constr = 1)
                  void AMultB(const TMatrixFSym& a, const TMatrixF& b, Int_t constr = 1)
                  void AMultB(const TMatrixFSym& a, const TMatrixFSym& b, Int_t constr = 1)
                  void AMultBt(const TMatrixF& a, const TMatrixF& b, Int_t constr = 1)
                  void AMultBt(const TMatrixF& a, const TMatrixFSym& b, Int_t constr = 1)
                  void AMultBt(const TMatrixFSym& a, const TMatrixF& b, Int_t constr = 1)
                  void AMultBt(const TMatrixFSym& a, const TMatrixFSym& b, Int_t constr = 1)
                  void AtMultB(const TMatrixF& a, const TMatrixF& b, Int_t constr = 1)
                  void AtMultB(const TMatrixF& a, const TMatrixFSym& b, Int_t constr = 1)
                  void AtMultB(const TMatrixFSym& a, const TMatrixF& b, Int_t constr = 1)
                  void AtMultB(const TMatrixFSym& a, const TMatrixFSym& b, Int_t constr = 1)
                  void Delete_m(Int_t size, Float_t*&)
                 Int_t Memcpy_m(Float_t* newp, const Float_t* oldp, Int_t copySize, Int_t newSize, Int_t oldSize)
              Float_t* New_m(Int_t size)

        public:

                                  TMatrixF()
                                  TMatrixF(Int_t nrows, Int_t ncols)
                                  TMatrixF(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb)
                                  TMatrixF(Int_t nrows, Int_t ncols, const Float_t* data, Option_t* option = "")
                                  TMatrixF(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, const Float_t* data, Option_t* option = "")
                                  TMatrixF(const TMatrixF& another)
                                  TMatrixF(const TMatrixD& another)
                                  TMatrixF(const TMatrixFSym& another)
                                  TMatrixF(TMatrixFBase::EMatrixCreatorsOp1 op, const TMatrixF& prototype)
                                  TMatrixF(const TMatrixF& a, TMatrixFBase::EMatrixCreatorsOp2 op, const TMatrixF& b)
                                  TMatrixF(const TMatrixF& a, TMatrixFBase::EMatrixCreatorsOp2 op, const TMatrixFSym& b)
                                  TMatrixF(const TMatrixFSym& a, TMatrixFBase::EMatrixCreatorsOp2 op, const TMatrixF& b)
                                  TMatrixF(const TMatrixFSym& a, TMatrixFBase::EMatrixCreatorsOp2 op, const TMatrixFSym& b)
                                  TMatrixF(const TMatrixFLazy& lazy_constructor)
                         TMatrixF GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Option_t* option = "S") const
                   const TMatrixF EigenVectors(TVectorF& eigenValues) const
                          virtual ~TMatrixF()
                   static TClass* Class()
                     virtual void Clear(Option_t* = "")
                 virtual Double_t Determinant() const
                     virtual void Determinant(Double_t& d1, Double_t& d2) const
             virtual const Int_t* GetColIndexArray() const
                   virtual Int_t* GetColIndexArray()
           virtual const Float_t* GetMatrixArray() const
                 virtual Float_t* GetMatrixArray()
             virtual const Int_t* GetRowIndexArray() const
                   virtual Int_t* GetRowIndexArray()
            virtual TMatrixFBase& GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, TMatrixFBase& target, Option_t* option = "S") const
                        TMatrixF& Invert(Double_t* det = 0)
                        TMatrixF& InvertFast(Double_t* det = 0)
                  virtual TClass* IsA() const
                             void Mult(const TMatrixF& a, const TMatrixF& b)
                             void Mult(const TMatrixF& a, const TMatrixFSym& b)
                             void Mult(const TMatrixFSym& a, const TMatrixF& b)
                        TMatrixF& NormByColumn(const TVectorF& v, Option_t* option = "D")
                        TMatrixF& NormByRow(const TVectorF& v, Option_t* option = "D")
                  virtual Float_t operator()(Int_t rown, Int_t coln) const
                 virtual Float_t& operator()(Int_t rown, Int_t coln)
                        TMatrixF& operator*=(Float_t val)
                        TMatrixF& operator*=(const TMatrixF& source)
                        TMatrixF& operator*=(const TMatrixFSym& source)
                        TMatrixF& operator*=(const TMatrixFDiag_const& diag)
                        TMatrixF& operator*=(const TMatrixFRow_const& row)
                        TMatrixF& operator*=(const TMatrixFColumn_const& col)
                        TMatrixF& operator+=(Float_t val)
                        TMatrixF& operator+=(const TMatrixF& source)
                        TMatrixF& operator+=(const TMatrixFSym& source)
                        TMatrixF& operator-=(Float_t val)
                        TMatrixF& operator-=(const TMatrixF& source)
                        TMatrixF& operator-=(const TMatrixFSym& source)
                        TMatrixF& operator/=(const TMatrixFDiag_const& diag)
                        TMatrixF& operator/=(const TMatrixFRow_const& row)
                        TMatrixF& operator/=(const TMatrixFColumn_const& col)
                        TMatrixF& operator=(const TMatrixF& source)
                        TMatrixF& operator=(const TMatrixD& source)
                        TMatrixF& operator=(const TMatrixFSym& source)
                        TMatrixF& operator=(const TMatrixFLazy& source)
                        TMatrixF& operator=(Float_t val)
          const TMatrixFRow_const operator[](Int_t rown) const
                      TMatrixFRow operator[](Int_t rown)
                        TMatrixF& Rank1Update(const TVectorF& v, Float_t alpha = 1.0)
                        TMatrixF& Rank1Update(const TVectorF& v1, const TVectorF& v2, Float_t alpha = 1.0)
            virtual TMatrixFBase& ResizeTo(Int_t nrows, Int_t ncols, Int_t nr_nonzeros = -1)
            virtual TMatrixFBase& ResizeTo(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Int_t nr_nonzeros = -1)
                    TMatrixFBase& ResizeTo(const TMatrixF& m)
            virtual TMatrixFBase& SetColIndexArray(Int_t*)
            virtual TMatrixFBase& SetRowIndexArray(Int_t*)
            virtual TMatrixFBase& SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixFBase& source)
                     virtual void ShowMembers(TMemberInspector& insp, char* parent)
                     virtual void Streamer(TBuffer& b)
                             void StreamerNVirtual(TBuffer& b)
                        TMatrixF& T()
                        TMatrixF& Transpose(const TMatrixF& source)
                        TMatrixF& Use(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Float_t* data)
                        TMatrixF& Use(Int_t nrows, Int_t ncols, Float_t* data)
                        TMatrixF& Use(TMatrixF& a)

### Data Members

        protected:

           Float_t fDataStack[25]  ! data container
          Float_t* fElements       [fNelems] elements themselves

## Class Description

     TMatrixF

     Implementation of a general matrix in the linear algebra package

TMatrixF(Int_t no_rows,Int_t no_cols)

TMatrixF(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb)

TMatrixF(Int_t no_rows,Int_t no_cols,const Float_t *elements,Option_t *option)

     option="F": array elements contains the matrix stored column-wise
                 like in Fortran, so a[i,j] = elements[i+no_rows*j],
     else        it is supposed that array elements are stored row-wise
                 a[i,j] = elements[i*no_cols+j]

     array elements are copied

TMatrixF(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb, const Float_t *elements,Option_t *option)

     array elements are copied

TMatrixF(const TMatrixF &another) : TMatrixFBase(another)

TMatrixF(const TMatrixD &another)

TMatrixF(const TMatrixFSym &another)

TMatrixF(EMatrixCreatorsOp1 op,const TMatrixF &prototype)

     Create a matrix applying a specific operation to the prototype.
     Example: TMatrixF a(10,12); ...; TMatrixF b(TMatrixFBase::kTransposed, a);
     Supported operations are: kZero, kUnit, kTransposed,  and kInverted .

TMatrixF(const TMatrixF &a,EMatrixCreatorsOp2 op,const TMatrixF &b)

     Create a matrix applying a specific operation to two prototypes.
     Example: TMatrixF a(10,12), b(12,5); ...; TMatrixF c(a, TMatrixFBase::kMult, b);
     Supported operations are: kMult (a*b), kTransposeMult (a'*b), kInvMult (a^(-1)*b)

TMatrixF(const TMatrixF &a,EMatrixCreatorsOp2 op,const TMatrixFSym &b)

TMatrixF(const TMatrixFSym &a,EMatrixCreatorsOp2 op,const TMatrixF &b)

TMatrixF(const TMatrixFSym &a,EMatrixCreatorsOp2 op,const TMatrixFSym &b)

TMatrixF(const TMatrixFLazy &lazy_constructor)

void Delete_m(Int_t size,Float_t *&m)

     delete data pointer m, if it was assigned on the heap

Float_t* New_m(Int_t size)

     return data pointer . if requested size <= kSizeMax, assign pointer
     to the stack space

Int_t Memcpy_m(Float_t *newp,const Float_t *oldp,Int_t copySize, Int_t newSize,Int_t oldSize)

     copy copySize doubles from *oldp to *newp . However take care of the
     situation where both pointers are assigned to the same stack space

void Allocate(Int_t no_rows,Int_t no_cols,Int_t row_lwb,Int_t col_lwb,Int_t init, Int_t /*nr_nonzeros*/)

     Allocate new matrix. Arguments are number of rows, columns, row
     lowerbound (0 default) and column lowerbound (0 default).

void AMultB(const TMatrixF &a,const TMatrixF &b,Int_t constr)

     General matrix multiplication. Create a matrix C such that C = A * B.
     Note, matrix C is allocated for constr=1.

void AMultB(const TMatrixFSym &a,const TMatrixF &b,Int_t constr)

     Matrix multiplication, with A symmetric and B general.
     Create a matrix C such that C = A * B.
     Note, matrix C is allocated for constr=1.

void AMultB(const TMatrixF &a,const TMatrixFSym &b,Int_t constr)

     Matrix multiplication, with A general and B symmetric.
     Create a matrix C such that C = A * B.
     Note, matrix C is allocated for constr=1.

void AMultB(const TMatrixFSym &a,const TMatrixFSym &b,Int_t constr)

     Matrix multiplication, with A symmetric and B symmetric.
     (Actually copied for the moment routine for B general)
     Create a matrix C such that C = A * B.
     Note, matrix C is allocated for constr=1.

void AtMultB(const TMatrixF &a,const TMatrixF &b,Int_t constr)

     Create a matrix C such that C = A' * B. In other words,
     c[i,j] = SUM{ a[k,i] * b[k,j] }. Note, matrix C is allocated for constr=1.

void AtMultB(const TMatrixF &a,const TMatrixFSym &b,Int_t constr)

     Create a matrix C such that C = A' * B. In other words,
     c[i,j] = SUM{ a[k,i] * b[k,j] }. Note, matrix C is allocated for constr=1.

void AMultBt(const TMatrixF &a,const TMatrixF &b,Int_t constr)

     General matrix multiplication. Create a matrix C such that C = A * B^T.
     Note, matrix C is allocated for constr=1.

void AMultBt(const TMatrixFSym &a,const TMatrixF &b,Int_t constr)

     Matrix multiplication, with A symmetric and B general.
     Create a matrix C such that C = A * B^T.
     Note, matrix C is allocated for constr=1.

TMatrixF& Use(Int_t row_lwb,Int_t row_upb, Int_t col_lwb,Int_t col_upb,Float_t *data)

TMatrixFBase& GetSub(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb, TMatrixFBase &target,Option_t *option) const

     Get submatrix [row_lwb..row_upb][col_lwb..col_upb]; The indexing range of the
     returned matrix depends on the argument option:

     option == "S" : return [0..row_upb-row_lwb+1][0..col_upb-col_lwb+1] (default)
     else          : return [row_lwb..row_upb][col_lwb..col_upb]

TMatrixFBase& SetSub(Int_t row_lwb,Int_t col_lwb,const TMatrixFBase &source)

     Insert matrix source starting at [row_lwb][col_lwb], thereby overwriting the part
     [row_lwb..row_lwb+nrows_source][col_lwb..col_lwb+ncols_source];

TMatrixFBase& ResizeTo(Int_t nrows,Int_t ncols,Int_t /*nr_nonzeros*/)

     Set size of the matrix to nrows x ncols
     New dynamic elements are created, the overlapping part of the old ones are
     copied to the new structures, then the old elements are deleted.

TMatrixFBase& ResizeTo(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb, Int_t /*nr_nonzeros*/)

     Set size of the matrix to [row_lwb:row_upb] x [col_lwb:col_upb]
     New dynamic elemenst are created, the overlapping part of the old ones are
     copied to the new structures, then the old elements are deleted.

Double_t Determinant() const

void Determinant(Double_t &d1,Double_t &d2) const

TMatrixF& Invert(Double_t *det)

     Invert the matrix and calculate its determinant

TMatrixF& InvertFast(Double_t *det)

     Invert the matrix and calculate its determinant

TMatrixF& Transpose(const TMatrixF &source)

     Transpose a matrix.

TMatrixF& Rank1Update(const TVectorF &v,Float_t alpha)

     Perform a rank 1 operation on the matrix:
         A += alpha * v * v^T

TMatrixF& Rank1Update(const TVectorF &v1,const TVectorF &v2,Float_t alpha)

     Perform a rank 1 operation on the matrix:
         A += alpha * v1 * v2^T

TMatrixF& NormByColumn(const TVectorF &v,Option_t *option)

     Multiply/divide matrix columns by a vector:
     option:
     "D"   :  b(i,j) = a(i,j)/v(i)   i = 0,fNrows-1 (default)
     else  :  b(i,j) = a(i,j)*v(i)

TMatrixF& NormByRow(const TVectorF &v,Option_t *option)

     Multiply/divide matrix rows with a vector:
     option:
     "D"   :  b(i,j) = a(i,j)/v(j)   i = 0,fNcols-1 (default)
     else  :  b(i,j) = a(i,j)*v(j)

const TMatrixF EigenVectors(TVectorF &eigenValues) const

     Return a matrix containing the eigen-vectors ordered by descending eigen-values
     If the matrix is asymmetric, only the real part of the eigen-values is
     returned . For full functionality use TMatrixDEigen .

void Streamer(TBuffer &R__b)

     Stream an object of class TMatrixF.

### Inline Functions

                               void ~TMatrixF()
                               void AtMultB(const TMatrixFSym& a, const TMatrixF& b, Int_t constr = 1)
                               void AtMultB(const TMatrixFSym& a, const TMatrixFSym& b, Int_t constr = 1)
                               void AMultBt(const TMatrixFSym& a, const TMatrixF& b, Int_t constr = 1)
                               void AMultBt(const TMatrixFSym& a, const TMatrixFSym& b, Int_t constr = 1)
                           TMatrixF TMatrixF(const TMatrixFLazy& lazy_constructor)
                     const Float_t* GetMatrixArray() const
                           Float_t* GetMatrixArray()
                       const Int_t* GetRowIndexArray() const
                             Int_t* GetRowIndexArray()
                       const Int_t* GetColIndexArray() const
                             Int_t* GetColIndexArray()
                      TMatrixFBase& SetRowIndexArray(Int_t*)
                      TMatrixFBase& SetColIndexArray(Int_t*)
                               void Clear(Option_t* = "")
                          TMatrixF& Use(Int_t nrows, Int_t ncols, Float_t* data)
                          TMatrixF& Use(TMatrixF& a)
                           TMatrixF GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Option_t* option = "S") const
                      TMatrixFBase& ResizeTo(const TMatrixF& m)
                          TMatrixF& T()
                               void Mult(const TMatrixF& a, const TMatrixF& b)
                               void Mult(const TMatrixF& a, const TMatrixFSym& b)
                               void Mult(const TMatrixFSym& a, const TMatrixF& b)
                            Float_t operator()(Int_t rown, Int_t coln) const
                           Float_t& operator()(Int_t rown, Int_t coln)
            const TMatrixFRow_const operator[](Int_t rown) const
                        TMatrixFRow operator[](Int_t rown)
                          TMatrixF& operator=(const TMatrixF& source)
                          TMatrixF& operator=(const TMatrixD& source)
                          TMatrixF& operator=(const TMatrixFSym& source)
                          TMatrixF& operator=(const TMatrixFLazy& source)
                          TMatrixF& operator=(Float_t val)
                          TMatrixF& operator-=(Float_t val)
                          TMatrixF& operator+=(Float_t val)
                          TMatrixF& operator*=(Float_t val)
                          TMatrixF& operator+=(const TMatrixF& source)
                          TMatrixF& operator+=(const TMatrixFSym& source)
                          TMatrixF& operator-=(const TMatrixF& source)
                          TMatrixF& operator-=(const TMatrixFSym& source)
                          TMatrixF& operator*=(const TMatrixF& source)
                          TMatrixF& operator*=(const TMatrixFSym& source)
                          TMatrixF& operator*=(const TMatrixFDiag_const& diag)
                          TMatrixF& operator/=(const TMatrixFDiag_const& diag)
                          TMatrixF& operator*=(const TMatrixFRow_const& row)
                          TMatrixF& operator/=(const TMatrixFRow_const& row)
                          TMatrixF& operator*=(const TMatrixFColumn_const& col)
                          TMatrixF& operator/=(const TMatrixFColumn_const& col)
                            TClass* Class()
                            TClass* IsA() const
                               void ShowMembers(TMemberInspector& insp, char* parent)
                               void StreamerNVirtual(TBuffer& b)

Last update: root/matrix:$Name: $:$Id: TMatrixF.cxx,v 1.31 2005/04/05 12:47:11 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *