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>
119 R__ASSERT(this->
fMatrix->IsValid());
120 Element *rp =
const_cast<Element *
>(this->
fPtr);
125 template<
class Element>
128 R__ASSERT(this->
fMatrix->IsValid());
129 Element *rp =
const_cast<Element *
>(this->
fPtr);
130 auto litr = l.begin();
131 for ( ; rp < this->
fPtr+this->
fMatrix->GetNcols() && litr != l.end(); rp += this->
fInc)
138 template<
class Element>
141 R__ASSERT(this->
fMatrix->IsValid());
142 Element *rp =
const_cast<Element *
>(this->
fPtr);
150 template<
class Element>
153 R__ASSERT(this->
fMatrix->IsValid());
154 Element *rp =
const_cast<Element *
>(this->
fPtr);
162 template<
class Element>
168 R__ASSERT(this->
fMatrix->IsValid());
172 Error(
"operator=(const TMatrixTRow_const &)",
"matrix rows not compatible");
176 Element *rp1 =
const_cast<Element *
>(this->
fPtr);
177 const Element *rp2 = mr.
GetPtr();
186 template<
class Element>
189 R__ASSERT(this->
fMatrix->IsValid());
193 Error(
"operator=(const TVectorT &)",
"vector length != matrix-row length");
197 Element *rp =
const_cast<Element *
>(this->
fPtr);
206 template<
class Element>
211 R__ASSERT(this->
fMatrix->IsValid());
215 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
219 Element *rp1 =
const_cast<Element *
>(this->
fPtr);
220 const Element *rp2 = r.
GetPtr();
229 template<
class Element>
234 R__ASSERT(this->
fMatrix->IsValid());
238 Error(
"operator*=(const TMatrixTRow_const &)",
"different row lengths");
242 Element *rp1 =
const_cast<Element *
>(this->
fPtr);
243 const Element *rp2 = r.
GetPtr();
251 template<
class Element>
257 if (this->fColInd >= matrix.
GetNcols() || this->fColInd < 0) {
258 Error(
"TMatrixTColumn_const(const TMatrixT &,Int_t)",
"column index out of bounds");
273 template<
class Element>
279 if (fColInd >= matrix.
GetNcols() || fColInd < 0) {
280 Error(
"TMatrixTColumn_const(const TMatrixTSym &,Int_t)",
"column index out of bounds");
295 template<
class Element>
304 template<
class Element>
313 template<
class Element>
322 template<
class Element>
325 R__ASSERT(this->
fMatrix->IsValid());
326 Element *cp =
const_cast<Element *
>(this->
fPtr);
327 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
334 template<
class Element>
337 R__ASSERT(this->
fMatrix->IsValid());
338 Element *rp =
const_cast<Element *
>(this->
fPtr);
339 auto litr = l.begin();
340 for ( ; rp < this->
fPtr+this->
fMatrix->GetNoElements() && litr != l.end(); rp += this->
fInc)
347 template<
class Element>
350 R__ASSERT(this->
fMatrix->IsValid());
351 Element *cp =
const_cast<Element *
>(this->
fPtr);
352 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
359 template<
class Element>
362 R__ASSERT(this->
fMatrix->IsValid());
363 Element *cp =
const_cast<Element *
>(this->
fPtr);
364 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
371 template<
class Element>
377 R__ASSERT(this->
fMatrix->IsValid());
381 Error(
"operator=(const TMatrixTColumn_const &)",
"matrix columns not compatible");
385 Element *cp1 =
const_cast<Element *
>(this->
fPtr);
386 const Element *cp2 = mc.
GetPtr();
394 template<
class Element>
397 R__ASSERT(this->
fMatrix->IsValid());
401 Error(
"operator=(const TVectorT &)",
"vector length != matrix-column length");
405 Element *cp =
const_cast<Element *
>(this->
fPtr);
407 for ( ; cp < this->
fPtr+this->
fMatrix->GetNoElements(); cp += this->
fInc)
416 template<
class Element>
421 R__ASSERT(this->
fMatrix->IsValid());
425 Error(
"operator+=(const TMatrixTColumn_const &)",
"different row lengths");
429 Element *cp1 =
const_cast<Element *
>(this->
fPtr);
430 const Element *cp2 = mc.
GetPtr();
439 template<
class Element>
444 R__ASSERT(this->
fMatrix->IsValid());
448 Error(
"operator*=(const TMatrixTColumn_const &)",
"different row lengths");
452 Element *cp1 =
const_cast<Element *
>(this->
fPtr);
453 const Element *cp2 = mc.
GetPtr();
461 template<
class Element>
475 template<
class Element>
489 template<
class Element>
498 template<
class Element>
507 template<
class Element>
516 template<
class Element>
519 R__ASSERT(this->
fMatrix->IsValid());
520 Element *dp =
const_cast<Element *
>(this->
fPtr);
521 for (Int_t i = 0; i < this->
fNdiag; i++, dp += this->
fInc)
528 template<
class Element>
531 R__ASSERT(this->
fMatrix->IsValid());
532 Element *dp =
const_cast<Element *
>(this->
fPtr);
533 for (Int_t i = 0; i < this->
fNdiag; i++, dp += this->
fInc)
540 template<
class Element>
543 R__ASSERT(this->
fMatrix->IsValid());
544 Element *dp =
const_cast<Element *
>(this->
fPtr);
545 for (Int_t i = 0; i < this->
fNdiag; i++, dp += this->
fInc)
552 template<
class Element>
556 if (this->
fMatrix == mt)
return;
558 R__ASSERT(this->
fMatrix->IsValid());
562 Error(
"operator=(const TMatrixTDiag_const &)",
"diagonals not compatible");
566 Element *dp1 =
const_cast<Element *
>(this->
fPtr);
567 const Element *dp2 = md.
GetPtr();
568 for (Int_t i = 0; i < this->
fNdiag; i++, dp1 += this->
fInc, dp2 += md.
GetInc())
575 template<
class Element>
578 R__ASSERT(this->
fMatrix->IsValid());
582 Error(
"operator=(const TVectorT &)",
"vector length != matrix-diagonal length");
586 Element *dp =
const_cast<Element *
>(this->
fPtr);
596 template<
class Element>
601 R__ASSERT(this->
fMatrix->IsValid());
604 Error(
"operator=(const TMatrixTDiag_const &)",
"matrix-diagonal's different length");
608 Element *dp1 =
const_cast<Element *
>(this->
fPtr);
609 const Element *dp2 = md.
GetPtr();
610 for (Int_t i = 0; i < this->
fNdiag; i++, dp1 += this->
fInc, dp2 += md.
GetInc())
618 template<
class Element>
623 R__ASSERT(this->
fMatrix->IsValid());
626 Error(
"operator*=(const TMatrixTDiag_const &)",
"matrix-diagonal's different length");
630 Element *dp1 =
const_cast<Element *
>(this->
fPtr);
631 const Element *dp2 = md.
GetPtr();
632 for (Int_t i = 0; i < this->
fNdiag; i++, dp1 += this->
fInc, dp2 += md.
GetInc())
639 template<
class Element>
652 template<
class Element>
665 template<
class Element>
674 template<
class Element>
683 template<
class Element>
692 template<
class Element>
695 R__ASSERT(this->
fMatrix->IsValid());
696 Element *fp =
const_cast<Element *
>(this->
fPtr);
697 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
704 template<
class Element>
707 R__ASSERT(this->
fMatrix->IsValid());
708 Element *fp =
const_cast<Element *
>(this->
fPtr);
709 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
716 template<
class Element>
719 R__ASSERT(this->
fMatrix->IsValid());
720 Element *fp =
const_cast<Element *
>(this->
fPtr);
721 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
728 template<
class Element>
734 R__ASSERT(this->
fMatrix->IsValid());
737 Error(
"operator=(const TMatrixTFlat_const &)",
"matrix lengths different");
741 Element *fp1 =
const_cast<Element *
>(this->
fPtr);
742 const Element *fp2 = mf.
GetPtr();
743 while (fp1 < this->
fPtr+this->
fMatrix->GetNoElements())
750 template<
class Element>
756 Error(
"operator=(const TVectorT &)",
"vector length != # matrix-elements");
760 Element *fp =
const_cast<Element *
>(this->
fPtr);
762 while (fp < this->
fPtr+this->
fMatrix->GetNoElements())
769 template<
class Element>
774 R__ASSERT(this->
fMatrix->IsValid());
777 Error(
"operator+=(const TMatrixTFlat_const &)",
"matrices lengths different");
781 Element *fp1 =
const_cast<Element *
>(this->
fPtr);
782 const Element *fp2 = mf.
GetPtr();
783 while (fp1 < this->
fPtr + this->
fMatrix->GetNoElements())
790 template<
class Element>
795 R__ASSERT(this->
fMatrix->IsValid());
798 Error(
"operator*=(const TMatrixTFlat_const &)",
"matrices lengths different");
802 Element *fp1 =
const_cast<Element *
>(this->
fPtr);
803 const Element *fp2 = mf.
GetPtr();
804 while (fp1 < this->
fPtr + this->
fMatrix->GetNoElements())
813 template<
class Element>
815 Int_t col_lwbs,Int_t col_upbs)
825 if (row_upbs < row_lwbs) {
826 Error(
"TMatrixTSub_const",
"Request sub-matrix with row_upbs(%d) < row_lwbs(%d)",row_upbs,row_lwbs);
829 if (col_upbs < col_lwbs) {
830 Error(
"TMatrixTSub_const",
"Request sub-matrix with col_upbs(%d) < col_lwbs(%d)",col_upbs,col_lwbs);
839 if (row_lwbs < rowLwb || row_lwbs > rowUpb) {
840 Error(
"TMatrixTSub_const",
"Request row_lwbs sub-matrix(%d) outside matrix range of %d - %d",row_lwbs,rowLwb,rowUpb);
843 if (col_lwbs < colLwb || col_lwbs > colUpb) {
844 Error(
"TMatrixTSub_const",
"Request col_lwbs sub-matrix(%d) outside matrix range of %d - %d",col_lwbs,colLwb,colUpb);
847 if (row_upbs < rowLwb || row_upbs > rowUpb) {
848 Error(
"TMatrixTSub_const",
"Request row_upbs sub-matrix(%d) outside matrix range of %d - %d",row_upbs,rowLwb,rowUpb);
851 if (col_upbs < colLwb || col_upbs > colUpb) {
852 Error(
"TMatrixTSub_const",
"Request col_upbs sub-matrix(%d) outside matrix range of %d - %d",col_upbs,colLwb,colUpb);
856 fRowOff = row_lwbs-rowLwb;
857 fColOff = col_lwbs-colLwb;
858 fNrowsSub = row_upbs-row_lwbs+1;
859 fNcolsSub = col_upbs-col_lwbs+1;
867 template<
class Element>
869 Int_t col_lwbs,Int_t col_upbs)
879 if (row_upbs < row_lwbs) {
880 Error(
"TMatrixTSub_const",
"Request sub-matrix with row_upbs(%d) < row_lwbs(%d)",row_upbs,row_lwbs);
883 if (col_upbs < col_lwbs) {
884 Error(
"TMatrixTSub_const",
"Request sub-matrix with col_upbs(%d) < col_lwbs(%d)",col_upbs,col_lwbs);
893 if (row_lwbs < rowLwb || row_lwbs > rowUpb) {
894 Error(
"TMatrixTSub_const",
"Request row_lwbs sub-matrix(%d) outside matrix range of %d - %d",row_lwbs,rowLwb,rowUpb);
897 if (col_lwbs < colLwb || col_lwbs > colUpb) {
898 Error(
"TMatrixTSub_const",
"Request col_lwbs sub-matrix(%d) outside matrix range of %d - %d",col_lwbs,colLwb,colUpb);
901 if (row_upbs < rowLwb || row_upbs > rowUpb) {
902 Error(
"TMatrixTSub_const",
"Request row_upbs sub-matrix(%d) outside matrix range of %d - %d",row_upbs,rowLwb,rowUpb);
905 if (col_upbs < colLwb || col_upbs > colUpb) {
906 Error(
"TMatrixTSub_const",
"Request col_upbs sub-matrix(%d) outside matrix range of %d - %d",col_upbs,colLwb,colUpb);
910 fRowOff = row_lwbs-rowLwb;
911 fColOff = col_lwbs-colLwb;
912 fNrowsSub = row_upbs-row_lwbs+1;
913 fNcolsSub = col_upbs-col_lwbs+1;
919 template<
class Element>
921 Int_t col_lwbs,Int_t col_upbs)
929 template<
class Element>
931 Int_t col_lwbs,Int_t col_upbs)
939 template<
class Element>
949 template<
class Element>
952 R__ASSERT(this->
fMatrix->IsValid());
956 Error(
"Rank1Update",
"vector too short");
963 const Int_t ncols = this->
fMatrix->GetNcols();
964 for (Int_t irow = 0; irow < this->
fNrowsSub; irow++) {
966 const Element tmp = alpha*pv[irow];
967 for (Int_t icol = 0; icol < this->
fNcolsSub; icol++)
968 mp[off+icol] += tmp*pv[icol];
975 template<
class Element>
978 R__ASSERT(this->
fMatrix->IsValid());
981 const Int_t ncols = this->
fMatrix->GetNcols();
982 for (Int_t irow = 0; irow < this->
fNrowsSub; irow++) {
984 for (Int_t icol = 0; icol < this->
fNcolsSub; icol++)
992 template<
class Element>
995 R__ASSERT(this->
fMatrix->IsValid());
998 const Int_t ncols = this->
fMatrix->GetNcols();
999 for (Int_t irow = 0; irow < this->
fNrowsSub; irow++) {
1001 for (Int_t icol = 0; icol < this->
fNcolsSub; icol++)
1009 template<
class Element>
1012 R__ASSERT(this->
fMatrix->IsValid());
1015 const Int_t ncols = this->
fMatrix->GetNcols();
1016 for (Int_t irow = 0; irow < this->
fNrowsSub; irow++) {
1018 for (Int_t icol = 0; icol < this->
fNcolsSub; icol++)
1026 template<
class Element>
1031 R__ASSERT(this->
fMatrix->IsValid());
1040 Error(
"operator=(const TMatrixTSub_const &)",
"sub matrices have different size");
1047 Bool_t overlap = (this->
fMatrix == mt) &&
1051 Element *p1 =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray());
1055 const Int_t ncols1 = this->
fMatrix->GetNcols();
1056 const Int_t ncols2 = mt->
GetNcols();
1057 for (Int_t irow = 0; irow < this->
fNrowsSub; irow++) {
1059 const Int_t off2 = (irow+rowOff2)*ncols2+colOff2;
1060 for (Int_t icol = 0; icol < this->
fNcolsSub; icol++)
1061 p1[off1+icol] = p2[off2+icol];
1064 const Int_t row_lwbs = rowOff2+mt->
GetRowLwb();
1065 const Int_t row_upbs = row_lwbs+this->
fNrowsSub-1;
1066 const Int_t col_lwbs = colOff2+mt->
GetColLwb();
1067 const Int_t col_upbs = col_lwbs+this->
fNcolsSub-1;
1071 const Int_t ncols1 = this->
fMatrix->GetNcols();
1072 const Int_t ncols2 = tmp.
GetNcols();
1073 for (Int_t irow = 0; irow < this->
fNrowsSub; irow++) {
1075 const Int_t off2 = irow*ncols2;
1076 for (Int_t icol = 0; icol < this->
fNcolsSub; icol++)
1077 p1[off1+icol] = p2[off2+icol];
1085 template<
class Element>
1088 R__ASSERT(this->
fMatrix->IsValid());
1094 Error(
"operator=(const TMatrixTBase<Element> &)",
"sub matrices and matrix have different size");
1105 template<
class Element>
1110 R__ASSERT(this->
fMatrix->IsValid());
1114 Error(
"operator+=(const TMatrixTSub_const &)",
"sub matrices have different size");
1121 Bool_t overlap = (this->
fMatrix == mt) &&
1125 Element *p1 =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray());
1129 const Int_t ncols1 = this->
fMatrix->GetNcols();
1130 const Int_t ncols2 = mt->
GetNcols();
1131 for (Int_t irow = 0; irow < this->
fNrowsSub; irow++) {
1133 const Int_t off2 = (irow+rowOff2)*ncols2+colOff2;
1134 for (Int_t icol = 0; icol < this->
fNcolsSub; icol++)
1135 p1[off1+icol] += p2[off2+icol];
1138 const Int_t row_lwbs = rowOff2+mt->
GetRowLwb();
1139 const Int_t row_upbs = row_lwbs+this->
fNrowsSub-1;
1140 const Int_t col_lwbs = colOff2+mt->
GetColLwb();
1141 const Int_t col_upbs = col_lwbs+this->
fNcolsSub-1;
1145 const Int_t ncols1 = this->
fMatrix->GetNcols();
1146 const Int_t ncols2 = tmp.
GetNcols();
1147 for (Int_t irow = 0; irow < this->
fNrowsSub; irow++) {
1149 const Int_t off2 = irow*ncols2;
1150 for (Int_t icol = 0; icol < this->
fNcolsSub; icol++)
1151 p1[off1+icol] += p2[off2+icol];
1159 template<
class Element>
1163 Error(
"operator*=(const TMatrixTSub_const &)",
"source sub matrix has wrong shape");
1172 const Int_t row_upbs = row_lwbs+this->
fNrowsSub-1;
1174 const Int_t col_upbs = col_lwbs+this->
fNcolsSub-1;
1175 source->
GetSub(row_lwbs,row_upbs,col_lwbs,col_upbs,source_sub);
1179 const Int_t ncols = this->
fMatrix->GetNcols();
1183 Bool_t isAllocated = kFALSE;
1184 Element *trp = work;
1186 isAllocated = kTRUE;
1190 Element *cp =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray())+this->
fRowOff*ncols+this->
fColOff;
1191 const Element *trp0 = cp;
1192 const Element *
const trp0_last = trp0+this->
fNrowsSub*ncols;
1193 while (trp0 < trp0_last) {
1194 memcpy(trp,trp0,this->
fNcolsSub*
sizeof(Element));
1195 for (
const Element *scp = sp; scp < sp+this->
fNcolsSub; ) {
1198 for (Int_t j = 0; j < this->
fNcolsSub; j++) {
1199 cij += trp[j] * *scp;
1207 R__ASSERT(trp0 == cp);
1210 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1218 template<
class Element>
1221 R__ASSERT(this->
fMatrix->IsValid());
1225 Error(
"operator+=(const TMatrixTBase<Element> &)",
"sub matrix and matrix have different size");
1229 Element *p1 =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray());
1232 const Int_t ncols1 = this->
fMatrix->GetNcols();
1233 const Int_t ncols2 = mt.
GetNcols();
1234 for (Int_t irow = 0; irow < this->
fNrowsSub; irow++) {
1236 const Int_t off2 = irow*ncols2;
1237 for (Int_t icol = 0; icol < this->
fNcolsSub; icol++)
1238 p1[off1+icol] += p2[off2+icol];
1245 template<
class Element>
1249 Error(
"operator*=(const TMatrixT<Element> &)",
"source matrix has wrong shape");
1264 const Int_t ncols = this->
fMatrix->GetNcols();
1268 Bool_t isAllocated = kFALSE;
1269 Element *trp = work;
1271 isAllocated = kTRUE;
1275 Element *cp =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray())+this->
fRowOff*ncols+this->
fColOff;
1276 const Element *trp0 = cp;
1277 const Element *
const trp0_last = trp0+this->
fNrowsSub*ncols;
1278 while (trp0 < trp0_last) {
1279 memcpy(trp,trp0,this->
fNcolsSub*
sizeof(Element));
1280 for (
const Element *scp = sp; scp < sp+this->
fNcolsSub; ) {
1283 for (Int_t j = 0; j < this->
fNcolsSub; j++) {
1284 cij += trp[j] * *scp;
1292 R__ASSERT(trp0 == cp);
1295 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1303 template<
class Element>
1307 Error(
"operator*=(const TMatrixTSym<Element> &)",
"source matrix has wrong shape");
1322 const Int_t ncols = this->
fMatrix->GetNcols();
1326 Bool_t isAllocated = kFALSE;
1327 Element *trp = work;
1329 isAllocated = kTRUE;
1333 Element *cp =
const_cast<Element *
>(this->
fMatrix->GetMatrixArray())+this->
fRowOff*ncols+this->
fColOff;
1334 const Element *trp0 = cp;
1335 const Element *
const trp0_last = trp0+this->
fNrowsSub*ncols;
1336 while (trp0 < trp0_last) {
1337 memcpy(trp,trp0,this->
fNcolsSub*
sizeof(Element));
1338 for (
const Element *scp = sp; scp < sp+this->
fNcolsSub; ) {
1341 for (Int_t j = 0; j < this->
fNcolsSub; j++) {
1342 cij += trp[j] * *scp;
1350 R__ASSERT(trp0 == cp);
1353 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1361 template<
class Element>
1367 if (fRowInd >= matrix.
GetNrows() || fRowInd < 0) {
1368 Error(
"TMatrixTSparseRow_const(const TMatrixTSparse &,Int_t)",
"row index out of bounds");
1379 fNindex = eIndex-sIndex;
1386 template<
class Element>
1390 R__ASSERT(
fMatrix->IsValid());
1391 const Int_t acoln = i-
fMatrix->GetColLwb();
1392 if (acoln < fMatrix->
GetNcols() && acoln >= 0) {
1394 if (index >= 0 && fColPtr[index] == acoln)
return fDataPtr[index];
1397 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
1406 template<
class Element>
1415 template<
class Element>
1424 template<
class Element>
1428 R__ASSERT(this->
fMatrix->IsValid());
1429 const Int_t acoln = i-this->
fMatrix->GetColLwb();
1430 if (acoln < this->
fMatrix->GetNcols() && acoln >= 0) {
1432 if (index >= 0 && this->
fColPtr[index] == acoln)
return this->
fDataPtr[index];
1435 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
1444 template<
class Element>
1448 R__ASSERT(this->
fMatrix->IsValid());
1450 const Int_t acoln = i-this->
fMatrix->GetColLwb();
1451 if (acoln >= this->
fMatrix->GetNcols() || acoln < 0) {
1452 Error(
"operator()(Int_t",
"Requested element %d outside range : %d - %d",i,
1458 if (index >= 0 && this->
fColPtr[index] == acoln)
1459 return (const_cast<Element*>(this->
fDataPtr))[index];
1467 this->
fNindex = eIndex-sIndex;
1471 if (index >= 0 && this->
fColPtr[index] == acoln)
1472 return (const_cast<Element*>(this->
fDataPtr))[index];
1474 Error(
"operator()(Int_t",
"Insert row failed");
1483 template<
class Element>
1486 R__ASSERT(this->
fMatrix->IsValid());
1487 Element *rp =
const_cast<Element *
>(this->
fDataPtr);
1495 template<
class Element>
1498 R__ASSERT(this->
fMatrix->IsValid());
1499 Element *rp =
const_cast<Element *
>(this->
fDataPtr);
1507 template<
class Element>
1510 R__ASSERT(this->
fMatrix->IsValid());
1511 Element *rp =
const_cast<Element *
>(this->
fDataPtr);
1519 template<
class Element>
1523 if (this->
fMatrix == mt)
return;
1525 R__ASSERT(this->
fMatrix->IsValid());
1528 Error(
"operator=(const TMatrixTSparseRow_const &)",
"matrix rows not compatible");
1532 const Int_t ncols = this->
fMatrix->GetNcols();
1535 const Int_t col = this->
fMatrix->GetColLwb();
1541 const Int_t sIndex = this->
fMatrix->GetRowIndexArray()[this->
fRowInd];
1542 const Int_t eIndex = this->
fMatrix->GetRowIndexArray()[this->
fRowInd+1];
1543 this->
fNindex = eIndex-sIndex;
1552 template<
class Element>
1555 R__ASSERT(this->
fMatrix->IsValid());
1559 Error(
"operator=(const TVectorT &)",
"vector length != matrix-row length");
1565 const Int_t col = this->
fMatrix->GetColLwb();
1568 const Int_t sIndex = this->
fMatrix->GetRowIndexArray()[this->
fRowInd];
1569 const Int_t eIndex = this->
fMatrix->GetRowIndexArray()[this->
fRowInd+1];
1570 this->
fNindex = eIndex-sIndex;
1578 template<
class Element>
1583 R__ASSERT(this->
fMatrix->IsValid());
1586 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
1590 const Int_t ncols = this->
fMatrix->GetNcols();
1593 const Int_t col = this->
fMatrix->GetColLwb();
1602 const Int_t sIndex = this->
fMatrix->GetRowIndexArray()[this->
fRowInd];
1603 const Int_t eIndex = this->
fMatrix->GetRowIndexArray()[this->
fRowInd+1];
1604 this->
fNindex = eIndex-sIndex;
1613 template<
class Element>
1618 R__ASSERT(this->
fMatrix->IsValid());
1621 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
1625 const Int_t ncols = this->
fMatrix->GetNcols();
1628 const Int_t col = this->
fMatrix->GetColLwb();
1638 const Int_t sIndex = this->
fMatrix->GetRowIndexArray()[this->
fRowInd];
1639 const Int_t eIndex = this->
fMatrix->GetRowIndexArray()[this->
fRowInd+1];
1640 this->
fNindex = eIndex-sIndex;
1648 template<
class Element>
1660 template<
class Element>
1663 R__ASSERT(
fMatrix->IsValid());
1664 if (i < fNdiag && i >= 0) {
1665 const Int_t *
const pR =
fMatrix->GetRowIndexArray();
1666 const Int_t *
const pC =
fMatrix->GetColIndexArray();
1667 const Element *
const pD =
fMatrix->GetMatrixArray();
1668 const Int_t sIndex = pR[i];
1669 const Int_t eIndex = pR[i+1];
1671 if (index >= sIndex && pC[index] == i)
return pD[index];
1674 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,fNdiag);
1683 template<
class Element>
1692 template<
class Element>
1701 template<
class Element>
1704 R__ASSERT(this->
fMatrix->IsValid());
1705 if (i < this->
fNdiag && i >= 0) {
1706 const Int_t *
const pR = this->
fMatrix->GetRowIndexArray();
1707 const Int_t *
const pC = this->
fMatrix->GetColIndexArray();
1708 const Element *
const pD = this->
fMatrix->GetMatrixArray();
1709 const Int_t sIndex = pR[i];
1710 const Int_t eIndex = pR[i+1];
1712 if (index >= sIndex && pC[index] == i)
return pD[index];
1715 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,this->
fNdiag);
1724 template<
class Element>
1727 R__ASSERT(this->
fMatrix->IsValid());
1729 if (i < 0 || i >= this->
fNdiag) {
1730 Error(
"operator()(Int_t",
"Requested element %d outside range : 0 - %d",i,this->
fNdiag);
1731 return (const_cast<Element*>(this->
fDataPtr))[0];
1737 Int_t sIndex = pR[i];
1738 Int_t eIndex = pR[i+1];
1740 if (index >= sIndex && pC[index] == i)
1741 return (const_cast<Element*>(this->
fDataPtr))[index];
1753 if (index >= sIndex && pC[index] == i)
1754 return (const_cast<Element*>(this->
fDataPtr))[index];
1756 Error(
"operator()(Int_t",
"Insert row failed");
1757 return (const_cast<Element*>(this->
fDataPtr))[0];
1765 template<
class Element>
1768 R__ASSERT(this->
fMatrix->IsValid());
1769 for (Int_t i = 0; i < this->
fNdiag; i++)
1776 template<
class Element>
1779 R__ASSERT(this->
fMatrix->IsValid());
1780 for (Int_t i = 0; i < this->
fNdiag; i++)
1787 template<
class Element>
1790 R__ASSERT(this->
fMatrix->IsValid());
1791 for (Int_t i = 0; i < this->
fNdiag; i++)
1798 template<
class Element>
1802 if (this->
fMatrix == mt)
return;
1804 R__ASSERT(this->
fMatrix->IsValid());
1807 Error(
"operator=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1811 for (Int_t i = 0; i < this->
fNdiag; i++)
1818 template<
class Element>
1821 R__ASSERT(this->
fMatrix->IsValid());
1825 Error(
"operator=(const TVectorT &)",
"vector length != matrix-diagonal length");
1830 for (Int_t i = 0; i < this->
fNdiag; i++)
1838 template<
class Element>
1843 R__ASSERT(this->
fMatrix->IsValid());
1846 Error(
"operator+=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1850 for (Int_t i = 0; i < this->
fNdiag; i++)
1851 (*
this)(i) += md(i);
1858 template<
class Element>
1863 R__ASSERT(this->
fMatrix->IsValid());
1866 Error(
"operator*=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1870 for (Int_t i = 0; i < this->
fNdiag; i++)
1871 (*
this)(i) *= md(i);
1879 const Double_t a = 16807.0;
1880 const Double_t b15 = 32768.0;
1881 const Double_t b16 = 65536.0;
1882 const Double_t p = 2147483647.0;
1883 Double_t xhi = ix/b16;
1884 Int_t xhiint = (Int_t) xhi;
1886 Double_t xalo = (ix-xhi*b16)*a;
1888 Double_t leftlo = xalo/b16;
1889 Int_t leftloint = (int) leftlo;
1891 Double_t fhi = xhi*a+leftlo;
1892 Double_t k = fhi/b15;
1893 Int_t kint = (Int_t) k;
1895 ix = (((xalo-leftlo*b16)-p)+(fhi-k*b15)*b16)+k;
1896 if (ix < 0.0) ix = ix+p;
1898 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 Assign(Element val)
Assign val to every element of the matrix row.
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 .
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
void operator=(std::initializer_list< Element > l)
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
Int_t GetRowIndex() const
void operator=(Element val)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t Int_t m
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
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
void Assign(Element val)
Assign val to every element of the matrix column.
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
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.
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)
Binary search in an array of n values to locate value.
const TMatrixTBase< Element > * GetMatrix() const
const TMatrixTBase< Element > * GetMatrix() const
void operator=(Element val)
Assign val to every element of the matrix diagonal.