1 /**********************************************************************************************/
3 /* Abstract class for matrix used for */
4 /* millepede2 operation. */
5 /* Works for expandable square matrices */
6 /* of arbitrary dimension */
7 /* Author: ruben.shahoyan@cern.ch */
10 /**********************************************************************************************/
18 #include "AliMatrixSq.h"
25 AliMatrixSq & AliMatrixSq::operator=(const AliMatrixSq &src)
28 if (this == &src) return *this;
29 TMatrixDBase::operator=(src);
30 fSymmetric = src.fSymmetric;
34 //___________________________________________________________
35 void AliMatrixSq::MultiplyByVec(const Double_t *vecIn,Double_t *vecOut) const
37 // fill vecOut by matrix*vecIn
38 // vector should be of the same size as the matrix
39 for (int i=GetSize();i--;) {
41 for (int j=GetSize();j--;) vecOut[i] += vecIn[j]*(*this)(i,j);
46 //___________________________________________________________
47 void AliMatrixSq::PrintCOO() const
49 // print matrix in COO sparse format
51 // get number of non-zero elements
54 for (int ir=0;ir<sz;ir++) for (int ic=0;ic<sz;ic++) if (Query(ir,ic)!=0) nnz++;
56 printf("%d %d %d\n",sz,sz,nnz);
58 for (int ir=0;ir<sz;ir++) for (int ic=0;ic<sz;ic++) if ((vl=Query(ir,ic))!=0) printf("%d %d %f\n",ir,ic,vl);