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);
121 for ( ; rp < this->fPtr+this->fMatrix->GetNcols(); rp += this->fInc)
128 template<
class Element>
132 Element *rp =
const_cast<Element *
>(this->fPtr);
133 for ( ; rp < this->fPtr+this->fMatrix->GetNcols(); rp += this->fInc)
140 template<
class Element>
144 Element *rp =
const_cast<Element *
>(this->fPtr);
145 for ( ; rp < this->fPtr + this->fMatrix->GetNcols(); rp += this->fInc)
152 template<
class Element>
161 if (this->fMatrix->GetNcols() != mt->
GetNcols() || this->fMatrix->GetColLwb() != mt->
GetColLwb()) {
162 Error(
"operator=(const TMatrixTRow_const &)",
"matrix rows not compatible");
166 Element *rp1 =
const_cast<Element *
>(this->fPtr);
167 const Element *rp2 = mr.
GetPtr();
168 for ( ; rp1 < this->fPtr+this->fMatrix->GetNcols(); rp1 += this->fInc,rp2 += mr.
GetInc())
176 template<
class Element>
182 if (this->fMatrix->GetColLwb() != vec.
GetLwb() || this->fMatrix->GetNcols() != vec.
GetNrows()) {
183 Error(
"operator=(const TVectorT &)",
"vector length != matrix-row length");
187 Element *rp =
const_cast<Element *
>(this->fPtr);
189 for ( ; rp < this->fPtr+this->fMatrix->GetNcols(); rp += this->fInc)
196 template<
class Element>
204 if (this->fMatrix->GetColLwb() != mt->
GetColLwb() || this->fMatrix->GetNcols() != mt->
GetNcols()) {
205 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
209 Element *rp1 =
const_cast<Element *
>(this->fPtr);
210 const Element *rp2 = r.
GetPtr();
211 for ( ; rp1 < this->fPtr+this->fMatrix->GetNcols(); rp1 += this->fInc,rp2 += r.
GetInc())
219 template<
class Element>
227 if (this->fMatrix->GetColLwb() != mt->
GetColLwb() || this->fMatrix->GetNcols() != mt->
GetNcols()) {
228 Error(
"operator*=(const TMatrixTRow_const &)",
"different row lengths");
232 Element *rp1 =
const_cast<Element *
>(this->fPtr);
233 const Element *rp2 = r.
GetPtr();
234 for ( ; rp1 < this->fPtr+this->fMatrix->GetNcols(); rp1 += this->fInc,rp2 += r.
GetInc())
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>
357 if (this->fMatrix->GetNrows() != mt->
GetNrows() || this->fMatrix->GetRowLwb() != mt->
GetRowLwb()) {
358 Error(
"operator=(const TMatrixTColumn_const &)",
"matrix columns not compatible");
362 Element *cp1 =
const_cast<Element *
>(this->fPtr);
363 const Element *cp2 = mc.
GetPtr();
364 for ( ; cp1 < this->fPtr+this->fMatrix->GetNoElements(); cp1 += this->fInc,cp2 += mc.
GetInc())
371 template<
class Element>
377 if (this->fMatrix->GetRowLwb() != vec.
GetLwb() || this->fMatrix->GetNrows() != vec.
GetNrows()) {
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>
401 if (this->fMatrix->GetRowLwb() != mt->
GetRowLwb() || this->fMatrix->GetNrows() != mt->
GetNrows()) {
402 Error(
"operator+=(const TMatrixTColumn_const &)",
"different row lengths");
406 Element *cp1 =
const_cast<Element *
>(this->fPtr);
407 const Element *cp2 = mc.
GetPtr();
408 for ( ; cp1 < this->fPtr+this->fMatrix->GetNoElements(); cp1 += this->fInc,cp2 += mc.
GetInc())
416 template<
class Element>
424 if (this->fMatrix->GetRowLwb() != mt->
GetRowLwb() || this->fMatrix->GetNrows() != mt->
GetNrows()) {
425 Error(
"operator*=(const TMatrixTColumn_const &)",
"different row lengths");
429 Element *cp1 =
const_cast<Element *
>(this->fPtr);
430 const Element *cp2 = mc.
GetPtr();
431 for ( ; cp1 < this->fPtr+this->fMatrix->GetNoElements(); cp1 += this->fInc,cp2 += mc.
GetInc())
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);
498 for (
Int_t i = 0; i < this->fNdiag; i++, dp += this->fInc)
505 template<
class Element>
509 Element *dp =
const_cast<Element *
>(this->fPtr);
510 for (
Int_t i = 0; i < this->fNdiag; i++, dp += this->fInc)
517 template<
class Element>
521 Element *dp =
const_cast<Element *
>(this->fPtr);
522 for (
Int_t i = 0; i < this->fNdiag; i++, dp += this->fInc)
529 template<
class Element>
533 if (this->fMatrix == mt)
return;
538 if (this->GetNdiags() != md.
GetNdiags()) {
539 Error(
"operator=(const TMatrixTDiag_const &)",
"diagonals not compatible");
543 Element *dp1 =
const_cast<Element *
>(this->fPtr);
544 const Element *dp2 = md.
GetPtr();
545 for (
Int_t i = 0; i < this->fNdiag; i++, dp1 += this->fInc, dp2 += md.
GetInc())
552 template<
class Element>
558 if (this->fNdiag != vec.
GetNrows()) {
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();
587 for (
Int_t i = 0; i < this->fNdiag; i++, dp1 += this->fInc, dp2 += md.
GetInc())
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();
609 for (
Int_t i = 0; i < this->fNdiag; i++, dp1 += this->fInc, dp2 += md.
GetInc())
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>
709 if (this->fMatrix->GetMatrixArray() == mt->
GetMatrixArray())
return;
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>
732 if (this->fMatrix->GetNoElements() != vec.
GetNrows()) {
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");
940 const Int_t ncols = this->fMatrix->GetNcols();
941 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
942 const Int_t off = (irow+this->fRowOff)*ncols+this->fColOff;
943 const Element tmp = alpha*pv[irow];
944 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
945 mp[off+icol] += tmp*pv[icol];
952 template<
class Element>
958 const Int_t ncols = this->fMatrix->GetNcols();
959 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
960 const Int_t off = (irow+this->fRowOff)*ncols+this->fColOff;
961 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
969 template<
class Element>
975 const Int_t ncols = this->fMatrix->GetNcols();
976 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
977 const Int_t off = (irow+this->fRowOff)*ncols+this->fColOff;
978 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
986 template<
class Element>
992 const Int_t ncols = this->fMatrix->GetNcols();
993 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
994 const Int_t off = (irow+this->fRowOff)*ncols+this->fColOff;
995 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1003 template<
class Element>
1011 if (this->fMatrix == mt &&
1012 (this->GetNrows() == ms.
GetNrows () && this->GetNcols() == ms.
GetNcols () &&
1016 if (this->GetNrows() != ms.
GetNrows() || this->GetNcols() != ms.
GetNcols()) {
1017 Error(
"operator=(const TMatrixTSub_const &)",
"sub matrices have different size");
1024 Bool_t overlap = (this->fMatrix == mt) &&
1025 ( (rowOff2 >= this->fRowOff && rowOff2 < this->fRowOff+this->fNrowsSub) ||
1026 (colOff2 >= this->fColOff && colOff2 < this->fColOff+this->fNcolsSub) );
1028 Element *
p1 =
const_cast<Element *
>(this->fMatrix->GetMatrixArray());
1032 const Int_t ncols1 = this->fMatrix->GetNcols();
1034 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
1035 const Int_t off1 = (irow+this->fRowOff)*ncols1+this->fColOff;
1036 const Int_t off2 = (irow+rowOff2)*ncols2+colOff2;
1037 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1038 p1[off1+icol] = p2[off2+icol];
1042 const Int_t row_upbs = row_lwbs+this->fNrowsSub-1;
1044 const Int_t col_upbs = col_lwbs+this->fNcolsSub-1;
1048 const Int_t ncols1 = this->fMatrix->GetNcols();
1050 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
1051 const Int_t off1 = (irow+this->fRowOff)*ncols1+this->fColOff;
1052 const Int_t off2 = irow*ncols2;
1053 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1054 p1[off1+icol] = p2[off2+icol];
1062 template<
class Element>
1068 if (this->fMatrix->GetMatrixArray() == m.
GetMatrixArray())
return;
1071 Error(
"operator=(const TMatrixTBase<Element> &)",
"sub matrices and matrix have different size");
1074 const Int_t row_lwbs = this->fRowOff+this->fMatrix->GetRowLwb();
1075 const Int_t col_lwbs = this->fColOff+this->fMatrix->GetColLwb();
1082 template<
class Element>
1090 if (this->GetNrows() != ms.
GetNrows() || this->GetNcols() != ms.
GetNcols()) {
1091 Error(
"operator+=(const TMatrixTSub_const &)",
"sub matrices have different size");
1098 Bool_t overlap = (this->fMatrix == mt) &&
1099 ( (rowOff2 >= this->fRowOff && rowOff2 < this->fRowOff+this->fNrowsSub) ||
1100 (colOff2 >= this->fColOff && colOff2 < this->fColOff+this->fNcolsSub) );
1102 Element *
p1 =
const_cast<Element *
>(this->fMatrix->GetMatrixArray());
1106 const Int_t ncols1 = this->fMatrix->GetNcols();
1108 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
1109 const Int_t off1 = (irow+this->fRowOff)*ncols1+this->fColOff;
1110 const Int_t off2 = (irow+rowOff2)*ncols2+colOff2;
1111 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1112 p1[off1+icol] += p2[off2+icol];
1116 const Int_t row_upbs = row_lwbs+this->fNrowsSub-1;
1118 const Int_t col_upbs = col_lwbs+this->fNcolsSub-1;
1122 const Int_t ncols1 = this->fMatrix->GetNcols();
1124 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
1125 const Int_t off1 = (irow+this->fRowOff)*ncols1+this->fColOff;
1126 const Int_t off2 = irow*ncols2;
1127 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1128 p1[off1+icol] += p2[off2+icol];
1136 template<
class Element>
1139 if (this->fNcolsSub != ms.
GetNrows() || this->fNcolsSub != ms.
GetNcols()) {
1140 Error(
"operator*=(const TMatrixTSub_const &)",
"source sub matrix has wrong shape");
1149 const Int_t row_upbs = row_lwbs+this->fNrowsSub-1;
1151 const Int_t col_upbs = col_lwbs+this->fNcolsSub-1;
1152 source->
GetSub(row_lwbs,row_upbs,col_lwbs,col_upbs,source_sub);
1156 const Int_t ncols = this->fMatrix->GetNcols();
1159 Element work[kWorkMax];
1161 Element *trp = work;
1162 if (this->fNcolsSub > kWorkMax) {
1163 isAllocated =
kTRUE;
1164 trp =
new Element[this->fNcolsSub];
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; ) {
1175 for (
Int_t j = 0; j < this->fNcolsSub; j++) {
1176 cij += trp[j] * *scp;
1177 scp += this->fNcolsSub;
1182 cp += ncols-this->fNcolsSub;
1187 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1195 template<
class Element>
1201 if (this->GetNrows() != mt.
GetNrows() || this->GetNcols() != mt.
GetNcols()) {
1202 Error(
"operator+=(const TMatrixTBase<Element> &)",
"sub matrix and matrix have different size");
1206 Element *
p1 =
const_cast<Element *
>(this->fMatrix->GetMatrixArray());
1209 const Int_t ncols1 = this->fMatrix->GetNcols();
1211 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
1212 const Int_t off1 = (irow+this->fRowOff)*ncols1+this->fColOff;
1213 const Int_t off2 = irow*ncols2;
1214 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1215 p1[off1+icol] += p2[off2+icol];
1222 template<
class Element>
1225 if (this->fNcolsSub != source.
GetNrows() || this->fNcolsSub != source.
GetNcols()) {
1226 Error(
"operator*=(const TMatrixT<Element> &)",
"source matrix has wrong shape");
1233 if (this->fMatrix->GetMatrixArray() == source.
GetMatrixArray()) {
1241 const Int_t ncols = this->fMatrix->GetNcols();
1244 Element work[kWorkMax];
1246 Element *trp = work;
1247 if (this->fNcolsSub > kWorkMax) {
1248 isAllocated =
kTRUE;
1249 trp =
new Element[this->fNcolsSub];
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; ) {
1260 for (
Int_t j = 0; j < this->fNcolsSub; j++) {
1261 cij += trp[j] * *scp;
1262 scp += this->fNcolsSub;
1267 cp += ncols-this->fNcolsSub;
1272 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1280 template<
class Element>
1283 if (this->fNcolsSub != source.
GetNrows() || this->fNcolsSub != source.
GetNcols()) {
1284 Error(
"operator*=(const TMatrixTSym<Element> &)",
"source matrix has wrong shape");
1291 if (this->fMatrix->GetMatrixArray() == source.
GetMatrixArray()) {
1299 const Int_t ncols = this->fMatrix->GetNcols();
1302 Element work[kWorkMax];
1304 Element *trp = work;
1305 if (this->fNcolsSub > kWorkMax) {
1306 isAllocated =
kTRUE;
1307 trp =
new Element[this->fNcolsSub];
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; ) {
1318 for (
Int_t j = 0; j < this->fNcolsSub; j++) {
1319 cij += trp[j] * *scp;
1320 scp += this->fNcolsSub;
1325 cp += ncols-this->fNcolsSub;
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>
1368 const Int_t acoln = i-fMatrix->GetColLwb();
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",
1375 i,fMatrix->GetColLwb(),fMatrix->GetColLwb()+fMatrix->GetNcols());
1383 template<
class Element>
1392 template<
class Element>
1401 template<
class Element>
1406 const Int_t acoln = i-this->fMatrix->GetColLwb();
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",
1413 i,this->fMatrix->GetColLwb(),this->fMatrix->GetColLwb()+this->fMatrix->GetNcols());
1421 template<
class Element>
1427 const Int_t acoln = i-this->fMatrix->GetColLwb();
1428 if (acoln >= this->fMatrix->GetNcols() || acoln < 0) {
1429 Error(
"operator()(Int_t",
"Requested element %d outside range : %d - %d",i,
1430 this->fMatrix->GetColLwb(),this->fMatrix->GetColLwb()+this->fMatrix->GetNcols());
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);
1465 for ( ; rp < this->fDataPtr+this->fNindex; rp++)
1472 template<
class Element>
1476 Element *rp =
const_cast<Element *
>(this->fDataPtr);
1477 for ( ; rp < this->fDataPtr+this->fNindex; rp++)
1484 template<
class Element>
1488 Element *rp =
const_cast<Element *
>(this->fDataPtr);
1489 for ( ; rp < this->fDataPtr+this->fNindex; rp++)
1496 template<
class Element>
1500 if (this->fMatrix == mt)
return;
1504 if (this->fMatrix->GetColLwb() != mt->
GetColLwb() || this->fMatrix->GetNcols() != mt->
GetNcols()) {
1505 Error(
"operator=(const TMatrixTSparseRow_const &)",
"matrix rows not compatible");
1509 const Int_t ncols = this->fMatrix->GetNcols();
1510 const Int_t row1 = this->fRowInd+this->fMatrix->GetRowLwb();
1512 const Int_t col = this->fMatrix->GetColLwb();
1519 const Int_t eIndex = this->fMatrix->GetRowIndexArray()[this->fRowInd+1];
1520 this->fNindex = eIndex-sIndex;
1522 this->fDataPtr = this->fMatrix->GetMatrixArray()+sIndex;
1529 template<
class Element>
1535 if (this->fMatrix->GetColLwb() != vec.
GetLwb() || this->fMatrix->GetNcols() != vec.
GetNrows()) {
1536 Error(
"operator=(const TVectorT &)",
"vector length != matrix-row length");
1541 const Int_t row = this->fRowInd+this->fMatrix->GetRowLwb();
1542 const Int_t col = this->fMatrix->GetColLwb();
1546 const Int_t eIndex = this->fMatrix->GetRowIndexArray()[this->fRowInd+1];
1547 this->fNindex = eIndex-sIndex;
1549 this->fDataPtr = this->fMatrix->GetMatrixArray()+sIndex;
1555 template<
class Element>
1562 if (this->fMatrix->GetColLwb() != mt->
GetColLwb() || this->fMatrix->GetNcols() != mt->
GetNcols()) {
1563 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
1567 const Int_t ncols = this->fMatrix->GetNcols();
1568 const Int_t row1 = this->fRowInd+this->fMatrix->GetRowLwb();
1570 const Int_t col = this->fMatrix->GetColLwb();
1580 const Int_t eIndex = this->fMatrix->GetRowIndexArray()[this->fRowInd+1];
1581 this->fNindex = eIndex-sIndex;
1583 this->fDataPtr = this->fMatrix->GetMatrixArray()+sIndex;
1590 template<
class Element>
1597 if (this->fMatrix->GetColLwb() != mt->
GetColLwb() || this->fMatrix->GetNcols() != mt->
GetNcols()) {
1598 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
1602 const Int_t ncols = this->fMatrix->GetNcols();
1605 const Int_t col = this->fMatrix->GetColLwb();
1616 const Int_t eIndex = this->fMatrix->GetRowIndexArray()[this->fRowInd+1];
1617 this->fNindex = eIndex-sIndex;
1619 this->fDataPtr = this->fMatrix->GetMatrixArray()+sIndex;
1625 template<
class Element>
1637 template<
class Element>
1641 if (i < fNdiag && i >= 0) {
1642 const Int_t *
const pR = fMatrix->GetRowIndexArray();
1643 const Int_t *
const pC = fMatrix->GetColIndexArray();
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>
1746 for (
Int_t i = 0; i < this->fNdiag; i++)
1753 template<
class Element>
1757 for (
Int_t i = 0; i < this->fNdiag; i++)
1764 template<
class Element>
1768 for (
Int_t i = 0; i < this->fNdiag; i++)
1775 template<
class Element>
1779 if (this->fMatrix == mt)
return;
1784 Error(
"operator=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1788 for (
Int_t i = 0; i < this->fNdiag; i++)
1795 template<
class Element>
1801 if (this->fNdiag != vec.
GetNrows()) {
1802 Error(
"operator=(const TVectorT &)",
"vector length != matrix-diagonal length");
1807 for (
Int_t i = 0; i < this->fNdiag; i++)
1815 template<
class Element>
1823 Error(
"operator+=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1827 for (
Int_t i = 0; i < this->fNdiag; i++)
1828 (*
this)(i) += md(i);
1835 template<
class Element>
1843 Error(
"operator*=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1847 for (
Int_t i = 0; i < this->fNdiag; i++)
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
virtual const Element * GetMatrixArray() const =0
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.
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.
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...
Int_t GetRowIndex() const
void operator+=(Element val)
Add val to every element of the matrix column.
virtual const Element * GetMatrixArray() const
void operator*=(Element val)
Multiply every element of the matrix with val.
TMatrixTSparseDiag_const()
void operator+=(Element val)
Assign val to every element of the matrix diagonal.
void operator*=(Element val)
Multiply every element of the sub matrix by val .
Int_t GetNoElements() const
const TMatrixTBase< Element > * GetMatrix() const
Short_t Min(Short_t a, Short_t b)
void operator=(Element val)
Assign val to every element of the matrix diagonal.
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 TMatrixTBase< Element > * GetMatrix() const
TMatrixTSparseRow_const()
Element operator()(Int_t i) const
Element operator()(Int_t i) const
void operator*=(Element val)
Multiply every element of the matrix diagonal by val.
static double p2(double t, double a, double b, double c)
const TMatrixTBase< Element > * GetMatrix() const
void Error(const char *location, const char *msgfmt,...)
virtual const Element * GetMatrixArray() const
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 const Int_t * GetRowIndexArray() const
const TMatrixTBase< Element > * GetMatrix() const
TMatrixT< Element > & ElementMult(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Multiply target by the source, element-by-element.
Int_t GetColIndex() const
virtual const Element * GetMatrixArray() const
static double p1(double t, double a, double b)
const TMatrixTBase< Element > * GetMatrix() const
Int_t GetRowIndex() const
void operator+=(Element val)
Add val to every element of the sub matrix.
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.
const Element * GetPtr() const
void operator+=(Element val)
Add val to every element of the matrix diagonal.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
const Element * GetPtr() const
void operator=(Element val)
Assign val to every element of the matrix row.
virtual const Int_t * GetColIndexArray() const
void operator*=(Element val)
Multiply every element of the matrix row by val.
Int_t GetNoElements() const
const Element * GetPtr() const
const TMatrixTBase< Element > * GetMatrix() const
const Element * GetPtr() const
void operator*=(Element val)
Multiply every element of the matrix column with val.
Short_t Max(Short_t a, Short_t b)
Element operator()(Int_t i) const
static Element & NaNValue()
void operator=(Element val)
Assign val to every non-zero (!) element of the matrix row.
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
Double_t Drand(Double_t &ix)
Random number generator [0....1] with seed ix.
void operator+=(Element val)
Add val to every element of the matrix row.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
void operator=(Element val)
Assign val to every element of the matrix diagonal.