43 template<
class Element>
49 if (fRowInd >= matrix.
GetNrows() || fRowInd < 0) {
50 Error(
"TMatrixTRow_const(const TMatrixT<Element> &,Int_t)",
"row index out of bounds");
65 template<
class Element>
71 if (fRowInd >= matrix.
GetNrows() || fRowInd < 0) {
72 Error(
"TMatrixTRow_const(const TMatrixTSym &,Int_t)",
"row index out of bounds");
87 template<
class Element>
96 template<
class Element>
105 template<
class Element>
114 template<
class Element>
118 Element *rp =
const_cast<Element *
>(this->
fPtr);
126 template<
class Element>
130 Element *rp =
const_cast<Element *
>(this->
fPtr);
138 template<
class Element>
142 Element *rp =
const_cast<Element *
>(this->
fPtr);
150 template<
class Element>
160 Error(
"operator=(const TMatrixTRow_const &)",
"matrix rows not compatible");
164 Element *rp1 =
const_cast<Element *
>(this->
fPtr);
165 const Element *rp2 = mr.
GetPtr();
174 template<
class Element>
181 Error(
"operator=(const TVectorT &)",
"vector length != matrix-row length");
185 Element *rp =
const_cast<Element *
>(this->
fPtr);
194 template<
class Element>
203 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
207 Element *rp1 =
const_cast<Element *
>(this->
fPtr);
208 const Element *rp2 = r.
GetPtr();
217 template<
class Element>
226 Error(
"operator*=(const TMatrixTRow_const &)",
"different row lengths");
230 Element *rp1 =
const_cast<Element *
>(this->
fPtr);
231 const Element *rp2 = r.
GetPtr();
239 template<
class Element>
245 if (this->fColInd >= matrix.
GetNcols() || this->fColInd < 0) {
246 Error(
"TMatrixTColumn_const(const TMatrixT &,Int_t)",
"column index out of bounds");
261 template<
class Element>
267 if (fColInd >= matrix.
GetNcols() || fColInd < 0) {
268 Error(
"TMatrixTColumn_const(const TMatrixTSym &,Int_t)",
"column index out of bounds");
283 template<
class Element>
292 template<
class Element>
301 template<
class Element>
310 template<
class Element>
314 Element *cp =
const_cast<Element *
>(this->
fPtr);
315 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
322 template<
class Element>
326 Element *cp =
const_cast<Element *
>(this->
fPtr);
327 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
334 template<
class Element>
338 Element *cp =
const_cast<Element *
>(this->
fPtr);
339 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
346 template<
class Element>
356 Error(
"operator=(const TMatrixTColumn_const &)",
"matrix columns not compatible");
360 Element *cp1 =
const_cast<Element *
>(this->
fPtr);
361 const Element *cp2 = mc.
GetPtr();
369 template<
class Element>
376 Error(
"operator=(const TVectorT &)",
"vector length != matrix-column length");
380 Element *cp =
const_cast<Element *
>(this->
fPtr);
382 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
391 template<
class Element>
400 Error(
"operator+=(const TMatrixTColumn_const &)",
"different row lengths");
404 Element *cp1 =
const_cast<Element *
>(this->
fPtr);
405 const Element *cp2 = mc.
GetPtr();
414 template<
class Element>
423 Error(
"operator*=(const TMatrixTColumn_const &)",
"different row lengths");
427 Element *cp1 =
const_cast<Element *
>(this->
fPtr);
428 const Element *cp2 = mc.
GetPtr();
436 template<
class Element>
450 template<
class Element>
464 template<
class Element>
473 template<
class Element>
482 template<
class Element>
491 template<
class Element>
495 Element *dp =
const_cast<Element *
>(this->
fPtr);
503 template<
class Element>
507 Element *dp =
const_cast<Element *
>(this->
fPtr);
515 template<
class Element>
519 Element *dp =
const_cast<Element *
>(this->
fPtr);
527 template<
class Element>
531 if (this->
fMatrix == mt)
return;
537 Error(
"operator=(const TMatrixTDiag_const &)",
"diagonals not compatible");
541 Element *dp1 =
const_cast<Element *
>(this->
fPtr);
542 const Element *dp2 = md.
GetPtr();
550 template<
class Element>
557 Error(
"operator=(const TVectorT &)",
"vector length != matrix-diagonal length");
561 Element *dp =
const_cast<Element *
>(this->
fPtr);
571 template<
class Element>
579 Error(
"operator=(const TMatrixTDiag_const &)",
"matrix-diagonal's different length");
583 Element *dp1 =
const_cast<Element *
>(this->
fPtr);
584 const Element *dp2 = md.
GetPtr();
593 template<
class Element>
601 Error(
"operator*=(const TMatrixTDiag_const &)",
"matrix-diagonal's different length");
605 Element *dp1 =
const_cast<Element *
>(this->
fPtr);
606 const Element *dp2 = md.
GetPtr();
614 template<
class Element>
627 template<
class Element>
640 template<
class Element>
649 template<
class Element>
658 template<
class Element>
667 template<
class Element>
671 Element *fp =
const_cast<Element *
>(this->
fPtr);
672 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
679 template<
class Element>
683 Element *fp =
const_cast<Element *
>(this->
fPtr);
684 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
691 template<
class Element>
695 Element *fp =
const_cast<Element *
>(this->
fPtr);
696 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
703 template<
class Element>
712 Error(
"operator=(const TMatrixTFlat_const &)",
"matrix lengths different");
716 Element *fp1 =
const_cast<Element *
>(this->
fPtr);
717 const Element *fp2 = mf.
GetPtr();
718 while (fp1 < this->
fPtr+this->
fMatrix->GetNoElements())
725 template<
class Element>
731 Error(
"operator=(const TVectorT &)",
"vector length != # matrix-elements");
735 Element *fp =
const_cast<Element *
>(this->
fPtr);
737 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
744 template<
class Element>
752 Error(
"operator+=(const TMatrixTFlat_const &)",
"matrices lengths different");
756 Element *fp1 =
const_cast<Element *
>(this->
fPtr);
757 const Element *fp2 = mf.
GetPtr();
758 while (fp1 < this->
fPtr + this->
fMatrix->GetNoElements())
765 template<
class Element>
773 Error(
"operator*=(const TMatrixTFlat_const &)",
"matrices lengths different");
777 Element *fp1 =
const_cast<Element *
>(this->
fPtr);
778 const Element *fp2 = mf.
GetPtr();
779 while (fp1 < this->
fPtr + this->
fMatrix->GetNoElements())
788 template<
class Element>
800 if (row_upbs < row_lwbs) {
801 Error(
"TMatrixTSub_const",
"Request sub-matrix with row_upbs(%d) < row_lwbs(%d)",row_upbs,row_lwbs);
804 if (col_upbs < col_lwbs) {
805 Error(
"TMatrixTSub_const",
"Request sub-matrix with col_upbs(%d) < col_lwbs(%d)",col_upbs,col_lwbs);
814 if (row_lwbs < rowLwb || row_lwbs > rowUpb) {
815 Error(
"TMatrixTSub_const",
"Request row_lwbs sub-matrix(%d) outside matrix range of %d - %d",row_lwbs,rowLwb,rowUpb);
818 if (col_lwbs < colLwb || col_lwbs > colUpb) {
819 Error(
"TMatrixTSub_const",
"Request col_lwbs sub-matrix(%d) outside matrix range of %d - %d",col_lwbs,colLwb,colUpb);
822 if (row_upbs < rowLwb || row_upbs > rowUpb) {
823 Error(
"TMatrixTSub_const",
"Request row_upbs sub-matrix(%d) outside matrix range of %d - %d",row_upbs,rowLwb,rowUpb);
826 if (col_upbs < colLwb || col_upbs > colUpb) {
827 Error(
"TMatrixTSub_const",
"Request col_upbs sub-matrix(%d) outside matrix range of %d - %d",col_upbs,colLwb,colUpb);
831 fRowOff = row_lwbs-rowLwb;
832 fColOff = col_lwbs-colLwb;
833 fNrowsSub = row_upbs-row_lwbs+1;
834 fNcolsSub = col_upbs-col_lwbs+1;
842 template<
class Element>
854 if (row_upbs < row_lwbs) {
855 Error(
"TMatrixTSub_const",
"Request sub-matrix with row_upbs(%d) < row_lwbs(%d)",row_upbs,row_lwbs);
858 if (col_upbs < col_lwbs) {
859 Error(
"TMatrixTSub_const",
"Request sub-matrix with col_upbs(%d) < col_lwbs(%d)",col_upbs,col_lwbs);
868 if (row_lwbs < rowLwb || row_lwbs > rowUpb) {
869 Error(
"TMatrixTSub_const",
"Request row_lwbs sub-matrix(%d) outside matrix range of %d - %d",row_lwbs,rowLwb,rowUpb);
872 if (col_lwbs < colLwb || col_lwbs > colUpb) {
873 Error(
"TMatrixTSub_const",
"Request col_lwbs sub-matrix(%d) outside matrix range of %d - %d",col_lwbs,colLwb,colUpb);
876 if (row_upbs < rowLwb || row_upbs > rowUpb) {
877 Error(
"TMatrixTSub_const",
"Request row_upbs sub-matrix(%d) outside matrix range of %d - %d",row_upbs,rowLwb,rowUpb);
880 if (col_upbs < colLwb || col_upbs > colUpb) {
881 Error(
"TMatrixTSub_const",
"Request col_upbs sub-matrix(%d) outside matrix range of %d - %d",col_upbs,colLwb,colUpb);
885 fRowOff = row_lwbs-rowLwb;
886 fColOff = col_lwbs-colLwb;
887 fNrowsSub = row_upbs-row_lwbs+1;
888 fNcolsSub = col_upbs-col_lwbs+1;
894 template<
class Element>
904 template<
class Element>
914 template<
class Element>
924 template<
class Element>
931 Error(
"Rank1Update",
"vector too short");
941 const Element tmp = alpha*pv[irow];
943 mp[off+icol] += tmp*pv[icol];
950 template<
class Element>
967 template<
class Element>
984 template<
class Element>
1001 template<
class Element>
1015 Error(
"operator=(const TMatrixTSub_const &)",
"sub matrices have different size");
1026 Element *
p1 =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray());
1034 const Int_t off2 = (irow+rowOff2)*ncols2+colOff2;
1036 p1[off1+icol] = p2[off2+icol];
1050 const Int_t off2 = irow*ncols2;
1052 p1[off1+icol] = p2[off2+icol];
1060 template<
class Element>
1069 Error(
"operator=(const TMatrixTBase<Element> &)",
"sub matrices and matrix have different size");
1080 template<
class Element>
1089 Error(
"operator+=(const TMatrixTSub_const &)",
"sub matrices have different size");
1100 Element *
p1 =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray());
1108 const Int_t off2 = (irow+rowOff2)*ncols2+colOff2;
1110 p1[off1+icol] += p2[off2+icol];
1124 const Int_t off2 = irow*ncols2;
1126 p1[off1+icol] += p2[off2+icol];
1134 template<
class Element>
1138 Error(
"operator*=(const TMatrixTSub_const &)",
"source sub matrix has wrong shape");
1150 source->
GetSub(row_lwbs,row_upbs,col_lwbs,col_upbs,source_sub);
1159 Element *trp = work;
1161 isAllocated =
kTRUE;
1165 Element *cp =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray())+this->
fRowOff*ncols+this->
fColOff;
1166 const Element *trp0 = cp;
1167 const Element *
const trp0_last = trp0+this->
fNrowsSub*ncols;
1168 while (trp0 < trp0_last) {
1169 memcpy(trp,trp0,this->
fNcolsSub*
sizeof(Element));
1170 for (
const Element *scp = sp; scp < sp+this->
fNcolsSub; ) {
1174 cij += trp[j] * *scp;
1185 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1193 template<
class Element>
1200 Error(
"operator+=(const TMatrixTBase<Element> &)",
"sub matrix and matrix have different size");
1204 Element *
p1 =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray());
1211 const Int_t off2 = irow*ncols2;
1213 p1[off1+icol] += p2[off2+icol];
1220 template<
class Element>
1224 Error(
"operator*=(const TMatrixT<Element> &)",
"source matrix has wrong shape");
1244 Element *trp = work;
1246 isAllocated =
kTRUE;
1250 Element *cp =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray())+this->
fRowOff*ncols+this->
fColOff;
1251 const Element *trp0 = cp;
1252 const Element *
const trp0_last = trp0+this->
fNrowsSub*ncols;
1253 while (trp0 < trp0_last) {
1254 memcpy(trp,trp0,this->
fNcolsSub*
sizeof(Element));
1255 for (
const Element *scp = sp; scp < sp+this->
fNcolsSub; ) {
1259 cij += trp[j] * *scp;
1270 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1278 template<
class Element>
1282 Error(
"operator*=(const TMatrixTSym<Element> &)",
"source matrix has wrong shape");
1302 Element *trp = work;
1304 isAllocated =
kTRUE;
1308 Element *cp =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray())+this->
fRowOff*ncols+this->
fColOff;
1309 const Element *trp0 = cp;
1310 const Element *
const trp0_last = trp0+this->
fNrowsSub*ncols;
1311 while (trp0 < trp0_last) {
1312 memcpy(trp,trp0,this->
fNcolsSub*
sizeof(Element));
1313 for (
const Element *scp = sp; scp < sp+this->
fNcolsSub; ) {
1317 cij += trp[j] * *scp;
1328 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1336 template<
class Element>
1342 if (fRowInd >= matrix.
GetNrows() || fRowInd < 0) {
1343 Error(
"TMatrixTSparseRow_const(const TMatrixTSparse &,Int_t)",
"row index out of bounds");
1354 fNindex = eIndex-sIndex;
1361 template<
class Element>
1367 if (acoln < fMatrix->
GetNcols() && acoln >= 0) {
1369 if (index >= 0 && fColPtr[index] == acoln)
return fDataPtr[index];
1372 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
1381 template<
class Element>
1390 template<
class Element>
1399 template<
class Element>
1405 if (acoln < this->
fMatrix->GetNcols() && acoln >= 0) {
1407 if (index >= 0 && this->
fColPtr[index] == acoln)
return this->
fDataPtr[index];
1410 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
1419 template<
class Element>
1426 if (acoln >= this->
fMatrix->GetNcols() || acoln < 0) {
1427 Error(
"operator()(Int_t",
"Requested element %d outside range : %d - %d",i,
1433 if (index >= 0 && this->
fColPtr[index] == acoln)
1434 return (const_cast<Element*>(this->
fDataPtr))[index];
1442 this->
fNindex = eIndex-sIndex;
1446 if (index >= 0 && this->
fColPtr[index] == acoln)
1447 return (const_cast<Element*>(this->
fDataPtr))[index];
1449 Error(
"operator()(Int_t",
"Insert row failed");
1458 template<
class Element>
1462 Element *rp =
const_cast<Element *
>(this->
fDataPtr);
1470 template<
class Element>
1474 Element *rp =
const_cast<Element *
>(this->
fDataPtr);
1482 template<
class Element>
1486 Element *rp =
const_cast<Element *
>(this->
fDataPtr);
1494 template<
class Element>
1498 if (this->
fMatrix == mt)
return;
1503 Error(
"operator=(const TMatrixTSparseRow_const &)",
"matrix rows not compatible");
1518 this->
fNindex = eIndex-sIndex;
1527 template<
class Element>
1534 Error(
"operator=(const TVectorT &)",
"vector length != matrix-row length");
1545 this->
fNindex = eIndex-sIndex;
1553 template<
class Element>
1561 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
1579 this->
fNindex = eIndex-sIndex;
1588 template<
class Element>
1596 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
1615 this->
fNindex = eIndex-sIndex;
1623 template<
class Element>
1635 template<
class Element>
1639 if (i < fNdiag && i >= 0) {
1642 const Element *
const pD =
fMatrix->GetMatrixArray();
1643 const Int_t sIndex = pR[i];
1644 const Int_t eIndex = pR[i+1];
1646 if (index >= sIndex && pC[index] == i)
return pD[index];
1649 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,fNdiag);
1658 template<
class Element>
1667 template<
class Element>
1676 template<
class Element>
1680 if (i < this->
fNdiag && i >= 0) {
1681 const Int_t *
const pR = this->
fMatrix->GetRowIndexArray();
1682 const Int_t *
const pC = this->
fMatrix->GetColIndexArray();
1683 const Element *
const pD = this->
fMatrix->GetMatrixArray();
1684 const Int_t sIndex = pR[i];
1685 const Int_t eIndex = pR[i+1];
1687 if (index >= sIndex && pC[index] == i)
return pD[index];
1690 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,this->
fNdiag);
1699 template<
class Element>
1704 if (i < 0 || i >= this->
fNdiag) {
1705 Error(
"operator()(Int_t",
"Requested element %d outside range : 0 - %d",i,this->
fNdiag);
1706 return (const_cast<Element*>(this->
fDataPtr))[0];
1712 Int_t sIndex = pR[i];
1713 Int_t eIndex = pR[i+1];
1715 if (index >= sIndex && pC[index] == i)
1716 return (const_cast<Element*>(this->
fDataPtr))[index];
1728 if (index >= sIndex && pC[index] == i)
1729 return (const_cast<Element*>(this->
fDataPtr))[index];
1731 Error(
"operator()(Int_t",
"Insert row failed");
1732 return (const_cast<Element*>(this->
fDataPtr))[0];
1740 template<
class Element>
1751 template<
class Element>
1762 template<
class Element>
1773 template<
class Element>
1777 if (this->
fMatrix == mt)
return;
1782 Error(
"operator=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1793 template<
class Element>
1800 Error(
"operator=(const TVectorT &)",
"vector length != matrix-diagonal length");
1813 template<
class Element>
1821 Error(
"operator+=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1826 (*
this)(i) += md(i);
1833 template<
class Element>
1841 Error(
"operator*=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1846 (*
this)(i) *= md(i);
1864 Int_t leftloint = (int) leftlo;
1870 ix = (((xalo-leftlo*b16)-p)+(fhi-k*b15)*b16)+k;
1871 if (ix < 0.0) ix = ix+p;
1873 return (ix*4.656612875e-10);
void Rank1Update(const TVectorT< Element > &vec, Element alpha=1.0)
Perform a rank 1 operation on the matrix: A += alpha * v * v^T.
Element operator()(Int_t i) const
const TMatrixTSparse< Element > * fMatrix
virtual const Element * GetMatrixArray() const =0
const TMatrixTBase< Element > * GetMatrix() const
virtual const Element * GetMatrixArray() const
virtual TMatrixTBase< Element > & InsertRow(Int_t row, Int_t col, const Element *v, Int_t n=-1)
Insert in row rown, n elements of array v at column coln.
const Element * GetPtr() const
virtual TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1)
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
void operator+=(Element val)
Add val to every element of the matrix column.
Int_t GetRowIndex() const
virtual const Int_t * GetRowIndexArray() const
void operator*=(Element val)
Multiply every element of the matrix with val.
virtual const Element * GetMatrixArray() const
TMatrixTSparseDiag_const()
const TMatrixTBase< Element > * fMatrix
void operator+=(Element val)
Assign val to every element of the matrix diagonal.
Double_t Drand(Double_t &ix)
Random number generator [0....1] with seed ix.
void operator*=(Element val)
Multiply every element of the sub matrix by val .
Short_t Min(Short_t a, Short_t b)
void operator=(Element val)
Assign val to every element of the matrix diagonal.
Element operator()(Int_t i) const
virtual const Element * GetMatrixArray() const
void operator+=(Element val)
Add val to every non-zero (!) element of the matrix row.
void operator*=(Element val)
Multiply every element of the matrix row with val.
virtual TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1)
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
const Element * GetPtr() const
Int_t GetNoElements() const
const Element * GetPtr() const
TMatrixTSparseRow_const()
const TMatrixTBase< Element > * fMatrix
void operator*=(Element val)
Multiply every element of the matrix diagonal by val.
const Element * GetPtr() const
static double p2(double t, double a, double b, double c)
Int_t GetRowIndex() const
void Error(const char *location, const char *msgfmt,...)
void operator=(Element val)
Assign val to every element of the matrix column.
Element * GetMatrixArray()
void operator=(Element val)
Assign val to every element of the matrix.
virtual void ExtractRow(Int_t row, Int_t col, Element *v, Int_t n=-1) const
Store in array v, n matrix elements of row rown starting at column coln.
TMatrixT< Element > & ElementMult(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Multiply target by the source, element-by-element.
Element operator()(Int_t i) const
Int_t GetNoElements() const
static double p1(double t, double a, double b)
const TMatrixTBase< Element > * fMatrix
void operator+=(Element val)
Add val to every element of the sub matrix.
const TMatrixTBase< Element > * GetMatrix() const
virtual const Int_t * GetColIndexArray() const
const TMatrixTBase< Element > * GetMatrix() const
void operator+=(Element val)
Add val to every element of the matrix.
void operator=(Element val)
Assign val to every element of the sub matrix.
void operator+=(Element val)
Add val to every element of the matrix diagonal.
Element operator()(Int_t i) const
const TMatrixTBase< Element > * GetMatrix() const
const TMatrixTSparse< Element > * fMatrix
void operator=(Element val)
Assign val to every element of the matrix row.
const TMatrixTBase< Element > * fMatrix
const TMatrixTBase< Element > * GetMatrix() const
void operator*=(Element val)
Multiply every element of the matrix row by val.
Int_t GetColIndex() const
void operator*=(Element val)
Multiply every element of the matrix column with val.
Short_t Max(Short_t a, Short_t b)
static Element & NaNValue()
void operator=(Element val)
Assign val to every non-zero (!) element of the matrix row.
const TMatrixTBase< Element > * fMatrix
void operator*=(Element val)
Assign val to every element of the matrix diagonal.
virtual TMatrixTBase< Element > & GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, TMatrixTBase< Element > &target, Option_t *option="S") const =0
void operator+=(Element val)
Add val to every element of the matrix row.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
const TMatrixTBase< Element > * GetMatrix() const
const TMatrixTBase< Element > * GetMatrix() const
void operator=(Element val)
Assign val to every element of the matrix diagonal.