//
AliVectorSparse* GetRow(Int_t ir) const {return (ir<fNcols) ? fVecs[ir] : 0;}
AliVectorSparse* GetRowAdd(Int_t ir);
-
+ //
+ virtual Int_t GetSize() const {return fNrows;}
+ virtual Int_t GetNRows() const {return fNrows;}
+ virtual Int_t GetNCols() const {return fNcols;}
+ //
void Clear(Option_t* option="");
void Reset() {for (int i=fNcols;i--;) GetRow(i)->Reset();}
void Print(Option_t* option="") const;
Double_t& DiagElem(Int_t r);
void SortIndices(Bool_t valuesToo=kFALSE);
//
- void MultiplyByVec(TVectorD &vecIn, TVectorD &vecOut) const;
- void MultiplyByVec(Double_t* vecIn, Double_t* vecOut) const;
+ void MultiplyByVec(const TVectorD &vecIn, TVectorD &vecOut) const;
+ void MultiplyByVec(const Double_t* vecIn, Double_t* vecOut) const;
//
void AddToRow(Int_t r, Double_t *valc,Int_t *indc,Int_t n);
//
};
//___________________________________________________
-inline void AliMatrixSparse::MultiplyByVec(TVectorD &vecIn, TVectorD &vecOut) const
+inline void AliMatrixSparse::MultiplyByVec(const TVectorD &vecIn, TVectorD &vecOut) const
{
MultiplyByVec((Double_t*)vecIn.GetMatrixArray(),(Double_t*)vecOut.GetMatrixArray());
}
// printf("M: findindexAdd\n");
if (IsSymmetric() && col>row) Swap(row,col);
AliVectorSparse* rowv = GetRowAdd(row);
+ if (col>=fNcols) fNcols = col+1;
return rowv->FindIndexAdd(col);
}
inline Double_t &AliMatrixSparse::DiagElem(Int_t row)
{
AliVectorSparse* rowv = GetRowAdd(row);
- if (IsSymmetric()) return (rowv->GetNElems()>0 && rowv->GetLastIndex()==row) ?
+ if (row>=fNcols) fNcols = row+1;
+ if (IsSymmetric()) {
+ return (rowv->GetNElems()>0 && rowv->GetLastIndex()==row) ?
rowv->GetLastElem() : rowv->FindIndexAdd(row);
+ }
else return rowv->FindIndexAdd(row);
//
}