Coding convention fixes
[u/mrichter/AliRoot.git] / STEER / AliMatrixSq.h
CommitLineData
8a9ab0eb 1#ifndef ALIMATRIXSQ_H
2#define ALIMATRIXSQ_H
7c3070ec 3/**********************************************************************************************/
4/* Abstract class for matrix used for millepede2 operation. */
5/* Author: ruben.shahoyan@cern.ch */
6/* */
7/**********************************************************************************************/
8a9ab0eb 8
9#include <TMatrixDBase.h>
10#include <TVectorD.h>
11
12class AliMatrixSq : public TMatrixDBase {
13 //
14 public:
15 AliMatrixSq(): fSymmetric(kFALSE) {}
16 AliMatrixSq(const AliMatrixSq &src) : TMatrixDBase(src), fSymmetric(src.fSymmetric) {}
17 virtual ~AliMatrixSq() {}
18 virtual Int_t GetSize() const {return fNcols;}
19 virtual Float_t GetDensity() const = 0;
20 //
21 virtual void Clear(Option_t* option="") = 0;//{Error("Clear","Dummy");}
22 //
de34b538 23 virtual Double_t Query(Int_t rown, Int_t coln) const {return operator()(rown,coln);}
8a9ab0eb 24 virtual Double_t operator()(Int_t rown, Int_t coln) const = 0;//{Error("(i,j)","Dummy");return 0;}
25 virtual Double_t& operator()(Int_t rown, Int_t coln) = 0;//{Error("(i,j)","Dummy");return 0;}
26 //
de34b538 27 virtual Double_t QueryDiag(Int_t rc) const {return DiagElem(rc);}
8a9ab0eb 28 virtual Double_t DiagElem(Int_t r) const = 0;
29 virtual Double_t& DiagElem(Int_t r) = 0;
de34b538 30 virtual void AddToRow(Int_t r, Double_t *valc,Int_t *indc,Int_t n) = 0;
8a9ab0eb 31 //
32 virtual void Print(Option_t* option="") const = 0;//{Error("Print","Dummy");}
33 virtual void Reset() = 0;
34 virtual void PrintCOO() const; // print in COO format
35 //
551c9e69 36 virtual void MultiplyByVec(const Double_t* vecIn, Double_t* vecOut) const;
37 virtual void MultiplyByVec(const TVectorD &vecIn, TVectorD &vecOut) const;
8a9ab0eb 38 //
39 Bool_t IsSymmetric() const {return fSymmetric;}
40 void SetSymmetric(Bool_t v=kTRUE) {fSymmetric = v;}
41 //
42 // ---------------------------------- Dummy methods of MatrixBase
43 virtual const Double_t *GetMatrixArray () const {Error("GetMatrixArray","Dummy"); return 0;};
44 virtual Double_t *GetMatrixArray () {Error("GetMatrixArray","Dummy"); return 0;};
45 virtual const Int_t *GetRowIndexArray() const {Error("GetRowIndexArray","Dummy"); return 0;};
46 virtual Int_t *GetRowIndexArray() {Error("GetRowIndexArray","Dummy"); return 0;};
47 virtual const Int_t *GetColIndexArray() const {Error("GetColIndexArray","Dummy"); return 0;};
48 virtual Int_t *GetColIndexArray() {Error("GetColIndexArray","Dummy"); return 0;};
49 virtual TMatrixDBase &SetRowIndexArray(Int_t *) {Error("SetRowIndexArray","Dummy"); return *this;}
50 virtual TMatrixDBase &SetColIndexArray(Int_t *) {Error("SetColIndexArray","Dummy"); return *this;}
51 virtual TMatrixDBase &GetSub(Int_t,Int_t,Int_t,Int_t,TMatrixDBase &,Option_t *) const {Error("GetSub","Dummy"); return *((TMatrixDBase*)this);}
52 virtual TMatrixDBase &SetSub(Int_t,Int_t,const TMatrixDBase &) {Error("GetSub","Dummy"); return *this;}
53 virtual TMatrixDBase &ResizeTo (Int_t,Int_t,Int_t) {Error("ResizeTo","Dummy"); return *this;}
54 virtual TMatrixDBase &ResizeTo (Int_t,Int_t,Int_t,Int_t,Int_t) {Error("ResizeTo","Dummy"); return *this;}
55 //
56 virtual void Allocate (Int_t ,Int_t ,Int_t , Int_t ,Int_t ,Int_t )
57 {Error("Allocate","Dummy"); return;}
58 //
7c185459 59 static Bool_t IsZero(Double_t x,Double_t thresh=1e-64) {return x>0 ? (x<thresh) : (x>-thresh);}
60 //
8a9ab0eb 61 protected:
62 //
63 void Swap(int &r,int &c) const {int t=r;r=c;c=t;}
64 //
65 protected:
66 //
67 Bool_t fSymmetric; // is the matrix symmetric? Only lower triangle is filled
68 //
69 ClassDef(AliMatrixSq,1) //Square Matrix Class
70};
71
72
73//___________________________________________________________
551c9e69 74inline void AliMatrixSq::MultiplyByVec(const TVectorD &vecIn, TVectorD &vecOut) const
8a9ab0eb 75{
76 MultiplyByVec(vecIn.GetMatrixArray(), vecOut.GetMatrixArray());
77}
78
79
80#endif