38template <
class Element>
47template <
class Element>
50 Allocate(row_upb - row_lwb + 1, col_upb - col_lwb + 1, row_lwb, col_lwb, 1);
61template <
class Element>
71template <
class Element>
75 Allocate(row_upb - row_lwb + 1, col_upb - col_lwb + 1, row_lwb, col_lwb);
82template <
class Element>
93template <
class Element>
104template <
class Element>
117template <
class Element>
142 const Element oldTol = this->
SetTol(std::numeric_limits<Element>::min());
150 TMult(prototype, prototype);
153 default:
Error(
"TMatrixT(EMatrixCreatorOp1)",
"operation %d not yet implemented", op);
163template <
class Element>
171 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
176 Allocate(
a.GetNcols(),
b.GetNcols(),
a.GetColLwb(),
b.GetColLwb(), 1);
181 Allocate(
a.GetNrows(),
b.GetNrows(),
a.GetRowLwb(),
b.GetRowLwb(), 1);
186 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
188 if (
a.GetNrows() ==
b.GetNcols()) {
190 const Element oldTol = this->
SetTol(std::numeric_limits<Element>::min());
196 const Element oldTol = ainv.
SetTol(std::numeric_limits<Element>::min());
205 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
211 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
216 default:
Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
225template <
class Element>
233 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
238 Allocate(
a.GetNcols(),
b.GetNcols(),
a.GetColLwb(),
b.GetColLwb(), 1);
243 Allocate(
a.GetNrows(),
b.GetNrows(),
a.GetRowLwb(),
b.GetRowLwb(), 1);
248 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
250 const Element oldTol = this->
SetTol(std::numeric_limits<Element>::min());
258 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
264 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
269 default:
Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
279template <
class Element>
287 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
292 Allocate(
a.GetNcols(),
b.GetNcols(),
a.GetColLwb(),
b.GetColLwb(), 1);
297 Allocate(
a.GetNrows(),
b.GetNrows(),
a.GetRowLwb(),
b.GetRowLwb(), 1);
302 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
304 if (
a.GetNrows() ==
b.GetNcols()) {
306 const Element oldTol = this->
SetTol(std::numeric_limits<Element>::min());
312 const Element oldTol = ainv.
SetTol(std::numeric_limits<Element>::min());
321 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
327 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
332 default:
Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
341template <
class Element>
349 Allocate(
a.GetNrows(),
b.GetNcols(),
a.GetRowLwb(),
b.GetColLwb(), 1);
354 Allocate(
a.GetNcols(),
b.GetNcols(),
a.GetColLwb(),
b.GetColLwb(), 1);
359 Allocate(
a.GetNrows(),
b.GetNrows(),
a.GetRowLwb(),
b.GetRowLwb(), 1);
364 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
366 const Element oldTol = this->
SetTol(std::numeric_limits<Element>::min());
374 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
380 Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb(), 1);
385 default:
Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
392template <
class Element>
398 lazy_constructor.
FillIn(*
this);
404template <
class Element>
418template <
class Element>
427 Element *heap =
new Element[
size];
437template <
class Element>
440 if (copySize == 0 || oldp == newp)
446 for (
Int_t i = copySize - 1; i >= 0; i--)
449 for (
Int_t i = 0; i < copySize; i++)
453 memcpy(newp, oldp, copySize *
sizeof(Element));
462template <
class Element>
467 this->
fTol = std::numeric_limits<Element>::epsilon();
475 if (no_rows < 0 || no_cols < 0) {
476 Error(
"Allocate",
"no_rows=%d no_cols=%d", no_rows, no_cols);
490 Error(
"Allocate",
"too large: no_rows=%d no_cols=%d", no_rows, no_cols);
506template <
class Element>
511 Error(
"Plus",
"matrices not compatible");
516 Error(
"Plus",
"this->GetMatrixArray() == a.GetMatrixArray()");
521 Error(
"Plus",
"this->GetMatrixArray() == b.GetMatrixArray()");
526 const Element *ap =
a.GetMatrixArray();
527 const Element *bp =
b.GetMatrixArray();
529 const Element *
const cp_last = cp + this->
fNelems;
531 while (cp < cp_last) {
540template <
class Element>
545 Error(
"Plus",
"matrices not compatible");
550 Error(
"Plus",
"this->GetMatrixArray() == a.GetMatrixArray()");
555 Error(
"Plus",
"this->GetMatrixArray() == b.GetMatrixArray()");
560 const Element *ap =
a.GetMatrixArray();
561 const Element *bp =
b.GetMatrixArray();
563 const Element *
const cp_last = cp + this->
fNelems;
565 while (cp < cp_last) {
574template <
class Element>
579 Error(
"Minus",
"matrices not compatible");
584 Error(
"Minus",
"this->GetMatrixArray() == a.GetMatrixArray()");
589 Error(
"Minus",
"this->GetMatrixArray() == b.GetMatrixArray()");
594 const Element *ap =
a.GetMatrixArray();
595 const Element *bp =
b.GetMatrixArray();
597 const Element *
const cp_last = cp + this->
fNelems;
599 while (cp < cp_last) {
608template <
class Element>
613 Error(
"Minus",
"matrices not compatible");
618 Error(
"Minus",
"this->GetMatrixArray() == a.GetMatrixArray()");
623 Error(
"Minus",
"this->GetMatrixArray() == b.GetMatrixArray()");
628 const Element *ap =
a.GetMatrixArray();
629 const Element *bp =
b.GetMatrixArray();
631 const Element *
const cp_last = cp + this->
fNelems;
633 while (cp < cp_last) {
642template <
class Element>
646 if (
a.GetNcols() !=
b.GetNrows() ||
a.GetColLwb() !=
b.GetRowLwb()) {
647 Error(
"Mult",
"A rows and B columns incompatible");
652 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
657 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
663 const Element *ap =
a.GetMatrixArray();
664 const Element *bp =
b.GetMatrixArray();
666 if (
typeid(Element) ==
typeid(
Double_t))
667 cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
fNrows,
fNcols,
a.GetNcols(), 1.0, ap,
a.GetNcols(), bp,
668 b.GetNcols(), 1.0, cp,
fNcols);
669 else if (
typeid(Element) !=
typeid(
Float_t))
670 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
fNrows,
fNcols,
a.GetNcols(), 1.0, ap,
a.GetNcols(), bp,
671 b.GetNcols(), 1.0, cp,
fNcols);
673 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
675 const Int_t na =
a.GetNoElements();
676 const Int_t nb =
b.GetNoElements();
677 const Int_t ncolsa =
a.GetNcols();
678 const Int_t ncolsb =
b.GetNcols();
679 const Element *
const ap =
a.GetMatrixArray();
680 const Element *
const bp =
b.GetMatrixArray();
683 AMultB(ap, na, ncolsa, bp, nb, ncolsb, cp);
691template <
class Element>
697 if (
a.GetNcols() !=
b.GetNrows() ||
a.GetColLwb() !=
b.GetRowLwb()) {
698 Error(
"Mult",
"A rows and B columns incompatible");
703 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
708 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
714 const Element *ap =
a.GetMatrixArray();
715 const Element *bp =
b.GetMatrixArray();
717 if (
typeid(Element) ==
typeid(
Double_t))
718 cblas_dsymm(CblasRowMajor, CblasLeft, CblasUpper,
fNrows,
fNcols, 1.0, ap,
a.GetNcols(), bp,
b.GetNcols(), 0.0,
720 else if (
typeid(Element) !=
typeid(
Float_t))
721 cblas_ssymm(CblasRowMajor, CblasLeft, CblasUpper,
fNrows,
fNcols, 1.0, ap,
a.GetNcols(), bp,
b.GetNcols(), 0.0,
724 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
726 const Int_t na =
a.GetNoElements();
727 const Int_t nb =
b.GetNoElements();
728 const Int_t ncolsa =
a.GetNcols();
729 const Int_t ncolsb =
b.GetNcols();
730 const Element *
const ap =
a.GetMatrixArray();
731 const Element *
const bp =
b.GetMatrixArray();
734 AMultB(ap, na, ncolsa, bp, nb, ncolsb, cp);
743template <
class Element>
749 if (
a.GetNcols() !=
b.GetNrows() ||
a.GetColLwb() !=
b.GetRowLwb()) {
750 Error(
"Mult",
"A rows and B columns incompatible");
755 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
760 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
766 const Element *ap =
a.GetMatrixArray();
767 const Element *bp =
b.GetMatrixArray();
769 if (
typeid(Element) ==
typeid(
Double_t))
770 cblas_dsymm(CblasRowMajor, CblasRight, CblasUpper,
fNrows,
fNcols, 1.0, bp,
b.GetNcols(), ap,
a.GetNcols(), 0.0,
772 else if (
typeid(Element) !=
typeid(
Float_t))
773 cblas_ssymm(CblasRowMajor, CblasRight, CblasUpper,
fNrows,
fNcols, 1.0, bp,
b.GetNcols(), ap,
a.GetNcols(), 0.0,
776 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
778 const Int_t na =
a.GetNoElements();
779 const Int_t nb =
b.GetNoElements();
780 const Int_t ncolsa =
a.GetNcols();
781 const Int_t ncolsb =
b.GetNcols();
782 const Element *
const ap =
a.GetMatrixArray();
783 const Element *
const bp =
b.GetMatrixArray();
786 AMultB(ap, na, ncolsa, bp, nb, ncolsb, cp);
795template <
class Element>
801 if (
a.GetNcols() !=
b.GetNrows() ||
a.GetColLwb() !=
b.GetRowLwb()) {
802 Error(
"Mult",
"A rows and B columns incompatible");
807 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
812 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
818 const Element *ap =
a.GetMatrixArray();
819 const Element *bp =
b.GetMatrixArray();
821 if (
typeid(Element) ==
typeid(
Double_t))
822 cblas_dsymm(CblasRowMajor, CblasLeft, CblasUpper,
fNrows,
fNcols, 1.0, ap,
a.GetNcols(), bp,
b.GetNcols(), 0.0,
824 else if (
typeid(Element) !=
typeid(
Float_t))
825 cblas_ssymm(CblasRowMajor, CblasLeft, CblasUpper,
fNrows,
fNcols, 1.0, ap,
a.GetNcols(), bp,
b.GetNcols(), 0.0,
828 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
830 const Int_t na =
a.GetNoElements();
831 const Int_t nb =
b.GetNoElements();
832 const Int_t ncolsa =
a.GetNcols();
833 const Int_t ncolsb =
b.GetNcols();
834 const Element *
const ap =
a.GetMatrixArray();
835 const Element *
const bp =
b.GetMatrixArray();
838 AMultB(ap, na, ncolsa, bp, nb, ncolsb, cp);
846template <
class Element>
852 if (
a.GetNrows() !=
b.GetNrows() ||
a.GetRowLwb() !=
b.GetRowLwb()) {
853 Error(
"TMult",
"A rows and B columns incompatible");
858 Error(
"TMult",
"this->GetMatrixArray() == a.GetMatrixArray()");
863 Error(
"TMult",
"this->GetMatrixArray() == b.GetMatrixArray()");
869 const Element *ap =
a.GetMatrixArray();
870 const Element *bp =
b.GetMatrixArray();
872 if (
typeid(Element) ==
typeid(
Double_t))
873 cblas_dgemm(CblasRowMajor, CblasTrans, CblasNoTrans, this->
fNrows, this->
fNcols,
a.GetNrows(), 1.0, ap,
874 a.GetNcols(), bp,
b.GetNcols(), 1.0, cp, this->fNcols);
875 else if (
typeid(Element) !=
typeid(
Float_t))
876 cblas_sgemm(CblasRowMajor, CblasTrans, CblasNoTrans,
fNrows,
fNcols,
a.GetNrows(), 1.0, ap,
a.GetNcols(), bp,
877 b.GetNcols(), 1.0, cp,
fNcols);
879 Error(
"TMult",
"type %s not implemented in BLAS library",
typeid(Element));
881 const Int_t nb =
b.GetNoElements();
882 const Int_t ncolsa =
a.GetNcols();
883 const Int_t ncolsb =
b.GetNcols();
884 const Element *
const ap =
a.GetMatrixArray();
885 const Element *
const bp =
b.GetMatrixArray();
888 AtMultB(ap, ncolsa, bp, nb, ncolsb, cp);
896template <
class Element>
902 if (
a.GetNrows() !=
b.GetNrows() ||
a.GetRowLwb() !=
b.GetRowLwb()) {
903 Error(
"TMult",
"A rows and B columns incompatible");
908 Error(
"TMult",
"this->GetMatrixArray() == a.GetMatrixArray()");
913 Error(
"TMult",
"this->GetMatrixArray() == b.GetMatrixArray()");
919 const Element *ap =
a.GetMatrixArray();
920 const Element *bp =
b.GetMatrixArray();
922 if (
typeid(Element) ==
typeid(
Double_t))
923 cblas_dgemm(CblasRowMajor, CblasTrans, CblasNoTrans,
fNrows,
fNcols,
a.GetNrows(), 1.0, ap,
a.GetNcols(), bp,
924 b.GetNcols(), 1.0, cp,
fNcols);
925 else if (
typeid(Element) !=
typeid(
Float_t))
926 cblas_sgemm(CblasRowMajor, CblasTrans, CblasNoTrans,
fNrows,
fNcols,
a.GetNrows(), 1.0, ap,
a.GetNcols(), bp,
927 b.GetNcols(), 1.0, cp,
fNcols);
929 Error(
"TMult",
"type %s not implemented in BLAS library",
typeid(Element));
931 const Int_t nb =
b.GetNoElements();
932 const Int_t ncolsa =
a.GetNcols();
933 const Int_t ncolsb =
b.GetNcols();
934 const Element *
const ap =
a.GetMatrixArray();
935 const Element *
const bp =
b.GetMatrixArray();
938 AtMultB(ap, ncolsa, bp, nb, ncolsb, cp);
945template <
class Element>
952 if (
a.GetNcols() !=
b.GetNcols() ||
a.GetColLwb() !=
b.GetColLwb()) {
953 Error(
"MultT",
"A rows and B columns incompatible");
958 Error(
"MultT",
"this->GetMatrixArray() == a.GetMatrixArray()");
963 Error(
"MultT",
"this->GetMatrixArray() == b.GetMatrixArray()");
969 const Element *ap =
a.GetMatrixArray();
970 const Element *bp =
b.GetMatrixArray();
972 if (
typeid(Element) ==
typeid(
Double_t))
973 cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasTrans,
fNrows,
fNcols,
a.GetNcols(), 1.0, ap,
a.GetNcols(), bp,
974 b.GetNcols(), 1.0, cp,
fNcols);
975 else if (
typeid(Element) !=
typeid(
Float_t))
976 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans,
fNrows,
fNcols,
a.GetNcols(), 1.0, ap,
a.GetNcols(), bp,
977 b.GetNcols(), 1.0, cp,
fNcols);
979 Error(
"MultT",
"type %s not implemented in BLAS library",
typeid(Element));
981 const Int_t na =
a.GetNoElements();
982 const Int_t nb =
b.GetNoElements();
983 const Int_t ncolsa =
a.GetNcols();
984 const Int_t ncolsb =
b.GetNcols();
985 const Element *
const ap =
a.GetMatrixArray();
986 const Element *
const bp =
b.GetMatrixArray();
989 AMultBt(ap, na, ncolsa, bp, nb, ncolsb, cp);
997template <
class Element>
1003 if (
a.GetNcols() !=
b.GetNcols() ||
a.GetColLwb() !=
b.GetColLwb()) {
1004 Error(
"MultT",
"A rows and B columns incompatible");
1009 Error(
"MultT",
"this->GetMatrixArray() == a.GetMatrixArray()");
1014 Error(
"MultT",
"this->GetMatrixArray() == b.GetMatrixArray()");
1020 const Element *ap =
a.GetMatrixArray();
1021 const Element *bp =
b.GetMatrixArray();
1023 if (
typeid(Element) ==
typeid(
Double_t))
1024 cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasTrans, this->
fNrows, this->
fNcols,
a.GetNcols(), 1.0, ap,
1025 a.GetNcols(), bp,
b.GetNcols(), 1.0, cp, this->fNcols);
1026 else if (
typeid(Element) !=
typeid(
Float_t))
1027 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans,
fNrows,
fNcols,
a.GetNcols(), 1.0, ap,
a.GetNcols(), bp,
1028 b.GetNcols(), 1.0, cp,
fNcols);
1030 Error(
"MultT",
"type %s not implemented in BLAS library",
typeid(Element));
1032 const Int_t na =
a.GetNoElements();
1033 const Int_t nb =
b.GetNoElements();
1034 const Int_t ncolsa =
a.GetNcols();
1035 const Int_t ncolsb =
b.GetNcols();
1036 const Element *
const ap =
a.GetMatrixArray();
1037 const Element *
const bp =
b.GetMatrixArray();
1040 AMultBt(ap, na, ncolsa, bp, nb, ncolsb, cp);
1047template <
class Element>
1051 if (row_upb < row_lwb) {
1052 Error(
"Use",
"row_upb=%d < row_lwb=%d", row_upb, row_lwb);
1055 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;
1080template <
class Element>
1087 Error(
"GetSub",
"row_lwb out of bounds");
1091 Error(
"GetSub",
"col_lwb out of bounds");
1095 Error(
"GetSub",
"row_upb out of bounds");
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);
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++) {
1147template <
class Element>
1155 Error(
"SetSub",
"row_lwb outof bounds");
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);
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++) {
1201template <
class Element>
1206 Error(
"ResizeTo(Int_t,Int_t)",
"Not owner of data array,cannot resize");
1213 else if (nrows == 0 || ncols == 0) {
1232 memset(elements_new, 0, this->
fNelems *
sizeof(Element));
1233 else if (this->
fNelems > nelems_old)
1234 memset(elements_new + nelems_old, 0, (this->
fNelems - nelems_old) *
sizeof(Element));
1241 if (ncols_old < this->
fNcols) {
1242 for (
Int_t i = nrows_copy - 1; i >= 0; i--) {
1243 Memcpy_m(elements_new + i * this->fNcols, elements_old + i * ncols_old, ncols_copy, nelems_new, nelems_old);
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, nelems_new, nelems_old);
1252 Delete_m(nelems_old, elements_old);
1265template <
class Element>
1271 Error(
"ResizeTo(Int_t,Int_t,Int_t,Int_t)",
"Not owner of data array,cannot resize");
1275 const Int_t new_nrows = row_upb - row_lwb + 1;
1276 const Int_t new_ncols = col_upb - col_lwb + 1;
1283 else if (new_nrows == 0 || new_ncols == 0) {
1284 this->
fNrows = new_nrows;
1285 this->
fNcols = new_ncols;
1299 Allocate(new_nrows, new_ncols, row_lwb, col_lwb);
1306 memset(elements_new, 0, this->
fNelems *
sizeof(Element));
1307 else if (this->
fNelems > nelems_old)
1308 memset(elements_new + nelems_old, 0, (this->
fNelems - nelems_old) *
sizeof(Element));
1316 const Int_t nrows_copy = rowUpb_copy - rowLwb_copy + 1;
1317 const Int_t ncols_copy = colUpb_copy - colLwb_copy + 1;
1319 if (nrows_copy > 0 && ncols_copy > 0) {
1320 const Int_t colOldOff = colLwb_copy - colLwb_old;
1322 if (ncols_old < this->
fNcols) {
1323 for (
Int_t i = nrows_copy - 1; i >= 0; i--) {
1324 const Int_t iRowOld = rowLwb_copy + i - rowLwb_old;
1326 Memcpy_m(elements_new + iRowNew * this->fNcols + colNewOff,
1327 elements_old + iRowOld * ncols_old + colOldOff, ncols_copy, this->
fNelems, nelems_old);
1329 memset(elements_new + iRowNew * this->fNcols + colNewOff + ncols_copy, 0,
1330 (this->fNcols - ncols_copy) *
sizeof(Element));
1333 for (
Int_t i = 0; i < nrows_copy; i++) {
1334 const Int_t iRowOld = rowLwb_copy + i - rowLwb_old;
1336 Memcpy_m(elements_new + iRowNew * this->fNcols + colNewOff,
1337 elements_old + iRowOld * ncols_old + colOldOff, ncols_copy, this->
fNelems, nelems_old);
1342 Delete_m(nelems_old, elements_old);
1344 Allocate(new_nrows, new_ncols, row_lwb, col_lwb, 1);
1353template <
class Element>
1366template <
class Element>
1388template <
class Element>
1402template <
class Element>
1411 Error(
"Invert()",
"matrix should be square");
1415 Error(
"InvertFast",
"matrix is singular");
1453template <
class Element>
1463 const Int_t off_i = i * this->fNrows;
1465 const Int_t off_j = j * this->fNcols;
1466 const Element tmp = ap[off_i + j];
1467 ap[off_i + j] = ap[off_j + i];
1468 ap[off_j + i] = tmp;
1479 this->
fNrows = ncols_old;
1480 this->
fNcols = nrows_old;
1485 const Int_t off = (icol - collwb_old) * ncols_old;
1486 (*this)(irow, icol) = oldElems[off + irow - rowlwb_old];
1494 Error(
"Transpose",
"matrix has wrong shape");
1499 const Element *scp = sp1;
1505 while (tp < tp_last) {
1506 const Element *sp2 = scp++;
1509 while (sp2 < sp1 + this->
fNelems) {
1524template <
class Element>
1530 if (
v.GetNoElements() <
TMath::Max(this->fNrows, this->fNcols)) {
1531 Error(
"Rank1Update",
"vector too short");
1536 const Element *
const pv =
v.GetMatrixArray();
1540 const Element tmp = alpha * pv[i];
1542 *mp++ += tmp * pv[j];
1552template <
class Element>
1560 if (
v1.GetNoElements() < this->fNrows) {
1561 Error(
"Rank1Update",
"vector v1 too short");
1565 if (
v2.GetNoElements() < this->fNcols) {
1566 Error(
"Rank1Update",
"vector v2 too short");
1571 const Element *
const pv1 =
v1.GetMatrixArray();
1572 const Element *
const pv2 =
v2.GetMatrixArray();
1576 const Element tmp = alpha * pv1[i];
1578 *mp++ += tmp * pv2[j];
1587template <
class Element>
1594 Error(
"Similarity(const TVectorT &)",
"matrix is not square");
1598 if (this->
fNcols !=
v.GetNrows() || this->fColLwb !=
v.GetLwb()) {
1599 Error(
"Similarity(const TVectorT &)",
"vector and matrix incompatible");
1605 const Element *vp =
v.GetMatrixArray();
1608 const Element *
const vp_first = vp;
1609 const Element *
const vp_last = vp +
v.GetNrows();
1610 while (vp < vp_last) {
1612 for (
const Element *sp = vp_first; sp < vp_last;)
1613 sum2 += *mp++ * *sp++;
1614 sum1 += sum2 * *vp++;
1628template <
class Element>
1634 if (
v.GetNoElements() < this->fNrows) {
1635 Error(
"NormByColumn",
"vector shorter than matrix column");
1644 const Element *pv =
v.GetMatrixArray();
1646 const Element *
const mp_last = mp + this->
fNelems;
1649 for (; mp < mp_last; pv++) {
1654 Error(
"NormbyColumn",
"vector element %ld is zero",
Long_t(pv -
v.GetMatrixArray()));
1660 for (; mp < mp_last; pv++)
1674template <
class Element>
1680 if (
v.GetNoElements() < this->fNcols) {
1681 Error(
"NormByRow",
"vector shorter than matrix column");
1690 const Element *pv0 =
v.GetMatrixArray();
1691 const Element *pv = pv0;
1693 const Element *
const mp_last = mp + this->
fNelems;
1696 for (; mp < mp_last; pv = pv0)
1701 Error(
"NormbyRow",
"vector element %ld is zero",
Long_t(pv - pv0));
1706 for (; mp < mp_last; pv = pv0)
1717template <
class Element>
1721 Error(
"operator=(const TMatrixT &)",
"matrices not compatible");
1736template <
class Element>
1740 Error(
"operator=(const TMatrixTSym &)",
"matrices not compatible");
1755template <
class Element>
1759 this->GetRowLwb() != source.
GetRowLwb() || this->GetColLwb() != source.
GetColLwb()) {
1760 Error(
"operator=(const TMatrixTSparse &",
"matrices not compatible");
1774 for (
Int_t irow = 0; irow < this->
fNrows; irow++) {
1776 const Int_t sIndex = pRowIndex[irow];
1777 const Int_t eIndex = pRowIndex[irow + 1];
1778 for (
Int_t index = sIndex; index < eIndex; index++)
1779 tp[off + pColIndex[index]] = sp[index];
1789template <
class Element>
1794 if (lazy_constructor.
GetRowUpb() != this->GetRowUpb() || lazy_constructor.
GetColUpb() != this->GetColUpb() ||
1795 lazy_constructor.
GetRowLwb() != this->GetRowLwb() || lazy_constructor.
GetColLwb() != this->GetColLwb()) {
1796 Error(
"operator=(const TMatrixTLazy&)",
"matrix is incompatible with "
1797 "the assigned Lazy matrix");
1801 lazy_constructor.
FillIn(*
this);
1808template <
class Element>
1814 const Element *
const ep_last = ep + this->
fNelems;
1815 while (ep < ep_last)
1824template <
class Element>
1830 const Element *
const ep_last = ep + this->
fNelems;
1831 while (ep < ep_last)
1840template <
class Element>
1846 const Element *
const ep_last = ep + this->
fNelems;
1847 while (ep < ep_last)
1856template <
class Element>
1862 const Element *
const ep_last = ep + this->
fNelems;
1863 while (ep < ep_last)
1872template <
class Element>
1876 Error(
"operator+=(const TMatrixT &)",
"matrices not compatible");
1882 const Element *
const tp_last = tp + this->
fNelems;
1883 while (tp < tp_last)
1892template <
class Element>
1896 Error(
"operator+=(const TMatrixTSym &)",
"matrices not compatible");
1902 const Element *
const tp_last = tp + this->
fNelems;
1903 while (tp < tp_last)
1912template <
class Element>
1916 Error(
"operator=-(const TMatrixT &)",
"matrices not compatible");
1922 const Element *
const tp_last = tp + this->
fNelems;
1923 while (tp < tp_last)
1932template <
class Element>
1936 Error(
"operator=-(const TMatrixTSym &)",
"matrices not compatible");
1942 const Element *
const tp_last = tp + this->
fNelems;
1943 while (tp < tp_last)
1954template <
class Element>
1962 Error(
"operator*=(const TMatrixT &)",
"source matrix has wrong shape");
1980 Element *trp = work;
1982 isAllocated =
kTRUE;
1983 trp =
new Element[this->
fNcols];
1987 const Element *trp0 = cp;
1988 const Element *
const trp0_last = trp0 + this->
fNelems;
1989 while (trp0 < trp0_last) {
1990 memcpy(trp, trp0, this->
fNcols *
sizeof(Element));
1991 for (
const Element *scp = sp; scp < sp + this->
fNcols;) {
1994 for (
Int_t j = 0; j < this->fNcols; j++) {
1995 cij += trp[j] * *scp;
1996 scp += this->fNcols;
2001 trp0 += this->fNcols;
2005 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
2016template <
class Element>
2023 Error(
"operator*=(const TMatrixTSym &)",
"source matrix has wrong shape");
2041 Element *trp = work;
2043 isAllocated =
kTRUE;
2044 trp =
new Element[this->
fNcols];
2048 const Element *trp0 = cp;
2049 const Element *
const trp0_last = trp0 + this->
fNelems;
2050 while (trp0 < trp0_last) {
2051 memcpy(trp, trp0, this->
fNcols *
sizeof(Element));
2052 for (
const Element *scp = sp; scp < sp + this->
fNcols;) {
2055 for (
Int_t j = 0; j < this->fNcols; j++) {
2056 cij += trp[j] * *scp;
2057 scp += this->fNcols;
2062 trp0 += this->fNcols;
2066 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
2077template <
class Element>
2084 Error(
"operator*=(const TMatrixTDiag_const &)",
"wrong diagonal length");
2090 const Element *
const mp_last = mp + this->
fNelems;
2092 while (mp < mp_last) {
2093 const Element *dp = diag.
GetPtr();
2107template <
class Element>
2114 Error(
"operator/=(const TMatrixTDiag_const &)",
"wrong diagonal length");
2120 const Element *
const mp_last = mp + this->
fNelems;
2122 while (mp < mp_last) {
2123 const Element *dp = diag.
GetPtr();
2128 Error(
"operator/=",
"%d-diagonal element is zero", j);
2142template <
class Element>
2151 Error(
"operator*=(const TMatrixTColumn_const &)",
"wrong column length");
2158 const Element *
const mp_last = mp + this->
fNelems;
2159 const Element *cp = col.
GetPtr();
2161 while (mp < mp_last) {
2175template <
class Element>
2184 Error(
"operator/=(const TMatrixTColumn_const &)",
"wrong column matrix");
2191 const Element *
const mp_last = mp + this->
fNelems;
2192 const Element *cp = col.
GetPtr();
2194 while (mp < mp_last) {
2201 Error(
"operator/=",
"%d-row of matrix column is zero", icol);
2214template <
class Element>
2223 Error(
"operator*=(const TMatrixTRow_const &)",
"wrong row length");
2228 const Element *
const endp = row.GetPtr() + mt->
GetNoElements();
2230 const Element *
const mp_last = mp + this->
fNelems;
2231 const Int_t inc = row.GetInc();
2232 while (mp < mp_last) {
2233 const Element *rp = row.GetPtr();
2248template <
class Element>
2256 Error(
"operator/=(const TMatrixTRow_const &)",
"wrong row length");
2260 const Element *
const endp = row.GetPtr() + mt->
GetNoElements();
2262 const Element *
const mp_last = mp + this->
fNelems;
2263 const Int_t inc = row.GetInc();
2264 while (mp < mp_last) {
2265 const Element *rp = row.GetPtr();
2271 Error(
"operator/=",
"%d-col of matrix row is zero", j);
2287template <
class Element>
2291 Warning(
"EigenVectors(TVectorT &)",
"Only real part of eigen-values will be returned");
2301template <
class Element>
2312template <
class Element>
2323template <
class Element>
2332template <
class Element>
2343template <
class Element>
2352template <
class Element>
2363template <
class Element>
2374template <
class Element>
2377 return Element(-1.0) * (
operator-(source2, source1));
2383template <
class Element>
2394template <
class Element>
2397 return Element(-1.0) *
operator-(source, val);
2403template <
class Element>
2414template <
class Element>
2423template <
class Element>
2433template <
class Element>
2443template <
class Element>
2453template <
class Element>
2464template <
class Element>
2470 Error(
"operator&&(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2480 while (tp < tp_last)
2481 *tp++ = (*sp1++ != 0.0 && *sp2++ != 0.0);
2489template <
class Element>
2495 Error(
"operator&&(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2505 while (tp < tp_last)
2506 *tp++ = (*sp1++ != 0.0 && *sp2++ != 0.0);
2514template <
class Element>
2523template <
class Element>
2529 Error(
"operator||(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2539 while (tp < tp_last)
2540 *tp++ = (*sp1++ != 0.0 || *sp2++ != 0.0);
2548template <
class Element>
2554 Error(
"operator||(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2564 while (tp < tp_last)
2565 *tp++ = (*sp1++ != 0.0 || *sp2++ != 0.0);
2573template <
class Element>
2582template <
class Element>
2588 Error(
"operator|(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2598 while (tp < tp_last) {
2599 *tp++ = (*sp1) > (*sp2);
2610template <
class Element>
2616 Error(
"operator>(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2626 while (tp < tp_last) {
2627 *tp++ = (*sp1) > (*sp2);
2638template <
class Element>
2647template <
class Element>
2653 Error(
"operator>=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2663 while (tp < tp_last) {
2664 *tp++ = (*sp1) >= (*sp2);
2675template <
class Element>
2681 Error(
"operator>=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2691 while (tp < tp_last) {
2692 *tp++ = (*sp1) >= (*sp2);
2703template <
class Element>
2712template <
class Element>
2718 Error(
"operator<=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2728 while (tp < tp_last) {
2729 *tp++ = (*sp1) <= (*sp2);
2740template <
class Element>
2746 Error(
"operator<=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2756 while (tp < tp_last) {
2757 *tp++ = (*sp1) <= (*sp2);
2768template <
class Element>
2777template <
class Element>
2783 Error(
"operator<(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2791 while (tp < tp_last) {
2792 *tp++ = (*sp1) < (*sp2);
2803template <
class Element>
2809 Error(
"operator<(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2819 while (tp < tp_last) {
2820 *tp++ = (*sp1) < (*sp2);
2831template <
class Element>
2840template <
class Element>
2846 Error(
"operator!=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2856 while (tp != tp_last) {
2857 *tp++ = (*sp1) != (*sp2);
2868template <
class Element>
2874 Error(
"operator!=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2884 while (tp != tp_last) {
2885 *tp++ = (*sp1) != (*sp2);
2896template <
class Element>
2906template<class Element>
2907TMatrixT<Element> operator!=(const TMatrixT<Element> &source1,Element val)
2909 TMatrixT<Element> target; target.ResizeTo(source1);
2911 const Element *sp = source1.GetMatrixArray();
2912 Element *tp = target.GetMatrixArray();
2913 const Element * const tp_last = tp+target.GetNoElements();
2914 while (tp != tp_last) {
2915 *tp++ = (*sp != val); sp++;
2924template<class Element>
2925TMatrixT<Element> operator!=(Element val,const TMatrixT<Element> &source1)
2927 return operator!=(source1,val);
2934template <
class Element>
2938 ::Error(
"Add(TMatrixT &,Element,const TMatrixT &)",
"matrices not compatible");
2947 *tp++ = scalar * (*sp++);
2948 }
else if (scalar == 1.) {
2953 *tp++ += scalar * (*sp++);
2962template <
class Element>
2967 ::Error(
"Add(TMatrixT &,Element,const TMatrixTSym &)",
"matrices not compatible");
2975 *tp++ += scalar * (*sp++);
2983template <
class Element>
2987 ::Error(
"ElementMult(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
3003template <
class Element>
3007 ::Error(
"ElementMult(TMatrixT &,const TMatrixTSym &)",
"matrices not compatible");
3023template <
class Element>
3027 ::Error(
"ElementDiv(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
3040 Error(
"ElementDiv",
"source (%d,%d) is zero", irow, icol);
3051template <
class Element>
3055 ::Error(
"ElementDiv(TMatrixT &,const TMatrixTSym &)",
"matrices not compatible");
3068 Error(
"ElementDiv",
"source (%d,%d) is zero", irow, icol);
3079template <
class Element>
3081 Int_t ncolsb, Element *cp)
3083 const Element *arp0 = ap;
3084 while (arp0 < ap + na) {
3085 for (
const Element *bcp = bp; bcp < bp + ncolsb;) {
3086 const Element *arp = arp0;
3088 while (bcp < bp + nb) {
3089 cij += *arp++ * *bcp;
3102template <
class Element>
3104 Int_t ncolsb, Element *cp)
3106 const Element *acp0 = ap;
3107 while (acp0 < ap + ncolsa) {
3108 for (
const Element *bcp = bp; bcp < bp + ncolsb;) {
3109 const Element *acp = acp0;
3111 while (bcp < bp + nb) {
3126template <
class Element>
3128 Int_t ncolsb, Element *cp)
3130 const Element *arp0 = ap;
3131 while (arp0 < ap + na) {
3132 const Element *brp0 = bp;
3133 while (brp0 < bp + nb) {
3134 const Element *arp = arp0;
3135 const Element *brp = brp0;
3137 while (brp < brp0 + ncolsb)
3138 cij += *arp++ * *brp++;
3149template <
class Element>
3158 }
else if (R__v == 2) {
3170 if (this->fNelems > 0) {
3191 for (
Int_t j = i; j < this->fNcols; j++) {
3192 const Int_t off_j = j * this->fNrows;
3193 const Element tmp =
fElements[off_i + j];
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).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
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)
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
TMatrixTSym< Double_t > TMatrixDSym
TMatrixT< Double_t > TMatrixD
TMatrixTSym< Float_t > TMatrixFSym
TMatrixT< Float_t > TMatrixF
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
TTime operator*(const TTime &t1, const TTime &t2)
TTime operator-(const TTime &t1, const TTime &t2)
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t ReadArray(Bool_t *&b)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
void Det(Double_t &d1, Double_t &d2) override
Calculate determinant det = d1*TMathPower(2.,d2).
static Bool_t InvertLU(TMatrixD &a, Double_t tol, Double_t *det=nullptr)
Calculate matrix inversion through in place forward/backward substitution.
const TMatrixD & GetEigenVectors() const
const TVectorD & GetEigenValuesRe() const
virtual const Element * GetMatrixArray() const =0
Bool_t fIsOwner
!default kTRUE, when Use array kFALSE
virtual TMatrixTBase< Element > & UnitMatrix()
Make a unit matrix (matrix need not be a square one).
virtual const Int_t * GetRowIndexArray() const =0
virtual const Int_t * GetColIndexArray() const =0
virtual TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t nr_nonzeros=-1)=0
Int_t GetNoElements() const
Element SetTol(Element tol)
virtual Bool_t IsSymmetric() const
Check whether matrix is symmetric.
virtual TMatrixTBase< Element > & SetMatrixArray(const Element *data, Option_t *option="")
Copy array data to matrix .
const TMatrixTBase< Element > * GetMatrix() const
const Element * GetPtr() const
const Element * GetPtr() const
const TMatrixTBase< Element > * GetMatrix() const
Templates of Lazy Matrix classes.
virtual void FillIn(TMatrixT< Element > &m) const =0
const Int_t * GetRowIndexArray() const override
const Int_t * GetColIndexArray() const override
const Element * GetMatrixArray() const override
TMatrixTSym< Element > & Invert(Double_t *det=nullptr)
Invert the matrix and calculate its determinant Notice that the LU decomposition is used instead of B...
const Element * GetMatrixArray() const override
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 Clear(Option_t *="") override
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.
Element fDataStack[TMatrixTBase< Element >::kSizeMax]
! data container
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,...
const Element * GetMatrixArray() const override
void Minus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix subtraction. Replace this matrix with C such that C = A - B.
TClass * IsA() const override
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
TVectorT< Element > & ResizeTo(Int_t lwb, Int_t upb)
Resize the vector to [lwb:upb] .
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 .
Bool_t Inv6x6(TMatrixT< Element > &m, Double_t *determ)
Bool_t Inv3x3(TMatrixT< Element > &m, Double_t *determ)
Bool_t Inv4x4(TMatrixT< Element > &m, Double_t *determ)
Bool_t Inv2x2(TMatrixT< Element > &m, Double_t *determ)
Bool_t Inv5x5(TMatrixT< Element > &m, Double_t *determ)