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