library: libMatrix #include "TMatrixFSym.h"

# TMatrixFSym

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

## class TMatrixFSym : public TMatrixFBase

| Inheritance Chart:
`TObject`
| <- | `TMatrixFBase`
| <- | `TMatrixFSym` |

        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 AMultA(const TMatrixFSym& a, Int_t constr = 1)
                  void AtMultA(const TMatrixF& a, Int_t constr = 1)
                  void AtMultA(const TMatrixFSym& a, 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:

                                  TMatrixFSym()
                                  TMatrixFSym(Int_t nrows)
                                  TMatrixFSym(Int_t row_lwb, Int_t row_upb)
                                  TMatrixFSym(Int_t nrows, const Float_t* data, Option_t* option = "")
                                  TMatrixFSym(Int_t row_lwb, Int_t row_upb, const Float_t* data, Option_t* option = "")
                                  TMatrixFSym(const TMatrixFSym& another)
                                  TMatrixFSym(const TMatrixDSym& another)
                                  TMatrixFSym(TMatrixFBase::EMatrixCreatorsOp1 op, const TMatrixFSym& prototype)
                                  TMatrixFSym(TMatrixFBase::EMatrixCreatorsOp1 op, const TMatrixF& prototype)
                                  TMatrixFSym(const TMatrixFSym& a, TMatrixFBase::EMatrixCreatorsOp2 op, const TMatrixFSym& b)
                                  TMatrixFSym(const TMatrixFSymLazy& lazy_constructor)
                      TMatrixFSym GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Option_t* option = "S") const
                          virtual ~TMatrixFSym()
            virtual TMatrixFBase& Apply(const TElementActionF& action)
            virtual TMatrixFBase& Apply(const TElementPosActionF& action)
                   static TClass* Class()
                     virtual void Clear(Option_t* = "")
                 virtual Double_t Determinant() const
                     virtual void Determinant(Double_t& d1, Double_t& d2) const
                   const TMatrixF EigenVectors(TVectorF& eigenValues) 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()
                     TMatrixFSym& GetSub(Int_t row_lwb, Int_t row_upb, TMatrixFSym& target, Option_t* option = "S") const
            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
                     TMatrixFSym& Invert(Double_t* det = 0)
                     TMatrixFSym& InvertFast(Double_t* det = 0)
                  virtual TClass* IsA() const
                   virtual Bool_t IsSymmetric() const
                  virtual Float_t operator()(Int_t rown, Int_t coln) const
                 virtual Float_t& operator()(Int_t rown, Int_t coln)
                     TMatrixFSym& operator*=(Float_t val)
                     TMatrixFSym& operator+=(Float_t val)
                     TMatrixFSym& operator+=(const TMatrixFSym& source)
                     TMatrixFSym& operator-=(Float_t val)
                     TMatrixFSym& operator-=(const TMatrixFSym& source)
                     TMatrixFSym& operator=(const TMatrixFSym& source)
                     TMatrixFSym& operator=(const TMatrixDSym& source)
                     TMatrixFSym& operator=(const TMatrixFSymLazy& source)
                     TMatrixFSym& operator=(Float_t val)
          const TMatrixFRow_const operator[](Int_t rown) const
                      TMatrixFRow operator[](Int_t rown)
            virtual TMatrixFBase& Randomize(Float_t alpha, Float_t beta, Double_t& seed)
             virtual TMatrixFSym& RandomizePD(Float_t alpha, Float_t beta, Double_t& seed)
                     TMatrixFSym& Rank1Update(const TVectorF& v, 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 TMatrixFSym& m)
            virtual TMatrixFBase& SetColIndexArray(Int_t*)
            virtual TMatrixFBase& SetMatrixArray(const Float_t* data, Option_t* option = "")
            virtual TMatrixFBase& SetRowIndexArray(Int_t*)
                     TMatrixFSym& SetSub(Int_t row_lwb, const TMatrixFBase& source)
            virtual TMatrixFBase& SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixFBase& source)
            virtual TMatrixFBase& Shift(Int_t row_shift, Int_t col_shift)
                     virtual void ShowMembers(TMemberInspector& insp, char* parent)
                     TMatrixFSym& Similarity(const TMatrixF& n)
                     TMatrixFSym& Similarity(const TMatrixFSym& n)
                     TMatrixFSym& SimilarityT(const TMatrixF& n)
                     virtual void Streamer(TBuffer& b)
                             void StreamerNVirtual(TBuffer& b)
                     TMatrixFSym& T()
                     TMatrixFSym& Transpose(const TMatrixFSym& source)
                     TMatrixFSym& Use(Int_t nrows, Float_t* data)
                     TMatrixFSym& Use(Int_t row_lwb, Int_t row_upb, Float_t* data)
                     TMatrixFSym& Use(TMatrixFSym& a)

### Data Members

        protected:

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

## Class Description

     TMatrixFSym

     Implementation of a symmetric matrix in the linear algebra package

     Note that in this implementation both matrix element m[i][j] and
     m[j][i] are updated and stored in memory . However, when making the
     object persistent only the upper right triangle is stored .

