47 template<
class Element>
50 Allocate(row_upb-row_lwb+1,col_upb-col_lwb+1,row_lwb,col_lwb,1);
61 template<
class Element>
71 template<
class Element>
73 const Element *elements,
Option_t *option)
75 Allocate(row_upb-row_lwb+1,col_upb-col_lwb+1,row_lwb,col_lwb);
82 template<
class Element>
93 template<
class Element>
104 template<
class Element>
117 template<
class Element>
149 this->SetTol(oldTol);
155 TMult(prototype,prototype);
159 Error(
"TMatrixT(EMatrixCreatorOp1)",
"operation %d not yet implemented", op);
168 template<
class Element>
196 this->SetTol(oldTol);
216 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
225 template<
class Element>
253 this->SetTol(oldTol);
273 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
282 template<
class Element>
310 this->SetTol(oldTol);
330 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
339 template<
class Element>
367 this->SetTol(oldTol);
387 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
394 template<
class Element>
400 lazy_constructor.
FillIn(*
this);
406 template<
class Element>
410 if (size > this->kSizeMax)
420 template<
class Element>
423 if (size == 0)
return 0;
425 if ( size <= this->kSizeMax )
428 Element *heap =
new Element[size];
438 template<
class Element>
442 if (copySize == 0 || oldp == newp)
445 if ( newSize <= this->kSizeMax && oldSize <= this->kSizeMax ) {
448 for (
Int_t i = copySize-1; i >= 0; i--)
451 for (
Int_t i = 0; i < copySize; i++)
456 memcpy(newp,oldp,copySize*
sizeof(Element));
465 template<
class Element>
469 this->fIsOwner =
kTRUE;
478 if (no_rows < 0 || no_cols < 0)
480 Error(
"Allocate",
"no_rows=%d no_cols=%d",no_rows,no_cols);
486 this->fNrows = no_rows;
487 this->fNcols = no_cols;
488 this->fRowLwb = row_lwb;
489 this->fColLwb = col_lwb;
490 this->fNelems = this->fNrows*this->fNcols;
492 if (this->fNelems > 0) {
493 fElements = New_m(this->fNelems);
495 memset(fElements,0,this->fNelems*
sizeof(Element));
503 template<
class Element>
508 Error(
"Plus",
"matrices not compatible");
513 Error(
"Plus",
"this->GetMatrixArray() == a.GetMatrixArray()");
518 Error(
"Plus",
"this->GetMatrixArray() == b.GetMatrixArray()");
525 Element * cp = this->GetMatrixArray();
526 const Element *
const cp_last = cp+this->fNelems;
528 while (cp < cp_last) {
537 template<
class Element>
542 Error(
"Plus",
"matrices not compatible");
547 Error(
"Plus",
"this->GetMatrixArray() == a.GetMatrixArray()");
552 Error(
"Plus",
"this->GetMatrixArray() == b.GetMatrixArray()");
559 Element * cp = this->GetMatrixArray();
560 const Element *
const cp_last = cp+this->fNelems;
562 while (cp < cp_last) {
571 template<
class Element>
576 Error(
"Minus",
"matrices not compatible");
581 Error(
"Minus",
"this->GetMatrixArray() == a.GetMatrixArray()");
586 Error(
"Minus",
"this->GetMatrixArray() == b.GetMatrixArray()");
593 Element * cp = this->GetMatrixArray();
594 const Element *
const cp_last = cp+this->fNelems;
596 while (cp < cp_last) {
605 template<
class Element>
610 Error(
"Minus",
"matrices not compatible");
615 Error(
"Minus",
"this->GetMatrixArray() == a.GetMatrixArray()");
620 Error(
"Minus",
"this->GetMatrixArray() == b.GetMatrixArray()");
627 Element * cp = this->GetMatrixArray();
628 const Element *
const cp_last = cp+this->fNelems;
630 while (cp < cp_last) {
639 template<
class Element>
644 Error(
"Mult",
"A rows and B columns incompatible");
649 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
654 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
662 Element *cp = this->GetMatrixArray();
663 if (
typeid(Element) ==
typeid(
Double_t))
664 cblas_dgemm (CblasRowMajor,CblasNoTrans,CblasNoTrans,fNrows,fNcols,a.
GetNcols(),
666 else if (
typeid(Element) !=
typeid(
Float_t))
667 cblas_sgemm (CblasRowMajor,CblasNoTrans,CblasNoTrans,fNrows,fNcols,a.
GetNcols(),
670 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
678 Element * cp = this->GetMatrixArray();
680 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
688 template<
class Element>
695 Error(
"Mult",
"A rows and B columns incompatible");
700 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
705 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
713 Element *cp = this->GetMatrixArray();
714 if (
typeid(Element) ==
typeid(
Double_t))
715 cblas_dsymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
717 else if (
typeid(Element) !=
typeid(
Float_t))
718 cblas_ssymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
721 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
729 Element * cp = this->GetMatrixArray();
731 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
740 template<
class Element>
747 Error(
"Mult",
"A rows and B columns incompatible");
752 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
757 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
765 Element *cp = this->GetMatrixArray();
766 if (
typeid(Element) ==
typeid(
Double_t))
767 cblas_dsymm (CblasRowMajor,CblasRight,CblasUpper,fNrows,fNcols,1.0,
769 else if (
typeid(Element) !=
typeid(
Float_t))
770 cblas_ssymm (CblasRowMajor,CblasRight,CblasUpper,fNrows,fNcols,1.0,
773 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
781 Element * cp = this->GetMatrixArray();
783 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
792 template<
class Element>
799 Error(
"Mult",
"A rows and B columns incompatible");
804 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
809 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
817 Element *cp = this->GetMatrixArray();
818 if (
typeid(Element) ==
typeid(
Double_t))
819 cblas_dsymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
821 else if (
typeid(Element) !=
typeid(
Float_t))
822 cblas_ssymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
825 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
833 Element * cp = this->GetMatrixArray();
835 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
843 template<
class Element>
850 Error(
"TMult",
"A rows and B columns incompatible");
855 Error(
"TMult",
"this->GetMatrixArray() == a.GetMatrixArray()");
860 Error(
"TMult",
"this->GetMatrixArray() == b.GetMatrixArray()");
868 Element *cp = this->GetMatrixArray();
869 if (
typeid(Element) ==
typeid(
Double_t))
870 cblas_dgemm (CblasRowMajor,CblasTrans,CblasNoTrans,this->fNrows,this->fNcols,a.
GetNrows(),
872 else if (
typeid(Element) !=
typeid(
Float_t))
873 cblas_sgemm (CblasRowMajor,CblasTrans,CblasNoTrans,fNrows,fNcols,a.
GetNrows(),
876 Error(
"TMult",
"type %s not implemented in BLAS library",
typeid(Element));
883 Element * cp = this->GetMatrixArray();
885 AtMultB(ap,ncolsa,bp,nb,ncolsb,cp);
893 template<
class Element>
900 Error(
"TMult",
"A rows and B columns incompatible");
905 Error(
"TMult",
"this->GetMatrixArray() == a.GetMatrixArray()");
910 Error(
"TMult",
"this->GetMatrixArray() == b.GetMatrixArray()");
918 Element *cp = this->GetMatrixArray();
919 if (
typeid(Element) ==
typeid(
Double_t))
920 cblas_dgemm (CblasRowMajor,CblasTrans,CblasNoTrans,fNrows,fNcols,a.
GetNrows(),
922 else if (
typeid(Element) !=
typeid(
Float_t))
923 cblas_sgemm (CblasRowMajor,CblasTrans,CblasNoTrans,fNrows,fNcols,a.
GetNrows(),
926 Error(
"TMult",
"type %s not implemented in BLAS library",
typeid(Element));
933 Element * cp = this->GetMatrixArray();
935 AtMultB(ap,ncolsa,bp,nb,ncolsb,cp);
942 template<
class Element>
950 Error(
"MultT",
"A rows and B columns incompatible");
955 Error(
"MultT",
"this->GetMatrixArray() == a.GetMatrixArray()");
960 Error(
"MultT",
"this->GetMatrixArray() == b.GetMatrixArray()");
968 Element *cp = this->GetMatrixArray();
969 if (
typeid(Element) ==
typeid(
Double_t))
970 cblas_dgemm (CblasRowMajor,CblasNoTrans,CblasTrans,fNrows,fNcols,a.
GetNcols(),
972 else if (
typeid(Element) !=
typeid(
Float_t))
973 cblas_sgemm (CblasRowMajor,CblasNoTrans,CblasTrans,fNrows,fNcols,a.
GetNcols(),
976 Error(
"MultT",
"type %s not implemented in BLAS library",
typeid(Element));
984 Element * cp = this->GetMatrixArray();
986 AMultBt(ap,na,ncolsa,bp,nb,ncolsb,cp);
994 template<
class Element>
1001 Error(
"MultT",
"A rows and B columns incompatible");
1006 Error(
"MultT",
"this->GetMatrixArray() == a.GetMatrixArray()");
1011 Error(
"MultT",
"this->GetMatrixArray() == b.GetMatrixArray()");
1019 Element *cp = this->GetMatrixArray();
1020 if (
typeid(Element) ==
typeid(
Double_t))
1021 cblas_dgemm (CblasRowMajor,CblasNoTrans,CblasTrans,this->fNrows,this->fNcols,a.
GetNcols(),
1023 else if (
typeid(Element) !=
typeid(
Float_t))
1024 cblas_sgemm (CblasRowMajor,CblasNoTrans,CblasTrans,fNrows,fNcols,a.
GetNcols(),
1027 Error(
"MultT",
"type %s not implemented in BLAS library",
typeid(Element));
1035 Element * cp = this->GetMatrixArray();
1037 AMultBt(ap,na,ncolsa,bp,nb,ncolsb,cp);
1044 template<
class Element>
1049 if (row_upb < row_lwb)
1051 Error(
"Use",
"row_upb=%d < row_lwb=%d",row_upb,row_lwb);
1054 if (col_upb < col_lwb)
1056 Error(
"Use",
"col_upb=%d < col_lwb=%d",col_upb,col_lwb);
1062 this->fNrows = row_upb-row_lwb+1;
1063 this->fNcols = col_upb-col_lwb+1;
1064 this->fRowLwb = row_lwb;
1065 this->fColLwb = col_lwb;
1066 this->fNelems = this->fNrows*this->fNcols;
1080 template<
class Element>
1086 if (row_lwb < this->fRowLwb || row_lwb > this->fRowLwb+this->fNrows-1) {
1087 Error(
"GetSub",
"row_lwb out of bounds");
1090 if (col_lwb < this->fColLwb || col_lwb > this->fColLwb+this->fNcols-1) {
1091 Error(
"GetSub",
"col_lwb out of bounds");
1094 if (row_upb < this->fRowLwb || row_upb > this->fRowLwb+this->fNrows-1) {
1095 Error(
"GetSub",
"row_upb out of bounds");
1098 if (col_upb < this->fColLwb || col_upb > this->fColLwb+this->fNcols-1) {
1099 Error(
"GetSub",
"col_upb out of bounds");
1102 if (row_upb < row_lwb || col_upb < col_lwb) {
1103 Error(
"GetSub",
"row_upb < row_lwb || col_upb < col_lwb");
1112 const Int_t row_lwb_sub = (shift) ? 0 : row_lwb;
1113 const Int_t row_upb_sub = (shift) ? row_upb-row_lwb : row_upb;
1114 const Int_t col_lwb_sub = (shift) ? 0 : col_lwb;
1115 const Int_t col_upb_sub = (shift) ? col_upb-col_lwb : col_upb;
1117 target.
ResizeTo(row_lwb_sub,row_upb_sub,col_lwb_sub,col_upb_sub);
1118 const Int_t nrows_sub = row_upb_sub-row_lwb_sub+1;
1119 const Int_t ncols_sub = col_upb_sub-col_lwb_sub+1;
1122 for (
Int_t irow = 0; irow < nrows_sub; irow++) {
1123 for (
Int_t icol = 0; icol < ncols_sub; icol++) {
1124 target(irow+row_lwb_sub,icol+col_lwb_sub) = (*this)(row_lwb+irow,col_lwb+icol);
1128 const Element *ap = this->GetMatrixArray()+(row_lwb-this->fRowLwb)*this->fNcols+(col_lwb-this->fColLwb);
1131 for (
Int_t irow = 0; irow < nrows_sub; irow++) {
1132 const Element *ap_sub = ap;
1133 for (
Int_t icol = 0; icol < ncols_sub; icol++) {
1147 template<
class Element>
1154 if (row_lwb < this->fRowLwb || row_lwb > this->fRowLwb+this->fNrows-1) {
1155 Error(
"SetSub",
"row_lwb outof bounds");
1158 if (col_lwb < this->fColLwb || col_lwb > this->fColLwb+this->fNcols-1) {
1159 Error(
"SetSub",
"col_lwb outof bounds");
1162 if (row_lwb+source.
GetNrows() > this->fRowLwb+this->fNrows ||
1163 col_lwb+source.
GetNcols() > this->fColLwb+this->fNcols) {
1164 Error(
"SetSub",
"source matrix too large");
1175 for (
Int_t irow = 0; irow < nRows_source; irow++) {
1176 for (
Int_t icol = 0; icol < nCols_source; icol++) {
1177 (*this)(row_lwb+irow,col_lwb+icol) = source(rowlwb_s+irow,collwb_s+icol);
1182 Element *ap = this->GetMatrixArray()+(row_lwb-this->fRowLwb)*this->fNcols+(col_lwb-this->fColLwb);
1184 for (
Int_t irow = 0; irow < nRows_source; irow++) {
1185 Element *ap_sub = ap;
1186 for (
Int_t icol = 0; icol < nCols_source; icol++) {
1201 template<
class Element>
1205 if (!this->fIsOwner) {
1206 Error(
"ResizeTo(Int_t,Int_t)",
"Not owner of data array,cannot resize");
1210 if (this->fNelems > 0) {
1211 if (this->fNrows == nrows && this->fNcols == ncols)
1213 else if (nrows == 0 || ncols == 0) {
1214 this->fNrows = nrows; this->fNcols = ncols;
1219 Element *elements_old = GetMatrixArray();
1220 const Int_t nelems_old = this->fNelems;
1221 const Int_t nrows_old = this->fNrows;
1222 const Int_t ncols_old = this->fNcols;
1227 Element *elements_new = GetMatrixArray();
1230 if (this->fNelems > this->kSizeMax || nelems_old > this->kSizeMax)
1231 memset(elements_new,0,this->fNelems*
sizeof(Element));
1232 else if (this->fNelems > nelems_old)
1233 memset(elements_new+nelems_old,0,(this->fNelems-nelems_old)*
sizeof(Element));
1239 const Int_t nelems_new = this->fNelems;
1240 if (ncols_old < this->fNcols) {
1241 for (
Int_t i = nrows_copy-1; i >= 0; i--) {
1242 Memcpy_m(elements_new+i*this->fNcols,elements_old+i*ncols_old,ncols_copy,
1243 nelems_new,nelems_old);
1244 if (this->fNelems <= this->kSizeMax && nelems_old <= this->kSizeMax)
1245 memset(elements_new+i*this->fNcols+ncols_copy,0,(this->fNcols-ncols_copy)*
sizeof(Element));
1248 for (
Int_t i = 0; i < nrows_copy; i++)
1249 Memcpy_m(elements_new+i*this->fNcols,elements_old+i*ncols_old,ncols_copy,
1250 nelems_new,nelems_old);
1253 Delete_m(nelems_old,elements_old);
1266 template<
class Element>
1271 if (!this->fIsOwner) {
1272 Error(
"ResizeTo(Int_t,Int_t,Int_t,Int_t)",
"Not owner of data array,cannot resize");
1276 const Int_t new_nrows = row_upb-row_lwb+1;
1277 const Int_t new_ncols = col_upb-col_lwb+1;
1279 if (this->fNelems > 0) {
1281 if (this->fNrows == new_nrows && this->fNcols == new_ncols &&
1282 this->fRowLwb == row_lwb && this->fColLwb == col_lwb)
1284 else if (new_nrows == 0 || new_ncols == 0) {
1285 this->fNrows = new_nrows; this->fNcols = new_ncols;
1286 this->fRowLwb = row_lwb; this->fColLwb = col_lwb;
1291 Element *elements_old = GetMatrixArray();
1292 const Int_t nelems_old = this->fNelems;
1293 const Int_t nrows_old = this->fNrows;
1294 const Int_t ncols_old = this->fNcols;
1295 const Int_t rowLwb_old = this->fRowLwb;
1296 const Int_t colLwb_old = this->fColLwb;
1298 Allocate(new_nrows,new_ncols,row_lwb,col_lwb);
1301 Element *elements_new = GetMatrixArray();
1304 if (this->fNelems > this->kSizeMax || nelems_old > this->kSizeMax)
1305 memset(elements_new,0,this->fNelems*
sizeof(Element));
1306 else if (this->fNelems > nelems_old)
1307 memset(elements_new+nelems_old,0,(this->fNelems-nelems_old)*
sizeof(Element));
1312 const Int_t rowUpb_copy =
TMath::Min(this->fRowLwb+this->fNrows-1,rowLwb_old+nrows_old-1);
1313 const Int_t colUpb_copy =
TMath::Min(this->fColLwb+this->fNcols-1,colLwb_old+ncols_old-1);
1315 const Int_t nrows_copy = rowUpb_copy-rowLwb_copy+1;
1316 const Int_t ncols_copy = colUpb_copy-colLwb_copy+1;
1318 if (nrows_copy > 0 && ncols_copy > 0) {
1319 const Int_t colOldOff = colLwb_copy-colLwb_old;
1320 const Int_t colNewOff = colLwb_copy-this->fColLwb;
1321 if (ncols_old < this->fNcols) {
1322 for (
Int_t i = nrows_copy-1; i >= 0; i--) {
1323 const Int_t iRowOld = rowLwb_copy+i-rowLwb_old;
1324 const Int_t iRowNew = rowLwb_copy+i-this->fRowLwb;
1325 Memcpy_m(elements_new+iRowNew*this->fNcols+colNewOff,
1326 elements_old+iRowOld*ncols_old+colOldOff,ncols_copy,this->fNelems,nelems_old);
1327 if (this->fNelems <= this->kSizeMax && nelems_old <= this->kSizeMax)
1328 memset(elements_new+iRowNew*this->fNcols+colNewOff+ncols_copy,0,
1329 (this->fNcols-ncols_copy)*
sizeof(Element));
1332 for (
Int_t i = 0; i < nrows_copy; i++) {
1333 const Int_t iRowOld = rowLwb_copy+i-rowLwb_old;
1334 const Int_t iRowNew = rowLwb_copy+i-this->fRowLwb;
1335 Memcpy_m(elements_new+iRowNew*this->fNcols+colNewOff,
1336 elements_old+iRowOld*ncols_old+colOldOff,ncols_copy,this->fNelems,nelems_old);
1341 Delete_m(nelems_old,elements_old);
1343 Allocate(new_nrows,new_ncols,row_lwb,col_lwb,1);
1352 template<
class Element>
1365 template<
class Element>
1387 template<
class Element>
1390 TMatrixD tmp(*
this);
1401 template<
class Element>
1410 if (this->GetNrows() != this->GetNcols() || this->GetRowLwb() != this->GetColLwb()) {
1411 Error(
"Invert()",
"matrix should be square");
1413 Element *pM = this->GetMatrixArray();
1415 Error(
"InvertFast",
"matrix is singular");
1427 TMatrixTCramerInv::Inv2x2<Element>(*
this,det);
1432 TMatrixTCramerInv::Inv3x3<Element>(*
this,det);
1437 TMatrixTCramerInv::Inv4x4<Element>(*
this,det);
1442 TMatrixTCramerInv::Inv5x5<Element>(*
this,det);
1447 TMatrixTCramerInv::Inv6x6<Element>(*
this,det);
1460 template<
class Element>
1467 Element *ap = this->GetMatrixArray();
1468 if (this->fNrows == this->fNcols && this->fRowLwb == this->fColLwb) {
1469 for (
Int_t i = 0; i < this->fNrows; i++) {
1470 const Int_t off_i = i*this->fNrows;
1471 for (
Int_t j = i+1; j < this->fNcols; j++) {
1472 const Int_t off_j = j*this->fNcols;
1473 const Element tmp = ap[off_i+j];
1474 ap[off_i+j] = ap[off_j+i];
1481 const Int_t nrows_old = this->fNrows;
1482 const Int_t ncols_old = this->fNcols;
1483 const Int_t rowlwb_old = this->fRowLwb;
1484 const Int_t collwb_old = this->fColLwb;
1486 this->fNrows = ncols_old; this->fNcols = nrows_old;
1487 this->fRowLwb = collwb_old; this->fColLwb = rowlwb_old;
1488 for (
Int_t irow = this->fRowLwb; irow < this->fRowLwb+this->fNrows; irow++) {
1489 for (
Int_t icol = this->fColLwb; icol < this->fColLwb+this->fNcols; icol++) {
1490 const Int_t off = (icol-collwb_old)*ncols_old;
1491 (*this)(irow,icol) = oldElems[off+irow-rowlwb_old];
1497 if (this->fNrows != source.
GetNcols() || this->fNcols != source.
GetNrows() ||
1500 Error(
"Transpose",
"matrix has wrong shape");
1505 const Element *scp = sp1;
1506 Element *tp = this->GetMatrixArray();
1507 const Element *
const tp_last = this->GetMatrixArray()+this->fNelems;
1511 while (tp < tp_last) {
1512 const Element *sp2 = scp++;
1515 while (sp2 < sp1+this->fNelems) {
1517 sp2 += this->fNrows;
1520 R__ASSERT(tp == tp_last && scp == sp1+this->fNrows);
1530 template<
class Element>
1537 Error(
"Rank1Update",
"vector too short");
1543 Element *mp = this->GetMatrixArray();
1545 for (
Int_t i = 0; i < this->fNrows; i++) {
1546 const Element tmp = alpha*pv[i];
1547 for (
Int_t j = 0; j < this->fNcols; j++)
1558 template<
class Element>
1566 Error(
"Rank1Update",
"vector v1 too short");
1571 Error(
"Rank1Update",
"vector v2 too short");
1578 Element *mp = this->GetMatrixArray();
1580 for (
Int_t i = 0; i < this->fNrows; i++) {
1581 const Element tmp = alpha*pv1[i];
1582 for (
Int_t j = 0; j < this->fNcols; j++)
1583 *mp++ += tmp*pv2[j];
1592 template<
class Element>
1598 if (this->fNcols != this->fNrows || this->fColLwb != this->fRowLwb) {
1599 Error(
"Similarity(const TVectorT &)",
"matrix is not square");
1603 if (this->fNcols != v.
GetNrows() || this->fColLwb != v.
GetLwb()) {
1604 Error(
"Similarity(const TVectorT &)",
"vector and matrix incompatible");
1609 const Element *mp = this->GetMatrixArray();
1613 const Element *
const vp_first = vp;
1614 const Element *
const vp_last = vp+v.
GetNrows();
1615 while (vp < vp_last) {
1617 for (
const Element *sp = vp_first; sp < vp_last; )
1618 sum2 += *mp++ * *sp++;
1619 sum1 += sum2 * *vp++;
1622 R__ASSERT(mp == this->GetMatrixArray()+this->GetNoElements());
1633 template<
class Element>
1640 Error(
"NormByColumn",
"vector shorter than matrix column");
1650 Element *mp = this->GetMatrixArray();
1651 const Element *
const mp_last = mp+this->fNelems;
1654 for ( ; mp < mp_last; pv++) {
1655 for (
Int_t j = 0; j < this->fNcols; j++)
1666 for ( ; mp < mp_last; pv++)
1667 for (
Int_t j = 0; j < this->fNcols; j++)
1680 template<
class Element>
1687 Error(
"NormByRow",
"vector shorter than matrix column");
1697 const Element *pv = pv0;
1698 Element *mp = this->GetMatrixArray();
1699 const Element *
const mp_last = mp+this->fNelems;
1702 for ( ; mp < mp_last; pv = pv0 )
1703 for (
Int_t j = 0; j < this->fNcols; j++) {
1707 Error(
"NormbyRow",
"vector element %ld is zero",
Long_t(pv-pv0));
1712 for ( ; mp < mp_last; pv = pv0 )
1713 for (
Int_t j = 0; j < this->fNcols; j++)
1723 template<
class Element>
1727 Error(
"operator=(const TMatrixT &)",
"matrices not compatible");
1733 memcpy(fElements,source.
GetMatrixArray(),this->fNelems*
sizeof(Element));
1734 this->fTol = source.
GetTol();
1742 template<
class Element>
1746 Error(
"operator=(const TMatrixTSym &)",
"matrices not compatible");
1752 memcpy(fElements,source.
GetMatrixArray(),this->fNelems*
sizeof(Element));
1753 this->fTol = source.
GetTol();
1761 template<
class Element>
1765 this->GetNrows() != source.
GetNrows()) || this->GetNcols() != source.
GetNcols() ||
1766 this->GetRowLwb() != source.
GetRowLwb() || this->GetColLwb() != source.
GetColLwb()) {
1767 Error(
"operator=(const TMatrixTSparse &",
"matrices not compatible");
1773 memset(fElements,0,this->fNelems*
sizeof(Element));
1776 Element * tp = this->GetMatrixArray();
1781 for (
Int_t irow = 0; irow < this->fNrows; irow++ ) {
1782 const Int_t off = irow*this->fNcols;
1783 const Int_t sIndex = pRowIndex[irow];
1784 const Int_t eIndex = pRowIndex[irow+1];
1785 for (
Int_t index = sIndex; index < eIndex; index++)
1786 tp[off+pColIndex[index]] = sp[index];
1788 this->fTol = source.
GetTol();
1796 template<
class Element>
1801 if (lazy_constructor.
GetRowUpb() != this->GetRowUpb() ||
1802 lazy_constructor.
GetColUpb() != this->GetColUpb() ||
1803 lazy_constructor.
GetRowLwb() != this->GetRowLwb() ||
1804 lazy_constructor.
GetColLwb() != this->GetColLwb()) {
1805 Error(
"operator=(const TMatrixTLazy&)",
"matrix is incompatible with "
1806 "the assigned Lazy matrix");
1810 lazy_constructor.
FillIn(*
this);
1817 template<
class Element>
1822 Element *ep = this->GetMatrixArray();
1823 const Element *
const ep_last = ep+this->fNelems;
1824 while (ep < ep_last)
1833 template<
class Element>
1838 Element *ep = this->GetMatrixArray();
1839 const Element *
const ep_last = ep+this->fNelems;
1840 while (ep < ep_last)
1849 template<
class Element>
1854 Element *ep = this->GetMatrixArray();
1855 const Element *
const ep_last = ep+this->fNelems;
1856 while (ep < ep_last)
1865 template<
class Element>
1870 Element *ep = this->GetMatrixArray();
1871 const Element *
const ep_last = ep+this->fNelems;
1872 while (ep < ep_last)
1881 template<
class Element>
1885 Error(
"operator+=(const TMatrixT &)",
"matrices not compatible");
1890 Element *tp = this->GetMatrixArray();
1891 const Element *
const tp_last = tp+this->fNelems;
1892 while (tp < tp_last)
1901 template<
class Element>
1905 Error(
"operator+=(const TMatrixTSym &)",
"matrices not compatible");
1910 Element *tp = this->GetMatrixArray();
1911 const Element *
const tp_last = tp+this->fNelems;
1912 while (tp < tp_last)
1921 template<
class Element>
1925 Error(
"operator=-(const TMatrixT &)",
"matrices not compatible");
1930 Element *tp = this->GetMatrixArray();
1931 const Element *
const tp_last = tp+this->fNelems;
1932 while (tp < tp_last)
1941 template<
class Element>
1945 Error(
"operator=-(const TMatrixTSym &)",
"matrices not compatible");
1950 Element *tp = this->GetMatrixArray();
1951 const Element *
const tp_last = tp+this->fNelems;
1952 while (tp < tp_last)
1963 template<
class Element>
1971 Error(
"operator*=(const TMatrixT &)",
"source matrix has wrong shape");
1988 Element work[kWorkMax];
1990 Element *trp = work;
1991 if (this->fNcols > kWorkMax) {
1992 isAllocated =
kTRUE;
1993 trp =
new Element[this->fNcols];
1996 Element *cp = this->GetMatrixArray();
1997 const Element *trp0 = cp;
1998 const Element *
const trp0_last = trp0+this->fNelems;
1999 while (trp0 < trp0_last) {
2000 memcpy(trp,trp0,this->fNcols*
sizeof(Element));
2001 for (
const Element *scp = sp; scp < sp+this->fNcols; ) {
2004 for (
Int_t j = 0; j < this->fNcols; j++) {
2005 cij += trp[j] * *scp;
2006 scp += this->fNcols;
2011 trp0 += this->fNcols;
2015 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
2026 template<
class Element>
2033 Error(
"operator*=(const TMatrixTSym &)",
"source matrix has wrong shape");
2050 Element work[kWorkMax];
2052 Element *trp = work;
2053 if (this->fNcols > kWorkMax) {
2054 isAllocated =
kTRUE;
2055 trp =
new Element[this->fNcols];
2058 Element *cp = this->GetMatrixArray();
2059 const Element *trp0 = cp;
2060 const Element *
const trp0_last = trp0+this->fNelems;
2061 while (trp0 < trp0_last) {
2062 memcpy(trp,trp0,this->fNcols*
sizeof(Element));
2063 for (
const Element *scp = sp; scp < sp+this->fNcols; ) {
2066 for (
Int_t j = 0; j < this->fNcols; j++) {
2067 cij += trp[j] * *scp;
2068 scp += this->fNcols;
2073 trp0 += this->fNcols;
2077 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
2088 template<
class Element>
2095 Error(
"operator*=(const TMatrixTDiag_const &)",
"wrong diagonal length");
2100 Element *mp = this->GetMatrixArray();
2101 const Element *
const mp_last = mp+this->fNelems;
2103 while (mp < mp_last) {
2104 const Element *dp = diag.
GetPtr();
2105 for (
Int_t j = 0; j < this->fNcols; j++) {
2118 template<
class Element>
2125 Error(
"operator/=(const TMatrixTDiag_const &)",
"wrong diagonal length");
2130 Element *mp = this->GetMatrixArray();
2131 const Element *
const mp_last = mp+this->fNelems;
2133 while (mp < mp_last) {
2134 const Element *dp = diag.
GetPtr();
2135 for (
Int_t j = 0; j < this->fNcols; j++) {
2139 Error(
"operator/=",
"%d-diagonal element is zero",j);
2153 template<
class Element>
2161 if (this->fNrows != mt->
GetNrows()) {
2162 Error(
"operator*=(const TMatrixTColumn_const &)",
"wrong column length");
2168 Element *mp = this->GetMatrixArray();
2169 const Element *
const mp_last = mp+this->fNelems;
2170 const Element *cp = col.
GetPtr();
2172 while (mp < mp_last) {
2174 for (
Int_t j = 0; j < this->fNcols; j++)
2186 template<
class Element>
2194 if (this->fNrows != mt->
GetNrows()) {
2195 Error(
"operator/=(const TMatrixTColumn_const &)",
"wrong column matrix");
2201 Element *mp = this->GetMatrixArray();
2202 const Element *
const mp_last = mp+this->fNelems;
2203 const Element *cp = col.
GetPtr();
2205 while (mp < mp_last) {
2208 for (
Int_t j = 0; j < this->fNcols; j++)
2212 Error(
"operator/=",
"%d-row of matrix column is zero",icol);
2225 template<
class Element>
2233 if (this->fNcols != mt->
GetNcols()) {
2234 Error(
"operator*=(const TMatrixTRow_const &)",
"wrong row length");
2240 Element *mp = this->GetMatrixArray();
2241 const Element *
const mp_last = mp+this->fNelems;
2243 while (mp < mp_last) {
2244 const Element *rp = row.
GetPtr();
2245 for (
Int_t j = 0; j < this->fNcols; j++) {
2259 template<
class Element>
2266 if (this->fNcols != mt->
GetNcols()) {
2267 Error(
"operator/=(const TMatrixTRow_const &)",
"wrong row length");
2272 Element *mp = this->GetMatrixArray();
2273 const Element *
const mp_last = mp+this->fNelems;
2275 while (mp < mp_last) {
2276 const Element *rp = row.
GetPtr();
2277 for (
Int_t j = 0; j < this->fNcols; j++) {
2282 Error(
"operator/=",
"%d-col of matrix row is zero",j);
2298 template<
class Element>
2301 if (!this->IsSymmetric())
2302 Warning(
"EigenVectors(TVectorT &)",
"Only real part of eigen-values will be returned");
2304 eigenValues.
ResizeTo(this->fNrows);
2312 template<
class Element>
2323 template<
class Element>
2334 template<
class Element>
2343 template<
class Element>
2354 template<
class Element>
2363 template<
class Element>
2374 template<
class Element>
2385 template<
class Element>
2388 return Element(-1.0)*(
operator-(source2,source1));
2394 template<
class Element>
2405 template<
class Element>
2408 return Element(-1.0)*
operator-(source,val);
2414 template<
class Element>
2425 template<
class Element>
2434 template<
class Element>
2444 template<
class Element>
2454 template<
class Element>
2464 template<
class Element>
2474 template<
class Element>
2480 Error(
"operator&&(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2490 while (tp < tp_last)
2491 *tp++ = (*sp1++ != 0.0 && *sp2++ != 0.0);
2499 template<
class Element>
2505 Error(
"operator&&(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2515 while (tp < tp_last)
2516 *tp++ = (*sp1++ != 0.0 && *sp2++ != 0.0);
2524 template<
class Element>
2533 template<
class Element>
2539 Error(
"operator||(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2549 while (tp < tp_last)
2550 *tp++ = (*sp1++ != 0.0 || *sp2++ != 0.0);
2558 template<
class Element>
2564 Error(
"operator||(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2574 while (tp < tp_last)
2575 *tp++ = (*sp1++ != 0.0 || *sp2++ != 0.0);
2583 template<
class Element>
2592 template<
class Element>
2598 Error(
"operator|(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2608 while (tp < tp_last) {
2609 *tp++ = (*sp1) > (*sp2); sp1++; sp2++;
2618 template<
class Element>
2624 Error(
"operator>(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2634 while (tp < tp_last) {
2635 *tp++ = (*sp1) > (*sp2); sp1++; sp2++;
2644 template<
class Element>
2653 template<
class Element>
2659 Error(
"operator>=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2669 while (tp < tp_last) {
2670 *tp++ = (*sp1) >= (*sp2); sp1++; sp2++;
2679 template<
class Element>
2685 Error(
"operator>=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2695 while (tp < tp_last) {
2696 *tp++ = (*sp1) >= (*sp2); sp1++; sp2++;
2705 template<
class Element>
2714 template<
class Element>
2720 Error(
"operator<=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2727 const Element *sp2 = source2.GetMatrixArray();
2730 while (tp < tp_last) {
2731 *tp++ = (*sp1) <= (*sp2); sp1++; sp2++;
2740 template<
class Element>
2746 Error(
"operator<=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2753 const Element *sp2 = source2.GetMatrixArray();
2756 while (tp < tp_last) {
2757 *tp++ = (*sp1) <= (*sp2); sp1++; sp2++;
2766 template<
class Element>
2775 template<
class Element>
2781 Error(
"operator<(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2786 const Element *sp2 = source2.GetMatrixArray();
2789 while (tp < tp_last) {
2790 *tp++ = (*sp1) < (*sp2); sp1++; sp2++;
2799 template<
class Element>
2805 Error(
"operator<(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2812 const Element *sp2 = source2.GetMatrixArray();
2815 while (tp < tp_last) {
2816 *tp++ = (*sp1) < (*sp2); sp1++; sp2++;
2825 template<
class Element>
2834 template<
class Element>
2840 Error(
"operator!=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2850 while (tp != tp_last) {
2851 *tp++ = (*sp1) != (*sp2); sp1++; sp2++;
2860 template<
class Element>
2866 Error(
"operator!=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2876 while (tp != tp_last) {
2877 *tp++ = (*sp1) != (*sp2); sp1++; sp2++;
2886 template<
class Element>
2896 template<class Element>
2897 TMatrixT<Element> operator!=(const TMatrixT<Element> &source1,Element val)
2899 TMatrixT<Element> target; target.ResizeTo(source1);
2901 const Element *sp = source1.GetMatrixArray();
2902 Element *tp = target.GetMatrixArray();
2903 const Element * const tp_last = tp+target.GetNoElements();
2904 while (tp != tp_last) {
2905 *tp++ = (*sp != val); sp++;
2914 template<class Element>
2915 TMatrixT<Element> operator!=(Element val,const TMatrixT<Element> &source1)
2917 return operator!=(source1,val);
2924 template<
class Element>
2928 ::Error(
"Add(TMatrixT &,Element,const TMatrixT &)",
"matrices not compatible");
2937 *tp++ = scalar * (*sp++);
2938 }
else if (scalar == 1.) {
2943 *tp++ += scalar * (*sp++);
2952 template<
class Element>
2956 ::Error(
"Add(TMatrixT &,Element,const TMatrixTSym &)",
"matrices not compatible");
2964 *tp++ += scalar * (*sp++);
2972 template<
class Element>
2976 ::Error(
"ElementMult(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
2992 template<
class Element>
2996 ::Error(
"ElementMult(TMatrixT &,const TMatrixTSym &)",
"matrices not compatible");
3012 template<
class Element>
3016 ::Error(
"ElementDiv(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
3023 while ( tp < ftp ) {
3029 Error(
"ElementDiv",
"source (%d,%d) is zero",irow,icol);
3040 template<
class Element>
3044 ::Error(
"ElementDiv(TMatrixT &,const TMatrixTSym &)",
"matrices not compatible");
3051 while ( tp < ftp ) {
3057 Error(
"ElementDiv",
"source (%d,%d) is zero",irow,icol);
3068 template<
class Element>
3070 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp)
3072 const Element *arp0 = ap;
3073 while (arp0 < ap+na) {
3074 for (
const Element *bcp = bp; bcp < bp+ncolsb; ) {
3075 const Element *arp = arp0;
3077 while (bcp < bp+nb) {
3078 cij += *arp++ * *bcp;
3091 template<
class Element>
3093 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp)
3095 const Element *acp0 = ap;
3096 while (acp0 < ap+ncolsa) {
3097 for (
const Element *bcp = bp; bcp < bp+ncolsb; ) {
3098 const Element *acp = acp0;
3100 while (bcp < bp+nb) {
3115 template<
class Element>
3117 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp)
3119 const Element *arp0 = ap;
3120 while (arp0 < ap+na) {
3121 const Element *brp0 = bp;
3122 while (brp0 < bp+nb) {
3123 const Element *arp = arp0;
3124 const Element *brp = brp0;
3126 while (brp < brp0+ncolsb)
3127 cij += *arp++ * *brp++;
3138 template<
class Element>
3147 }
else if (R__v == 2) {
3149 TObject::Streamer(R__b);
3151 R__b >> this->fNrows;
3152 R__b >> this->fNcols;
3153 R__b >> this->fNelems;
3154 R__b >> this->fRowLwb;
3155 R__b >> this->fColLwb;
3159 if (this->fNelems > 0) {
3160 fElements =
new Element[this->fNelems];
3167 TObject::Streamer(R__b);
3169 R__b >> this->fNrows;
3170 R__b >> this->fNcols;
3171 R__b >> this->fRowLwb;
3172 R__b >> this->fColLwb;
3173 this->fNelems = R__b.
ReadArray(fElements);
3177 if (R__v <= 2 && fElements) {
3178 for (
Int_t i = 0; i < this->fNrows; i++) {
3179 const Int_t off_i = i*this->fNcols;
3180 for (
Int_t j = i; j < this->fNcols; j++) {
3181 const Int_t off_j = j*this->fNrows;
3182 const Element tmp = fElements[off_i+j];
3183 fElements[off_i+j] = fElements[off_j+i];
3184 fElements[off_j+i] = tmp;
3188 if (this->fNelems > 0 && this->fNelems <= this->kSizeMax) {
3190 memcpy(fDataStack,fElements,this->fNelems*
sizeof(Element));
3191 delete [] fElements;
3193 fElements = fDataStack;
3194 }
else if (this->fNelems < 0)
3204 #ifndef ROOT_TMatrixFfwd
3207 #ifndef ROOT_TMatrixFSymfwd
3211 template TMatrixF
operator+ <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3212 template TMatrixF
operator+ <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3213 template TMatrixF
operator+ <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3214 template TMatrixF
operator+ <
Float_t>(
const TMatrixF &source ,
Float_t val );
3215 template TMatrixF
operator+ <
Float_t>(
Float_t val ,
const TMatrixF &source );
3216 template TMatrixF
operator- <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3217 template TMatrixF
operator- <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3218 template TMatrixF
operator- <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3219 template TMatrixF
operator- <
Float_t>(
const TMatrixF &source ,
Float_t val );
3220 template TMatrixF
operator- <
Float_t>(
Float_t val ,
const TMatrixF &source );
3221 template TMatrixF
operator* <
Float_t>(
Float_t val ,
const TMatrixF &source );
3222 template TMatrixF
operator* <
Float_t>(
const TMatrixF &source ,
Float_t val );
3223 template TMatrixF
operator* <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3224 template TMatrixF
operator* <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3225 template TMatrixF
operator* <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3227 template TMatrixF
operator&& <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3228 template TMatrixF
operator&& <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3229 template TMatrixF
operator&& <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3230 template TMatrixF
operator|| <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3231 template TMatrixF
operator|| <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3232 template TMatrixF
operator|| <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3233 template TMatrixF
operator> <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3234 template TMatrixF
operator> <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3235 template TMatrixF
operator> <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3236 template TMatrixF
operator>= <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3237 template TMatrixF
operator>= <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3238 template TMatrixF
operator>= <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3245 template TMatrixF
operator!= <
Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3246 template TMatrixF
operator!= <
Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3247 template TMatrixF
operator!= <
Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3263 #ifndef ROOT_TMatrixDfwd
3266 #ifndef ROOT_TMatrixDSymfwd
3270 template class TMatrixT<Double_t>;
3272 template TMatrixD
operator+ <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3273 template TMatrixD
operator+ <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3274 template TMatrixD
operator+ <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3275 template TMatrixD
operator+ <
Double_t>(
const TMatrixD &source ,
Double_t val );
3276 template TMatrixD
operator+ <
Double_t>(
Double_t val ,
const TMatrixD &source );
3277 template TMatrixD
operator- <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3278 template TMatrixD
operator- <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3279 template TMatrixD
operator- <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3280 template TMatrixD
operator- <
Double_t>(
const TMatrixD &source ,
Double_t val );
3281 template TMatrixD
operator- <
Double_t>(
Double_t val ,
const TMatrixD &source );
3282 template TMatrixD
operator* <
Double_t>(
Double_t val ,
const TMatrixD &source );
3283 template TMatrixD
operator* <
Double_t>(
const TMatrixD &source ,
Double_t val );
3284 template TMatrixD
operator* <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3285 template TMatrixD
operator* <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3286 template TMatrixD
operator* <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3288 template TMatrixD
operator&& <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3289 template TMatrixD
operator&& <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3290 template TMatrixD
operator&& <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3291 template TMatrixD
operator|| <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3292 template TMatrixD
operator|| <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3293 template TMatrixD
operator|| <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3294 template TMatrixD
operator> <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3295 template TMatrixD
operator> <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3296 template TMatrixD
operator> <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3297 template TMatrixD
operator>= <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3298 template TMatrixD
operator>= <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3299 template TMatrixD
operator>= <
Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3306 template TMatrixD
operator!= <
Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3307 template TMatrixD
operator!= <
Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3308 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