47 fNelems =
size * (
w + 1) -
w * (
w + 1) / 2;
49 fElems =
new Double_t[fNcols * fRowLwb];
50 memset(
fElems, 0, fNcols * fRowLwb *
sizeof(Double_t));
57 if (
src.GetSize() < 1) {
61 fNrows =
src.GetBandHWidth();
63 fNelems =
src.GetNElemsStored();
64 fElems =
new Double_t[fNcols * fRowLwb];
65 memcpy(
fElems,
src.fElems, fNcols * fRowLwb *
sizeof(Double_t));
78 TObject::operator=(
src);
79 if (fNcols !=
src.fNcols) {
84 fNcols =
src.GetSize();
85 fNrows =
src.GetBandHWidth();
86 fNelems =
src.GetNElemsStored();
87 fRowLwb =
src.fRowLwb;
88 fElems =
new Double_t[fNcols * fRowLwb];
90 memcpy(
fElems,
src.fElems, fNcols * fRowLwb *
sizeof(Double_t));
103 fNelems = fNcols = fNrows = fRowLwb = 0;
113 for (
int i = fNelems;
i--;) {
118 return nel / fNelems;
124 printf(
"Symmetric Band-Diagonal Matrix : Size = %d, half bandwidth = %d\n",
126 TString opt = option;
132 opt += 1 +
int(TMath::Log10(
double(
GetSize())));
149 int jmax = TMath::Min(
GetSize(),
i + fRowLwb);
150 for (
int j =
i + 1;
j < jmax;
j++) {
159 for (
int j = jmin;
j < jmax;
j++) {
168 int jmax = TMath::Min(
GetSize(),
i + fRowLwb);
169 for (
int j = jmin;
j < jmax;
j++) {
180 memset(
fElems, 0, fNcols * fRowLwb *
sizeof(Double_t));
188 for (
int i = 0;
i <
n;
i++) {
189 (*this)(
r, indc[
i]) = valc[
i];
200 Double_t eps = std::numeric_limits<double>::epsilon() * std::numeric_limits<double>::epsilon();
202 Double_t dtmp, gamma = 0.0, xi = 0.0;
206 for (dtmp = 0.0, iDiag = 0; iDiag <
GetSize(); iDiag++) {
216 for (
int ir = 1;
ir < iDiag;
ir++) {
221 dtmp = TMath::Abs(
Query(
ir, ic));
227 double delta = eps * TMath::Max(1.0, xi + gamma);
230 double beta = TMath::Sqrt(TMath::Max(eps, TMath::Max(gamma, xi * sn)));
232 for (
int kr = 1; kr <
GetSize(); kr++) {
236 for (
int jr = colKmin; jr <= kr; jr++) {
240 for (
int i = TMath::Max(colKmin, colJmin);
i < jr;
i++) {
243 dtmp = (*this)(kr, jr) -= dtmp;
245 theta = TMath::Max(theta, TMath::Abs(dtmp));
251 (*this)(kr, jr) = 0.0;
253 }
else if (kr < iDiag) {
256 dtmp = TMath::Max(dtmp, delta);
257 (*this)(kr, jr) = TMath::Max(TMath::Abs(
Query(kr, jr)), dtmp);
279 for (
int kr = 0; kr <
GetSize(); kr++) {
280 for (
int jr = TMath::Max(0, kr -
GetBandHWidth()); jr < kr; jr++) {
281 rhs[kr] -=
Query(kr, jr) * rhs[jr];
285 for (
int kr =
GetSize(); kr--;) {
289 for (
int kr =
GetSize(); kr--;) {
290 for (
int jr = TMath::Max(0, kr -
GetBandHWidth()); jr < kr; jr++) {
291 rhs[jr] -=
Query(kr, jr) * rhs[kr];
299 memcpy(sol, rhs,
GetSize() *
sizeof(Double_t));
Symmetric Band Diagonal matrix (from AliROOT) with half band width W (+1 for diagonal)
static Bool_t IsZero(Double_t x, Double_t thresh=1e-64)
virtual Int_t GetSize() const
virtual Double_t Query(Int_t rown, Int_t coln) const
Bool_t fSymmetric
is the matrix symmetric? Only lower triangle is filled
virtual Double_t QueryDiag(Int_t rc) const
Double_t DiagElem(Int_t r) const override
Float_t GetDensity() const override
get fraction of non-zero elements
void Print(Option_t *option="") const override
print data
Int_t GetBandHWidth() const
void Solve(Double_t *rhs)
solve matrix equation
void MultiplyByVec(const Double_t *vecIn, Double_t *vecOut) const override
fill vecOut by matrix*vecIn
Double_t * fElems
Elements booked by constructor.
void SetDecomposed(Bool_t v=kTRUE)
void Reset() override
set all elems to 0
void Clear(Option_t *option="") override
clear dynamic part
void DecomposeLDLT()
decomposition to L Diag L^T
void AddToRow(Int_t r, Double_t *valc, Int_t *indc, Int_t n) override
add list of elements to row r
~SymBDMatrix() override
d-tor
SymBDMatrix & operator=(const SymBDMatrix &src)
assignment operator
Double_t GetEl(Int_t row, Int_t col) const
Bool_t IsDecomposed() const
GLubyte GLubyte GLubyte GLubyte w
o2::InteractionRecord ir(0, 0)