Project
Loading...
Searching...
No Matches
MatrixSq.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13
14#include <iostream>
15
16#include "TClass.h"
17#include "TMath.h"
18
19#include "Framework/Logger.h"
21
22using namespace o2::fwdalign;
23
25
26//___________________________________________________________
29 fSymmetric(src.fSymmetric)
30{
31 LOG(debug) << "copy ctor";
32}
33
34//___________________________________________________________
36{
37 if (this == &src) {
38 return *this;
39 }
40 TMatrixDBase::operator=(src);
41 fSymmetric = src.fSymmetric;
42 return *this;
43}
44
45//___________________________________________________________
46void MatrixSq::MultiplyByVec(const Double_t* vecIn, Double_t* vecOut) const
47{
48 for (int i = GetSize(); i--;) {
49 vecOut[i] = 0.0;
50 for (int j = GetSize(); j--;) {
51 vecOut[i] += vecIn[j] * (*this)(i, j);
52 }
53 }
54}
55
56//___________________________________________________________
58{
59 // get number of non-zero elements
60 int nnz = 0;
61 int sz = GetSize();
62 for (int ir = 0; ir < sz; ir++) {
63 for (int ic = 0; ic < sz; ic++) {
64 if (Query(ir, ic) != 0) {
65 nnz++;
66 }
67 }
68 }
69
70 printf("%d %d %d\n", sz, sz, nnz);
71 double vl;
72 for (int ir = 0; ir < sz; ir++) {
73 for (int ic = 0; ic < sz; ic++) {
74 if ((vl = Query(ir, ic)) != 0) {
75 printf("%d %d %f\n", ir, ic, vl);
76 }
77 }
78 }
79}
int32_t i
ClassImp(MatrixSq)
Abstract class (from AliROOT) for square matrix used for millepede2 operation.
uint32_t j
Definition RawData.h:0
std::ostringstream debug
virtual Int_t GetSize() const
Definition MatrixSq.h:39
virtual Double_t Query(Int_t rown, Int_t coln) const
Definition MatrixSq.h:44
Bool_t fSymmetric
is the matrix symmetric? Only lower triangle is filled
Definition MatrixSq.h:145
virtual void PrintCOO() const
print matrix in COO sparse format
Definition MatrixSq.cxx:57
virtual void MultiplyByVec(const Double_t *vecIn, Double_t *vecOut) const
fill vecOut by matrix * vecIn (vector should be of the same size as the matrix)
Definition MatrixSq.cxx:46
MatrixSq & operator=(const MatrixSq &src)
= operator
Definition MatrixSq.cxx:35
GLenum src
Definition glcorearb.h:1767
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)