45template<
class Element>
51 if (fRowInd >= matrix.
GetNrows() || fRowInd < 0) {
52 Error(
"TMatrixTRow_const(const TMatrixT<Element> &,Int_t)",
"row index out of bounds");
67template<
class Element>
73 if (fRowInd >= matrix.
GetNrows() || fRowInd < 0) {
74 Error(
"TMatrixTRow_const(const TMatrixTSym &,Int_t)",
"row index out of bounds");
89template<
class Element>
98template<
class Element>
107template<
class Element>
116template<
class Element>
120 Element *rp =
const_cast<Element *
>(this->fPtr);
121 for ( ; rp < this->fPtr+this->fMatrix->GetNcols(); rp += this->fInc)
125template<
class Element>
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)
138template<
class Element>
142 Element *rp =
const_cast<Element *
>(this->fPtr);
143 for ( ; rp < this->fPtr+this->fMatrix->GetNcols(); rp += this->fInc)
150template<
class Element>
154 Element *rp =
const_cast<Element *
>(this->fPtr);
155 for ( ; rp < this->fPtr + this->fMatrix->GetNcols(); rp += this->fInc)
162template<
class Element>
171 if (this->fMatrix->GetNcols() != mt->
GetNcols() || this->fMatrix->GetColLwb() != mt->
GetColLwb()) {
172 Error(
"operator=(const TMatrixTRow_const &)",
"matrix rows not compatible");
176 Element *rp1 =
const_cast<Element *
>(this->fPtr);
177 const Element *rp2 = mr.
GetPtr();
178 for ( ; rp1 < this->fPtr+this->fMatrix->GetNcols(); rp1 += this->fInc,rp2 += mr.
GetInc())
186template<
class Element>
192 if (this->fMatrix->GetColLwb() !=
vec.GetLwb() || this->fMatrix->GetNcols() !=
vec.GetNrows()) {
193 Error(
"operator=(const TVectorT &)",
"vector length != matrix-row length");
197 Element *rp =
const_cast<Element *
>(this->fPtr);
198 const Element *vp =
vec.GetMatrixArray();
199 for ( ; rp < this->fPtr+this->fMatrix->GetNcols(); rp += this->fInc)
206template<
class Element>
214 if (this->fMatrix->GetColLwb() != mt->
GetColLwb() || this->fMatrix->GetNcols() != mt->
GetNcols()) {
215 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
219 Element *rp1 =
const_cast<Element *
>(this->fPtr);
220 const Element *rp2 =
r.GetPtr();
221 for ( ; rp1 < this->fPtr+this->fMatrix->GetNcols(); rp1 += this->fInc,rp2 +=
r.GetInc())
229template<
class Element>
237 if (this->fMatrix->GetColLwb() != mt->
GetColLwb() || this->fMatrix->GetNcols() != mt->
GetNcols()) {
238 Error(
"operator*=(const TMatrixTRow_const &)",
"different row lengths");
242 Element *rp1 =
const_cast<Element *
>(this->fPtr);
243 const Element *rp2 =
r.GetPtr();
244 for ( ; rp1 < this->fPtr+this->fMatrix->GetNcols(); rp1 += this->fInc,rp2 +=
r.GetInc())
251template<
class Element>
257 if (this->fColInd >= matrix.
GetNcols() || this->fColInd < 0) {
258 Error(
"TMatrixTColumn_const(const TMatrixT &,Int_t)",
"column index out of bounds");
273template<
class Element>
279 if (fColInd >= matrix.
GetNcols() || fColInd < 0) {
280 Error(
"TMatrixTColumn_const(const TMatrixTSym &,Int_t)",
"column index out of bounds");
295template<
class Element>
304template<
class Element>
313template<
class Element>
322template<
class Element>
326 Element *cp =
const_cast<Element *
>(this->fPtr);
327 for ( ; cp < this->fPtr+this->fMatrix->GetNoElements(); cp += this->fInc)
334template<
class Element>
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)
347template<
class Element>
351 Element *cp =
const_cast<Element *
>(this->fPtr);
352 for ( ; cp < this->fPtr+this->fMatrix->GetNoElements(); cp += this->fInc)
359template<
class Element>
363 Element *cp =
const_cast<Element *
>(this->fPtr);
364 for ( ; cp < this->fPtr+this->fMatrix->GetNoElements(); cp += this->fInc)
371template<
class Element>
380 if (this->fMatrix->GetNrows() != mt->
GetNrows() || this->fMatrix->GetRowLwb() != mt->
GetRowLwb()) {
381 Error(
"operator=(const TMatrixTColumn_const &)",
"matrix columns not compatible");
385 Element *cp1 =
const_cast<Element *
>(this->fPtr);
386 const Element *cp2 = mc.
GetPtr();
387 for ( ; cp1 < this->fPtr+this->fMatrix->GetNoElements(); cp1 += this->fInc,cp2 += mc.
GetInc())
394template<
class Element>
400 if (this->fMatrix->GetRowLwb() !=
vec.GetLwb() || this->fMatrix->GetNrows() !=
vec.GetNrows()) {
401 Error(
"operator=(const TVectorT &)",
"vector length != matrix-column length");
405 Element *cp =
const_cast<Element *
>(this->fPtr);
406 const Element *vp =
vec.GetMatrixArray();
407 for ( ; cp < this->fPtr+this->fMatrix->GetNoElements(); cp += this->fInc)
416template<
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())
439template<
class Element>
447 if (this->fMatrix->GetRowLwb() != mt->
GetRowLwb() || this->fMatrix->GetNrows() != mt->
GetNrows()) {
448 Error(
"operator*=(const TMatrixTColumn_const &)",
"different row lengths");
452 Element *cp1 =
const_cast<Element *
>(this->fPtr);
453 const Element *cp2 = mc.
GetPtr();
454 for ( ; cp1 < this->fPtr+this->fMatrix->GetNoElements(); cp1 += this->fInc,cp2 += mc.
GetInc())
461template<
class Element>
475template<
class Element>
489template<
class Element>
498template<
class Element>
507template<
class Element>
516template<
class Element>
520 Element *dp =
const_cast<Element *
>(this->fPtr);
521 for (
Int_t i = 0; i < this->fNdiag; i++, dp += this->fInc)
528template<
class Element>
532 Element *dp =
const_cast<Element *
>(this->fPtr);
533 for (
Int_t i = 0; i < this->fNdiag; i++, dp += this->fInc)
540template<
class Element>
544 Element *dp =
const_cast<Element *
>(this->fPtr);
545 for (
Int_t i = 0; i < this->fNdiag; i++, dp += this->fInc)
552template<
class Element>
556 if (this->fMatrix == mt)
return;
561 if (this->GetNdiags() != md.
GetNdiags()) {
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())
575template<
class Element>
581 if (this->fNdiag !=
vec.GetNrows()) {
582 Error(
"operator=(const TVectorT &)",
"vector length != matrix-diagonal length");
586 Element *dp =
const_cast<Element *
>(this->fPtr);
587 const Element *vp =
vec.GetMatrixArray();
588 for ( ; vp <
vec.GetMatrixArray()+
vec.GetNrows(); dp += this->fInc)
596template<
class Element>
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())
618template<
class Element>
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())
639template<
class Element>
652template<
class Element>
665template<
class Element>
674template<
class Element>
683template<
class Element>
692template<
class Element>
696 Element *fp =
const_cast<Element *
>(this->fPtr);
697 while (fp < this->fPtr+this->fMatrix->GetNoElements())
704template<
class Element>
708 Element *fp =
const_cast<Element *
>(this->fPtr);
709 while (fp < this->fPtr+this->fMatrix->GetNoElements())
716template<
class Element>
720 Element *fp =
const_cast<Element *
>(this->fPtr);
721 while (fp < this->fPtr+this->fMatrix->GetNoElements())
728template<
class Element>
732 if (this->fMatrix->GetMatrixArray() == mt->
GetMatrixArray())
return;
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())
750template<
class Element>
755 if (this->fMatrix->GetNoElements() !=
vec.GetNrows()) {
756 Error(
"operator=(const TVectorT &)",
"vector length != # matrix-elements");
760 Element *fp =
const_cast<Element *
>(this->fPtr);
761 const Element *vp =
vec.GetMatrixArray();
762 while (fp < this->fPtr+this->fMatrix->GetNoElements())
769template<
class Element>
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())
790template<
class Element>
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())
813template<
class Element>
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;
867template<
class Element>
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;
919template<
class Element>
929template<
class Element>
939template<
class Element>
949template<
class Element>
955 if (
v.GetNoElements() <
TMath::Max(this->fNrowsSub,this->fNcolsSub)) {
956 Error(
"Rank1Update",
"vector too short");
960 const Element *
const pv =
v.GetMatrixArray();
963 const Int_t ncols = this->fMatrix->GetNcols();
964 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
965 const Int_t off = (irow+this->fRowOff)*ncols+this->fColOff;
966 const Element tmp = alpha*pv[irow];
967 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
968 mp[off+icol] += tmp*pv[icol];
975template<
class Element>
981 const Int_t ncols = this->fMatrix->GetNcols();
982 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
983 const Int_t off = (irow+this->fRowOff)*ncols+this->fColOff;
984 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
992template<
class Element>
998 const Int_t ncols = this->fMatrix->GetNcols();
999 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
1000 const Int_t off = (irow+this->fRowOff)*ncols+this->fColOff;
1001 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1009template<
class Element>
1015 const Int_t ncols = this->fMatrix->GetNcols();
1016 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
1017 const Int_t off = (irow+this->fRowOff)*ncols+this->fColOff;
1018 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1026template<
class Element>
1034 if (this->fMatrix == mt &&
1035 (this->GetNrows() == ms.
GetNrows () && this->GetNcols() == ms.
GetNcols () &&
1039 if (this->GetNrows() != ms.
GetNrows() || this->GetNcols() != ms.
GetNcols()) {
1040 Error(
"operator=(const TMatrixTSub_const &)",
"sub matrices have different size");
1047 Bool_t overlap = (this->fMatrix == mt) &&
1048 ( (rowOff2 >= this->fRowOff && rowOff2 < this->fRowOff+this->fNrowsSub) ||
1049 (colOff2 >= this->fColOff && colOff2 < this->fColOff+this->fNcolsSub) );
1051 Element *p1 =
const_cast<Element *
>(this->fMatrix->GetMatrixArray());
1055 const Int_t ncols1 = this->fMatrix->GetNcols();
1057 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
1058 const Int_t off1 = (irow+this->fRowOff)*ncols1+this->fColOff;
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];
1065 const Int_t row_upbs = row_lwbs+this->fNrowsSub-1;
1067 const Int_t col_upbs = col_lwbs+this->fNcolsSub-1;
1069 const Element *p2 = tmp.GetMatrixArray();
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++) {
1074 const Int_t off1 = (irow+this->fRowOff)*ncols1+this->fColOff;
1075 const Int_t off2 = irow*ncols2;
1076 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1077 p1[off1+icol] = p2[off2+icol];
1085template<
class Element>
1091 if (this->fMatrix->GetMatrixArray() ==
m.GetMatrixArray())
return;
1093 if (this->fNrowsSub !=
m.GetNrows() || this->fNcolsSub !=
m.GetNcols()) {
1094 Error(
"operator=(const TMatrixTBase<Element> &)",
"sub matrices and matrix have different size");
1097 const Int_t row_lwbs = this->fRowOff+this->fMatrix->GetRowLwb();
1098 const Int_t col_lwbs = this->fColOff+this->fMatrix->GetColLwb();
1105template<
class Element>
1113 if (this->GetNrows() != ms.
GetNrows() || this->GetNcols() != ms.
GetNcols()) {
1114 Error(
"operator+=(const TMatrixTSub_const &)",
"sub matrices have different size");
1121 Bool_t overlap = (this->fMatrix == mt) &&
1122 ( (rowOff2 >= this->fRowOff && rowOff2 < this->fRowOff+this->fNrowsSub) ||
1123 (colOff2 >= this->fColOff && colOff2 < this->fColOff+this->fNcolsSub) );
1125 Element *p1 =
const_cast<Element *
>(this->fMatrix->GetMatrixArray());
1129 const Int_t ncols1 = this->fMatrix->GetNcols();
1131 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
1132 const Int_t off1 = (irow+this->fRowOff)*ncols1+this->fColOff;
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];
1139 const Int_t row_upbs = row_lwbs+this->fNrowsSub-1;
1141 const Int_t col_upbs = col_lwbs+this->fNcolsSub-1;
1143 const Element *p2 = tmp.GetMatrixArray();
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++) {
1148 const Int_t off1 = (irow+this->fRowOff)*ncols1+this->fColOff;
1149 const Int_t off2 = irow*ncols2;
1150 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1151 p1[off1+icol] += p2[off2+icol];
1159template<
class Element>
1162 if (this->fNcolsSub != ms.
GetNrows() || this->fNcolsSub != ms.
GetNcols()) {
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();
1182 Element work[kWorkMax];
1184 Element *trp = work;
1185 if (this->fNcolsSub > kWorkMax) {
1186 isAllocated =
kTRUE;
1187 trp =
new Element[this->fNcolsSub];
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;
1200 scp += this->fNcolsSub;
1205 cp += ncols-this->fNcolsSub;
1210 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1218template<
class Element>
1224 if (this->GetNrows() != mt.
GetNrows() || this->GetNcols() != mt.
GetNcols()) {
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();
1234 for (
Int_t irow = 0; irow < this->fNrowsSub; irow++) {
1235 const Int_t off1 = (irow+this->fRowOff)*ncols1+this->fColOff;
1236 const Int_t off2 = irow*ncols2;
1237 for (
Int_t icol = 0; icol < this->fNcolsSub; icol++)
1238 p1[off1+icol] += p2[off2+icol];
1245template<
class Element>
1248 if (this->fNcolsSub != source.
GetNrows() || this->fNcolsSub != source.
GetNcols()) {
1249 Error(
"operator*=(const TMatrixT<Element> &)",
"source matrix has wrong shape");
1256 if (this->fMatrix->GetMatrixArray() == source.
GetMatrixArray()) {
1257 tmp.ResizeTo(source);
1259 sp = tmp.GetMatrixArray();
1264 const Int_t ncols = this->fMatrix->GetNcols();
1267 Element work[kWorkMax];
1269 Element *trp = work;
1270 if (this->fNcolsSub > kWorkMax) {
1271 isAllocated =
kTRUE;
1272 trp =
new Element[this->fNcolsSub];
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;
1285 scp += this->fNcolsSub;
1290 cp += ncols-this->fNcolsSub;
1295 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1303template<
class Element>
1306 if (this->fNcolsSub != source.
GetNrows() || this->fNcolsSub != source.
GetNcols()) {
1307 Error(
"operator*=(const TMatrixTSym<Element> &)",
"source matrix has wrong shape");
1314 if (this->fMatrix->GetMatrixArray() == source.
GetMatrixArray()) {
1315 tmp.ResizeTo(source);
1317 sp = tmp.GetMatrixArray();
1322 const Int_t ncols = this->fMatrix->GetNcols();
1325 Element work[kWorkMax];
1327 Element *trp = work;
1328 if (this->fNcolsSub > kWorkMax) {
1329 isAllocated =
kTRUE;
1330 trp =
new Element[this->fNcolsSub];
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;
1343 scp += this->fNcolsSub;
1348 cp += ncols-this->fNcolsSub;
1353 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
1361template<
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;
1386template<
class Element>
1391 const Int_t acoln = i-fMatrix->GetColLwb();
1392 if (acoln < fMatrix->GetNcols() && acoln >= 0) {
1397 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
1398 i,fMatrix->GetColLwb(),fMatrix->GetColLwb()+fMatrix->GetNcols());
1406template<
class Element>
1415template<
class Element>
1424template<
class Element>
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",
1436 i,this->fMatrix->GetColLwb(),this->fMatrix->GetColLwb()+this->fMatrix->GetNcols());
1444template<
class Element>
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,
1453 this->fMatrix->GetColLwb(),this->fMatrix->GetColLwb()+this->fMatrix->GetNcols());
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");
1483template<
class Element>
1487 Element *rp =
const_cast<Element *
>(this->fDataPtr);
1488 for ( ; rp < this->fDataPtr+this->fNindex; rp++)
1495template<
class Element>
1499 Element *rp =
const_cast<Element *
>(this->fDataPtr);
1500 for ( ; rp < this->fDataPtr+this->fNindex; rp++)
1507template<
class Element>
1511 Element *rp =
const_cast<Element *
>(this->fDataPtr);
1512 for ( ; rp < this->fDataPtr+this->fNindex; rp++)
1519template<
class Element>
1523 if (this->fMatrix == mt)
return;
1527 if (this->fMatrix->GetColLwb() != mt->
GetColLwb() || this->fMatrix->GetNcols() != mt->
GetNcols()) {
1528 Error(
"operator=(const TMatrixTSparseRow_const &)",
"matrix rows not compatible");
1532 const Int_t ncols = this->fMatrix->GetNcols();
1533 const Int_t row1 = this->fRowInd+this->fMatrix->GetRowLwb();
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;
1552template<
class Element>
1558 if (this->fMatrix->GetColLwb() !=
vec.GetLwb() || this->fMatrix->GetNcols() !=
vec.GetNrows()) {
1559 Error(
"operator=(const TVectorT &)",
"vector length != matrix-row length");
1563 const Element *vp =
vec.GetMatrixArray();
1564 const Int_t row = this->fRowInd+this->fMatrix->GetRowLwb();
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;
1578template<
class Element>
1585 if (this->fMatrix->GetColLwb() != mt->
GetColLwb() || this->fMatrix->GetNcols() != mt->
GetNcols()) {
1586 Error(
"operator+=(const TMatrixTRow_const &)",
"different row lengths");
1590 const Int_t ncols = this->fMatrix->GetNcols();
1591 const Int_t row1 = this->fRowInd+this->fMatrix->GetRowLwb();
1593 const Int_t col = this->fMatrix->GetColLwb();
1597 this->fMatrix->ExtractRow(row1,col,
v1.GetMatrixArray());
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;
1613template<
class Element>
1620 if (this->fMatrix->GetColLwb() != mt->
GetColLwb() || this->fMatrix->GetNcols() != mt->
GetNcols()) {
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();
1632 this->fMatrix->ExtractRow(row1,col,
v1.GetMatrixArray());
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;
1648template<
class Element>
1660template<
class Element>
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];
1674 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,fNdiag);
1683template<
class Element>
1692template<
class Element>
1701template<
class Element>
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];
1715 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,this->fNdiag);
1724template<
class Element>
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];
1741 return (
const_cast<Element*
>(this->fDataPtr))[
index];
1754 return (
const_cast<Element*
>(this->fDataPtr))[
index];
1756 Error(
"operator()(Int_t",
"Insert row failed");
1757 return (
const_cast<Element*
>(this->fDataPtr))[0];
1765template<
class Element>
1769 for (
Int_t i = 0; i < this->fNdiag; i++)
1776template<
class Element>
1780 for (
Int_t i = 0; i < this->fNdiag; i++)
1787template<
class Element>
1791 for (
Int_t i = 0; i < this->fNdiag; i++)
1798template<
class Element>
1802 if (this->fMatrix == mt)
return;
1807 Error(
"operator=(const TMatrixTSparseDiag_const &)",
"matrix-diagonal's different length");
1811 for (
Int_t i = 0; i < this->fNdiag; i++)
1818template<
class Element>
1824 if (this->fNdiag !=
vec.GetNrows()) {
1825 Error(
"operator=(const TVectorT &)",
"vector length != matrix-diagonal length");
1829 const Element *vp =
vec.GetMatrixArray();
1830 for (
Int_t i = 0; i < this->fNdiag; i++)
1838template<
class Element>
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);
1858template<
class Element>
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);
1895 ix = (((xalo-leftlo*b16)-
p)+(fhi-k*b15)*b16)+k;
1896 if (ix < 0.0) ix = ix+
p;
1898 return (ix*4.656612875e-10);
1901template class TMatrixTRow_const <Float_t>;
1902template class TMatrixTColumn_const <Float_t>;
1903template class TMatrixTDiag_const <Float_t>;
1904template class TMatrixTFlat_const <Float_t>;
1905template class TMatrixTSub_const <Float_t>;
1906template class TMatrixTSparseRow_const <Float_t>;
1908template class TMatrixTRow <Float_t>;
1909template class TMatrixTColumn <Float_t>;
1910template class TMatrixTDiag <Float_t>;
1911template class TMatrixTFlat <Float_t>;
1912template class TMatrixTSub <Float_t>;
1913template class TMatrixTSparseRow <Float_t>;
1914template class TMatrixTSparseDiag <Float_t>;
1915template class TElementActionT <Float_t>;
1916template class TElementPosActionT <Float_t>;
1918template class TMatrixTRow_const <Double_t>;
1919template class TMatrixTColumn_const <Double_t>;
1920template class TMatrixTDiag_const <Double_t>;
1921template class TMatrixTFlat_const <Double_t>;
1922template class TMatrixTSub_const <Double_t>;
1923template class TMatrixTSparseRow_const <Double_t>;
1925template class TMatrixTRow <Double_t>;
1926template class TMatrixTColumn <Double_t>;
1927template class TMatrixTDiag <Double_t>;
1928template class TMatrixTFlat <Double_t>;
1929template class TMatrixTSub <Double_t>;
1930template class TMatrixTSparseRow <Double_t>;
1931template class TMatrixTSparseDiag <Double_t>;
1932template class TElementActionT <Double_t>;
1933template class TElementPosActionT <Double_t>;
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Double_t Drand(Double_t &ix)
Random number generator [0....1] with seed ix.
virtual const Element * GetMatrixArray() const =0
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
Int_t GetNoElements() const
static Element & NaNValue()
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.
Int_t GetColIndex() const
const TMatrixTBase< Element > * GetMatrix() const
const Element * GetPtr() const
void operator+=(Element val)
Add val to every element of the matrix column.
void operator=(Element val)
void Assign(Element val)
Assign val to every element of the matrix column.
void operator*=(Element val)
Multiply every element of the matrix column with val.
const Element * GetPtr() const
const TMatrixTBase< Element > * GetMatrix() const
void operator+=(Element val)
Assign val to every element of the matrix diagonal.
void operator=(Element val)
Assign val to every element of the matrix diagonal.
void operator*=(Element val)
Assign val to every element of the matrix diagonal.
const TMatrixTBase< Element > * GetMatrix() const
const Element * GetPtr() const
void operator+=(Element val)
Add val to every element of the matrix.
void operator*=(Element val)
Multiply every element of the matrix with val.
void operator=(Element val)
Assign val to every element of the matrix.
const Element * GetPtr() const
Int_t GetRowIndex() const
const TMatrixTBase< Element > * GetMatrix() const
void Assign(Element val)
Assign val to every element of the matrix row.
void operator*=(Element val)
Multiply every element of the matrix row with val.
void operator+=(Element val)
Add val to every element of the matrix row.
void operator=(std::initializer_list< Element > l)
TMatrixTSparseDiag_const()
Element operator()(Int_t i) const
const TMatrixTBase< Element > * GetMatrix() const
Element operator()(Int_t i) const
void operator=(Element val)
Assign val to every element of the matrix diagonal.
void operator*=(Element val)
Multiply every element of the matrix diagonal by val.
void operator+=(Element val)
Add val to every element of the matrix diagonal.
TMatrixTSparseRow_const()
Int_t GetRowIndex() const
Element operator()(Int_t i) const
const TMatrixTBase< Element > * GetMatrix() const
void operator+=(Element val)
Add val to every non-zero (!) element of the matrix row.
void operator=(Element val)
Assign val to every non-zero (!) element of the matrix row.
void operator*=(Element val)
Multiply every element of the matrix row by val.
Element operator()(Int_t i) const
TMatrixTBase< Element > & InsertRow(Int_t row, Int_t col, const Element *v, Int_t n=-1) override
Insert in row rown, n elements of array v at column coln.
const Int_t * GetRowIndexArray() const override
const Int_t * GetColIndexArray() const override
const Element * GetMatrixArray() const override
const TMatrixTBase< Element > * GetMatrix() const
void Rank1Update(const TVectorT< Element > &vec, Element alpha=1.0)
Perform a rank 1 operation on the matrix: A += alpha * v * v^T.
void operator*=(Element val)
Multiply every element of the sub matrix by val .
void operator+=(Element val)
Add val to every element of the sub matrix.
void operator=(Element val)
Assign val to every element of the sub matrix.
const Element * GetMatrixArray() const override
const Element * GetMatrixArray() const override
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
TMatrixT< Element > & ElementMult(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Multiply target by the source, element-by-element.