46 template<
class Element>
49 Allocate(row_upb-row_lwb+1,col_upb-col_lwb+1,row_lwb,col_lwb,1);
60 template<
class Element>
70 template<
class Element>
72 const Element *elements,
Option_t *option)
74 Allocate(row_upb-row_lwb+1,col_upb-col_lwb+1,row_lwb,col_lwb);
81 template<
class Element>
92 template<
class Element>
103 template<
class Element>
116 template<
class Element>
148 this->SetTol(oldTol);
154 TMult(prototype,prototype);
158 Error(
"TMatrixT(EMatrixCreatorOp1)",
"operation %d not yet implemented", op);
167 template<
class Element>
195 this->SetTol(oldTol);
215 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
224 template<
class Element>
252 this->SetTol(oldTol);
272 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
281 template<
class Element>
309 this->SetTol(oldTol);
329 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
338 template<
class Element>
366 this->SetTol(oldTol);
386 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
393 template<
class Element>
399 lazy_constructor.
FillIn(*
this);
405 template<
class Element>
409 if (size > this->kSizeMax)
419 template<
class Element>
422 if (size == 0)
return 0;
424 if ( size <= this->kSizeMax )
427 Element *heap =
new Element[size];
437 template<
class Element>
441 if (copySize == 0 || oldp == newp)
444 if ( newSize <= this->kSizeMax && oldSize <= this->kSizeMax ) {
447 for (
Int_t i = copySize-1; i >= 0; i--)
450 for (
Int_t i = 0; i < copySize; i++)
455 memcpy(newp,oldp,copySize*
sizeof(Element));
464 template<
class Element>
468 this->fIsOwner =
kTRUE;
477 if (no_rows < 0 || no_cols < 0)
479 Error(
"Allocate",
"no_rows=%d no_cols=%d",no_rows,no_cols);
485 this->fNrows = no_rows;
486 this->fNcols = no_cols;
487 this->fRowLwb = row_lwb;
488 this->fColLwb = col_lwb;
489 this->fNelems = this->fNrows*this->fNcols;
491 if (this->fNelems > 0) {
492 fElements = New_m(this->fNelems);
494 memset(fElements,0,this->fNelems*
sizeof(Element));
502 template<
class Element>
507 Error(
"Plus",
"matrices not compatible");
512 Error(
"Plus",
"this->GetMatrixArray() == a.GetMatrixArray()");
517 Error(
"Plus",
"this->GetMatrixArray() == b.GetMatrixArray()");
524 Element * cp = this->GetMatrixArray();
525 const Element *
const cp_last = cp+this->fNelems;
527 while (cp < cp_last) {
536 template<
class Element>
541 Error(
"Plus",
"matrices not compatible");
546 Error(
"Plus",
"this->GetMatrixArray() == a.GetMatrixArray()");
551 Error(
"Plus",
"this->GetMatrixArray() == b.GetMatrixArray()");
558 Element * cp = this->GetMatrixArray();
559 const Element *
const cp_last = cp+this->fNelems;
561 while (cp < cp_last) {
570 template<
class Element>
575 Error(
"Minus",
"matrices not compatible");
580 Error(
"Minus",
"this->GetMatrixArray() == a.GetMatrixArray()");
585 Error(
"Minus",
"this->GetMatrixArray() == b.GetMatrixArray()");
592 Element * cp = this->GetMatrixArray();
593 const Element *
const cp_last = cp+this->fNelems;
595 while (cp < cp_last) {
604 template<
class Element>
609 Error(
"Minus",
"matrices not compatible");
614 Error(
"Minus",
"this->GetMatrixArray() == a.GetMatrixArray()");
619 Error(
"Minus",
"this->GetMatrixArray() == b.GetMatrixArray()");
626 Element * cp = this->GetMatrixArray();
627 const Element *
const cp_last = cp+this->fNelems;
629 while (cp < cp_last) {
638 template<
class Element>
643 Error(
"Mult",
"A rows and B columns incompatible");
648 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
653 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
661 Element *cp = this->GetMatrixArray();
662 if (
typeid(Element) ==
typeid(
Double_t))
663 cblas_dgemm (CblasRowMajor,CblasNoTrans,CblasNoTrans,fNrows,fNcols,a.
GetNcols(),
665 else if (
typeid(Element) !=
typeid(
Float_t))
666 cblas_sgemm (CblasRowMajor,CblasNoTrans,CblasNoTrans,fNrows,fNcols,a.
GetNcols(),
669 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
677 Element * cp = this->GetMatrixArray();
679 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
687 template<
class Element>
694 Error(
"Mult",
"A rows and B columns incompatible");
699 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
704 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
712 Element *cp = this->GetMatrixArray();
713 if (
typeid(Element) ==
typeid(
Double_t))
714 cblas_dsymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
716 else if (
typeid(Element) !=
typeid(
Float_t))
717 cblas_ssymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
720 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
728 Element * cp = this->GetMatrixArray();
730 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
739 template<
class Element>
746 Error(
"Mult",
"A rows and B columns incompatible");
751 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
756 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
764 Element *cp = this->GetMatrixArray();
765 if (
typeid(Element) ==
typeid(
Double_t))
766 cblas_dsymm (CblasRowMajor,CblasRight,CblasUpper,fNrows,fNcols,1.0,
768 else if (
typeid(Element) !=
typeid(
Float_t))
769 cblas_ssymm (CblasRowMajor,CblasRight,CblasUpper,fNrows,fNcols,1.0,
772 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
780 Element * cp = this->GetMatrixArray();
782 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
791 template<
class Element>
798 Error(
"Mult",
"A rows and B columns incompatible");
803 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
808 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
816 Element *cp = this->GetMatrixArray();
817 if (
typeid(Element) ==
typeid(
Double_t))
818 cblas_dsymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
820 else if (
typeid(Element) !=
typeid(
Float_t))
821 cblas_ssymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
824 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
832 Element * cp = this->GetMatrixArray();
834 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
842 template<
class Element>
849 Error(
"TMult",
"A rows and B columns incompatible");
854 Error(
"TMult",
"this->GetMatrixArray() == a.GetMatrixArray()");
859 Error(
"TMult",
"this->GetMatrixArray() == b.GetMatrixArray()");
867 Element *cp = this->GetMatrixArray();
868 if (
typeid(Element) ==
typeid(
Double_t))
869 cblas_dgemm (CblasRowMajor,CblasTrans,CblasNoTrans,this->fNrows,this->fNcols,a.
GetNrows(),
871 else if (
typeid(Element) !=
typeid(
Float_t))
872 cblas_sgemm (CblasRowMajor,CblasTrans,CblasNoTrans,fNrows,fNcols,a.
GetNrows(),
875 Error(
"TMult",
"type %s not implemented in BLAS library",
typeid(Element));
882 Element * cp = this->GetMatrixArray();
884 AtMultB(ap,ncolsa,bp,nb,ncolsb,cp);
892 template<
class Element>
899 Error(
"TMult",
"A rows and B columns incompatible");
904 Error(
"TMult",
"this->GetMatrixArray() == a.GetMatrixArray()");
909 Error(
"TMult",
"this->GetMatrixArray() == b.GetMatrixArray()");
917 Element *cp = this->GetMatrixArray();
918 if (
typeid(Element) ==
typeid(
Double_t))
919 cblas_dgemm (CblasRowMajor,CblasTrans,CblasNoTrans,fNrows,fNcols,a.
GetNrows(),
921 else if (
typeid(Element) !=
typeid(
Float_t))
922 cblas_sgemm (CblasRowMajor,CblasTrans,CblasNoTrans,fNrows,fNcols,a.
GetNrows(),
925 Error(
"TMult",
"type %s not implemented in BLAS library",
typeid(Element));
932 Element * cp = this->GetMatrixArray();
934 AtMultB(ap,ncolsa,bp,nb,ncolsb,cp);
941 template<
class Element>
949 Error(
"MultT",
"A rows and B columns incompatible");
954 Error(
"MultT",
"this->GetMatrixArray() == a.GetMatrixArray()");
959 Error(
"MultT",
"this->GetMatrixArray() == b.GetMatrixArray()");
967 Element *cp = this->GetMatrixArray();
968 if (
typeid(Element) ==
typeid(
Double_t))
969 cblas_dgemm (CblasRowMajor,CblasNoTrans,CblasTrans,fNrows,fNcols,a.
GetNcols(),
971 else if (
typeid(Element) !=
typeid(
Float_t))
972 cblas_sgemm (CblasRowMajor,CblasNoTrans,CblasTrans,fNrows,fNcols,a.
GetNcols(),
975 Error(
"MultT",
"type %s not implemented in BLAS library",
typeid(Element));
983 Element * cp = this->GetMatrixArray();
985 AMultBt(ap,na,ncolsa,bp,nb,ncolsb,cp);
993 template<
class Element>
1000 Error(
"MultT",
"A rows and B columns incompatible");
1005 Error(
"MultT",
"this->GetMatrixArray() == a.GetMatrixArray()");
1010 Error(
"MultT",
"this->GetMatrixArray() == b.GetMatrixArray()");
1018 Element *cp = this->GetMatrixArray();
1019 if (
typeid(Element) ==
typeid(
Double_t))
1020 cblas_dgemm (CblasRowMajor,CblasNoTrans,CblasTrans,this->fNrows,this->fNcols,a.
GetNcols(),
1022 else if (
typeid(Element) !=
typeid(
Float_t))
1023 cblas_sgemm (CblasRowMajor,CblasNoTrans,CblasTrans,fNrows,fNcols,a.
GetNcols(),
1026 Error(
"MultT",
"type %s not implemented in BLAS library",
typeid(Element));
1034 Element * cp = this->GetMatrixArray();
1036 AMultBt(ap,na,ncolsa,bp,nb,ncolsb,cp);
1043 template<
class Element>
1048 if (row_upb < row_lwb)
1050 Error(
"Use",
"row_upb=%d < row_lwb=%d",row_upb,row_lwb);
1053 if (col_upb < col_lwb)
1055 Error(
"Use",
"col_upb=%d < col_lwb=%d",col_upb,col_lwb);
1061 this->fNrows = row_upb-row_lwb+1;
1062 this->fNcols = col_upb-col_lwb+1;
1063 this->fRowLwb = row_lwb;
1064 this->fColLwb = col_lwb;
1065 this->fNelems = this->fNrows*this->fNcols;
1079 template<
class Element>
1085 if (row_lwb < this->fRowLwb || row_lwb > this->fRowLwb+this->fNrows-1) {
1086 Error(
"GetSub",
"row_lwb out of bounds");
1089 if (col_lwb < this->fColLwb || col_lwb > this->fColLwb+this->fNcols-1) {
1090 Error(
"GetSub",
"col_lwb out of bounds");
1093 if (row_upb < this->fRowLwb || row_upb > this->fRowLwb+this->fNrows-1) {
1094 Error(
"GetSub",
"row_upb out of bounds");
1097 if (col_upb < this->fColLwb || col_upb > this->fColLwb+this->fNcols-1) {
1098 Error(
"GetSub",
"col_upb out of bounds");
1101 if (row_upb < row_lwb || col_upb < col_lwb) {
1102 Error(
"GetSub",
"row_upb < row_lwb || col_upb < col_lwb");
1111 const Int_t row_lwb_sub = (shift) ? 0 : row_lwb;
1112 const Int_t row_upb_sub = (shift) ? row_upb-row_lwb : row_upb;
1113 const Int_t col_lwb_sub = (shift) ? 0 : col_lwb;
1114 const Int_t col_upb_sub = (shift) ? col_upb-col_lwb : col_upb;
1116 target.
ResizeTo(row_lwb_sub,row_upb_sub,col_lwb_sub,col_upb_sub);
1117 const Int_t nrows_sub = row_upb_sub-row_lwb_sub+1;
1118 const Int_t ncols_sub = col_upb_sub-col_lwb_sub+1;
1121 for (
Int_t irow = 0; irow < nrows_sub; irow++) {
1122 for (
Int_t icol = 0; icol < ncols_sub; icol++) {
1123 target(irow+row_lwb_sub,icol+col_lwb_sub) = (*this)(row_lwb+irow,col_lwb+icol);
1127 const Element *ap = this->GetMatrixArray()+(row_lwb-this->fRowLwb)*this->fNcols+(col_lwb-this->fColLwb);
1130 for (
Int_t irow = 0; irow < nrows_sub; irow++) {
1131 const Element *ap_sub = ap;
1132 for (
Int_t icol = 0; icol < ncols_sub; icol++) {
1146 template<
class Element>
1153 if (row_lwb < this->fRowLwb || row_lwb > this->fRowLwb+this->fNrows-1) {
1154 Error(
"SetSub",
"row_lwb outof bounds");
1157 if (col_lwb < this->fColLwb || col_lwb > this->fColLwb+this->fNcols-1) {
1158 Error(
"SetSub",
"col_lwb outof bounds");
1161 if (row_lwb+source.
GetNrows() > this->fRowLwb+this->fNrows ||
1162 col_lwb+source.
GetNcols() > this->fColLwb+this->fNcols) {
1163 Error(
"SetSub",
"source matrix too large");
1174 for (
Int_t irow = 0; irow < nRows_source; irow++) {
1175 for (
Int_t icol = 0; icol < nCols_source; icol++) {
1176 (*this)(row_lwb+irow,col_lwb+icol) = source(rowlwb_s+irow,collwb_s+icol);
1181 Element *ap = this->GetMatrixArray()+(row_lwb-this->fRowLwb)*this->fNcols+(col_lwb-this->fColLwb);
1183 for (
Int_t irow = 0; irow < nRows_source; irow++) {
1184 Element *ap_sub = ap;
1185 for (
Int_t icol = 0; icol < nCols_source; icol++) {
1200 template<
class Element>
1204 if (!this->fIsOwner) {
1205 Error(
"ResizeTo(Int_t,Int_t)",
"Not owner of data array,cannot resize");
1209 if (this->fNelems > 0) {
1210 if (this->fNrows == nrows && this->fNcols == ncols)
1212 else if (nrows == 0 || ncols == 0) {
1213 this->fNrows = nrows; this->fNcols = ncols;
1218 Element *elements_old = GetMatrixArray();
1219 const Int_t nelems_old = this->fNelems;
1220 const Int_t nrows_old = this->fNrows;
1221 const Int_t ncols_old = this->fNcols;
1226 Element *elements_new = GetMatrixArray();
1229 if (this->fNelems > this->kSizeMax || nelems_old > this->kSizeMax)
1230 memset(elements_new,0,this->fNelems*
sizeof(Element));
1231 else if (this->fNelems > nelems_old)
1232 memset(elements_new+nelems_old,0,(this->fNelems-nelems_old)*
sizeof(Element));
1238 const Int_t nelems_new = this->fNelems;
1239 if (ncols_old < this->fNcols) {
1240 for (
Int_t i = nrows_copy-1; i >= 0; i--) {
1241 Memcpy_m(elements_new+i*this->fNcols,elements_old+i*ncols_old,ncols_copy,
1242 nelems_new,nelems_old);
1243 if (this->fNelems <= this->kSizeMax && nelems_old <= this->kSizeMax)
1244 memset(elements_new+i*this->fNcols+ncols_copy,0,(this->fNcols-ncols_copy)*
sizeof(Element));
1247 for (
Int_t i = 0; i < nrows_copy; i++)
1248 Memcpy_m(elements_new+i*this->fNcols,elements_old+i*ncols_old,ncols_copy,
1249 nelems_new,nelems_old);
1252 Delete_m(nelems_old,elements_old);
1265 template<
class Element>
1270 if (!this->fIsOwner) {
1271 Error(
"ResizeTo(Int_t,Int_t,Int_t,Int_t)",
"Not owner of data array,cannot resize");
1275 const Int_t new_nrows = row_upb-row_lwb+1;
1276 const Int_t new_ncols = col_upb-col_lwb+1;
1278 if (this->fNelems > 0) {
1280 if (this->fNrows == new_nrows && this->fNcols == new_ncols &&
1281 this->fRowLwb == row_lwb && this->fColLwb == col_lwb)
1283 else if (new_nrows == 0 || new_ncols == 0) {
1284 this->fNrows = new_nrows; this->fNcols = new_ncols;
1285 this->fRowLwb = row_lwb; this->fColLwb = col_lwb;
1290 Element *elements_old = GetMatrixArray();
1291 const Int_t nelems_old = this->fNelems;
1292 const Int_t nrows_old = this->fNrows;
1293 const Int_t ncols_old = this->fNcols;
1294 const Int_t rowLwb_old = this->fRowLwb;
1295 const Int_t colLwb_old = this->fColLwb;
1297 Allocate(new_nrows,new_ncols,row_lwb,col_lwb);
1300 Element *elements_new = GetMatrixArray();
1303 if (this->fNelems > this->kSizeMax || nelems_old > this->kSizeMax)
1304 memset(elements_new,0,this->fNelems*
sizeof(Element));
1305 else if (this->fNelems > nelems_old)
1306 memset(elements_new+nelems_old,0,(this->fNelems-nelems_old)*
sizeof(Element));
1311 const Int_t rowUpb_copy =
TMath::Min(this->fRowLwb+this->fNrows-1,rowLwb_old+nrows_old-1);
1312 const Int_t colUpb_copy =
TMath::Min(this->fColLwb+this->fNcols-1,colLwb_old+ncols_old-1);
1314 const Int_t nrows_copy = rowUpb_copy-rowLwb_copy+1;
1315 const Int_t ncols_copy = colUpb_copy-colLwb_copy+1;
1317 if (nrows_copy > 0 && ncols_copy > 0) {
1318 const Int_t colOldOff = colLwb_copy-colLwb_old;
1319 const Int_t colNewOff = colLwb_copy-this->fColLwb;
1320 if (ncols_old < this->fNcols) {
1321 for (
Int_t i = nrows_copy-1; i >= 0; i--) {
1322 const Int_t iRowOld = rowLwb_copy+i-rowLwb_old;
1323 const Int_t iRowNew = rowLwb_copy+i-this->fRowLwb;
1324 Memcpy_m(elements_new+iRowNew*this->fNcols+colNewOff,
1325 elements_old+iRowOld*ncols_old+colOldOff,ncols_copy,this->fNelems,nelems_old);
1326 if (this->fNelems <= this->kSizeMax && nelems_old <= this->kSizeMax)
1327 memset(elements_new+iRowNew*this->fNcols+colNewOff+ncols_copy,0,
1328 (this->fNcols-ncols_copy)*
sizeof(Element));
1331 for (
Int_t i = 0; i < nrows_copy; i++) {
1332 const Int_t iRowOld = rowLwb_copy+i-rowLwb_old;
1333 const Int_t iRowNew = rowLwb_copy+i-this->fRowLwb;
1334 Memcpy_m(elements_new+iRowNew*this->fNcols+colNewOff,
1335 elements_old+iRowOld*ncols_old+colOldOff,ncols_copy,this->fNelems,nelems_old);
1340 Delete_m(nelems_old,elements_old);
1342 Allocate(new_nrows,new_ncols,row_lwb,col_lwb,1);
1351 template<
class Element>
1364 template<
class Element>
1386 template<
class Element>
1389 TMatrixD tmp(*
this);
1400 template<
class Element>
1409 if (this->GetNrows() != this->GetNcols() || this->GetRowLwb() != this->GetColLwb()) {
1410 Error(
"Invert()",
"matrix should be square");
1412 Element *pM = this->GetMatrixArray();
1414 Error(
"InvertFast",
"matrix is singular");
1426 TMatrixTCramerInv::Inv2x2<Element>(*
this,det);
1431 TMatrixTCramerInv::Inv3x3<Element>(*
this,det);
1436 TMatrixTCramerInv::Inv4x4<Element>(*
this,det);
1441 TMatrixTCramerInv::Inv5x5<Element>(*
this,det);
1446 TMatrixTCramerInv::Inv6x6<Element>(*
this,det);
1459 template<
class Element>
1466 Element *ap = this->GetMatrixArray();
1467 if (this->fNrows == this->fNcols && this->fRowLwb == this->fColLwb) {
1468 for (
Int_t i = 0; i < this->fNrows; i++) {
1469 const Int_t off_i = i*this->fNrows;
1470 for (
Int_t j = i+1; j < this->fNcols; j++) {
1471 const Int_t off_j = j*this->fNcols;
1472 const Element tmp = ap[off_i+j];
1473 ap[off_i+j] = ap[off_j+i];
1480 const Int_t nrows_old = this->fNrows;
1481 const Int_t ncols_old = this->fNcols;
1482 const Int_t rowlwb_old = this->fRowLwb;
1483 const Int_t collwb_old = this->fColLwb;
1485 this->fNrows = ncols_old; this->fNcols = nrows_old;
1486 this->fRowLwb = collwb_old; this->fColLwb = rowlwb_old;
1487 for (
Int_t irow = this->fRowLwb; irow < this->fRowLwb+this->fNrows; irow++) {
1488 for (
Int_t icol = this->fColLwb; icol < this->fColLwb+this->fNcols; icol++) {
1489 const Int_t off = (icol-collwb_old)*ncols_old;
1490 (*this)(irow,icol) = oldElems[off+irow-rowlwb_old];
1496 if (this->fNrows != source.
GetNcols() || this->fNcols != source.
GetNrows() ||
1499 Error(
"Transpose",
"matrix has wrong shape");
1504 const Element *scp = sp1;
1505 Element *tp = this->GetMatrixArray();
1506 const Element *
const tp_last = this->GetMatrixArray()+this->fNelems;
1510 while (tp < tp_last) {
1511 const Element *sp2 = scp++;
1514 while (sp2 < sp1+this->fNelems) {
1516 sp2 += this->fNrows;
1519 R__ASSERT(tp == tp_last && scp == sp1+this->fNrows);
1529 template<
class Element>
1536 Error(
"Rank1Update",
"vector too short");
1542 Element *mp = this->GetMatrixArray();
1544 for (
Int_t i = 0; i < this->fNrows; i++) {
1545 const Element tmp = alpha*pv[i];
1546 for (
Int_t j = 0; j < this->fNcols; j++)
1557 template<
class Element>
1565 Error(
"Rank1Update",
"vector v1 too short");
1570 Error(
"Rank1Update",
"vector v2 too short");
1577 Element *mp = this->GetMatrixArray();
1579 for (
Int_t i = 0; i < this->fNrows; i++) {
1580 const Element tmp = alpha*pv1[i];
1581 for (
Int_t j = 0; j < this->fNcols; j++)
1582 *mp++ += tmp*pv2[j];
1591 template<
class Element>
1597 if (this->fNcols != this->fNrows || this->fColLwb != this->fRowLwb) {
1598 Error(
"Similarity(const TVectorT &)",
"matrix is not square");
1602 if (this->fNcols != v.
GetNrows() || this->fColLwb != v.
GetLwb()) {
1603 Error(
"Similarity(const TVectorT &)",
"vector and matrix incompatible");
1608 const Element *mp = this->GetMatrixArray();
1612 const Element *
const vp_first = vp;
1613 const Element *
const vp_last = vp+v.
GetNrows();
1614 while (vp < vp_last) {
1616 for (
const Element *sp = vp_first; sp < vp_last; )
1617 sum2 += *mp++ * *sp++;
1618 sum1 += sum2 * *vp++;
1621 R__ASSERT(mp == this->GetMatrixArray()+this->GetNoElements());
1632 template<
class Element>
1639 Error(
"NormByColumn",
"vector shorter than matrix column");
1649 Element *mp = this->GetMatrixArray();
1650 const Element *
const mp_last = mp+this->fNelems;
1653 for ( ; mp < mp_last; pv++) {
1654 for (
Int_t j = 0; j < this->fNcols; j++)
1665 for ( ; mp < mp_last; pv++)
1666 for (
Int_t j = 0; j < this->fNcols; j++)
1679 template<
class Element>
1686 Error(
"NormByRow",
"vector shorter than matrix column");
1696 const Element *pv = pv0;
1697 Element *mp = this->GetMatrixArray();
1698 const Element *
const mp_last = mp+this->fNelems;
1701 for ( ; mp < mp_last; pv = pv0 )
1702 for (
Int_t j = 0; j < this->fNcols; j++) {
1706 Error(
"NormbyRow",
"vector element %ld is zero",
Long_t(pv-pv0));
1711 for ( ; mp < mp_last; pv = pv0 )
1712 for (
Int_t j = 0; j < this->fNcols; j++)
1722 template<
class Element>
1726 Error(
"operator=(const TMatrixT &)",
"matrices not compatible");
1732 memcpy(fElements,source.
GetMatrixArray(),this->fNelems*
sizeof(Element));
1733 this->fTol = source.
GetTol();
1741 template<
class Element>
1745 Error(
"operator=(const TMatrixTSym &)",
"matrices not compatible");
1751 memcpy(fElements,source.
GetMatrixArray(),this->fNelems*
sizeof(Element));
1752 this->fTol = source.
GetTol();
1760 template<
class Element>
1764 this->GetNrows() != source.
GetNrows()) || this->GetNcols() != source.
GetNcols() ||
1765 this->GetRowLwb() != source.
GetRowLwb() || this->GetColLwb() != source.
GetColLwb()) {
1766 Error(
"operator=(const TMatrixTSparse &",
"matrices not compatible");
1772 memset(fElements,0,this->fNelems*
sizeof(Element));
1775 Element * tp = this->GetMatrixArray();
1780 for (
Int_t irow = 0; irow < this->fNrows; irow++ ) {
1781 const Int_t off = irow*this->fNcols;
1782 const Int_t sIndex = pRowIndex[irow];
1783 const Int_t eIndex = pRowIndex[irow+1];
1784 for (
Int_t index = sIndex; index < eIndex; index++)
1785 tp[off+pColIndex[index]] = sp[index];
1787 this->fTol = source.
GetTol();
1795 template<
class Element>
1800 if (lazy_constructor.
GetRowUpb() != this->GetRowUpb() ||
1801 lazy_constructor.
GetColUpb() != this->GetColUpb() ||
1802 lazy_constructor.
GetRowLwb() != this->GetRowLwb() ||
1803 lazy_constructor.
GetColLwb() != this->GetColLwb()) {
1804 Error(
"operator=(const TMatrixTLazy&)",
"matrix is incompatible with "
1805 "the assigned Lazy matrix");
1809 lazy_constructor.
FillIn(*
this);
1816 template<
class Element>
1821 Element *ep = this->GetMatrixArray();
1822 const Element *
const ep_last = ep+this->fNelems;
1823 while (ep < ep_last)
1832 template<
class Element>
1837 Element *ep = this->GetMatrixArray();
1838 const Element *
const ep_last = ep+this->fNelems;
1839 while (ep < ep_last)
1848 template<
class Element>
1853 Element *ep = this->GetMatrixArray();
1854 const Element *
const ep_last = ep+this->fNelems;
1855 while (ep < ep_last)
1864 template<
class Element>
1869 Element *ep = this->GetMatrixArray();
1870 const Element *
const ep_last = ep+this->fNelems;
1871 while (ep < ep_last)
1880 template<
class Element>
1884 Error(
"operator+=(const TMatrixT &)",
"matrices not compatible");
1889 Element *tp = this->GetMatrixArray();
1890 const Element *
const tp_last = tp+this->fNelems;
1891 while (tp < tp_last)
1900 template<
class Element>
1904 Error(
"operator+=(const TMatrixTSym &)",
"matrices not compatible");
1909 Element *tp = this->GetMatrixArray();
1910 const Element *
const tp_last = tp+this->fNelems;
1911 while (tp < tp_last)
1920 template<
class Element>
1924 Error(
"operator=-(const TMatrixT &)",
"matrices not compatible");
1929 Element *tp = this->GetMatrixArray();
1930 const Element *
const tp_last = tp+this->fNelems;
1931 while (tp < tp_last)
1940 template<
class Element>
1944 Error(
"operator=-(const TMatrixTSym &)",
"matrices not compatible");
1949 Element *tp = this->GetMatrixArray();
1950 const Element *
const tp_last = tp+this->fNelems;
1951 while (tp < tp_last)
1962 template<
class Element>
1970 Error(
"operator*=(const TMatrixT &)",
"source matrix has wrong shape");
1987 Element work[kWorkMax];
1989 Element *trp = work;
1990 if (this->fNcols > kWorkMax) {
1991 isAllocated =
kTRUE;
1992 trp =
new Element[this->fNcols];
1995 Element *cp = this->GetMatrixArray();
1996 const Element *trp0 = cp;
1997 const Element *
const trp0_last = trp0+this->fNelems;
1998 while (trp0 < trp0_last) {
1999 memcpy(trp,trp0,this->fNcols*
sizeof(Element));
2000 for (
const Element *scp = sp; scp < sp+this->fNcols; ) {
2003 for (
Int_t j = 0; j < this->fNcols; j++) {
2004 cij += trp[j] * *scp;
2005 scp += this->fNcols;
2010 trp0 += this->fNcols;
2014 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
2025 template<
class Element>
2032 Error(
"operator*=(const TMatrixTSym &)",
"source matrix has wrong shape");
2049 Element work[kWorkMax];
2051 Element *trp = work;
2052 if (this->fNcols > kWorkMax) {
2053 isAllocated =
kTRUE;
2054 trp =
new Element[this->fNcols];
2057 Element *cp = this->GetMatrixArray();
2058 const Element *trp0 = cp;
2059 const Element *
const trp0_last = trp0+this->fNelems;
2060 while (trp0 < trp0_last) {
2061 memcpy(trp,trp0,this->fNcols*
sizeof(Element));
2062 for (
const Element *scp = sp; scp < sp+this->fNcols; ) {
2065 for (
Int_t j = 0; j < this->fNcols; j++) {
2066 cij += trp[j] * *scp;
2067 scp += this->fNcols;
2072 trp0 += this->fNcols;
2076 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
2087 template<
class Element>
2094 Error(
"operator*=(const TMatrixTDiag_const &)",
"wrong diagonal length");
2099 Element *mp = this->GetMatrixArray();
2100 const Element *
const mp_last = mp+this->fNelems;
2102 while (mp < mp_last) {
2103 const Element *dp = diag.
GetPtr();
2104 for (
Int_t j = 0; j < this->fNcols; j++) {
2117 template<
class Element>
2124 Error(
"operator/=(const TMatrixTDiag_const &)",
"wrong diagonal length");
2129 Element *mp = this->GetMatrixArray();
2130 const Element *
const mp_last = mp+this->fNelems;
2132 while (mp < mp_last) {
2133 const Element *dp = diag.
GetPtr();
2134 for (
Int_t j = 0; j < this->fNcols; j++) {
2138 Error(
"operator/=",
"%d-diagonal element is zero",j);
2152 template<
class Element>
2160 if (this->fNrows != mt->
GetNrows()) {
2161 Error(
"operator*=(const TMatrixTColumn_const &)",
"wrong column length");
2167 Element *mp = this->GetMatrixArray();
2168 const Element *
const mp_last = mp+this->fNelems;
2169 const Element *cp = col.
GetPtr();
2171 while (mp < mp_last) {
2173 for (
Int_t j = 0; j < this->fNcols; j++)
2185 template<
class Element>
2193 if (this->fNrows != mt->
GetNrows()) {
2194 Error(
"operator/=(const TMatrixTColumn_const &)",
"wrong column matrix");
2200 Element *mp = this->GetMatrixArray();
2201 const Element *
const mp_last = mp+this->fNelems;
2202 const Element *cp = col.
GetPtr();
2204 while (mp < mp_last) {
2207 for (
Int_t j = 0; j < this->fNcols; j++)
2211 Error(
"operator/=",
"%d-row of matrix column is zero",icol);
2224 template<
class Element>
2232 if (this->fNcols != mt->
GetNcols()) {
2233 Error(
"operator*=(const TMatrixTRow_const &)",
"wrong row length");
2239 Element *mp = this->GetMatrixArray();
2240 const Element *
const mp_last = mp+this->fNelems;
2242 while (mp < mp_last) {
2243 const Element *rp = row.
GetPtr();
2244 for (
Int_t j = 0; j < this->fNcols; j++) {
2258 template<
class Element>
2265 if (this->fNcols != mt->
GetNcols()) {
2266 Error(
"operator/=(const TMatrixTRow_const &)",
"wrong row length");
2271 Element *mp = this->GetMatrixArray();
2272 const Element *
const mp_last = mp+this->fNelems;
2274 while (mp < mp_last) {
2275 const Element *rp = row.
GetPtr();
2276 for (
Int_t j = 0; j < this->fNcols; j++) {
2281 Error(
"operator/=",
"%d-col of matrix row is zero",j);
2297 template<
class Element>
2300 if (!this->IsSymmetric())
2301 Warning(
"EigenVectors(TVectorT &)",
"Only real part of eigen-values will be returned");
2303 eigenValues.
ResizeTo(this->fNrows);
2311 template<
class Element>
2322 template<
class Element>
2333 template<
class Element>
2342 template<
class Element>
2353 template<
class Element>
2362 template<
class Element>
2373 template<
class Element>
2384 template<
class Element>
2387 return Element(-1.0)*(
operator-(source2,source1));
2393 template<
class Element>
2404 template<
class Element>
2407 return Element(-1.0)*
operator-(source,val);
2413 template<
class Element>
2424 template<
class Element>
2433 template<
class Element>
2443 template<
class Element>
2453 template<
class Element>
2463 template<
class Element>
2473 template<
class Element>
2479 Error(
"operator&&(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2489 while (tp < tp_last)
2490 *tp++ = (*sp1++ != 0.0 && *sp2++ != 0.0);
2498 template<
class Element>
2504 Error(
"operator&&(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2514 while (tp < tp_last)
2515 *tp++ = (*sp1++ != 0.0 && *sp2++ != 0.0);
2523 template<
class Element>
2532 template<
class Element>
2538 Error(
"operator||(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2548 while (tp < tp_last)
2549 *tp++ = (*sp1++ != 0.0 || *sp2++ != 0.0);
2557 template<
class Element>
2563 Error(
"operator||(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2573 while (tp < tp_last)
2574 *tp++ = (*sp1++ != 0.0 || *sp2++ != 0.0);
2582 template<
class Element>
2591 template<
class Element>
2597 Error(
"operator|(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2607 while (tp < tp_last) {
2608 *tp++ = (*sp1) > (*sp2); sp1++; sp2++;
2617 template<
class Element>
2623 Error(
"operator>(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2633 while (tp < tp_last) {
2634 *tp++ = (*sp1) > (*sp2); sp1++; sp2++;
2643 template<
class Element>
2652 template<
class Element>
2658 Error(
"operator>=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2668 while (tp < tp_last) {
2669 *tp++ = (*sp1) >= (*sp2); sp1++; sp2++;
2678 template<
class Element>
2684 Error(
"operator>=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2694 while (tp < tp_last) {
2695 *tp++ = (*sp1) >= (*sp2); sp1++; sp2++;
2704 template<
class Element>
2713 template<
class Element>
2719 Error(
"operator<=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2726 const Element *sp2 = source2.GetMatrixArray();
2729 while (tp < tp_last) {
2730 *tp++ = (*sp1) <= (*sp2); sp1++; sp2++;
2739 template<
class Element>
2745 Error(
"operator<=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2752 const Element *sp2 = source2.GetMatrixArray();
2755 while (tp < tp_last) {
2756 *tp++ = (*sp1) <= (*sp2); sp1++; sp2++;
2765 template<
class Element>
2774 template<
class Element>
2780 Error(
"operator<(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2785 const Element *sp2 = source2.GetMatrixArray();
2788 while (tp < tp_last) {
2789 *tp++ = (*sp1) < (*sp2); sp1++; sp2++;
2798 template<
class Element>
2804 Error(
"operator<(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2811 const Element *sp2 = source2.GetMatrixArray();
2814 while (tp < tp_last) {
2815 *tp++ = (*sp1) < (*sp2); sp1++; sp2++;
2824 template<
class Element>
2833 template<
class Element>
2839 Error(
"operator!=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2849 while (tp != tp_last) {
2850 *tp++ = (*sp1) != (*sp2); sp1++; sp2++;
2859 template<
class Element>
2865 Error(
"operator!=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2875 while (tp != tp_last) {
2876 *tp++ = (*sp1) != (*sp2); sp1++; sp2++;
2885 template<
class Element>
2895 template<class Element>
2896 TMatrixT<Element> operator!=(const TMatrixT<Element> &source1,Element val)
2898 TMatrixT<Element> target; target.ResizeTo(source1);
2900 const Element *sp = source1.GetMatrixArray();
2901 Element *tp = target.GetMatrixArray();
2902 const Element * const tp_last = tp+target.GetNoElements();
2903 while (tp != tp_last) {
2904 *tp++ = (*sp != val); sp++;
2913 template<class Element>
2914 TMatrixT<Element> operator!=(Element val,const TMatrixT<Element> &source1)
2916 return operator!=(source1,val);
2923 template<
class Element>
2927 ::Error(
"Add(TMatrixT &,Element,const TMatrixT &)",
"matrices not compatible");
2936 *tp++ = scalar * (*sp++);
2937 }
else if (scalar == 1.) {
2942 *tp++ += scalar * (*sp++);
2951 template<
class Element>
2955 ::Error(
"Add(TMatrixT &,Element,const TMatrixTSym &)",
"matrices not compatible");
2963 *tp++ += scalar * (*sp++);
2971 template<
class Element>
2975 ::Error(
"ElementMult(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
2991 template<
class Element>
2995 ::Error(
"ElementMult(TMatrixT &,const TMatrixTSym &)",
"matrices not compatible");
3011 template<
class Element>
3015 ::Error(
"ElementDiv(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
3022 while ( tp < ftp ) {
3028 Error(
"ElementDiv",
"source (%d,%d) is zero",irow,icol);
3039 template<
class Element>
3043 ::Error(
"ElementDiv(TMatrixT &,const TMatrixTSym &)",
"matrices not compatible");
3050 while ( tp < ftp ) {
3056 Error(
"ElementDiv",
"source (%d,%d) is zero",irow,icol);
3067 template<
class Element>
3069 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp)
3071 const Element *arp0 = ap;
3072 while (arp0 < ap+na) {
3073 for (
const Element *bcp = bp; bcp < bp+ncolsb; ) {
3074 const Element *arp = arp0;
3076 while (bcp < bp+nb) {
3077 cij += *arp++ * *bcp;
3090 template<
class Element>
3092 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp)
3094 const Element *acp0 = ap;
3095 while (acp0 < ap+ncolsa) {
3096 for (
const Element *bcp = bp; bcp < bp+ncolsb; ) {
3097 const Element *acp = acp0;
3099 while (bcp < bp+nb) {
3114 template<
class Element>
3116 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp)
3118 const Element *arp0 = ap;
3119 while (arp0 < ap+na) {
3120 const Element *brp0 = bp;
3121 while (brp0 < bp+nb) {
3122 const Element *arp = arp0;
3123 const Element *brp = brp0;
3125 while (brp < brp0+ncolsb)
3126 cij += *arp++ * *brp++;
3137 template<
class Element>
3146 }
else if (R__v == 2) {
3148 TObject::Streamer(R__b);
3150 R__b >> this->fNrows;
3151 R__b >> this->fNcols;
3152 R__b >> this->fNelems;
3153 R__b >> this->fRowLwb;
3154 R__b >> this->fColLwb;
3158 if (this->fNelems > 0) {
3159 fElements =
new Element[this->fNelems];
3166 TObject::Streamer(R__b);
3168 R__b >> this->fNrows;
3169 R__b >> this->fNcols;
3170 R__b >> this->fRowLwb;
3171 R__b >> this->fColLwb;
3172 this->fNelems = R__b.
ReadArray(fElements);
3176 if (R__v <= 2 && fElements) {
3177 for (
Int_t i = 0; i < this->fNrows; i++) {
3178 const Int_t off_i = i*this->fNcols;
3179 for (
Int_t j = i; j < this->fNcols; j++) {
3180 const Int_t off_j = j*this->fNrows;
3181 const Element tmp = fElements[off_i+j];
3182 fElements[off_i+j] = fElements[off_j+i];
3183 fElements[off_j+i] = tmp;
3187 if (this->fNelems > 0 && this->fNelems <= this->kSizeMax) {
3189 memcpy(fDataStack,fElements,this->fNelems*
sizeof(Element));
3190 delete [] fElements;
3192 fElements = fDataStack;
3193 }
else if (this->fNelems < 0)
3203 #ifndef ROOT_TMatrixFfwd
3206 #ifndef ROOT_TMatrixFSymfwd
3210 template TMatrixF
operator+ <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3211 template TMatrixF
operator+ <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3212 template TMatrixF
operator+ <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3213 template TMatrixF
operator+ <
Float_t>(
const TMatrixF &source ,
Float_t val );
3214 template TMatrixF
operator+ <
Float_t>(
Float_t val ,
const TMatrixF &source );
3215 template TMatrixF
operator- <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3216 template TMatrixF
operator- <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3217 template TMatrixF
operator- <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3218 template TMatrixF
operator- <
Float_t>(
const TMatrixF &source ,
Float_t val );
3219 template TMatrixF
operator- <
Float_t>(
Float_t val ,
const TMatrixF &source );
3220 template TMatrixF
operator* <
Float_t>(
Float_t val ,
const TMatrixF &source );
3221 template TMatrixF
operator* <
Float_t>(
const TMatrixF &source ,
Float_t val );
3222 template TMatrixF
operator* <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3223 template TMatrixF
operator* <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3224 template TMatrixF
operator* <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3226 template TMatrixF
operator&& <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3227 template TMatrixF
operator&& <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3228 template TMatrixF
operator&& <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3229 template TMatrixF
operator|| <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3230 template TMatrixF
operator|| <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3231 template TMatrixF
operator|| <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3232 template TMatrixF
operator> <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3233 template TMatrixF
operator> <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3234 template TMatrixF
operator> <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3235 template TMatrixF
operator>= <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3236 template TMatrixF
operator>= <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3237 template TMatrixF
operator>= <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3244 template TMatrixF
operator!= <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3245 template TMatrixF
operator!= <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3246 template TMatrixF
operator!= <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3262 #ifndef ROOT_TMatrixDfwd
3265 #ifndef ROOT_TMatrixDSymfwd
3269 template class TMatrixT<Double_t>;
3271 template TMatrixD
operator+ <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3272 template TMatrixD
operator+ <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3273 template TMatrixD
operator+ <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3274 template TMatrixD
operator+ <
Double_t>(
const TMatrixD &source ,
Double_t val );
3275 template TMatrixD
operator+ <
Double_t>(
Double_t val ,
const TMatrixD &source );
3276 template TMatrixD
operator- <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3277 template TMatrixD
operator- <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3278 template TMatrixD
operator- <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3279 template TMatrixD
operator- <
Double_t>(
const TMatrixD &source ,
Double_t val );
3280 template TMatrixD
operator- <
Double_t>(
Double_t val ,
const TMatrixD &source );
3281 template TMatrixD
operator* <
Double_t>(
Double_t val ,
const TMatrixD &source );
3282 template TMatrixD
operator* <
Double_t>(
const TMatrixD &source ,
Double_t val );
3283 template TMatrixD
operator* <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3284 template TMatrixD
operator* <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3285 template TMatrixD
operator* <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3287 template TMatrixD
operator&& <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3288 template TMatrixD
operator&& <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3289 template TMatrixD
operator&& <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3290 template TMatrixD
operator|| <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3291 template TMatrixD
operator|| <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3292 template TMatrixD
operator|| <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3293 template TMatrixD
operator> <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3294 template TMatrixD
operator> <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3295 template TMatrixD
operator> <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3296 template TMatrixD
operator>= <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3297 template TMatrixD
operator>= <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3298 template TMatrixD
operator>= <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3305 template TMatrixD
operator!= <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3306 template TMatrixD
operator!= <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3307 template TMatrixD
operator!= <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
TMatrixT< Element > & operator+=(Element val)
Add val to every element of the matrix.
virtual const Element * GetMatrixArray() const =0
TMatrixT< Element > & NormByColumn(const TVectorT< Element > &v, Option_t *option="D")
Multiply/divide matrix columns by a vector: option: "D" : b(i,j) = a(i,j)/v(i) i = 0...
template TMatrixD & Add< Double_t >(TMatrixD &target, Double_t scalar, const TMatrixD &source)
int Invert(LASymMatrix &)
TVectorT< Element > & ResizeTo(Int_t lwb, Int_t upb)
Resize the vector to [lwb:upb] .
void Delete_m(Int_t size, Element *&)
Delete data pointer m, if it was assigned on the heap.
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
TMatrixT< Element > & Transpose(const TMatrixT< Element > &source)
Transpose matrix source.
TMatrixT< Element > & ElementMult(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Multiply target by the source, element-by-element.
Small helper to encapsulate whether to return the value pointed to by the iterator or its address...
virtual TMatrixTBase< Element > & SetMatrixArray(const Element *data, Option_t *option="")
Copy array data to matrix .
virtual const Element * GetMatrixArray() const
TMatrixT< Element > & ElementDiv(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Divide target by the source, element-by-element.
TMatrixT< Element > operator<=(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 <= source2
TMatrixT< Element > & operator*=(Element val)
Multiply every element of the matrix with val.
template TMatrixD & ElementDiv< Double_t >(TMatrixD &target, const TMatrixD &source)
template void AtMultB< Float_t >(const Float_t *const ap, Int_t ncolsa, const Float_t *const bp, Int_t nb, Int_t ncolsb, Float_t *cp)
TMatrixT< Element > operator<(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 < source2
const TMatrixD & GetEigenVectors() const
void ToUpper()
Change string to upper case.
Buffer base class used for serializing objects.
Int_t GetNoElements() const
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Expr< TransposeOp< SMatrix< T, D1, D2, R >, T, D1, D2 >, T, D2, D1, typename TranspPolicy< T, D1, D2, R >::RepType > Transpose(const SMatrix< T, D1, D2, R > &rhs)
Matrix Transpose B(i,j) = A(j,i) returning a matrix expression.
void AtMultB(const Element *const ap, Int_t ncolsa, const Element *const bp, Int_t nb, Int_t ncolsb, Element *cp)
Elementary routine to calculate matrix multiplication A^T*B.
template TMatrixF & ElementDiv< Float_t >(TMatrixF &target, const TMatrixF &source)
static Bool_t InvertLU(TMatrixD &a, Double_t tol, Double_t *det=0)
Calculate matrix inversion through in place forward/backward substitution.
template TMatrixF & ElementMult< Float_t >(TMatrixF &target, const TMatrixF &source)
Short_t Min(Short_t a, Short_t b)
virtual void Det(Double_t &d1, Double_t &d2)
Calculate determinant det = d1*TMath::Power(2.,d2)
template TMatrixF & Add< Float_t >(TMatrixF &target, Float_t scalar, const TMatrixF &source)
void Allocate(Int_t nrows, Int_t ncols, Int_t row_lwb=0, Int_t col_lwb=0, Int_t init=0, Int_t=-1)
Allocate new matrix.
virtual TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t nr_nonzeros=-1)=0
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
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
template TMatrixF operator<=< Float_t >(const TMatrixF &source1, const TMatrixF &source2)
template void AtMultB< Double_t >(const Double_t *const ap, Int_t ncolsa, const Double_t *const bp, Int_t nb, Int_t ncolsb, Double_t *cp)
template TMatrixD & ElementMult< Double_t >(TMatrixD &target, const TMatrixD &source)
void Minus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix summation. Create a matrix C such that C = A - B.
template TMatrixF operator<< Float_t >(const TMatrixF &source1, const TMatrixF &source2)
template void AMultB< Float_t >(const Float_t *const ap, Int_t na, Int_t ncolsa, const Float_t *const bp, Int_t nb, Int_t ncolsb, Float_t *cp)
void AMultBt(const Element *const ap, Int_t na, Int_t ncolsa, const Element *const bp, Int_t nb, Int_t ncolsb, Element *cp)
Elementary routine to calculate matrix multiplication A*B^T.
void MultT(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix multiplication. Create a matrix C such that C = A * B^T.
template TMatrixD operator<< Double_t >(const TMatrixD &source1, const TMatrixD &source2)
TMatrixT< Element > operator!=(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 != source2
Element * New_m(Int_t size)
Return data pointer .
TMatrixT< Element > & operator-=(Element val)
Subtract val from every element of the matrix.
template void AMultB< Double_t >(const Double_t *const ap, Int_t na, Int_t ncolsa, const Double_t *const bp, Int_t nb, Int_t ncolsb, Double_t *cp)
TMatrixT< Element > & operator/=(const TMatrixTDiag_const< Element > &diag)
Divide a matrix row by the diagonal of another matrix matrix(i,j) /= diag(j)
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Bool_t AreCompatible(const TMatrixTBase< Element1 > &m1, const TMatrixTBase< Element2 > &m2, Int_t verbose=0)
Check that matrice sm1 and m2 areboth valid and have identical shapes .
void TMult(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
Create a matrix C such that C = A' * B.
void Error(const char *location, const char *msgfmt,...)
TMatrixT< Element > & Invert(Double_t *det=0)
Invert the matrix and calculate its determinant.
virtual const Element * GetMatrixArray() const
Element * GetMatrixArray()
TMatrixT< Element > operator&&(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
Logical AND.
Element Similarity(const TVectorT< Element > &v) const
Calculate scalar v * (*this) * v^T.
TMatrixT< Element > & Rank1Update(const TVectorT< Element > &v, Element alpha=1.0)
Perform a rank 1 operation on matrix A: A += alpha * v * v^T.
virtual const Int_t * GetRowIndexArray() const
template void AMultBt< Float_t >(const Float_t *const ap, Int_t na, Int_t ncolsa, const Float_t *const bp, Int_t nb, Int_t ncolsb, Float_t *cp)
const TMatrixTBase< Element > * GetMatrix() const
TMatrixT< Element > operator>(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 > source2
const TMatrixT< Element > EigenVectors(TVectorT< Element > &eigenValues) const
Return a matrix containing the eigen-vectors ordered by descending values of Re^2+Im^2 of the complex...
TMatrixT< Element > & NormByRow(const TVectorT< Element > &v, Option_t *option="D")
Multiply/divide matrix rows with a vector: option: "D" : b(i,j) = a(i,j)/v(j) i = 0...
virtual TMatrixTBase< Element > & SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixTBase< Element > &source)
Insert matrix source starting at [row_lwb][col_lwb], thereby overwriting the part [row_lwb...
virtual const Element * GetMatrixArray() const
const TMatrixTBase< Element > * GetMatrix() const
R__EXTERN Int_t gMatrixCheck
TMatrixT< Element > operator>=(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 >= source2
void Warning(const char *location, const char *msgfmt,...)
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
TMatrixT< Element > operator*(Element val, const TMatrixT< Element > &source)
operation this = val*source
virtual void FillIn(TMatrixT< Element > &m) const =0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
DisplacementVector3D< CoordSystem, U > Mult(const Matrix &m, const DisplacementVector3D< CoordSystem, U > &v)
Multiplications of a generic matrices with a DisplacementVector3D of any coordinate system...
const Element * GetPtr() const
Int_t Memcpy_m(Element *newp, const Element *oldp, Int_t copySize, Int_t newSize, Int_t oldSize)
Copy copySize doubles from *oldp to *newp .
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
Get submatrix [row_lwb..row_upb] x [col_lwb..col_upb]; The indexing range of the returned matrix depe...
TMatrixT< Element > & operator=(const TMatrixT< Element > &source)
Assignment operator.
template void AMultBt< Double_t >(const Double_t *const ap, Int_t na, Int_t ncolsa, const Double_t *const bp, Int_t nb, Int_t ncolsb, Double_t *cp)
TCppObject_t Allocate(TCppType_t type)
TMatrixT< Element > & Use(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Element *data)
Use the array data to fill the matrix ([row_lwb..row_upb] x [col_lwb..col_upb])
virtual const Int_t * GetColIndexArray() const
Int_t GetNoElements() const
const Element * GetPtr() const
templateClassImp(TMatrixT) template< class Element > TMatrixT< Element >
Constructor for (nrows x ncols) matrix.
void Plus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix summation. Create a matrix C such that C = A + B.
template TMatrixD operator<=< Double_t >(const TMatrixD &source1, const TMatrixD &source2)
const Element * GetPtr() const
Short_t Max(Short_t a, Short_t b)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TMatrixT< Element > & InvertFast(Double_t *det=0)
Invert the matrix and calculate its determinant, however upto (6x6) a fast Cramer inversion is used ...
virtual Double_t Determinant() const
Return the matrix determinant.
TMatrixT< Element > operator+(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
operation this = source1+source2
TMatrixT< Element > operator-(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
operation this = source1-source2
void Mult(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix multiplication. Create a matrix C such that C = A * B.
TMatrixT< Element > operator||(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
Logical OR.
const TVectorD & GetEigenValuesRe() const
virtual const Int_t * GetColIndexArray() const =0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual const Int_t * GetRowIndexArray() const =0
void AMultB(const Element *const ap, Int_t na, Int_t ncolsa, const Element *const bp, Int_t nb, Int_t ncolsb, Element *cp)
Elementary routine to calculate matrix multiplication A*B.
virtual Int_t ReadArray(Bool_t *&b)=0