Processing SPD Mean Vertex only in PHYSICS runs.
[u/mrichter/AliRoot.git] / 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
20
21
22//___________________________________________________________
23void AliMatrixSq::MultiplyByVec(Double_t *vecIn,Double_t *vecOut) const
24{
25 // fill vecOut by matrix*vecIn
26 // vector should be of the same size as the matrix
27 for (int i=GetSize();i--;) {
28 vecOut[i] = 0.0;
29 for (int j=GetSize();j--;) vecOut[i] += vecIn[j]*(*this)(i,j);
30 }
31 //
32}
33
34//___________________________________________________________
35void AliMatrixSq::PrintCOO() const
36{
37 // print matrix in COO sparse format
38 //
39 // get number of non-zero elements
40 int nnz = 0;
41 int sz = GetSize();
de34b538 42 for (int ir=0;ir<sz;ir++) for (int ic=0;ic<sz;ic++) if (Query(ir,ic)!=0) nnz++;
8a9ab0eb 43 //
44 printf("%d %d %d\n",sz,sz,nnz);
45 double vl;
de34b538 46 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 47 //
48}