15#include <TStopwatch.h>
79 fNcols =
src.GetNCols();
80 fNrows =
src.GetNRows();
83 for (
int i = fNrows;
i--;) {
92 for (
int i = fNrows;
i--;) {
102 LOG(info) <<
"Sparse Matrix of size " << fNrows <<
" x " << fNcols;
104 LOG(info) <<
" (Symmetric)\n";
106 for (
int i = 0;
i < fNrows;
i++) {
108 if (!
row->GetNElems()) {
119 memset(vecOut, 0,
GetSize() *
sizeof(Double_t));
121 for (
int rw =
GetSize(); rw--;) {
133 if (indV[--nel] == rw) {
134 vecOut[rw] += vecIn[rw] * elmV[nel];
138 for (
int iel = nel; iel--;) {
140 vecOut[rw] += vecIn[indV[iel]] * elmV[iel];
141 vecOut[indV[iel]] += vecIn[rw] * elmV[iel];
145 for (
int iel = nel; iel--;) {
147 vecOut[rw] += vecIn[indV[iel]] * elmV[iel];
159 LOG(info) <<
"MatrixSparse:SortIndices >>";
165 LOG(info) <<
"MatrixSparse:SortIndices <<";
175 for (
int i =
n;
i--;) {
176 for (
int j =
i;
j >= 0;
j--) {
177 if (indc[
j] > indc[
i]) {
192 (*this)(indc[ni],
r) += valc[ni];
203 row->Add(valc, indc, ni + 1);
215 return float(nel) / den;
Sparse matrix class (from AliROOT), used as a global matrix for MillePede2.
void Clear(Option_t *option="") override
MatrixSparse & operator=(const MatrixSparse &src)
Int_t GetSize() const override
void AddToRow(Int_t r, Double_t *valc, Int_t *indc, Int_t n) override
void MultiplyByVec(const TVectorD &vecIn, TVectorD &vecOut) const override
fill vecOut by matrix * vecIn (vector should be of the same size as the matrix)
void SortIndices(Bool_t valuesToo=kFALSE)
sort columns in increasing order. Used to fix the matrix after ILUk decompostion
void Print(Option_t *option="") const override
Float_t GetDensity() const override
get fraction of non-zero elements
VectorSparse * GetRow(Int_t ir) const
VectorSparse * GetRowAdd(Int_t ir)
Bool_t IsSymmetric() const override
MatrixSq & operator=(const MatrixSq &src)
= operator
void SetSymmetric(Bool_t v=kTRUE)
Double_t * GetElems() const
UShort_t * GetIndices() const
void SortIndices(Bool_t valuesToo=kFALSE)
sort indices in increasing order. Used to fix the row after ILUk decomposition
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)