TMatrixFSym(Int_t no_rows)

TMatrixFSym(Int_t row_lwb,Int_t row_upb)

TMatrixFSym(Int_t no_rows,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

TMatrixFSym(Int_t row_lwb,Int_t row_upb,const Float_t *elements,Option_t *option)

     array elements are copied

TMatrixFSym(const TMatrixFSym &another) : TMatrixFBase(another)

TMatrixFSym(const TMatrixDSym &another)

TMatrixFSym(EMatrixCreatorsOp1 op,const TMatrixFSym &prototype)

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

TMatrixFSym(EMatrixCreatorsOp1 op,const TMatrixF &prototype)

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

TMatrixFSym(const TMatrixFSymLazy &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 AtMultA(const TMatrixF &a,Int_t constr)

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

void AtMultA(const TMatrixFSym &a,Int_t constr)

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

TMatrixFSym& Use(Int_t row_lwb,Int_t row_upb,Float_t *data)

TMatrixFSym& GetSub(Int_t row_lwb,Int_t row_upb,TMatrixFSym &target,Option_t *option) const

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

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

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]

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

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

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

     Insert matrix source starting at [row_lwb][col_lwb] in a symmetric fashion, thereby overwriting the part
     [row_lwb..row_lwb+nrows_source][row_lwb..row_lwb+nrows_source];

TMatrixFBase& SetMatrixArray(const Float_t *data,Option_t *option)

TMatrixFBase& Shift(Int_t row_shift,Int_t col_shift)

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

TMatrixFSym& Invert(Double_t *det)

     Invert the matrix and calculate its determinant

TMatrixFSym& InvertFast(Double_t *det)

     Invert the matrix and calculate its determinant

TMatrixFSym& Transpose(const TMatrixFSym &source)

     Transpose a matrix.

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

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

TMatrixFSym& Similarity(const TMatrixF &b)

     Calculate B * (*this) * B^T , final matrix will be (nrowsb x nrowsb)
     This is a similarity transform when B is orthogonal . It is more
     efficient than applying the actual multiplication because this
     routine realizes that  the final matrix is symmetric .

TMatrixFSym& Similarity(const TMatrixFSym &b)

     Calculate B * (*this) * B^T , final matrix will be (nrowsb x nrowsb)
     This is a similarity transform when B is orthogonal . It is more
     efficient than applying the actual multiplication because this
     routine realizes that  the final matrix is symmetric .

TMatrixFSym& SimilarityT(const TMatrixF &b)

     Calculate B^T * (*this) * B , final matrix will be (ncolsb x ncolsb)
     It is more efficient than applying the actual multiplication because this
     routine realizes that  the final matrix is symmetric .

TMatrixFBase& Apply(const TElementActionF &action)

TMatrixFBase& Apply(const TElementPosActionF &action)

     Apply action to each element of the matrix. To action the location
     of the current element is passed.

TMatrixFBase& Randomize(Float_t alpha,Float_t beta,Double_t &seed)

     randomize matrix element values but keep matrix symmetric

TMatrixFSym& RandomizePD(Float_t alpha,Float_t beta,Double_t &seed)

     randomize matrix element values but keep matrix symmetric positive definite

const TMatrixF EigenVectors(TVectorF &eigenValues) const

     Return a matrix containing the eigen-vectors ordered by descending eigen-values.
     For full functionality use TMatrixDSymEigen .

void Streamer(TBuffer &R__b)

     Stream an object of class TMatrixFSym.

### Inline Functions

                               void ~TMatrixFSym()
                               void AMultA(const TMatrixFSym& a, Int_t constr = 1)
                        TMatrixFSym TMatrixFSym(const TMatrixFSymLazy& 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* = "")
                             Bool_t IsSymmetric() const
                       TMatrixFSym& Use(Int_t row_lwb, Int_t row_upb, Float_t* data)
                       TMatrixFSym& Use(TMatrixFSym& a)
                        TMatrixFSym 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 TMatrixFSym& m)
                       TMatrixFSym& T()
                            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)
                       TMatrixFSym& operator=(const TMatrixFSym& source)
                       TMatrixFSym& operator=(const TMatrixDSym& source)
                       TMatrixFSym& operator=(const TMatrixFSymLazy& source)
                       TMatrixFSym& operator=(Float_t val)
                       TMatrixFSym& operator-=(Float_t val)
                       TMatrixFSym& operator+=(Float_t val)
                       TMatrixFSym& operator*=(Float_t val)
                       TMatrixFSym& operator+=(const TMatrixFSym& source)
                       TMatrixFSym& operator-=(const TMatrixFSym& source)
                            TClass* Class()
                            TClass* IsA() const
                               void ShowMembers(TMemberInspector& insp, char* parent)
                               void StreamerNVirtual(TBuffer& b)

Last update: root/matrix:$Name: $:$Id: TMatrixFSym.cxx,v 1.20 2005/01/06 06:37:14 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *