]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliSymMatrix.h
Fixes
[u/mrichter/AliRoot.git] / STEER / AliSymMatrix.h
index f22d5d54ea227ebbda942cd31956a4358dfc7fd4..7247898e67fe5fd6a6bf55bdfb0d39b7159a13ed 100644 (file)
@@ -1,8 +1,18 @@
 #ifndef ALISYMMATRIX_H
 #define ALISYMMATRIX_H
+/**********************************************************************************************/
+/* Fast symmetric matrix with dynamically expandable size.                                    */
+/* Only part can be used for matrix operations. It is defined as:                             */ 
+/* fNCols: rows built by constructor (GetSizeBooked)                                          */ 
+/* fNRows: number of rows added dynamically (automatically added on assignment to row)        */ 
+/*         GetNRowAdded                                                                       */ 
+/* fNRowIndex: total size (fNCols+fNRows), GetSize                                            */ 
+/* fRowLwb   : actual size to used for given operation, by default = total size, GetSizeUsed  */ 
+/*                                                                                            */ 
+/* Author: ruben.shahoyan@cern.ch                                                             */
+/*                                                                                            */ 
+/**********************************************************************************************/
 
-#include <string.h>
-#include <TObject.h>
 #include <TVectorD.h>
 #include "AliMatrixSq.h"
 
@@ -20,8 +30,12 @@ class AliSymMatrix : public AliMatrixSq {
   void          Reset();
   //
   Int_t         GetSize()                                        const {return fNrowIndex;}
+  Int_t         GetSizeUsed()                                    const {return fRowLwb;}
+  Int_t         GetSizeBooked()                                  const {return fNcols;}
+  Int_t         GetSizeAdded()                                   const {return fNrows;}
   Float_t       GetDensity()                                     const;
   AliSymMatrix& operator=(const AliSymMatrix& src);
+  AliSymMatrix& operator+=(const AliSymMatrix& src);
   Double_t      operator()(Int_t rown, Int_t coln)               const;
   Double_t&     operator()(Int_t rown, Int_t coln);
   //
@@ -30,13 +44,14 @@ class AliSymMatrix : public AliMatrixSq {
   //
   Double_t*     GetRow(Int_t r);
   //
-  void          Print(Option_t* option="")                       const;
+  void          Print(const Option_t* option="")                 const;
   void          AddRows(int nrows=1);
+  void          SetSizeUsed(Int_t sz)                                  {fRowLwb = sz;}
   //
   void          Scale(Double_t coeff);
-  void          MultiplyByVec(Double_t* vecIn, Double_t* vecOut) const;
-  void          MultiplyByVec(TVectorD &vecIn, TVectorD &vecOut) const;
-  void          AddToRow(Int_t r, Double_t *valc,Int_t *indc,Int_t n);
+  void          MultiplyByVec(const Double_t* vecIn, Double_t* vecOut) const;
+  void          MultiplyByVec(const TVectorD &vecIn, TVectorD &vecOut) const;
+  void          AddToRow(Int_t r, Double_t *valc, Int_t *indc,Int_t n);
   //
   // ---------------------------------- Dummy methods of MatrixBase
   virtual       const Double_t   *GetMatrixArray  () const {return fElems;};
@@ -103,7 +118,7 @@ inline Double_t& AliSymMatrix::operator()(Int_t row, Int_t col)
 }
 
 //___________________________________________________________
-inline void AliSymMatrix::MultiplyByVec(TVectorD &vecIn, TVectorD &vecOut) const
+inline void AliSymMatrix::MultiplyByVec(const TVectorD &vecIn, TVectorD &vecOut) const
 {
   MultiplyByVec(vecIn.GetMatrixArray(), vecOut.GetMatrixArray());
 }
@@ -115,7 +130,7 @@ inline void AliSymMatrix::Scale(Double_t coeff)
 }
 
 //___________________________________________________________
-inline void AliSymMatrix::AddToRow(Int_t r, Double_t *valc,Int_t *indc,Int_t n)
+inline void AliSymMatrix::AddToRow(Int_t r, Double_t *valc, Int_t *indc,Int_t n)
 {
   for (int i=n;i--;) (*this)(indc[i],r) += valc[i];
 }