]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliMatrixSq.cxx
POI's and RP's for LeeYang Zeroes eventplane
[u/mrichter/AliRoot.git] / STEER / AliMatrixSq.cxx
CommitLineData
8a9ab0eb 1#include <stdlib.h>
2#include <stdio.h>
3#include <iostream>
4//
5#include "TClass.h"
6#include "TMath.h"
7#include "TVectorD.h"
8#include "AliMatrixSq.h"
9//
10
11using namespace std;
12
13ClassImp(AliMatrixSq)
14
15
16
17//___________________________________________________________
18void AliMatrixSq::MultiplyByVec(Double_t *vecIn,Double_t *vecOut) const
19{
20 // fill vecOut by matrix*vecIn
21 // vector should be of the same size as the matrix
22 for (int i=GetSize();i--;) {
23 vecOut[i] = 0.0;
24 for (int j=GetSize();j--;) vecOut[i] += vecIn[j]*(*this)(i,j);
25 }
26 //
27}
28
29//___________________________________________________________
30void AliMatrixSq::PrintCOO() const
31{
32 // print matrix in COO sparse format
33 //
34 // get number of non-zero elements
35 int nnz = 0;
36 int sz = GetSize();
37 for (int ir=0;ir<sz;ir++) for (int ic=0;ic<sz;ic++) if (Querry(ir,ic)!=0) nnz++;
38 //
39 printf("%d %d %d\n",sz,sz,nnz);
40 double vl;
41 for (int ir=0;ir<sz;ir++) for (int ic=0;ic<sz;ic++) if ((vl=Querry(ir,ic))!=0) printf("%d %d %f\n",ir,ic,vl);
42 //
43}