37template <
class Element>
46template <
class Element>
60template <
class Element>
70template <
class Element>
81template <
class Element>
92template <
class Element>
103template <
class Element>
116template <
class Element>
141 const Element
oldTol = this->SetTol(std::numeric_limits<Element>::min());
152 default:
Error(
"TMatrixT(EMatrixCreatorOp1)",
"operation %d not yet implemented",
op);
162template <
class Element>
170 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
175 Allocate(
a.GetNcols(),
b.GetNcols(),
a.GetColLwb(),
b.GetColLwb(), 1);
180 Allocate(
a.GetNrows(),
b.GetNrows(),
a.GetRowLwb(),
b.GetRowLwb(), 1);
185 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
187 if (
a.GetNrows() ==
b.GetNcols()) {
189 const Element
oldTol = this->SetTol(std::numeric_limits<Element>::min());
195 const Element
oldTol =
ainv.SetTol(std::numeric_limits<Element>::min());
204 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
210 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
215 default:
Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented",
op);
224template <
class Element>
232 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
237 Allocate(
a.GetNcols(),
b.GetNcols(),
a.GetColLwb(),
b.GetColLwb(), 1);
242 Allocate(
a.GetNrows(),
b.GetNrows(),
a.GetRowLwb(),
b.GetRowLwb(), 1);
247 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
249 const Element
oldTol = this->SetTol(std::numeric_limits<Element>::min());
257 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
263 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
268 default:
Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented",
op);
278template <
class Element>
286 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
291 Allocate(
a.GetNcols(),
b.GetNcols(),
a.GetColLwb(),
b.GetColLwb(), 1);
296 Allocate(
a.GetNrows(),
b.GetNrows(),
a.GetRowLwb(),
b.GetRowLwb(), 1);
301 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
303 if (
a.GetNrows() ==
b.GetNcols()) {
305 const Element
oldTol = this->SetTol(std::numeric_limits<Element>::min());
311 const Element
oldTol =
ainv.SetTol(std::numeric_limits<Element>::min());
320 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
326 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
331 default:
Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented",
op);
340template <
class Element>
348 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
353 Allocate(
a.GetNcols(),
b.GetNcols(),
a.GetColLwb(),
b.GetColLwb(), 1);
358 Allocate(
a.GetNrows(),
b.GetNrows(),
a.GetRowLwb(),
b.GetRowLwb(), 1);
363 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
365 const Element
oldTol = this->SetTol(std::numeric_limits<Element>::min());
373 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
379 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
384 default:
Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented",
op);
391template <
class Element>
403template <
class Element>
407 if (
size > this->kSizeMax)
417template <
class Element>
436template <
class Element>
461template <
class Element>
465 this->fIsOwner =
kTRUE;
466 this->fTol = std::numeric_limits<Element>::epsilon();
485 this->fNelems = this->fNrows * this->fNcols;
488 if (((
Long64_t)this->fNrows) * this->fNcols != this->fNelems) {
494 if (this->fNelems > 0) {
495 fElements = New_m(this->fNelems);
497 memset(fElements, 0, this->fNelems *
sizeof(Element));
505template <
class Element>
510 Error(
"Plus",
"matrices not compatible");
514 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
515 Error(
"Plus",
"this->GetMatrixArray() == a.GetMatrixArray()");
519 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
520 Error(
"Plus",
"this->GetMatrixArray() == b.GetMatrixArray()");
525 const Element *
ap =
a.GetMatrixArray();
526 const Element *
bp =
b.GetMatrixArray();
527 Element *
cp = this->GetMatrixArray();
528 const Element *
const cp_last =
cp + this->fNelems;
539template <
class Element>
544 Error(
"Plus",
"matrices not compatible");
548 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
549 Error(
"Plus",
"this->GetMatrixArray() == a.GetMatrixArray()");
553 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
554 Error(
"Plus",
"this->GetMatrixArray() == b.GetMatrixArray()");
559 const Element *
ap =
a.GetMatrixArray();
560 const Element *
bp =
b.GetMatrixArray();
561 Element *
cp = this->GetMatrixArray();
562 const Element *
const cp_last =
cp + this->fNelems;
573template <
class Element>
578 Error(
"Minus",
"matrices not compatible");
582 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
583 Error(
"Minus",
"this->GetMatrixArray() == a.GetMatrixArray()");
587 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
588 Error(
"Minus",
"this->GetMatrixArray() == b.GetMatrixArray()");
593 const Element *
ap =
a.GetMatrixArray();
594 const Element *
bp =
b.GetMatrixArray();
595 Element *
cp = this->GetMatrixArray();
596 const Element *
const cp_last =
cp + this->fNelems;
607template <
class Element>
612 Error(
"Minus",
"matrices not compatible");
616 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
617 Error(
"Minus",
"this->GetMatrixArray() == a.GetMatrixArray()");
621 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
622 Error(
"Minus",
"this->GetMatrixArray() == b.GetMatrixArray()");
627 const Element *
ap =
a.GetMatrixArray();
628 const Element *
bp =
b.GetMatrixArray();
629 Element *
cp = this->GetMatrixArray();
630 const Element *
const cp_last =
cp + this->fNelems;
641template <
class Element>
645 if (
a.GetNcols() !=
b.GetNrows() ||
a.GetColLwb() !=
b.GetRowLwb()) {
646 Error(
"Mult",
"A rows and B columns incompatible");
650 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
651 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
655 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
656 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
662 const Element *
ap =
a.GetMatrixArray();
663 const Element *
bp =
b.GetMatrixArray();
664 Element *
cp = this->GetMatrixArray();
665 if (
typeid(Element) ==
typeid(
Double_t))
666 cblas_dgemm(
CblasRowMajor,
CblasNoTrans,
CblasNoTrans, fNrows, fNcols,
a.GetNcols(), 1.0,
ap,
a.GetNcols(),
bp,
667 b.GetNcols(), 1.0,
cp, fNcols);
668 else if (
typeid(Element) !=
typeid(
Float_t))
669 cblas_sgemm(
CblasRowMajor,
CblasNoTrans,
CblasNoTrans, fNrows, fNcols,
a.GetNcols(), 1.0,
ap,
a.GetNcols(),
bp,
670 b.GetNcols(), 1.0,
cp, fNcols);
672 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
678 const Element *
const ap =
a.GetMatrixArray();
679 const Element *
const bp =
b.GetMatrixArray();
680 Element *
cp = this->GetMatrixArray();
690template <
class Element>
696 if (
a.GetNcols() !=
b.GetNrows() ||
a.GetColLwb() !=
b.GetRowLwb()) {
697 Error(
"Mult",
"A rows and B columns incompatible");
701 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
702 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
706 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
707 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
713 const Element *
ap =
a.GetMatrixArray();
714 const Element *
bp =
b.GetMatrixArray();
715 Element *
cp = this->GetMatrixArray();
716 if (
typeid(Element) ==
typeid(
Double_t))
717 cblas_dsymm(
CblasRowMajor,
CblasLeft,
CblasUpper, fNrows, fNcols, 1.0,
ap,
a.GetNcols(),
bp,
b.GetNcols(), 0.0,
719 else if (
typeid(Element) !=
typeid(
Float_t))
720 cblas_ssymm(
CblasRowMajor,
CblasLeft,
CblasUpper, fNrows, fNcols, 1.0,
ap,
a.GetNcols(),
bp,
b.GetNcols(), 0.0,
723 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
729 const Element *
const ap =
a.GetMatrixArray();
730 const Element *
const bp =
b.GetMatrixArray();
731 Element *
cp = this->GetMatrixArray();
742template <
class Element>
748 if (
a.GetNcols() !=
b.GetNrows() ||
a.GetColLwb() !=
b.GetRowLwb()) {
749 Error(
"Mult",
"A rows and B columns incompatible");
753 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
754 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
758 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
759 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
765 const Element *
ap =
a.GetMatrixArray();
766 const Element *
bp =
b.GetMatrixArray();
767 Element *
cp = this->GetMatrixArray();
768 if (
typeid(Element) ==
typeid(
Double_t))
769 cblas_dsymm(
CblasRowMajor,
CblasRight,
CblasUpper, fNrows, fNcols, 1.0,
bp,
b.GetNcols(),
ap,
a.GetNcols(), 0.0,
771 else if (
typeid(Element) !=
typeid(
Float_t))
772 cblas_ssymm(
CblasRowMajor,
CblasRight,
CblasUpper, fNrows, fNcols, 1.0,
bp,
b.GetNcols(),
ap,
a.GetNcols(), 0.0,
775 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
781 const Element *
const ap =
a.GetMatrixArray();
782 const Element *
const bp =
b.GetMatrixArray();
783 Element *
cp = this->GetMatrixArray();
794template <
class Element>
800 if (
a.GetNcols() !=
b.GetNrows() ||
a.GetColLwb() !=
b.GetRowLwb()) {
801 Error(
"Mult",
"A rows and B columns incompatible");
805 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
806 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
810 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
811 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
817 const Element *
ap =
a.GetMatrixArray();
818 const Element *
bp =
b.GetMatrixArray();
819 Element *
cp = this->GetMatrixArray();
820 if (
typeid(Element) ==
typeid(
Double_t))
821 cblas_dsymm(
CblasRowMajor,
CblasLeft,
CblasUpper, fNrows, fNcols, 1.0,
ap,
a.GetNcols(),
bp,
b.GetNcols(), 0.0,
823 else if (
typeid(Element) !=
typeid(
Float_t))
824 cblas_ssymm(
CblasRowMajor,
CblasLeft,
CblasUpper, fNrows, fNcols, 1.0,
ap,
a.GetNcols(),
bp,
b.GetNcols(), 0.0,
827 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
833 const Element *
const ap =
a.GetMatrixArray();
834 const Element *
const bp =
b.GetMatrixArray();
835 Element *
cp = this->GetMatrixArray();
845template <
class Element>
851 if (
a.GetNrows() !=
b.GetNrows() ||
a.GetRowLwb() !=
b.GetRowLwb()) {
852 Error(
"TMult",
"A rows and B columns incompatible");
856 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
857 Error(
"TMult",
"this->GetMatrixArray() == a.GetMatrixArray()");
861 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
862 Error(
"TMult",
"this->GetMatrixArray() == b.GetMatrixArray()");
868 const Element *
ap =
a.GetMatrixArray();
869 const Element *
bp =
b.GetMatrixArray();
870 Element *
cp = this->GetMatrixArray();
871 if (
typeid(Element) ==
typeid(
Double_t))
873 a.GetNcols(),
bp,
b.GetNcols(), 1.0,
cp,
this->fNcols);
874 else if (
typeid(Element) !=
typeid(
Float_t))
875 cblas_sgemm(
CblasRowMajor,
CblasTrans,
CblasNoTrans, fNrows, fNcols,
a.GetNrows(), 1.0,
ap,
a.GetNcols(),
bp,
876 b.GetNcols(), 1.0,
cp, fNcols);
878 Error(
"TMult",
"type %s not implemented in BLAS library",
typeid(Element));
883 const Element *
const ap =
a.GetMatrixArray();
884 const Element *
const bp =
b.GetMatrixArray();
885 Element *
cp = this->GetMatrixArray();
895template <
class Element>
901 if (
a.GetNrows() !=
b.GetNrows() ||
a.GetRowLwb() !=
b.GetRowLwb()) {
902 Error(
"TMult",
"A rows and B columns incompatible");
906 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
907 Error(
"TMult",
"this->GetMatrixArray() == a.GetMatrixArray()");
911 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
912 Error(
"TMult",
"this->GetMatrixArray() == b.GetMatrixArray()");
918 const Element *
ap =
a.GetMatrixArray();
919 const Element *
bp =
b.GetMatrixArray();
920 Element *
cp = this->GetMatrixArray();
921 if (
typeid(Element) ==
typeid(
Double_t))
922 cblas_dgemm(
CblasRowMajor,
CblasTrans,
CblasNoTrans, fNrows, fNcols,
a.GetNrows(), 1.0,
ap,
a.GetNcols(),
bp,
923 b.GetNcols(), 1.0,
cp, fNcols);
924 else if (
typeid(Element) !=
typeid(
Float_t))
925 cblas_sgemm(
CblasRowMajor,
CblasTrans,
CblasNoTrans, fNrows, fNcols,
a.GetNrows(), 1.0,
ap,
a.GetNcols(),
bp,
926 b.GetNcols(), 1.0,
cp, fNcols);
928 Error(
"TMult",
"type %s not implemented in BLAS library",
typeid(Element));
933 const Element *
const ap =
a.GetMatrixArray();
934 const Element *
const bp =
b.GetMatrixArray();
935 Element *
cp = this->GetMatrixArray();
944template <
class Element>
951 if (
a.GetNcols() !=
b.GetNcols() ||
a.GetColLwb() !=
b.GetColLwb()) {
952 Error(
"MultT",
"A rows and B columns incompatible");
956 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
957 Error(
"MultT",
"this->GetMatrixArray() == a.GetMatrixArray()");
961 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
962 Error(
"MultT",
"this->GetMatrixArray() == b.GetMatrixArray()");
968 const Element *
ap =
a.GetMatrixArray();
969 const Element *
bp =
b.GetMatrixArray();
970 Element *
cp = this->GetMatrixArray();
971 if (
typeid(Element) ==
typeid(
Double_t))
972 cblas_dgemm(
CblasRowMajor,
CblasNoTrans,
CblasTrans, fNrows, fNcols,
a.GetNcols(), 1.0,
ap,
a.GetNcols(),
bp,
973 b.GetNcols(), 1.0,
cp, fNcols);
974 else if (
typeid(Element) !=
typeid(
Float_t))
975 cblas_sgemm(
CblasRowMajor,
CblasNoTrans,
CblasTrans, fNrows, fNcols,
a.GetNcols(), 1.0,
ap,
a.GetNcols(),
bp,
976 b.GetNcols(), 1.0,
cp, fNcols);
978 Error(
"MultT",
"type %s not implemented in BLAS library",
typeid(Element));
984 const Element *
const ap =
a.GetMatrixArray();
985 const Element *
const bp =
b.GetMatrixArray();
986 Element *
cp = this->GetMatrixArray();
996template <
class Element>
1002 if (
a.GetNcols() !=
b.GetNcols() ||
a.GetColLwb() !=
b.GetColLwb()) {
1003 Error(
"MultT",
"A rows and B columns incompatible");
1007 if (this->GetMatrixArray() ==
a.GetMatrixArray()) {
1008 Error(
"MultT",
"this->GetMatrixArray() == a.GetMatrixArray()");
1012 if (this->GetMatrixArray() ==
b.GetMatrixArray()) {
1013 Error(
"MultT",
"this->GetMatrixArray() == b.GetMatrixArray()");
1019 const Element *
ap =
a.GetMatrixArray();
1020 const Element *
bp =
b.GetMatrixArray();
1021 Element *
cp = this->GetMatrixArray();
1022 if (
typeid(Element) ==
typeid(
Double_t))
1024 a.GetNcols(),
bp,
b.GetNcols(), 1.0,
cp,
this->fNcols);
1025 else if (
typeid(Element) !=
typeid(
Float_t))
1026 cblas_sgemm(
CblasRowMajor,
CblasNoTrans,
CblasTrans, fNrows, fNcols,
a.GetNcols(), 1.0,
ap,
a.GetNcols(),
bp,
1027 b.GetNcols(), 1.0,
cp, fNcols);
1029 Error(
"MultT",
"type %s not implemented in BLAS library",
typeid(Element));
1031 const Int_t na =
a.GetNoElements();
1032 const Int_t nb =
b.GetNoElements();
1035 const Element *
const ap =
a.GetMatrixArray();
1036 const Element *
const bp =
b.GetMatrixArray();
1037 Element *
cp = this->GetMatrixArray();
1046template <
class Element>
1065 this->fNelems = this->fNrows * this->fNcols;
1079template <
class Element>
1086 Error(
"GetSub",
"row_lwb out of bounds");
1090 Error(
"GetSub",
"col_lwb out of bounds");
1094 Error(
"GetSub",
"row_upb out of bounds");
1098 Error(
"GetSub",
"col_upb out of bounds");
1102 Error(
"GetSub",
"row_upb < row_lwb || col_upb < col_lwb");
1120 if (
target.GetRowIndexArray() &&
target.GetColIndexArray()) {
1127 const Element *
ap = this->GetMatrixArray() + (
row_lwb - this->fRowLwb) * this->fNcols + (
col_lwb - this->fColLwb);
1128 Element *
bp =
target.GetMatrixArray();
1146template <
class Element>
1154 Error(
"SetSub",
"row_lwb outof bounds");
1158 Error(
"SetSub",
"col_lwb outof bounds");
1163 Error(
"SetSub",
"source matrix too large");
1171 if (
source.GetRowIndexArray() &&
source.GetColIndexArray()) {
1180 const Element *
bp =
source.GetMatrixArray();
1181 Element *
ap = this->GetMatrixArray() + (
row_lwb - this->fRowLwb) * this->fNcols + (
col_lwb - this->fColLwb);
1200template <
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)
1213 this->fNrows =
nrows;
1214 this->fNcols =
ncols;
1230 if (this->fNelems > this->kSizeMax ||
nelems_old > this->kSizeMax)
1264template <
class Element>
1269 if (!this->fIsOwner) {
1270 Error(
"ResizeTo(Int_t,Int_t,Int_t,Int_t)",
"Not owner of data array,cannot resize");
1277 if (this->fNelems > 0) {
1304 if (this->fNelems > this->kSizeMax ||
nelems_old > this->kSizeMax)
1329 (this->fNcols -
ncols_copy) *
sizeof(Element));
1352template <
class Element>
1365template <
class Element>
1387template <
class Element>
1392 std::copy(tmp.GetMatrixArray(), tmp.GetMatrixArray() +
this->GetNoElements(),
this->GetMatrixArray());
1401template <
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");
1424 TMatrixTCramerInv::Inv2x2<Element>(*
this,
det);
1428 TMatrixTCramerInv::Inv3x3<Element>(*
this,
det);
1432 TMatrixTCramerInv::Inv4x4<Element>(*
this,
det);
1436 TMatrixTCramerInv::Inv5x5<Element>(*
this,
det);
1440 TMatrixTCramerInv::Inv6x6<Element>(*
this,
det);
1452template <
class Element>
1458 if (this->GetMatrixArray() ==
source.GetMatrixArray()) {
1459 Element *
ap = this->GetMatrixArray();
1460 if (this->fNrows == this->fNcols && this->fRowLwb == this->fColLwb) {
1461 for (
Int_t i = 0; i < this->fNrows; i++) {
1463 for (
Int_t j = i + 1;
j < this->fNcols;
j++) {
1491 if (this->fNrows !=
source.GetNcols() || this->fNcols !=
source.GetNrows() ||
1492 this->fRowLwb !=
source.GetColLwb() || this->fColLwb !=
source.GetRowLwb()) {
1493 Error(
"Transpose",
"matrix has wrong shape");
1497 const Element *
sp1 =
source.GetMatrixArray();
1498 const Element *
scp =
sp1;
1499 Element *
tp = this->GetMatrixArray();
1500 const Element *
const tp_last = this->GetMatrixArray() + this->fNelems;
1505 const Element *
sp2 =
scp++;
1510 sp2 += this->fNrows;
1523template <
class Element>
1530 Error(
"Rank1Update",
"vector too short");
1535 const Element *
const pv =
v.GetMatrixArray();
1536 Element *
mp = this->GetMatrixArray();
1538 for (
Int_t i = 0; i < this->fNrows; i++) {
1539 const Element tmp = alpha *
pv[i];
1540 for (
Int_t j = 0;
j < this->fNcols;
j++)
1541 *
mp++ += tmp *
pv[
j];
1551template <
class Element>
1559 if (
v1.GetNoElements() <
this->fNrows) {
1560 Error(
"Rank1Update",
"vector v1 too short");
1564 if (
v2.GetNoElements() <
this->fNcols) {
1565 Error(
"Rank1Update",
"vector v2 too short");
1570 const Element *
const pv1 =
v1.GetMatrixArray();
1571 const Element *
const pv2 =
v2.GetMatrixArray();
1572 Element *
mp = this->GetMatrixArray();
1574 for (
Int_t i = 0; i < this->fNrows; i++) {
1575 const Element tmp = alpha *
pv1[i];
1576 for (
Int_t j = 0;
j < this->fNcols;
j++)
1586template <
class Element>
1592 if (this->fNcols != this->fNrows || this->fColLwb != this->fRowLwb) {
1593 Error(
"Similarity(const TVectorT &)",
"matrix is not square");
1597 if (this->fNcols !=
v.GetNrows() ||
this->fColLwb !=
v.GetLwb()) {
1598 Error(
"Similarity(const TVectorT &)",
"vector and matrix incompatible");
1603 const Element *
mp = this->GetMatrixArray();
1604 const Element *
vp =
v.GetMatrixArray();
1608 const Element *
const vp_last =
vp +
v.GetNrows();
1616 R__ASSERT(
mp == this->GetMatrixArray() + this->GetNoElements());
1627template <
class Element>
1633 if (
v.GetNoElements() <
this->fNrows) {
1634 Error(
"NormByColumn",
"vector shorter than matrix column");
1643 const Element *
pv =
v.GetMatrixArray();
1644 Element *
mp = this->GetMatrixArray();
1645 const Element *
const mp_last =
mp + this->fNelems;
1649 for (
Int_t j = 0;
j < this->fNcols;
j++) {
1653 Error(
"NormbyColumn",
"vector element %ld is zero",
Long_t(
pv -
v.GetMatrixArray()));
1660 for (
Int_t j = 0;
j < this->fNcols;
j++)
1673template <
class Element>
1679 if (
v.GetNoElements() <
this->fNcols) {
1680 Error(
"NormByRow",
"vector shorter than matrix column");
1689 const Element *
pv0 =
v.GetMatrixArray();
1690 const Element *
pv =
pv0;
1691 Element *
mp = this->GetMatrixArray();
1692 const Element *
const mp_last =
mp + this->fNelems;
1696 for (
Int_t j = 0;
j < this->fNcols;
j++) {
1706 for (
Int_t j = 0;
j < this->fNcols;
j++)
1716template <
class Element>
1720 Error(
"operator=(const TMatrixT &)",
"matrices not compatible");
1724 if (this->GetMatrixArray() !=
source.GetMatrixArray()) {
1726 memcpy(fElements,
source.GetMatrixArray(),
this->fNelems *
sizeof(Element));
1727 this->fTol =
source.GetTol();
1735template <
class Element>
1739 Error(
"operator=(const TMatrixTSym &)",
"matrices not compatible");
1743 if (this->GetMatrixArray() !=
source.GetMatrixArray()) {
1745 memcpy(fElements,
source.GetMatrixArray(),
this->fNelems *
sizeof(Element));
1746 this->fTol =
source.GetTol();
1754template <
class Element>
1759 Error(
"operator=(const TMatrixTSparse &",
"matrices not compatible");
1763 if (this->GetMatrixArray() !=
source.GetMatrixArray()) {
1765 memset(fElements, 0, this->fNelems *
sizeof(Element));
1767 const Element *
const sp =
source.GetMatrixArray();
1768 Element *
tp = this->GetMatrixArray();
1780 this->fTol =
source.GetTol();
1788template <
class Element>
1795 Error(
"operator=(const TMatrixTLazy&)",
"matrix is incompatible with "
1796 "the assigned Lazy matrix");
1807template <
class Element>
1812 Element *
ep = this->GetMatrixArray();
1813 const Element *
const ep_last =
ep + this->fNelems;
1823template <
class Element>
1828 Element *
ep = this->GetMatrixArray();
1829 const Element *
const ep_last =
ep + this->fNelems;
1839template <
class Element>
1844 Element *
ep = this->GetMatrixArray();
1845 const Element *
const ep_last =
ep + this->fNelems;
1855template <
class Element>
1860 Element *
ep = this->GetMatrixArray();
1861 const Element *
const ep_last =
ep + this->fNelems;
1871template <
class Element>
1875 Error(
"operator+=(const TMatrixT &)",
"matrices not compatible");
1879 const Element *
sp =
source.GetMatrixArray();
1880 Element *
tp = this->GetMatrixArray();
1881 const Element *
const tp_last =
tp + this->fNelems;
1891template <
class Element>
1895 Error(
"operator+=(const TMatrixTSym &)",
"matrices not compatible");
1899 const Element *
sp =
source.GetMatrixArray();
1900 Element *
tp = this->GetMatrixArray();
1901 const Element *
const tp_last =
tp + this->fNelems;
1911template <
class Element>
1915 Error(
"operator=-(const TMatrixT &)",
"matrices not compatible");
1919 const Element *
sp =
source.GetMatrixArray();
1920 Element *
tp = this->GetMatrixArray();
1921 const Element *
const tp_last =
tp + this->fNelems;
1931template <
class Element>
1935 Error(
"operator=-(const TMatrixTSym &)",
"matrices not compatible");
1939 const Element *
sp =
source.GetMatrixArray();
1940 Element *
tp = this->GetMatrixArray();
1941 const Element *
const tp_last =
tp + this->fNelems;
1953template <
class Element>
1959 if (this->fNcols !=
source.GetNrows() ||
this->fColLwb !=
source.GetRowLwb() ||
1961 Error(
"operator*=(const TMatrixT &)",
"source matrix has wrong shape");
1969 if (this->GetMatrixArray() ==
source.GetMatrixArray()) {
1972 sp = tmp.GetMatrixArray();
1977 Element
work[kWorkMax];
1980 if (this->fNcols > kWorkMax) {
1982 trp =
new Element[this->fNcols];
1985 Element *
cp = this->GetMatrixArray();
1986 const Element *
trp0 =
cp;
1990 for (
const Element *
scp =
sp;
scp <
sp + this->fNcols;) {
1993 for (
Int_t j = 0;
j < this->fNcols;
j++) {
1995 scp += this->fNcols;
2000 trp0 += this->fNcols;
2015template <
class Element>
2021 if (this->fNcols !=
source.GetNrows() ||
this->fColLwb !=
source.GetRowLwb()) {
2022 Error(
"operator*=(const TMatrixTSym &)",
"source matrix has wrong shape");
2030 if (this->GetMatrixArray() ==
source.GetMatrixArray()) {
2033 sp = tmp.GetMatrixArray();
2038 Element
work[kWorkMax];
2041 if (this->fNcols > kWorkMax) {
2043 trp =
new Element[this->fNcols];
2046 Element *
cp = this->GetMatrixArray();
2047 const Element *
trp0 =
cp;
2051 for (
const Element *
scp =
sp;
scp <
sp + this->fNcols;) {
2054 for (
Int_t j = 0;
j < this->fNcols;
j++) {
2056 scp += this->fNcols;
2061 trp0 += this->fNcols;
2076template <
class Element>
2082 if (this->fNcols !=
diag.GetNdiags()) {
2083 Error(
"operator*=(const TMatrixTDiag_const &)",
"wrong diagonal length");
2088 Element *
mp = this->GetMatrixArray();
2089 const Element *
const mp_last =
mp + this->fNelems;
2092 const Element *
dp =
diag.GetPtr();
2093 for (
Int_t j = 0;
j < this->fNcols;
j++) {
2106template <
class Element>
2112 if (this->fNcols !=
diag.GetNdiags()) {
2113 Error(
"operator/=(const TMatrixTDiag_const &)",
"wrong diagonal length");
2118 Element *
mp = this->GetMatrixArray();
2119 const Element *
const mp_last =
mp + this->fNelems;
2122 const Element *
dp =
diag.GetPtr();
2123 for (
Int_t j = 0;
j < this->fNcols;
j++) {
2127 Error(
"operator/=",
"%d-diagonal element is zero",
j);
2141template <
class Element>
2149 if (this->fNrows != mt->GetNrows()) {
2150 Error(
"operator*=(const TMatrixTColumn_const &)",
"wrong column length");
2155 const Element *
const endp = col.GetPtr() + mt->GetNoElements();
2156 Element *
mp = this->GetMatrixArray();
2157 const Element *
const mp_last =
mp + this->fNelems;
2158 const Element *
cp = col.GetPtr();
2162 for (
Int_t j = 0;
j < this->fNcols;
j++)
2174template <
class Element>
2182 if (this->fNrows != mt->GetNrows()) {
2183 Error(
"operator/=(const TMatrixTColumn_const &)",
"wrong column matrix");
2188 const Element *
const endp = col.GetPtr() + mt->GetNoElements();
2189 Element *
mp = this->GetMatrixArray();
2190 const Element *
const mp_last =
mp + this->fNelems;
2191 const Element *
cp = col.GetPtr();
2196 for (
Int_t j = 0;
j < this->fNcols;
j++)
2200 Error(
"operator/=",
"%d-row of matrix column is zero",
icol);
2213template <
class Element>
2221 if (this->fNcols != mt->GetNcols()) {
2222 Error(
"operator*=(const TMatrixTRow_const &)",
"wrong row length");
2227 const Element *
const endp = row.GetPtr() + mt->GetNoElements();
2228 Element *
mp = this->GetMatrixArray();
2229 const Element *
const mp_last =
mp + this->fNelems;
2232 const Element *
rp = row.GetPtr();
2233 for (
Int_t j = 0;
j < this->fNcols;
j++) {
2247template <
class Element>
2254 if (this->fNcols != mt->GetNcols()) {
2255 Error(
"operator/=(const TMatrixTRow_const &)",
"wrong row length");
2259 const Element *
const endp = row.GetPtr() + mt->GetNoElements();
2260 Element *
mp = this->GetMatrixArray();
2261 const Element *
const mp_last =
mp + this->fNelems;
2264 const Element *
rp = row.GetPtr();
2265 for (
Int_t j = 0;
j < this->fNcols;
j++) {
2270 Error(
"operator/=",
"%d-col of matrix row is zero",
j);
2286template <
class Element>
2289 if (!this->IsSymmetric())
2290 Warning(
"EigenVectors(TVectorT &)",
"Only real part of eigen-values will be returned");
2294 return eigen.GetEigenVectors();
2300template <
class Element>
2311template <
class Element>
2322template <
class Element>
2331template <
class Element>
2342template <
class Element>
2351template <
class Element>
2362template <
class Element>
2373template <
class Element>
2382template <
class Element>
2393template <
class Element>
2402template <
class Element>
2413template <
class Element>
2422template <
class Element>
2432template <
class Element>
2442template <
class Element>
2452template <
class Element>
2463template <
class Element>
2469 Error(
"operator&&(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2475 const Element *
sp1 =
source1.GetMatrixArray();
2476 const Element *
sp2 =
source2.GetMatrixArray();
2477 Element *
tp =
target.GetMatrixArray();
2480 *
tp++ = (*
sp1++ != 0.0 && *
sp2++ != 0.0);
2488template <
class Element>
2494 Error(
"operator&&(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2500 const Element *
sp1 =
source1.GetMatrixArray();
2501 const Element *
sp2 =
source2.GetMatrixArray();
2502 Element *
tp =
target.GetMatrixArray();
2505 *
tp++ = (*
sp1++ != 0.0 && *
sp2++ != 0.0);
2513template <
class Element>
2522template <
class Element>
2528 Error(
"operator||(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2534 const Element *
sp1 =
source1.GetMatrixArray();
2535 const Element *
sp2 =
source2.GetMatrixArray();
2536 Element *
tp =
target.GetMatrixArray();
2539 *
tp++ = (*
sp1++ != 0.0 || *
sp2++ != 0.0);
2547template <
class Element>
2553 Error(
"operator||(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2559 const Element *
sp1 =
source1.GetMatrixArray();
2560 const Element *
sp2 =
source2.GetMatrixArray();
2561 Element *
tp =
target.GetMatrixArray();
2564 *
tp++ = (*
sp1++ != 0.0 || *
sp2++ != 0.0);
2572template <
class Element>
2581template <
class Element>
2587 Error(
"operator|(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2593 const Element *
sp1 =
source1.GetMatrixArray();
2594 const Element *
sp2 =
source2.GetMatrixArray();
2595 Element *
tp =
target.GetMatrixArray();
2598 *
tp++ = (*sp1) > (*sp2);
2609template <
class Element>
2615 Error(
"operator>(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2621 const Element *
sp1 =
source1.GetMatrixArray();
2622 const Element *
sp2 =
source2.GetMatrixArray();
2623 Element *
tp =
target.GetMatrixArray();
2626 *
tp++ = (*sp1) > (*sp2);
2637template <
class Element>
2646template <
class Element>
2652 Error(
"operator>=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2658 const Element *
sp1 =
source1.GetMatrixArray();
2659 const Element *
sp2 =
source2.GetMatrixArray();
2660 Element *
tp =
target.GetMatrixArray();
2663 *
tp++ = (*sp1) >= (*sp2);
2674template <
class Element>
2680 Error(
"operator>=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2686 const Element *
sp1 =
source1.GetMatrixArray();
2687 const Element *
sp2 =
source2.GetMatrixArray();
2688 Element *
tp =
target.GetMatrixArray();
2691 *
tp++ = (*sp1) >= (*sp2);
2702template <
class Element>
2711template <
class Element>
2717 Error(
"operator<=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2723 const Element *
sp1 =
source1.GetMatrixArray();
2724 const Element *
sp2 =
source2.GetMatrixArray();
2725 Element *
tp =
target.GetMatrixArray();
2728 *
tp++ = (*sp1) <= (*sp2);
2739template <
class Element>
2745 Error(
"operator<=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2751 const Element *
sp1 =
source1.GetMatrixArray();
2752 const Element *
sp2 =
source2.GetMatrixArray();
2753 Element *
tp =
target.GetMatrixArray();
2756 *
tp++ = (*sp1) <= (*sp2);
2767template <
class Element>
2776template <
class Element>
2782 Error(
"operator<(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2786 const Element *
sp1 =
source1.GetMatrixArray();
2787 const Element *
sp2 =
source2.GetMatrixArray();
2788 Element *
tp =
target.GetMatrixArray();
2791 *
tp++ = (*sp1) < (*sp2);
2802template <
class Element>
2808 Error(
"operator<(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2814 const Element *
sp1 =
source1.GetMatrixArray();
2815 const Element *
sp2 =
source2.GetMatrixArray();
2816 Element *
tp =
target.GetMatrixArray();
2819 *
tp++ = (*sp1) < (*sp2);
2830template <
class Element>
2839template <
class Element>
2845 Error(
"operator!=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2851 const Element *
sp1 =
source1.GetMatrixArray();
2852 const Element *
sp2 =
source2.GetMatrixArray();
2853 Element *
tp =
target.GetMatrixArray();
2856 *
tp++ = (*sp1) != (*sp2);
2867template <
class Element>
2873 Error(
"operator!=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2879 const Element *
sp1 =
source1.GetMatrixArray();
2880 const Element *
sp2 =
source2.GetMatrixArray();
2881 Element *
tp =
target.GetMatrixArray();
2884 *
tp++ = (*sp1) != (*sp2);
2895template <
class Element>
2905template<class Element>
2906TMatrixT<Element> operator!=(const TMatrixT<Element> &source1,Element val)
2908 TMatrixT<Element> target; target.ResizeTo(source1);
2910 const Element *sp = source1.GetMatrixArray();
2911 Element *tp = target.GetMatrixArray();
2912 const Element * const tp_last = tp+target.GetNoElements();
2913 while (tp != tp_last) {
2914 *tp++ = (*sp != val); sp++;
2923template<class Element>
2924TMatrixT<Element> operator!=(Element val,const TMatrixT<Element> &source1)
2926 return operator!=(source1,val);
2933template <
class Element>
2937 ::Error(
"Add(TMatrixT &,Element,const TMatrixT &)",
"matrices not compatible");
2941 const Element *
sp =
source.GetMatrixArray();
2942 Element *
tp =
target.GetMatrixArray();
2947 }
else if (
scalar == 1.) {
2961template <
class Element>
2966 ::Error(
"Add(TMatrixT &,Element,const TMatrixTSym &)",
"matrices not compatible");
2970 const Element *
sp =
source.GetMatrixArray();
2971 Element *
tp =
target.GetMatrixArray();
2982template <
class Element>
2986 ::Error(
"ElementMult(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
2990 const Element *
sp =
source.GetMatrixArray();
2991 Element *
tp =
target.GetMatrixArray();
3002template <
class Element>
3006 ::Error(
"ElementMult(TMatrixT &,const TMatrixTSym &)",
"matrices not compatible");
3010 const Element *
sp =
source.GetMatrixArray();
3011 Element *
tp =
target.GetMatrixArray();
3022template <
class Element>
3026 ::Error(
"ElementDiv(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
3030 const Element *
sp =
source.GetMatrixArray();
3031 Element *
tp =
target.GetMatrixArray();
3050template <
class Element>
3054 ::Error(
"ElementDiv(TMatrixT &,const TMatrixTSym &)",
"matrices not compatible");
3058 const Element *
sp =
source.GetMatrixArray();
3059 Element *
tp =
target.GetMatrixArray();
3078template <
class Element>
3086 if (M <= 12 &&
N <= 12 && P <= 12) {
3087 for (
Int_t i = 0; i < M; ++i) {
3089 Element
sum = Element(0);
3090 for (
Int_t k = 0; k <
N; ++k) {
3098 const Int_t BLOCK = (M >= 192 &&
N >= 192 && P >= 192) ? 48 : 32;
3105 for (;
j <=
j1 - 4;
j += 4) {
3106 cp[i * P +
j + 0] = Element(0);
3107 cp[i * P +
j + 1] = Element(0);
3108 cp[i * P +
j + 2] = Element(0);
3109 cp[i * P +
j + 3] = Element(0);
3112 cp[i * P +
j] = Element(0);
3121 const Element
aik =
ap[i *
N + k];
3125 for (;
j <=
j1 - 4;
j += 4) {
3126 cp[i * P +
j + 0] +=
aik *
bp[k * P +
j + 0];
3127 cp[i * P +
j + 1] +=
aik *
bp[k * P +
j + 1];
3128 cp[i * P +
j + 2] +=
aik *
bp[k * P +
j + 2];
3129 cp[i * P +
j + 3] +=
aik *
bp[k * P +
j + 3];
3144template <
class Element>
3148 const Element *
acp0 =
ap;
3168template <
class Element>
3172 const Element *
arp0 =
ap;
3174 const Element *
brp0 =
bp;
3191template <
class Element>
3194 if (
R__b.IsReading()) {
3200 }
else if (
R__v == 2) {
3204 R__b >> this->fNrows;
3205 R__b >> this->fNcols;
3206 R__b >> this->fNelems;
3207 R__b >> this->fRowLwb;
3208 R__b >> this->fColLwb;
3212 if (this->fNelems > 0) {
3213 fElements =
new Element[this->fNelems];
3214 R__b.ReadFastArray(fElements, this->fNelems);
3216 fElements =
nullptr;
3222 R__b >> this->fNrows;
3223 R__b >> this->fNcols;
3224 R__b >> this->fRowLwb;
3225 R__b >> this->fColLwb;
3226 this->fNelems =
R__b.ReadArray(fElements);
3230 if (
R__v <= 2 && fElements) {
3231 for (
Int_t i = 0; i < this->fNrows; i++) {
3233 for (
Int_t j = i;
j < this->fNcols;
j++) {
3235 const Element tmp = fElements[
off_i +
j];
3237 fElements[
off_j + i] = tmp;
3243 memcpy(fDataStack, fElements, this->fNelems *
sizeof(Element));
3246 fElements = fDataStack;
3247 }
else if (this->fNelems < 0)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
short Version_t
Class version identifier (short)
char Char_t
Character 1 byte (char)
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
float Float_t
Float 4 bytes (float)
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Bool_t operator<=(const TDatime &d1, const TDatime &d2)
Bool_t operator>(const TDatime &d1, const TDatime &d2)
Bool_t operator!=(const TDatime &d1, const TDatime &d2)
Bool_t operator>=(const TDatime &d1, const TDatime &d2)
Bool_t operator<(const TDatime &d1, const TDatime &d2)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
R__EXTERN Int_t gMatrixCheck
TTime operator*(const TTime &t1, const TTime &t2)
TTime operator-(const TTime &t1, const TTime &t2)
Buffer base class used for serializing objects.
static Bool_t InvertLU(TMatrixD &a, Double_t tol, Double_t *det=nullptr)
Calculate matrix inversion through in place forward/backward substitution.
virtual TMatrixTBase< Element > & SetMatrixArray(const Element *data, Option_t *option="")
Copy array data to matrix .
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 override
Get submatrix [row_lwb..row_upb] x [col_lwb..col_upb]; The indexing range of the returned matrix depe...
TMatrixT< Element > & Rank1Update(const TVectorT< Element > &v, Element alpha=1.0)
Perform a rank 1 operation on matrix A: A += alpha * v * v^T.
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])
void Delete_m(Int_t size, Element *&)
Delete data pointer m, if it was assigned on the heap.
void Streamer(TBuffer &) override
Stream an object of class TMatrixT.
TMatrixT< Element > & operator*=(Element val)
Multiply every element of the matrix with val.
TMatrixT< Element > & operator=(const TMatrixT< Element > &source)
Assignment operator.
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,...
void Minus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix subtraction. Replace this matrix with C such that C = A - B.
Element Similarity(const TVectorT< Element > &v) const
Calculate scalar v * (*this) * v^T.
void Plus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix summation. Replace this matrix with C such that C = A + B.
TMatrixT< Element > & operator-=(Element val)
Subtract val from every element of the matrix.
Double_t Determinant() const override
Return the matrix determinant.
TMatrixT< Element > & Transpose(const TMatrixT< Element > &source)
Transpose matrix source.
void MultT(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix multiplication. Replace this matrix with C such that C = A * B^T.
TMatrixT< Element > & InvertFast(Double_t *det=nullptr)
Invert the matrix and calculate its determinant, however upto (6x6) a fast Cramer inversion is used .
TMatrixTBase< Element > & SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixTBase< Element > &source) override
Insert matrix source starting at [row_lwb][col_lwb], thereby overwriting the part [row_lwb....
Element * New_m(Int_t size)
Return data pointer .
TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1) override
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
TMatrixT< Element > & Invert(Double_t *det=nullptr)
Invert the matrix and calculate its determinant.
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.
TMatrixT< Element > & operator+=(Element val)
Add val to every element of the matrix.
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,...
void TMult(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
Replace this matrix with C such that C = A' * B.
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...
void Mult(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix multiplication. Replace this matrix with C such that C = A * B.
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 .
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) noexcept
TObject assignment operator.
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
void ToUpper()
Change string to upper case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
ELogLevel operator+(ELogLevel severity, int offset)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
TMatrixT< Element > operator!=(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 != source2
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 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.
TMatrixT< Element > operator+(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
operation this = source1+source2
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.
TMatrixT< Element > operator>=(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 >= source2
TMatrixT< Element > & ElementMult(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Multiply target by the source, element-by-element.
TMatrixT< Element > operator||(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
Logical OR.
TMatrixT< Element > operator<(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 < source2
TMatrixT< Element > operator>(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 > source2
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
TMatrixT< Element > & ElementDiv(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Divide target by the source, element-by-element.
Element1 Mult(const TVectorT< Element1 > &v1, const TMatrixT< Element2 > &m, const TVectorT< Element3 > &v2)
Perform v1 * M * v2, a scalar result.
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)
logical operation source1 <= source2
TMatrixT< Element > operator&&(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
Logical AND.
TMatrixT< Element > operator*(Element val, const TMatrixT< Element > &source)
operation this = val*source
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 .
static uint64_t sum(uint64_t i)