//*-- Author : R.Schicker //*-- Modified : M.Sanchez (01.06.2000) #include "hsymmat.h" #include //_HADES_CLASS_DESCRIPTION ///////////////////////////////////////// // HSymMat // // Implements a generic symetric matrix // In order to allow statically sized matrixes //the HSymMat class cannot be instantiated directly //but one of the derived classes HSymMat4, HSymMat5 ... //can be instantiated. // // Each of these classes corresponds to a //symetric matrix of fixed dimension; i.e. HSymMat5 is //a symetric matrix of dimension 5. // // The HSymMatX classes themselves have no useful //methods, but inherit all their functionality from //HSymMat. // // Elements in the matrix can be accessed both via //a row and column number or with a linear index. The //relation between both of them is: //linear_index = row * dimension + column ///////////////////////////////////////////// HSymMat::HSymMat(void) { //Constructor. size = 0; pData = 0; } HSymMat::HSymMat(Int_t idim) { //Constructor with specific dimension. size = (idim * (idim + 1) / 2); pData = 0; dim = idim; } HSymMat::~HSymMat(void) { } Float_t HSymMat::convolution(Float_t v1[], Float_t v2[]) { Float_t r=0.; for (Int_t i=0;i= dim || j >= dim) { Error("setElement","Out of bounds! "); } else { pData[getLinear(i,j)]=elel; } } void HSymMat::setErr(const Int_t i,const Float_t elel){ //Sets element (i,i) to the value elel if (i >= dim) { Error("setErr","Out of bounds! "); } else { pData[getLinear(i,i)]=elel*elel; } } void HSymMat::setCov(HSymMat& a){ //Copies the matrix a if( dim != a.dim){ Error("setCov","Dimensions don't match! "); } else { for(Int_t ind=0; ind= dim || j >= dim) { Error("getElement","Out of bounds! "); } else { ind=getLinear(i,j); return pData[ind]; } return 0; } Float_t HSymMat::getErr(const Int_t i){ //Returns the element at (i,i) if (i >= dim) { Error("getErr","Out of bounds! "); } else { return sqrt(pData[getLinear(i,i)]); } return 0; } void HSymMat::getCov(HSymMat& a){ //Copies this matrix into a if( dim != a.dim) { Error("getCov","Dimensions don't match! "); } else { for(Int_t ind=0; ind