]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEER/AliMatrixSq.cxx
Fixing coverity 17919
[u/mrichter/AliRoot.git] / STEER / STEER / AliMatrixSq.cxx
CommitLineData
7c3070ec 1/**********************************************************************************************/
2/* Abstract class for matrix used for millepede2 operation. */
3/* Author: ruben.shahoyan@cern.ch */
4/* */
5/**********************************************************************************************/
6
8a9ab0eb 7#include <stdlib.h>
8#include <stdio.h>
9#include <iostream>
10//
11#include "TClass.h"
12#include "TMath.h"
8a9ab0eb 13#include "AliMatrixSq.h"
14//
15
16using namespace std;
17
18ClassImp(AliMatrixSq)
19
6d3c4556 20AliMatrixSq & AliMatrixSq::operator=(const AliMatrixSq &src)
21{
22 // = operator
23 if (this == &src) return *this;
24 TMatrixDBase::operator=(src);
25 fSymmetric = src.fSymmetric;
247ffe04 26 return *this;
6d3c4556 27}
8a9ab0eb 28
29//___________________________________________________________
551c9e69 30void AliMatrixSq::MultiplyByVec(const Double_t *vecIn,Double_t *vecOut) const
8a9ab0eb 31{
32 // fill vecOut by matrix*vecIn
33 // vector should be of the same size as the matrix
34 for (int i=GetSize();i--;) {
35 vecOut[i] = 0.0;
36 for (int j=GetSize();j--;) vecOut[i] += vecIn[j]*(*this)(i,j);
37 }
38 //
39}
40
41//___________________________________________________________
42void AliMatrixSq::PrintCOO() const
43{
44 // print matrix in COO sparse format
45 //
46 // get number of non-zero elements
47 int nnz = 0;
48 int sz = GetSize();
de34b538 49 for (int ir=0;ir<sz;ir++) for (int ic=0;ic<sz;ic++) if (Query(ir,ic)!=0) nnz++;
8a9ab0eb 50 //
51 printf("%d %d %d\n",sz,sz,nnz);
52 double vl;
de34b538 53 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);
8a9ab0eb 54 //
55}