45 template<
class Element>
51 if (fRowInd >= matrix.
GetNrows() || fRowInd < 0) {
52 Error(
"TMatrixTRow_const(const TMatrixT<Element> &,Int_t)",
"row index out of bounds");
67 template<
class Element>
73 if (fRowInd >= matrix.
GetNrows() || fRowInd < 0) {
74 Error(
"TMatrixTRow_const(const TMatrixTSym &,Int_t)",
"row index out of bounds");
89 template<
class Element>
98 template<
class Element>
107 template<
class Element>
116 template<
class Element>
120 Element *rp =
const_cast<Element *
>(this->
fPtr);
128 template<
class Element>
132 Element *rp =
const_cast<Element *
>(this->
fPtr);
140 template<
class Element>
144 Element *rp =
const_cast<Element *
>(this->
fPtr);
152 template<
class Element>
162 Error(
"operator=(const TMatrixTRow_const &)",
"matrix rows not compatible");
166 Element *rp1 =
const_cast<Element *
>(this->
fPtr);
167 const Element *rp2 = mr.
GetPtr();
176 template<
class Element>
183 Error(
"operator=(const TVectorT &)",
"vector length != matrix-row length");
187 Element *rp =
const_cast<Element *
>(this->
fPtr);
196 template<
class Element>
205 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
209 Element *rp1 =
const_cast<Element *
>(this->
fPtr);
210 const Element *rp2 = r.
GetPtr();
219 template<
class Element>
228 Error(
"operator*=(const TMatrixTRow_const &)",
"different row lengths");
232 Element *rp1 =
const_cast<Element *
>(this->
fPtr);
233 const Element *rp2 = r.
GetPtr();
241 template<
class Element>
247 if (this->fColInd >= matrix.
GetNcols() || this->fColInd < 0) {
248 Error(
"TMatrixTColumn_const(const TMatrixT &,Int_t)",
"column index out of bounds");
263 template<
class Element>
269 if (fColInd >= matrix.
GetNcols() || fColInd < 0) {
270 Error(
"TMatrixTColumn_const(const TMatrixTSym &,Int_t)",
"column index out of bounds");
285 template<
class Element>
294 template<
class Element>
303 template<
class Element>
312 template<
class Element>
316 Element *cp =
const_cast<Element *
>(this->
fPtr);
317 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
324 template<
class Element>
328 Element *cp =
const_cast<Element *
>(this->
fPtr);
329 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
336 template<
class Element>
340 Element *cp =
const_cast<Element *
>(this->
fPtr);
341 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
348 template<
class Element>
358 Error(
"operator=(const TMatrixTColumn_const &)",
"matrix columns not compatible");
362 Element *cp1 =
const_cast<Element *
>(this->
fPtr);
363 const Element *cp2 = mc.
GetPtr();
371 template<
class Element>
378 Error(
"operator=(const TVectorT &)",
"vector length != matrix-column length");
382 Element *cp =
const_cast<Element *
>(this->
fPtr);
384 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
393 template<
class Element>
402 Error(
"operator+=(const TMatrixTColumn_const &)",
"different row lengths");
406 Element *cp1 =
const_cast<Element *
>(this->
fPtr);
407 const Element *cp2 = mc.
GetPtr();
416 template<
class Element>
425 Error(
"operator*=(const TMatrixTColumn_const &)",
"different row lengths");
429 Element *cp1 =
const_cast<Element *
>(this->
fPtr);
430 const Element *cp2 = mc.
GetPtr();
438 template<
class Element>
452 template<
class Element>
466 template<
class Element>
475 template<
class Element>
484 template<
class Element>
493 template<
class Element>
497 Element *dp =
const_cast<Element *
>(this->
fPtr);
505 template<
class Element>
509 Element *dp =
const_cast<Element *
>(this->
fPtr);
517 template<
class Element>
521 Element *dp =
const_cast<Element *
>(this->
fPtr);
529 template<
class Element>
533 if (this->
fMatrix == mt)
return;
539 Error(
"operator=(const TMatrixTDiag_const &)",
"diagonals not compatible");
543 Element *dp1 =
const_cast<Element *
>(this->
fPtr);
544 const Element *dp2 = md.
GetPtr();
552 template<
class Element>
559 Error(
"operator=(const TVectorT &)",
"vector length != matrix-diagonal length");
563 Element *dp =
const_cast<Element *
>(this->
fPtr);
573 template<
class Element>
581 Error(
"operator=(const TMatrixTDiag_const &)",
"matrix-diagonal's different length");
585 Element *dp1 =
const_cast<Element *
>(this->
fPtr);
586 const Element *dp2 = md.
GetPtr();
595 template<
class Element>
603 Error(
"operator*=(const TMatrixTDiag_const &)",
"matrix-diagonal's different length");
607 Element *dp1 =
const_cast<Element *
>(this->
fPtr);
608 const Element *dp2 = md.
GetPtr();
616 template<
class Element>
629 template<
class Element>
642 template<
class Element>
651 template<
class Element>
660 template<
class Element>
669 template<
class Element>
673 Element *fp =
const_cast<Element *
>(this->
fPtr);
674 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
681 template<
class Element>
685 Element *fp =
const_cast<Element *
>(this->
fPtr);
686 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
693 template<
class Element>
697 Element *fp =
const_cast<Element *
>(this->
fPtr);
698 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
705 template<
class Element>
714 Error(
"operator=(const TMatrixTFlat_const &)",
"matrix lengths different");
718 Element *fp1 =
const_cast<Element *
>(this->
fPtr);
719 const Element *fp2 = mf.
GetPtr();
720 while (fp1 < this->
fPtr+this->
fMatrix->GetNoElements())
727 template<
class Element>
733 Error(
"operator=(const TVectorT &)",
"vector length != # matrix-elements");
737 Element *fp =
const_cast<Element *
>(this->
fPtr);
739 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
746 template<
class Element>
754 Error(
"operator+=(const TMatrixTFlat_const &)",
"matrices lengths different");
758 Element *fp1 =
const_cast<Element *
>(this->
fPtr);
759 const Element *fp2 = mf.
GetPtr();
760 while (fp1 < this->
fPtr + this->
fMatrix->GetNoElements())
767 template<
class Element>
775 Error(
"operator*=(const TMatrixTFlat_const &)",
"matrices lengths different");
779 Element *fp1 =
const_cast<Element *
>(this->
fPtr);
780 const Element *fp2 = mf.
GetPtr();
781 while (fp1 < this->
fPtr + this->
fMatrix->GetNoElements())
790 template<
class Element>
802 if (row_upbs < row_lwbs) {
803 Error(
"TMatrixTSub_const",
"Request sub-matrix with row_upbs(%d) < row_lwbs(%d)",row_upbs,row_lwbs);
806 if (col_upbs < col_lwbs) {
807 Error(
"TMatrixTSub_const",
"Request sub-matrix with col_upbs(%d) < col_lwbs(%d)",col_upbs,col_lwbs);
816 if (row_lwbs < rowLwb || row_lwbs > rowUpb) {
817 Error(
"TMatrixTSub_const",
"Request row_lwbs sub-matrix(%d) outside matrix range of %d - %d",row_lwbs,rowLwb,rowUpb);
820 if (col_lwbs < colLwb || col_lwbs > colUpb) {
821 Error(
"TMatrixTSub_const",
"Request col_lwbs sub-matrix(%d) outside matrix range of %d - %d",col_lwbs,colLwb,colUpb);
824 if (row_upbs < rowLwb || row_upbs > rowUpb) {
825 Error(
"TMatrixTSub_const",
"Request row_upbs sub-matrix(%d) outside matrix range of %d - %d",row_upbs,rowLwb,rowUpb);
828 if (col_upbs < colLwb || col_upbs > colUpb) {
829 Error(
"TMatrixTSub_const",
"Request col_upbs sub-matrix(%d) outside matrix range of %d - %d",col_upbs,colLwb,colUpb);
833 fRowOff = row_lwbs-rowLwb;
834 fColOff = col_lwbs-colLwb;
835 fNrowsSub = row_upbs-row_lwbs+1;
836 fNcolsSub = col_upbs-col_lwbs+1;
844 template<
class Element>
856 if (row_upbs < row_lwbs) {
857 Error(
"TMatrixTSub_const",
"Request sub-matrix with row_upbs(%d) < row_lwbs(%d)",row_upbs,row_lwbs);
860 if (col_upbs < col_lwbs) {
861 Error(
"TMatrixTSub_const",
"Request sub-matrix with col_upbs(%d) < col_lwbs(%d)",col_upbs,col_lwbs);
870 if (row_lwbs < rowLwb || row_lwbs > rowUpb) {
871 Error(
"TMatrixTSub_const",
"Request row_lwbs sub-matrix(%d) outside matrix range of %d - %d",row_lwbs,rowLwb,rowUpb);
874 if (col_lwbs < colLwb || col_lwbs > colUpb) {
875 Error(
"TMatrixTSub_const",
"Request col_lwbs sub-matrix(%d) outside matrix range of %d - %d",col_lwbs,colLwb,colUpb);
878 if (row_upbs < rowLwb || row_upbs > rowUpb) {
879 Error(
"TMatrixTSub_const",
"Request row_upbs sub-matrix(%d) outside matrix range of %d - %d",row_upbs,rowLwb,rowUpb);
882 if (col_upbs < colLwb || col_upbs > colUpb) {
883 Error(
"TMatrixTSub_const",
"Request col_upbs sub-matrix(%d) outside matrix range of %d - %d",col_upbs,colLwb,colUpb);
887 fRowOff = row_lwbs-rowLwb;
888 fColOff = col_lwbs-colLwb;
889 fNrowsSub = row_upbs-row_lwbs+1;
890 fNcolsSub = col_upbs-col_lwbs+1;
896 template<
class Element>
906 template<
class Element>
916 template<
class Element>
926 template<
class Element>
933 Error(
"Rank1Update",
"vector too short");
943 const Element tmp = alpha*pv[irow];
945 mp[off+icol] += tmp*pv[icol];
952 template<
class Element>
969 template<
class Element>
986 template<
class Element>
1003 template<
class Element>
1017 Error(
"operator=(const TMatrixTSub_const &)",
"sub matrices have different size");
1028 Element *
p1 =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray());
1036 const Int_t off2 = (irow+rowOff2)*ncols2+colOff2;
1038 p1[off1+icol] = p2[off2+icol];
1052 const Int_t off2 = irow*ncols2;
1054 p1[off1+icol] = p2[off2+icol];
1062 template<
class Element>
1071 Error(
"operator=(const TMatrixTBase<Element> &)",
"sub matrices and matrix have different size");
1082 template<
class Element>
1091 Error(
"operator+=(const TMatrixTSub_const &)",
"sub matrices have different size");
1102 Element *
p1 =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray());
1110 const Int_t off2 = (irow+rowOff2)*ncols2+colOff2;
1112 p1[off1+icol] += p2[off2+icol];
1126 const Int_t off2 = irow*ncols2;
1128 p1[off1+icol] += p2[off2+icol];
1136 template<
class Element>
1140 Error(
"operator*=(const TMatrixTSub_const &)",
"source sub matrix has wrong shape");
1152 source->
GetSub(row_lwbs,row_upbs,col_lwbs,col_upbs,source_sub);
1161 Element *trp = work;
1163 isAllocated =
kTRUE;
1167 Element *cp =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray())+this->
fRowOff*ncols+this->
fColOff;
1168 const Element *trp0 = cp;
1169 const Element *
const trp0_last = trp0+this->
fNrowsSub*ncols;
1170 while (trp0 < trp0_last) {
1171 memcpy(trp,trp0,this->
fNcolsSub*
sizeof(Element));
1172 for (
const Element *scp = sp; scp < sp+this->
fNcolsSub; ) {
1176 cij += trp[j] * *scp;
1187 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1195 template<
class Element>
1202 Error(
"operator+=(const TMatrixTBase<Element> &)",
"sub matrix and matrix have different size");
1206 Element *
p1 =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray());
1213 const Int_t off2 = irow*ncols2;
1215 p1[off1+icol] += p2[off2+icol];
1222 template<
class Element>
1226 Error(
"operator*=(const TMatrixT<Element> &)",
"source matrix has wrong shape");
1246 Element *trp = work;
1248 isAllocated =
kTRUE;
1252 Element *cp =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray())+this->
fRowOff*ncols+this->
fColOff;
1253 const Element *trp0 = cp;
1254 const Element *
const trp0_last = trp0+this->
fNrowsSub*ncols;
1255 while (trp0 < trp0_last) {
1256 memcpy(trp,trp0,this->
fNcolsSub*
sizeof(Element));
1257 for (
const Element *scp = sp; scp < sp+this->
fNcolsSub; ) {
1261 cij += trp[j] * *scp;
1272 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1280 template<
class Element>
1284 Error(
"operator*=(const TMatrixTSym<Element> &)",
"source matrix has wrong shape");
1304 Element *trp = work;
1306 isAllocated =
kTRUE;
1310 Element *cp =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray())+this->
fRowOff*ncols+this->
fColOff;
1311 const Element *trp0 = cp;
1312 const Element *
const trp0_last = trp0+this->
fNrowsSub*ncols;
1313 while (trp0 < trp0_last) {
1314 memcpy(trp,trp0,this->
fNcolsSub*
sizeof(Element));
1315 for (
const Element *scp = sp; scp < sp+this->
fNcolsSub; ) {
1319 cij += trp[j] * *scp;
1330 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1338 template<
class Element>
1344 if (fRowInd >= matrix.
GetNrows() || fRowInd < 0) {
1345 Error(
"TMatrixTSparseRow_const(const TMatrixTSparse &,Int_t)",
"row index out of bounds");
1356 fNindex = eIndex-sIndex;
1363 template<
class Element>
1369 if (acoln < fMatrix->
GetNcols() && acoln >= 0) {
1371 if (index >= 0 && fColPtr[index] == acoln)
return fDataPtr[index];
1374 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
1383 template<
class Element>
1392 template<
class Element>
1401 template<
class Element>
1407 if (acoln < this->
fMatrix->GetNcols() && acoln >= 0) {
1409 if (index >= 0 && this->
fColPtr[index] == acoln)
return this->
fDataPtr[index];
1412 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
1421 template<
class Element>
1428 if (acoln >= this->
fMatrix->GetNcols() || acoln < 0) {
1429 Error(
"operator()(Int_t",
"Requested element %d outside range : %d - %d",i,
1435 if (index >= 0 && this->
fColPtr[index] == acoln)
1436 return (const_cast<Element*>(this->
fDataPtr))[index];
1444 this->
fNindex = eIndex-sIndex;
1448 if (index >= 0 && this->
fColPtr[index] == acoln)
1449 return (const_cast<Element*>(this->
fDataPtr))[index];
1451 Error(
"operator()(Int_t",
"Insert row failed");
1460 template<
class Element>
1464 Element *rp =
const_cast<Element *
>(this->
fDataPtr);
1472 template<
class Element>
1476 Element *rp =
const_cast<Element *
>(this->
fDataPtr);
1484 template<
class Element>
1488 Element *rp =
const_cast<Element *
>(this->
fDataPtr);
1496 template<
class Element>
1500 if (this->
fMatrix == mt)
return;
1505 Error(
"operator=(const TMatrixTSparseRow_const &)",
"matrix rows not compatible");
1520 this->
fNindex = eIndex-sIndex;
1529 template<
class Element>
1536 Error(
"operator=(const TVectorT &)",
"vector length != matrix-row length");
1547 this->
fNindex = eIndex-sIndex;
1555 template<
class Element>
1563 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
1581 this->
fNindex = eIndex-sIndex;
1590 template<
class Element>
1598 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
1617 this->
fNindex = eIndex-sIndex;
1625 template<
class Element>
1637 template<
class Element>
1641 if (i < fNdiag && i >= 0) {
1644 const Element *
const pD =
fMatrix->GetMatrixArray();
1645 const Int_t sIndex = pR[i];
1646 const Int_t eIndex = pR[i+1];
1648 if (index >= sIndex && pC[index] == i)
return pD[index];
1651 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,fNdiag);
1660 template<
class Element>
1669 template<
class Element>
1678 template<
class Element>
1682 if (i < this->
fNdiag && i >= 0) {
1683 const Int_t *
const pR = this->
fMatrix->GetRowIndexArray();
1684 const Int_t *
const pC = this->
fMatrix->GetColIndexArray();
1685 const Element *
const pD = this->
fMatrix->GetMatrixArray();
1686 const Int_t sIndex = pR[i];
1687 const Int_t eIndex = pR[i+1];
1689 if (index >= sIndex && pC[index] == i)
return pD[index];
1692 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,this->
fNdiag);
1701 template<
class Element>
1706 if (i < 0 || i >= this->
fNdiag) {
1707 Error(
"operator()(Int_t",
"Requested element %d outside range : 0 - %d",i,this->
fNdiag);
1708 return (const_cast<Element*>(this->
fDataPtr))[0];
1714 Int_t sIndex = pR[i];
1715 Int_t eIndex = pR[i+1];
1717 if (index >= sIndex && pC[index] == i)
1718 return (const_cast<Element*>(this->
fDataPtr))[index];
1730 if (index >= sIndex && pC[index] == i)
1731 return (const_cast<Element*>(this->
fDataPtr))[index];
1733 Error(
"operator()(Int_t",
"Insert row failed");
1734 return (const_cast<Element*>(this->
fDataPtr))[0];
1742 template<
class Element>
1753 template<
class Element>
1764 template<
class Element>
1775 template<
class Element>
1779 if (this->
fMatrix == mt)
return;
1784 Error(
"operator=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1795 template<
class Element>
1802 Error(
"operator=(const TVectorT &)",
"vector length != matrix-diagonal length");
1815 template<
class Element>
1823 Error(
"operator+=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1828 (*
this)(i) += md(i);
1835 template<
class Element>
1843 Error(
"operator*=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1848 (*
this)(i) *= md(i);
1866 Int_t leftloint = (int) leftlo;
1872 ix = (((xalo-leftlo*b16)-p)+(fhi-k*b15)*b16)+k;
1873 if (ix < 0.0) ix = ix+p;
1875 return (ix*4.656612875
e-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
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
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.