33 templateClassImp(TMatrixT);
38 template<
class Element>
39 TMatrixT<Element>::TMatrixT(Int_t nrows,Int_t ncols)
41 Allocate(nrows,ncols,0,0,1);
47 template<
class Element>
48 TMatrixT<Element>::TMatrixT(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb)
50 Allocate(row_upb-row_lwb+1,col_upb-col_lwb+1,row_lwb,col_lwb,1);
61 template<
class Element>
62 TMatrixT<Element>::TMatrixT(Int_t no_rows,Int_t no_cols,
const Element *elements,Option_t *option)
64 Allocate(no_rows,no_cols);
65 TMatrixTBase<Element>::SetMatrixArray(elements,option);
71 template<
class Element>
72 TMatrixT<Element>::TMatrixT(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,
73 const Element *elements,Option_t *option)
75 Allocate(row_upb-row_lwb+1,col_upb-col_lwb+1,row_lwb,col_lwb);
76 TMatrixTBase<Element>::SetMatrixArray(elements,option);
82 template<
class Element>
83 TMatrixT<Element>::TMatrixT(
const TMatrixT<Element> &another) : TMatrixTBase<Element>(another)
85 R__ASSERT(another.IsValid());
86 Allocate(another.GetNrows(),another.GetNcols(),another.GetRowLwb(),another.GetColLwb());
93 template<
class Element>
94 TMatrixT<Element>::TMatrixT(
const TMatrixTSym<Element> &another)
96 R__ASSERT(another.IsValid());
97 Allocate(another.GetNrows(),another.GetNcols(),another.GetRowLwb(),another.GetColLwb());
104 template<
class Element>
105 TMatrixT<Element>::TMatrixT(
const TMatrixTSparse<Element> &another)
107 R__ASSERT(another.IsValid());
108 Allocate(another.GetNrows(),another.GetNcols(),another.GetRowLwb(),another.GetColLwb());
117 template<
class Element>
118 TMatrixT<Element>::TMatrixT(EMatrixCreatorsOp1 op,
const TMatrixT<Element> &prototype)
120 R__ASSERT(prototype.IsValid());
124 Allocate(prototype.GetNrows(),prototype.GetNcols(),
125 prototype.GetRowLwb(),prototype.GetColLwb(),1);
129 Allocate(prototype.GetNrows(),prototype.GetNcols(),
130 prototype.GetRowLwb(),prototype.GetColLwb(),1);
135 Allocate(prototype.GetNcols(), prototype.GetNrows(),
136 prototype.GetColLwb(),prototype.GetRowLwb());
137 Transpose(prototype);
142 Allocate(prototype.GetNrows(),prototype.GetNcols(),
143 prototype.GetRowLwb(),prototype.GetColLwb(),1);
147 const Element oldTol = this->SetTol(std::numeric_limits<Element>::min());
149 this->SetTol(oldTol);
154 Allocate(prototype.GetNcols(),prototype.GetNcols(),prototype.GetColLwb(),prototype.GetColLwb(),1);
155 TMult(prototype,prototype);
159 Error(
"TMatrixT(EMatrixCreatorOp1)",
"operation %d not yet implemented", op);
168 template<
class Element>
169 TMatrixT<Element>::TMatrixT(
const TMatrixT<Element> &a,EMatrixCreatorsOp2 op,
const TMatrixT<Element> &b)
171 R__ASSERT(a.IsValid());
172 R__ASSERT(b.IsValid());
176 Allocate(a.GetNrows(),b.GetNcols(),a.GetRowLwb(),b.GetColLwb(),1);
181 Allocate(a.GetNcols(),b.GetNcols(),a.GetColLwb(),b.GetColLwb(),1);
186 Allocate(a.GetNrows(),b.GetNrows(),a.GetRowLwb(),b.GetRowLwb(),1);
192 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
194 const Element oldTol = this->SetTol(std::numeric_limits<Element>::min());
196 this->SetTol(oldTol);
203 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
210 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
216 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
225 template<
class Element>
226 TMatrixT<Element>::TMatrixT(
const TMatrixT<Element> &a,EMatrixCreatorsOp2 op,
const TMatrixTSym<Element> &b)
228 R__ASSERT(a.IsValid());
229 R__ASSERT(b.IsValid());
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);
249 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
251 const Element oldTol = this->SetTol(std::numeric_limits<Element>::min());
253 this->SetTol(oldTol);
260 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
267 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
273 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
282 template<
class Element>
283 TMatrixT<Element>::TMatrixT(
const TMatrixTSym<Element> &a,EMatrixCreatorsOp2 op,
const TMatrixT<Element> &b)
285 R__ASSERT(a.IsValid());
286 R__ASSERT(b.IsValid());
290 Allocate(a.GetNrows(),b.GetNcols(),a.GetRowLwb(),b.GetColLwb(),1);
295 Allocate(a.GetNcols(),b.GetNcols(),a.GetColLwb(),b.GetColLwb(),1);
300 Allocate(a.GetNrows(),b.GetNrows(),a.GetRowLwb(),b.GetRowLwb(),1);
306 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
308 const Element oldTol = this->SetTol(std::numeric_limits<Element>::min());
310 this->SetTol(oldTol);
317 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
324 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
330 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
339 template<
class Element>
340 TMatrixT<Element>::TMatrixT(
const TMatrixTSym<Element> &a,EMatrixCreatorsOp2 op,
const TMatrixTSym<Element> &b)
342 R__ASSERT(a.IsValid());
343 R__ASSERT(b.IsValid());
347 Allocate(a.GetNrows(),b.GetNcols(),a.GetRowLwb(),b.GetColLwb(),1);
352 Allocate(a.GetNcols(),b.GetNcols(),a.GetColLwb(),b.GetColLwb(),1);
357 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());
367 this->SetTol(oldTol);
374 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
375 Plus(*
dynamic_cast<const TMatrixT<Element> *
>(&a),b);
381 Allocate(a.GetNrows(),a.GetNcols(),a.GetRowLwb(),a.GetColLwb(),1);
382 Minus(*
dynamic_cast<const TMatrixT<Element> *
>(&a),b);
387 Error(
"TMatrixT(EMatrixCreatorOp2)",
"operation %d not yet implemented", op);
394 template<
class Element>
395 TMatrixT<Element>::TMatrixT(
const TMatrixTLazy<Element> &lazy_constructor)
397 Allocate(lazy_constructor.GetRowUpb()-lazy_constructor.GetRowLwb()+1,
398 lazy_constructor.GetColUpb()-lazy_constructor.GetColLwb()+1,
399 lazy_constructor.GetRowLwb(),lazy_constructor.GetColLwb(),1);
400 lazy_constructor.FillIn(*
this);
406 template<
class Element>
407 void TMatrixT<Element>::Delete_m(Int_t size,Element *&m)
410 if (size > this->kSizeMax)
420 template<
class Element>
421 Element* TMatrixT<Element>::New_m(Int_t size)
423 if (size == 0)
return 0;
425 if ( size <= this->kSizeMax )
428 Element *heap =
new Element[size];
438 template<
class Element>
439 Int_t TMatrixT<Element>::Memcpy_m(Element *newp,
const Element *oldp,Int_t copySize,
440 Int_t newSize,Int_t oldSize)
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>
466 void TMatrixT<Element>::Allocate(Int_t no_rows,Int_t no_cols,Int_t row_lwb,Int_t col_lwb,
469 this->fIsOwner = kTRUE;
470 this->fTol = std::numeric_limits<Element>::epsilon();
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;
493 if( ((Long64_t)this->fNrows)*this->fNcols != this->fNelems )
495 Error(
"Allocate",
"too large: no_rows=%d no_cols=%d",no_rows,no_cols);
500 if (this->fNelems > 0) {
501 fElements = New_m(this->fNelems);
503 memset(fElements,0,this->fNelems*
sizeof(Element));
511 template<
class Element>
512 void TMatrixT<Element>::Plus(
const TMatrixT<Element> &a,
const TMatrixT<Element> &b)
515 if (!AreCompatible(a,b)) {
516 Error(
"Plus",
"matrices not compatible");
520 if (this->GetMatrixArray() == a.GetMatrixArray()) {
521 Error(
"Plus",
"this->GetMatrixArray() == a.GetMatrixArray()");
525 if (this->GetMatrixArray() == b.GetMatrixArray()) {
526 Error(
"Plus",
"this->GetMatrixArray() == b.GetMatrixArray()");
531 const Element * ap = a.GetMatrixArray();
532 const Element * bp = b.GetMatrixArray();
533 Element * cp = this->GetMatrixArray();
534 const Element *
const cp_last = cp+this->fNelems;
536 while (cp < cp_last) {
545 template<
class Element>
546 void TMatrixT<Element>::Plus(
const TMatrixT<Element> &a,
const TMatrixTSym<Element> &b)
549 if (!AreCompatible(a,b)) {
550 Error(
"Plus",
"matrices not compatible");
554 if (this->GetMatrixArray() == a.GetMatrixArray()) {
555 Error(
"Plus",
"this->GetMatrixArray() == a.GetMatrixArray()");
559 if (this->GetMatrixArray() == b.GetMatrixArray()) {
560 Error(
"Plus",
"this->GetMatrixArray() == b.GetMatrixArray()");
565 const Element * ap = a.GetMatrixArray();
566 const Element * bp = b.GetMatrixArray();
567 Element * cp = this->GetMatrixArray();
568 const Element *
const cp_last = cp+this->fNelems;
570 while (cp < cp_last) {
579 template<
class Element>
580 void TMatrixT<Element>::Minus(
const TMatrixT<Element> &a,
const TMatrixT<Element> &b)
583 if (!AreCompatible(a,b)) {
584 Error(
"Minus",
"matrices not compatible");
588 if (this->GetMatrixArray() == a.GetMatrixArray()) {
589 Error(
"Minus",
"this->GetMatrixArray() == a.GetMatrixArray()");
593 if (this->GetMatrixArray() == b.GetMatrixArray()) {
594 Error(
"Minus",
"this->GetMatrixArray() == b.GetMatrixArray()");
599 const Element * ap = a.GetMatrixArray();
600 const Element * bp = b.GetMatrixArray();
601 Element * cp = this->GetMatrixArray();
602 const Element *
const cp_last = cp+this->fNelems;
604 while (cp < cp_last) {
613 template<
class Element>
614 void TMatrixT<Element>::Minus(
const TMatrixT<Element> &a,
const TMatrixTSym<Element> &b)
617 if (!AreCompatible(a,b)) {
618 Error(
"Minus",
"matrices not compatible");
622 if (this->GetMatrixArray() == a.GetMatrixArray()) {
623 Error(
"Minus",
"this->GetMatrixArray() == a.GetMatrixArray()");
627 if (this->GetMatrixArray() == b.GetMatrixArray()) {
628 Error(
"Minus",
"this->GetMatrixArray() == b.GetMatrixArray()");
633 const Element * ap = a.GetMatrixArray();
634 const Element * bp = b.GetMatrixArray();
635 Element * cp = this->GetMatrixArray();
636 const Element *
const cp_last = cp+this->fNelems;
638 while (cp < cp_last) {
647 template<
class Element>
648 void TMatrixT<Element>::Mult(
const TMatrixT<Element> &a,
const TMatrixT<Element> &b)
651 if (a.GetNcols() != b.GetNrows() || a.GetColLwb() != b.GetRowLwb()) {
652 Error(
"Mult",
"A rows and B columns incompatible");
656 if (this->GetMatrixArray() == a.GetMatrixArray()) {
657 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
661 if (this->GetMatrixArray() == b.GetMatrixArray()) {
662 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
668 const Element *ap = a.GetMatrixArray();
669 const Element *bp = b.GetMatrixArray();
670 Element *cp = this->GetMatrixArray();
671 if (
typeid(Element) ==
typeid(Double_t))
672 cblas_dgemm (CblasRowMajor,CblasNoTrans,CblasNoTrans,fNrows,fNcols,a.GetNcols(),
673 1.0,ap,a.GetNcols(),bp,b.GetNcols(),1.0,cp,fNcols);
674 else if (
typeid(Element) !=
typeid(Float_t))
675 cblas_sgemm (CblasRowMajor,CblasNoTrans,CblasNoTrans,fNrows,fNcols,a.GetNcols(),
676 1.0,ap,a.GetNcols(),bp,b.GetNcols(),1.0,cp,fNcols);
678 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
680 const Int_t na = a.GetNoElements();
681 const Int_t nb = b.GetNoElements();
682 const Int_t ncolsa = a.GetNcols();
683 const Int_t ncolsb = b.GetNcols();
684 const Element *
const ap = a.GetMatrixArray();
685 const Element *
const bp = b.GetMatrixArray();
686 Element * cp = this->GetMatrixArray();
688 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
696 template<
class Element>
697 void TMatrixT<Element>::Mult(
const TMatrixTSym<Element> &a,
const TMatrixT<Element> &b)
700 R__ASSERT(a.IsValid());
701 R__ASSERT(b.IsValid());
702 if (a.GetNcols() != b.GetNrows() || a.GetColLwb() != b.GetRowLwb()) {
703 Error(
"Mult",
"A rows and B columns incompatible");
707 if (this->GetMatrixArray() == a.GetMatrixArray()) {
708 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
712 if (this->GetMatrixArray() == b.GetMatrixArray()) {
713 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
719 const Element *ap = a.GetMatrixArray();
720 const Element *bp = b.GetMatrixArray();
721 Element *cp = this->GetMatrixArray();
722 if (
typeid(Element) ==
typeid(Double_t))
723 cblas_dsymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
724 ap,a.GetNcols(),bp,b.GetNcols(),0.0,cp,fNcols);
725 else if (
typeid(Element) !=
typeid(Float_t))
726 cblas_ssymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
727 ap,a.GetNcols(),bp,b.GetNcols(),0.0,cp,fNcols);
729 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
731 const Int_t na = a.GetNoElements();
732 const Int_t nb = b.GetNoElements();
733 const Int_t ncolsa = a.GetNcols();
734 const Int_t ncolsb = b.GetNcols();
735 const Element *
const ap = a.GetMatrixArray();
736 const Element *
const bp = b.GetMatrixArray();
737 Element * cp = this->GetMatrixArray();
739 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
748 template<
class Element>
749 void TMatrixT<Element>::Mult(
const TMatrixT<Element> &a,
const TMatrixTSym<Element> &b)
752 R__ASSERT(a.IsValid());
753 R__ASSERT(b.IsValid());
754 if (a.GetNcols() != b.GetNrows() || a.GetColLwb() != b.GetRowLwb()) {
755 Error(
"Mult",
"A rows and B columns incompatible");
759 if (this->GetMatrixArray() == a.GetMatrixArray()) {
760 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
764 if (this->GetMatrixArray() == b.GetMatrixArray()) {
765 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
771 const Element *ap = a.GetMatrixArray();
772 const Element *bp = b.GetMatrixArray();
773 Element *cp = this->GetMatrixArray();
774 if (
typeid(Element) ==
typeid(Double_t))
775 cblas_dsymm (CblasRowMajor,CblasRight,CblasUpper,fNrows,fNcols,1.0,
776 bp,b.GetNcols(),ap,a.GetNcols(),0.0,cp,fNcols);
777 else if (
typeid(Element) !=
typeid(Float_t))
778 cblas_ssymm (CblasRowMajor,CblasRight,CblasUpper,fNrows,fNcols,1.0,
779 bp,b.GetNcols(),ap,a.GetNcols(),0.0,cp,fNcols);
781 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
783 const Int_t na = a.GetNoElements();
784 const Int_t nb = b.GetNoElements();
785 const Int_t ncolsa = a.GetNcols();
786 const Int_t ncolsb = b.GetNcols();
787 const Element *
const ap = a.GetMatrixArray();
788 const Element *
const bp = b.GetMatrixArray();
789 Element * cp = this->GetMatrixArray();
791 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
800 template<
class Element>
801 void TMatrixT<Element>::Mult(
const TMatrixTSym<Element> &a,
const TMatrixTSym<Element> &b)
804 R__ASSERT(a.IsValid());
805 R__ASSERT(b.IsValid());
806 if (a.GetNcols() != b.GetNrows() || a.GetColLwb() != b.GetRowLwb()) {
807 Error(
"Mult",
"A rows and B columns incompatible");
811 if (this->GetMatrixArray() == a.GetMatrixArray()) {
812 Error(
"Mult",
"this->GetMatrixArray() == a.GetMatrixArray()");
816 if (this->GetMatrixArray() == b.GetMatrixArray()) {
817 Error(
"Mult",
"this->GetMatrixArray() == b.GetMatrixArray()");
823 const Element *ap = a.GetMatrixArray();
824 const Element *bp = b.GetMatrixArray();
825 Element *cp = this->GetMatrixArray();
826 if (
typeid(Element) ==
typeid(Double_t))
827 cblas_dsymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
828 ap,a.GetNcols(),bp,b.GetNcols(),0.0,cp,fNcols);
829 else if (
typeid(Element) !=
typeid(Float_t))
830 cblas_ssymm (CblasRowMajor,CblasLeft,CblasUpper,fNrows,fNcols,1.0,
831 ap,a.GetNcols(),bp,b.GetNcols(),0.0,cp,fNcols);
833 Error(
"Mult",
"type %s not implemented in BLAS library",
typeid(Element));
835 const Int_t na = a.GetNoElements();
836 const Int_t nb = b.GetNoElements();
837 const Int_t ncolsa = a.GetNcols();
838 const Int_t ncolsb = b.GetNcols();
839 const Element *
const ap = a.GetMatrixArray();
840 const Element *
const bp = b.GetMatrixArray();
841 Element * cp = this->GetMatrixArray();
843 AMultB(ap,na,ncolsa,bp,nb,ncolsb,cp);
851 template<
class Element>
852 void TMatrixT<Element>::TMult(
const TMatrixT<Element> &a,
const TMatrixT<Element> &b)
855 R__ASSERT(a.IsValid());
856 R__ASSERT(b.IsValid());
857 if (a.GetNrows() != b.GetNrows() || a.GetRowLwb() != b.GetRowLwb()) {
858 Error(
"TMult",
"A rows and B columns incompatible");
862 if (this->GetMatrixArray() == a.GetMatrixArray()) {
863 Error(
"TMult",
"this->GetMatrixArray() == a.GetMatrixArray()");
867 if (this->GetMatrixArray() == b.GetMatrixArray()) {
868 Error(
"TMult",
"this->GetMatrixArray() == b.GetMatrixArray()");
874 const Element *ap = a.GetMatrixArray();
875 const Element *bp = b.GetMatrixArray();
876 Element *cp = this->GetMatrixArray();
877 if (
typeid(Element) ==
typeid(Double_t))
878 cblas_dgemm (CblasRowMajor,CblasTrans,CblasNoTrans,this->fNrows,this->fNcols,a.GetNrows(),
879 1.0,ap,a.GetNcols(),bp,b.GetNcols(),1.0,cp,this->fNcols);
880 else if (
typeid(Element) !=
typeid(Float_t))
881 cblas_sgemm (CblasRowMajor,CblasTrans,CblasNoTrans,fNrows,fNcols,a.GetNrows(),
882 1.0,ap,a.GetNcols(),bp,b.GetNcols(),1.0,cp,fNcols);
884 Error(
"TMult",
"type %s not implemented in BLAS library",
typeid(Element));
886 const Int_t nb = b.GetNoElements();
887 const Int_t ncolsa = a.GetNcols();
888 const Int_t ncolsb = b.GetNcols();
889 const Element *
const ap = a.GetMatrixArray();
890 const Element *
const bp = b.GetMatrixArray();
891 Element * cp = this->GetMatrixArray();
893 AtMultB(ap,ncolsa,bp,nb,ncolsb,cp);
901 template<
class Element>
902 void TMatrixT<Element>::TMult(
const TMatrixT<Element> &a,
const TMatrixTSym<Element> &b)
905 R__ASSERT(a.IsValid());
906 R__ASSERT(b.IsValid());
907 if (a.GetNrows() != b.GetNrows() || a.GetRowLwb() != b.GetRowLwb()) {
908 Error(
"TMult",
"A rows and B columns incompatible");
912 if (this->GetMatrixArray() == a.GetMatrixArray()) {
913 Error(
"TMult",
"this->GetMatrixArray() == a.GetMatrixArray()");
917 if (this->GetMatrixArray() == b.GetMatrixArray()) {
918 Error(
"TMult",
"this->GetMatrixArray() == b.GetMatrixArray()");
924 const Element *ap = a.GetMatrixArray();
925 const Element *bp = b.GetMatrixArray();
926 Element *cp = this->GetMatrixArray();
927 if (
typeid(Element) ==
typeid(Double_t))
928 cblas_dgemm (CblasRowMajor,CblasTrans,CblasNoTrans,fNrows,fNcols,a.GetNrows(),
929 1.0,ap,a.GetNcols(),bp,b.GetNcols(),1.0,cp,fNcols);
930 else if (
typeid(Element) !=
typeid(Float_t))
931 cblas_sgemm (CblasRowMajor,CblasTrans,CblasNoTrans,fNrows,fNcols,a.GetNrows(),
932 1.0,ap,a.GetNcols(),bp,b.GetNcols(),1.0,cp,fNcols);
934 Error(
"TMult",
"type %s not implemented in BLAS library",
typeid(Element));
936 const Int_t nb = b.GetNoElements();
937 const Int_t ncolsa = a.GetNcols();
938 const Int_t ncolsb = b.GetNcols();
939 const Element *
const ap = a.GetMatrixArray();
940 const Element *
const bp = b.GetMatrixArray();
941 Element * cp = this->GetMatrixArray();
943 AtMultB(ap,ncolsa,bp,nb,ncolsb,cp);
950 template<
class Element>
951 void TMatrixT<Element>::MultT(
const TMatrixT<Element> &a,
const TMatrixT<Element> &b)
954 R__ASSERT(a.IsValid());
955 R__ASSERT(b.IsValid());
957 if (a.GetNcols() != b.GetNcols() || a.GetColLwb() != b.GetColLwb()) {
958 Error(
"MultT",
"A rows and B columns incompatible");
962 if (this->GetMatrixArray() == a.GetMatrixArray()) {
963 Error(
"MultT",
"this->GetMatrixArray() == a.GetMatrixArray()");
967 if (this->GetMatrixArray() == b.GetMatrixArray()) {
968 Error(
"MultT",
"this->GetMatrixArray() == b.GetMatrixArray()");
974 const Element *ap = a.GetMatrixArray();
975 const Element *bp = b.GetMatrixArray();
976 Element *cp = this->GetMatrixArray();
977 if (
typeid(Element) ==
typeid(Double_t))
978 cblas_dgemm (CblasRowMajor,CblasNoTrans,CblasTrans,fNrows,fNcols,a.GetNcols(),
979 1.0,ap,a.GetNcols(),bp,b.GetNcols(),1.0,cp,fNcols);
980 else if (
typeid(Element) !=
typeid(Float_t))
981 cblas_sgemm (CblasRowMajor,CblasNoTrans,CblasTrans,fNrows,fNcols,a.GetNcols(),
982 1.0,ap,a.GetNcols(),bp,b.GetNcols(),1.0,cp,fNcols);
984 Error(
"MultT",
"type %s not implemented in BLAS library",
typeid(Element));
986 const Int_t na = a.GetNoElements();
987 const Int_t nb = b.GetNoElements();
988 const Int_t ncolsa = a.GetNcols();
989 const Int_t ncolsb = b.GetNcols();
990 const Element *
const ap = a.GetMatrixArray();
991 const Element *
const bp = b.GetMatrixArray();
992 Element * cp = this->GetMatrixArray();
994 AMultBt(ap,na,ncolsa,bp,nb,ncolsb,cp);
1002 template<
class Element>
1003 void TMatrixT<Element>::MultT(
const TMatrixTSym<Element> &a,
const TMatrixT<Element> &b)
1006 R__ASSERT(a.IsValid());
1007 R__ASSERT(b.IsValid());
1008 if (a.GetNcols() != b.GetNcols() || a.GetColLwb() != b.GetColLwb()) {
1009 Error(
"MultT",
"A rows and B columns incompatible");
1013 if (this->GetMatrixArray() == a.GetMatrixArray()) {
1014 Error(
"MultT",
"this->GetMatrixArray() == a.GetMatrixArray()");
1018 if (this->GetMatrixArray() == b.GetMatrixArray()) {
1019 Error(
"MultT",
"this->GetMatrixArray() == b.GetMatrixArray()");
1025 const Element *ap = a.GetMatrixArray();
1026 const Element *bp = b.GetMatrixArray();
1027 Element *cp = this->GetMatrixArray();
1028 if (
typeid(Element) ==
typeid(Double_t))
1029 cblas_dgemm (CblasRowMajor,CblasNoTrans,CblasTrans,this->fNrows,this->fNcols,a.GetNcols(),
1030 1.0,ap,a.GetNcols(),bp,b.GetNcols(),1.0,cp,this->fNcols);
1031 else if (
typeid(Element) !=
typeid(Float_t))
1032 cblas_sgemm (CblasRowMajor,CblasNoTrans,CblasTrans,fNrows,fNcols,a.GetNcols(),
1033 1.0,ap,a.GetNcols(),bp,b.GetNcols(),1.0,cp,fNcols);
1035 Error(
"MultT",
"type %s not implemented in BLAS library",
typeid(Element));
1037 const Int_t na = a.GetNoElements();
1038 const Int_t nb = b.GetNoElements();
1039 const Int_t ncolsa = a.GetNcols();
1040 const Int_t ncolsb = b.GetNcols();
1041 const Element *
const ap = a.GetMatrixArray();
1042 const Element *
const bp = b.GetMatrixArray();
1043 Element * cp = this->GetMatrixArray();
1045 AMultBt(ap,na,ncolsa,bp,nb,ncolsb,cp);
1052 template<
class Element>
1053 TMatrixT<Element> &TMatrixT<Element>::Use(Int_t row_lwb,Int_t row_upb,
1054 Int_t col_lwb,Int_t col_upb,Element *data)
1057 if (row_upb < row_lwb)
1059 Error(
"Use",
"row_upb=%d < row_lwb=%d",row_upb,row_lwb);
1062 if (col_upb < col_lwb)
1064 Error(
"Use",
"col_upb=%d < col_lwb=%d",col_upb,col_lwb);
1070 this->fNrows = row_upb-row_lwb+1;
1071 this->fNcols = col_upb-col_lwb+1;
1072 this->fRowLwb = row_lwb;
1073 this->fColLwb = col_lwb;
1074 this->fNelems = this->fNrows*this->fNcols;
1076 this->fIsOwner = kFALSE;
1088 template<
class Element>
1089 TMatrixTBase<Element> &TMatrixT<Element>::GetSub(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,
1090 TMatrixTBase<Element> &target,Option_t *option)
const
1093 R__ASSERT(this->IsValid());
1094 if (row_lwb < this->fRowLwb || row_lwb > this->fRowLwb+this->fNrows-1) {
1095 Error(
"GetSub",
"row_lwb out of bounds");
1098 if (col_lwb < this->fColLwb || col_lwb > this->fColLwb+this->fNcols-1) {
1099 Error(
"GetSub",
"col_lwb out of bounds");
1102 if (row_upb < this->fRowLwb || row_upb > this->fRowLwb+this->fNrows-1) {
1103 Error(
"GetSub",
"row_upb out of bounds");
1106 if (col_upb < this->fColLwb || col_upb > this->fColLwb+this->fNcols-1) {
1107 Error(
"GetSub",
"col_upb out of bounds");
1110 if (row_upb < row_lwb || col_upb < col_lwb) {
1111 Error(
"GetSub",
"row_upb < row_lwb || col_upb < col_lwb");
1116 TString opt(option);
1118 const Int_t shift = (opt.Contains(
"S")) ? 1 : 0;
1120 const Int_t row_lwb_sub = (shift) ? 0 : row_lwb;
1121 const Int_t row_upb_sub = (shift) ? row_upb-row_lwb : row_upb;
1122 const Int_t col_lwb_sub = (shift) ? 0 : col_lwb;
1123 const Int_t col_upb_sub = (shift) ? col_upb-col_lwb : col_upb;
1125 target.ResizeTo(row_lwb_sub,row_upb_sub,col_lwb_sub,col_upb_sub);
1126 const Int_t nrows_sub = row_upb_sub-row_lwb_sub+1;
1127 const Int_t ncols_sub = col_upb_sub-col_lwb_sub+1;
1129 if (target.GetRowIndexArray() && target.GetColIndexArray()) {
1130 for (Int_t irow = 0; irow < nrows_sub; irow++) {
1131 for (Int_t icol = 0; icol < ncols_sub; icol++) {
1132 target(irow+row_lwb_sub,icol+col_lwb_sub) = (*this)(row_lwb+irow,col_lwb+icol);
1136 const Element *ap = this->GetMatrixArray()+(row_lwb-this->fRowLwb)*this->fNcols+(col_lwb-this->fColLwb);
1137 Element *bp = target.GetMatrixArray();
1139 for (Int_t irow = 0; irow < nrows_sub; irow++) {
1140 const Element *ap_sub = ap;
1141 for (Int_t icol = 0; icol < ncols_sub; icol++) {
1155 template<
class Element>
1156 TMatrixTBase<Element> &TMatrixT<Element>::SetSub(Int_t row_lwb,Int_t col_lwb,
const TMatrixTBase<Element> &source)
1159 R__ASSERT(this->IsValid());
1160 R__ASSERT(source.IsValid());
1162 if (row_lwb < this->fRowLwb || row_lwb > this->fRowLwb+this->fNrows-1) {
1163 Error(
"SetSub",
"row_lwb outof bounds");
1166 if (col_lwb < this->fColLwb || col_lwb > this->fColLwb+this->fNcols-1) {
1167 Error(
"SetSub",
"col_lwb outof bounds");
1170 if (row_lwb+source.GetNrows() > this->fRowLwb+this->fNrows ||
1171 col_lwb+source.GetNcols() > this->fColLwb+this->fNcols) {
1172 Error(
"SetSub",
"source matrix too large");
1177 const Int_t nRows_source = source.GetNrows();
1178 const Int_t nCols_source = source.GetNcols();
1180 if (source.GetRowIndexArray() && source.GetColIndexArray()) {
1181 const Int_t rowlwb_s = source.GetRowLwb();
1182 const Int_t collwb_s = source.GetColLwb();
1183 for (Int_t irow = 0; irow < nRows_source; irow++) {
1184 for (Int_t icol = 0; icol < nCols_source; icol++) {
1185 (*this)(row_lwb+irow,col_lwb+icol) = source(rowlwb_s+irow,collwb_s+icol);
1189 const Element *bp = source.GetMatrixArray();
1190 Element *ap = this->GetMatrixArray()+(row_lwb-this->fRowLwb)*this->fNcols+(col_lwb-this->fColLwb);
1192 for (Int_t irow = 0; irow < nRows_source; irow++) {
1193 Element *ap_sub = ap;
1194 for (Int_t icol = 0; icol < nCols_source; icol++) {
1209 template<
class Element>
1210 TMatrixTBase<Element> &TMatrixT<Element>::ResizeTo(Int_t nrows,Int_t ncols,Int_t )
1212 R__ASSERT(this->IsValid());
1213 if (!this->fIsOwner) {
1214 Error(
"ResizeTo(Int_t,Int_t)",
"Not owner of data array,cannot resize");
1218 if (this->fNelems > 0) {
1219 if (this->fNrows == nrows && this->fNcols == ncols)
1221 else if (nrows == 0 || ncols == 0) {
1222 this->fNrows = nrows; this->fNcols = ncols;
1227 Element *elements_old = GetMatrixArray();
1228 const Int_t nelems_old = this->fNelems;
1229 const Int_t nrows_old = this->fNrows;
1230 const Int_t ncols_old = this->fNcols;
1232 Allocate(nrows,ncols);
1233 R__ASSERT(this->IsValid());
1235 Element *elements_new = GetMatrixArray();
1238 if (this->fNelems > this->kSizeMax || nelems_old > this->kSizeMax)
1239 memset(elements_new,0,this->fNelems*
sizeof(Element));
1240 else if (this->fNelems > nelems_old)
1241 memset(elements_new+nelems_old,0,(this->fNelems-nelems_old)*
sizeof(Element));
1244 const Int_t ncols_copy = TMath::Min(this->fNcols,ncols_old);
1245 const Int_t nrows_copy = TMath::Min(this->fNrows,nrows_old);
1247 const Int_t nelems_new = this->fNelems;
1248 if (ncols_old < this->fNcols) {
1249 for (Int_t i = nrows_copy-1; i >= 0; i--) {
1250 Memcpy_m(elements_new+i*this->fNcols,elements_old+i*ncols_old,ncols_copy,
1251 nelems_new,nelems_old);
1252 if (this->fNelems <= this->kSizeMax && nelems_old <= this->kSizeMax)
1253 memset(elements_new+i*this->fNcols+ncols_copy,0,(this->fNcols-ncols_copy)*
sizeof(Element));
1256 for (Int_t i = 0; i < nrows_copy; i++)
1257 Memcpy_m(elements_new+i*this->fNcols,elements_old+i*ncols_old,ncols_copy,
1258 nelems_new,nelems_old);
1261 Delete_m(nelems_old,elements_old);
1263 Allocate(nrows,ncols,0,0,1);
1274 template<
class Element>
1275 TMatrixTBase<Element> &TMatrixT<Element>::ResizeTo(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,
1278 R__ASSERT(this->IsValid());
1279 if (!this->fIsOwner) {
1280 Error(
"ResizeTo(Int_t,Int_t,Int_t,Int_t)",
"Not owner of data array,cannot resize");
1284 const Int_t new_nrows = row_upb-row_lwb+1;
1285 const Int_t new_ncols = col_upb-col_lwb+1;
1287 if (this->fNelems > 0) {
1289 if (this->fNrows == new_nrows && this->fNcols == new_ncols &&
1290 this->fRowLwb == row_lwb && this->fColLwb == col_lwb)
1292 else if (new_nrows == 0 || new_ncols == 0) {
1293 this->fNrows = new_nrows; this->fNcols = new_ncols;
1294 this->fRowLwb = row_lwb; this->fColLwb = col_lwb;
1299 Element *elements_old = GetMatrixArray();
1300 const Int_t nelems_old = this->fNelems;
1301 const Int_t nrows_old = this->fNrows;
1302 const Int_t ncols_old = this->fNcols;
1303 const Int_t rowLwb_old = this->fRowLwb;
1304 const Int_t colLwb_old = this->fColLwb;
1306 Allocate(new_nrows,new_ncols,row_lwb,col_lwb);
1307 R__ASSERT(this->IsValid());
1309 Element *elements_new = GetMatrixArray();
1312 if (this->fNelems > this->kSizeMax || nelems_old > this->kSizeMax)
1313 memset(elements_new,0,this->fNelems*
sizeof(Element));
1314 else if (this->fNelems > nelems_old)
1315 memset(elements_new+nelems_old,0,(this->fNelems-nelems_old)*
sizeof(Element));
1318 const Int_t rowLwb_copy = TMath::Max(this->fRowLwb,rowLwb_old);
1319 const Int_t colLwb_copy = TMath::Max(this->fColLwb,colLwb_old);
1320 const Int_t rowUpb_copy = TMath::Min(this->fRowLwb+this->fNrows-1,rowLwb_old+nrows_old-1);
1321 const Int_t colUpb_copy = TMath::Min(this->fColLwb+this->fNcols-1,colLwb_old+ncols_old-1);
1323 const Int_t nrows_copy = rowUpb_copy-rowLwb_copy+1;
1324 const Int_t ncols_copy = colUpb_copy-colLwb_copy+1;
1326 if (nrows_copy > 0 && ncols_copy > 0) {
1327 const Int_t colOldOff = colLwb_copy-colLwb_old;
1328 const Int_t colNewOff = colLwb_copy-this->fColLwb;
1329 if (ncols_old < this->fNcols) {
1330 for (Int_t i = nrows_copy-1; i >= 0; i--) {
1331 const Int_t iRowOld = rowLwb_copy+i-rowLwb_old;
1332 const Int_t iRowNew = rowLwb_copy+i-this->fRowLwb;
1333 Memcpy_m(elements_new+iRowNew*this->fNcols+colNewOff,
1334 elements_old+iRowOld*ncols_old+colOldOff,ncols_copy,this->fNelems,nelems_old);
1335 if (this->fNelems <= this->kSizeMax && nelems_old <= this->kSizeMax)
1336 memset(elements_new+iRowNew*this->fNcols+colNewOff+ncols_copy,0,
1337 (this->fNcols-ncols_copy)*
sizeof(Element));
1340 for (Int_t i = 0; i < nrows_copy; i++) {
1341 const Int_t iRowOld = rowLwb_copy+i-rowLwb_old;
1342 const Int_t iRowNew = rowLwb_copy+i-this->fRowLwb;
1343 Memcpy_m(elements_new+iRowNew*this->fNcols+colNewOff,
1344 elements_old+iRowOld*ncols_old+colOldOff,ncols_copy,this->fNelems,nelems_old);
1349 Delete_m(nelems_old,elements_old);
1351 Allocate(new_nrows,new_ncols,row_lwb,col_lwb,1);
1360 template<
class Element>
1361 Double_t TMatrixT<Element>::Determinant()
const
1363 const TMatrixT<Element> &tmp = *
this;
1364 TDecompLU lu(tmp,this->fTol);
1367 return d1*TMath::Power(2.0,d2);
1373 template<
class Element>
1374 void TMatrixT<Element>::Determinant(Double_t &d1,Double_t &d2)
const
1376 const TMatrixT<Element> &tmp = *
this;
1377 TDecompLU lu(tmp,Double_t(this->fTol));
1385 TMatrixT<Double_t> &TMatrixT<Double_t>::Invert(Double_t *det)
1387 R__ASSERT(this->IsValid());
1388 TDecompLU::InvertLU(*
this, Double_t(fTol), det);
1395 template<
class Element>
1396 TMatrixT<Element> &TMatrixT<Element>::Invert(Double_t *det)
1398 TMatrixD tmp(*
this);
1399 if (TDecompLU::InvertLU(tmp, Double_t(this->fTol),det))
1400 std::copy(tmp.GetMatrixArray(), tmp.GetMatrixArray() + this->GetNoElements(), this->GetMatrixArray());
1409 template<
class Element>
1410 TMatrixT<Element> &TMatrixT<Element>::InvertFast(Double_t *det)
1412 R__ASSERT(this->IsValid());
1414 const Char_t nRows = Char_t(this->GetNrows());
1418 if (this->GetNrows() != this->GetNcols() || this->GetRowLwb() != this->GetColLwb()) {
1419 Error(
"Invert()",
"matrix should be square");
1421 Element *pM = this->GetMatrixArray();
1423 Error(
"InvertFast",
"matrix is singular");
1435 TMatrixTCramerInv::Inv2x2<Element>(*
this,det);
1440 TMatrixTCramerInv::Inv3x3<Element>(*
this,det);
1445 TMatrixTCramerInv::Inv4x4<Element>(*
this,det);
1450 TMatrixTCramerInv::Inv5x5<Element>(*
this,det);
1455 TMatrixTCramerInv::Inv6x6<Element>(*
this,det);
1468 template<
class Element>
1469 TMatrixT<Element> &TMatrixT<Element>::Transpose(
const TMatrixT<Element> &source)
1471 R__ASSERT(this->IsValid());
1472 R__ASSERT(source.IsValid());
1474 if (this->GetMatrixArray() == source.GetMatrixArray()) {
1475 Element *ap = this->GetMatrixArray();
1476 if (this->fNrows == this->fNcols && this->fRowLwb == this->fColLwb) {
1477 for (Int_t i = 0; i < this->fNrows; i++) {
1478 const Int_t off_i = i*this->fNrows;
1479 for (Int_t j = i+1; j < this->fNcols; j++) {
1480 const Int_t off_j = j*this->fNcols;
1481 const Element tmp = ap[off_i+j];
1482 ap[off_i+j] = ap[off_j+i];
1487 Element *oldElems =
new Element[source.GetNoElements()];
1488 memcpy(oldElems,source.GetMatrixArray(),source.GetNoElements()*
sizeof(Element));
1489 const Int_t nrows_old = this->fNrows;
1490 const Int_t ncols_old = this->fNcols;
1491 const Int_t rowlwb_old = this->fRowLwb;
1492 const Int_t collwb_old = this->fColLwb;
1494 this->fNrows = ncols_old; this->fNcols = nrows_old;
1495 this->fRowLwb = collwb_old; this->fColLwb = rowlwb_old;
1496 for (Int_t irow = this->fRowLwb; irow < this->fRowLwb+this->fNrows; irow++) {
1497 for (Int_t icol = this->fColLwb; icol < this->fColLwb+this->fNcols; icol++) {
1498 const Int_t off = (icol-collwb_old)*ncols_old;
1499 (*this)(irow,icol) = oldElems[off+irow-rowlwb_old];
1505 if (this->fNrows != source.GetNcols() || this->fNcols != source.GetNrows() ||
1506 this->fRowLwb != source.GetColLwb() || this->fColLwb != source.GetRowLwb())
1508 Error(
"Transpose",
"matrix has wrong shape");
1512 const Element *sp1 = source.GetMatrixArray();
1513 const Element *scp = sp1;
1514 Element *tp = this->GetMatrixArray();
1515 const Element *
const tp_last = this->GetMatrixArray()+this->fNelems;
1519 while (tp < tp_last) {
1520 const Element *sp2 = scp++;
1523 while (sp2 < sp1+this->fNelems) {
1525 sp2 += this->fNrows;
1528 R__ASSERT(tp == tp_last && scp == sp1+this->fNrows);
1538 template<
class Element>
1539 TMatrixT<Element> &TMatrixT<Element>::Rank1Update(
const TVectorT<Element> &v,Element alpha)
1542 R__ASSERT(this->IsValid());
1543 R__ASSERT(v.IsValid());
1544 if (v.GetNoElements() < TMath::Max(this->fNrows,this->fNcols)) {
1545 Error(
"Rank1Update",
"vector too short");
1550 const Element *
const pv = v.GetMatrixArray();
1551 Element *mp = this->GetMatrixArray();
1553 for (Int_t i = 0; i < this->fNrows; i++) {
1554 const Element tmp = alpha*pv[i];
1555 for (Int_t j = 0; j < this->fNcols; j++)
1566 template<
class Element>
1567 TMatrixT<Element> &TMatrixT<Element>::Rank1Update(
const TVectorT<Element> &v1,
const TVectorT<Element> &v2,Element alpha)
1570 R__ASSERT(this->IsValid());
1571 R__ASSERT(v1.IsValid());
1572 R__ASSERT(v2.IsValid());
1573 if (v1.GetNoElements() < this->fNrows) {
1574 Error(
"Rank1Update",
"vector v1 too short");
1578 if (v2.GetNoElements() < this->fNcols) {
1579 Error(
"Rank1Update",
"vector v2 too short");
1584 const Element *
const pv1 = v1.GetMatrixArray();
1585 const Element *
const pv2 = v2.GetMatrixArray();
1586 Element *mp = this->GetMatrixArray();
1588 for (Int_t i = 0; i < this->fNrows; i++) {
1589 const Element tmp = alpha*pv1[i];
1590 for (Int_t j = 0; j < this->fNcols; j++)
1591 *mp++ += tmp*pv2[j];
1600 template<
class Element>
1601 Element TMatrixT<Element>::Similarity(
const TVectorT<Element> &v)
const
1604 R__ASSERT(this->IsValid());
1605 R__ASSERT(v.IsValid());
1606 if (this->fNcols != this->fNrows || this->fColLwb != this->fRowLwb) {
1607 Error(
"Similarity(const TVectorT &)",
"matrix is not square");
1611 if (this->fNcols != v.GetNrows() || this->fColLwb != v.GetLwb()) {
1612 Error(
"Similarity(const TVectorT &)",
"vector and matrix incompatible");
1617 const Element *mp = this->GetMatrixArray();
1618 const Element *vp = v.GetMatrixArray();
1621 const Element *
const vp_first = vp;
1622 const Element *
const vp_last = vp+v.GetNrows();
1623 while (vp < vp_last) {
1625 for (
const Element *sp = vp_first; sp < vp_last; )
1626 sum2 += *mp++ * *sp++;
1627 sum1 += sum2 * *vp++;
1630 R__ASSERT(mp == this->GetMatrixArray()+this->GetNoElements());
1641 template<
class Element>
1642 TMatrixT<Element> &TMatrixT<Element>::NormByColumn(
const TVectorT<Element> &v,Option_t *option)
1645 R__ASSERT(this->IsValid());
1646 R__ASSERT(v.IsValid());
1647 if (v.GetNoElements() < this->fNrows) {
1648 Error(
"NormByColumn",
"vector shorter than matrix column");
1653 TString opt(option);
1655 const Int_t divide = (opt.Contains(
"D")) ? 1 : 0;
1657 const Element *pv = v.GetMatrixArray();
1658 Element *mp = this->GetMatrixArray();
1659 const Element *
const mp_last = mp+this->fNelems;
1662 for ( ; mp < mp_last; pv++) {
1663 for (Int_t j = 0; j < this->fNcols; j++)
1668 Error(
"NormbyColumn",
"vector element %ld is zero",Long_t(pv-v.GetMatrixArray()));
1674 for ( ; mp < mp_last; pv++)
1675 for (Int_t j = 0; j < this->fNcols; j++)
1688 template<
class Element>
1689 TMatrixT<Element> &TMatrixT<Element>::NormByRow(
const TVectorT<Element> &v,Option_t *option)
1692 R__ASSERT(this->IsValid());
1693 R__ASSERT(v.IsValid());
1694 if (v.GetNoElements() < this->fNcols) {
1695 Error(
"NormByRow",
"vector shorter than matrix column");
1700 TString opt(option);
1702 const Int_t divide = (opt.Contains(
"D")) ? 1 : 0;
1704 const Element *pv0 = v.GetMatrixArray();
1705 const Element *pv = pv0;
1706 Element *mp = this->GetMatrixArray();
1707 const Element *
const mp_last = mp+this->fNelems;
1710 for ( ; mp < mp_last; pv = pv0 )
1711 for (Int_t j = 0; j < this->fNcols; j++) {
1715 Error(
"NormbyRow",
"vector element %ld is zero",Long_t(pv-pv0));
1720 for ( ; mp < mp_last; pv = pv0 )
1721 for (Int_t j = 0; j < this->fNcols; j++)
1731 template<
class Element>
1732 TMatrixT<Element> &TMatrixT<Element>::operator=(
const TMatrixT<Element> &source)
1734 if (gMatrixCheck && !AreCompatible(*
this,source)) {
1735 Error(
"operator=(const TMatrixT &)",
"matrices not compatible");
1739 if (this->GetMatrixArray() != source.GetMatrixArray()) {
1740 TObject::operator=(source);
1741 memcpy(fElements,source.GetMatrixArray(),this->fNelems*
sizeof(Element));
1742 this->fTol = source.GetTol();
1750 template<
class Element>
1751 TMatrixT<Element> &TMatrixT<Element>::operator=(
const TMatrixTSym<Element> &source)
1753 if (gMatrixCheck && !AreCompatible(*
this,source)) {
1754 Error(
"operator=(const TMatrixTSym &)",
"matrices not compatible");
1758 if (this->GetMatrixArray() != source.GetMatrixArray()) {
1759 TObject::operator=(source);
1760 memcpy(fElements,source.GetMatrixArray(),this->fNelems*
sizeof(Element));
1761 this->fTol = source.GetTol();
1769 template<
class Element>
1770 TMatrixT<Element> &TMatrixT<Element>::operator=(
const TMatrixTSparse<Element> &source)
1772 if ((gMatrixCheck &&
1773 this->GetNrows() != source.GetNrows()) || this->GetNcols() != source.GetNcols() ||
1774 this->GetRowLwb() != source.GetRowLwb() || this->GetColLwb() != source.GetColLwb()) {
1775 Error(
"operator=(const TMatrixTSparse &",
"matrices not compatible");
1779 if (this->GetMatrixArray() != source.GetMatrixArray()) {
1780 TObject::operator=(source);
1781 memset(fElements,0,this->fNelems*
sizeof(Element));
1783 const Element *
const sp = source.GetMatrixArray();
1784 Element * tp = this->GetMatrixArray();
1786 const Int_t *
const pRowIndex = source.GetRowIndexArray();
1787 const Int_t *
const pColIndex = source.GetColIndexArray();
1789 for (Int_t irow = 0; irow < this->fNrows; irow++ ) {
1790 const Int_t off = irow*this->fNcols;
1791 const Int_t sIndex = pRowIndex[irow];
1792 const Int_t eIndex = pRowIndex[irow+1];
1793 for (Int_t index = sIndex; index < eIndex; index++)
1794 tp[off+pColIndex[index]] = sp[index];
1796 this->fTol = source.GetTol();
1804 template<
class Element>
1805 TMatrixT<Element> &TMatrixT<Element>::operator=(
const TMatrixTLazy<Element> &lazy_constructor)
1807 R__ASSERT(this->IsValid());
1809 if (lazy_constructor.GetRowUpb() != this->GetRowUpb() ||
1810 lazy_constructor.GetColUpb() != this->GetColUpb() ||
1811 lazy_constructor.GetRowLwb() != this->GetRowLwb() ||
1812 lazy_constructor.GetColLwb() != this->GetColLwb()) {
1813 Error(
"operator=(const TMatrixTLazy&)",
"matrix is incompatible with "
1814 "the assigned Lazy matrix");
1818 lazy_constructor.FillIn(*
this);
1825 template<
class Element>
1826 TMatrixT<Element> &TMatrixT<Element>::operator=(Element val)
1828 R__ASSERT(this->IsValid());
1830 Element *ep = this->GetMatrixArray();
1831 const Element *
const ep_last = ep+this->fNelems;
1832 while (ep < ep_last)
1841 template<
class Element>
1842 TMatrixT<Element> &TMatrixT<Element>::operator+=(Element val)
1844 R__ASSERT(this->IsValid());
1846 Element *ep = this->GetMatrixArray();
1847 const Element *
const ep_last = ep+this->fNelems;
1848 while (ep < ep_last)
1857 template<
class Element>
1858 TMatrixT<Element> &TMatrixT<Element>::operator-=(Element val)
1860 R__ASSERT(this->IsValid());
1862 Element *ep = this->GetMatrixArray();
1863 const Element *
const ep_last = ep+this->fNelems;
1864 while (ep < ep_last)
1873 template<
class Element>
1874 TMatrixT<Element> &TMatrixT<Element>::operator*=(Element val)
1876 R__ASSERT(this->IsValid());
1878 Element *ep = this->GetMatrixArray();
1879 const Element *
const ep_last = ep+this->fNelems;
1880 while (ep < ep_last)
1889 template<
class Element>
1890 TMatrixT<Element> &TMatrixT<Element>::operator+=(
const TMatrixT<Element> &source)
1892 if (gMatrixCheck && !AreCompatible(*
this,source)) {
1893 Error(
"operator+=(const TMatrixT &)",
"matrices not compatible");
1897 const Element *sp = source.GetMatrixArray();
1898 Element *tp = this->GetMatrixArray();
1899 const Element *
const tp_last = tp+this->fNelems;
1900 while (tp < tp_last)
1909 template<
class Element>
1910 TMatrixT<Element> &TMatrixT<Element>::operator+=(
const TMatrixTSym<Element> &source)
1912 if (gMatrixCheck && !AreCompatible(*
this,source)) {
1913 Error(
"operator+=(const TMatrixTSym &)",
"matrices not compatible");
1917 const Element *sp = source.GetMatrixArray();
1918 Element *tp = this->GetMatrixArray();
1919 const Element *
const tp_last = tp+this->fNelems;
1920 while (tp < tp_last)
1929 template<
class Element>
1930 TMatrixT<Element> &TMatrixT<Element>::operator-=(
const TMatrixT<Element> &source)
1932 if (gMatrixCheck && !AreCompatible(*
this,source)) {
1933 Error(
"operator=-(const TMatrixT &)",
"matrices not compatible");
1937 const Element *sp = source.GetMatrixArray();
1938 Element *tp = this->GetMatrixArray();
1939 const Element *
const tp_last = tp+this->fNelems;
1940 while (tp < tp_last)
1949 template<
class Element>
1950 TMatrixT<Element> &TMatrixT<Element>::operator-=(
const TMatrixTSym<Element> &source)
1952 if (gMatrixCheck && !AreCompatible(*
this,source)) {
1953 Error(
"operator=-(const TMatrixTSym &)",
"matrices not compatible");
1957 const Element *sp = source.GetMatrixArray();
1958 Element *tp = this->GetMatrixArray();
1959 const Element *
const tp_last = tp+this->fNelems;
1960 while (tp < tp_last)
1971 template<
class Element>
1972 TMatrixT<Element> &TMatrixT<Element>::operator*=(
const TMatrixT<Element> &source)
1975 R__ASSERT(this->IsValid());
1976 R__ASSERT(source.IsValid());
1977 if (this->fNcols != source.GetNrows() || this->fColLwb != source.GetRowLwb() ||
1978 this->fNcols != source.GetNcols() || this->fColLwb != source.GetColLwb()) {
1979 Error(
"operator*=(const TMatrixT &)",
"source matrix has wrong shape");
1986 TMatrixT<Element> tmp;
1987 if (this->GetMatrixArray() == source.GetMatrixArray()) {
1988 tmp.ResizeTo(source);
1990 sp = tmp.GetMatrixArray();
1993 sp = source.GetMatrixArray();
1996 Element work[kWorkMax];
1997 Bool_t isAllocated = kFALSE;
1998 Element *trp = work;
1999 if (this->fNcols > kWorkMax) {
2000 isAllocated = kTRUE;
2001 trp =
new Element[this->fNcols];
2004 Element *cp = this->GetMatrixArray();
2005 const Element *trp0 = cp;
2006 const Element *
const trp0_last = trp0+this->fNelems;
2007 while (trp0 < trp0_last) {
2008 memcpy(trp,trp0,this->fNcols*
sizeof(Element));
2009 for (
const Element *scp = sp; scp < sp+this->fNcols; ) {
2012 for (Int_t j = 0; j < this->fNcols; j++) {
2013 cij += trp[j] * *scp;
2014 scp += this->fNcols;
2017 scp -= source.GetNoElements()-1;
2019 trp0 += this->fNcols;
2020 R__ASSERT(trp0 == cp);
2023 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
2034 template<
class Element>
2035 TMatrixT<Element> &TMatrixT<Element>::operator*=(
const TMatrixTSym<Element> &source)
2038 R__ASSERT(this->IsValid());
2039 R__ASSERT(source.IsValid());
2040 if (this->fNcols != source.GetNrows() || this->fColLwb != source.GetRowLwb()) {
2041 Error(
"operator*=(const TMatrixTSym &)",
"source matrix has wrong shape");
2048 TMatrixT<Element> tmp;
2049 if (this->GetMatrixArray() == source.GetMatrixArray()) {
2050 tmp.ResizeTo(source);
2052 sp = tmp.GetMatrixArray();
2055 sp = source.GetMatrixArray();
2058 Element work[kWorkMax];
2059 Bool_t isAllocated = kFALSE;
2060 Element *trp = work;
2061 if (this->fNcols > kWorkMax) {
2062 isAllocated = kTRUE;
2063 trp =
new Element[this->fNcols];
2066 Element *cp = this->GetMatrixArray();
2067 const Element *trp0 = cp;
2068 const Element *
const trp0_last = trp0+this->fNelems;
2069 while (trp0 < trp0_last) {
2070 memcpy(trp,trp0,this->fNcols*
sizeof(Element));
2071 for (
const Element *scp = sp; scp < sp+this->fNcols; ) {
2074 for (Int_t j = 0; j < this->fNcols; j++) {
2075 cij += trp[j] * *scp;
2076 scp += this->fNcols;
2079 scp -= source.GetNoElements()-1;
2081 trp0 += this->fNcols;
2082 R__ASSERT(trp0 == cp);
2085 R__ASSERT(cp == trp0_last && trp0 == trp0_last);
2096 template<
class Element>
2097 TMatrixT<Element> &TMatrixT<Element>::operator*=(
const TMatrixTDiag_const<Element> &diag)
2100 R__ASSERT(this->IsValid());
2101 R__ASSERT(diag.GetMatrix()->IsValid());
2102 if (this->fNcols != diag.GetNdiags()) {
2103 Error(
"operator*=(const TMatrixTDiag_const &)",
"wrong diagonal length");
2108 Element *mp = this->GetMatrixArray();
2109 const Element *
const mp_last = mp+this->fNelems;
2110 const Int_t inc = diag.GetInc();
2111 while (mp < mp_last) {
2112 const Element *dp = diag.GetPtr();
2113 for (Int_t j = 0; j < this->fNcols; j++) {
2126 template<
class Element>
2127 TMatrixT<Element> &TMatrixT<Element>::operator/=(
const TMatrixTDiag_const<Element> &diag)
2130 R__ASSERT(this->IsValid());
2131 R__ASSERT(diag.GetMatrix()->IsValid());
2132 if (this->fNcols != diag.GetNdiags()) {
2133 Error(
"operator/=(const TMatrixTDiag_const &)",
"wrong diagonal length");
2138 Element *mp = this->GetMatrixArray();
2139 const Element *
const mp_last = mp+this->fNelems;
2140 const Int_t inc = diag.GetInc();
2141 while (mp < mp_last) {
2142 const Element *dp = diag.GetPtr();
2143 for (Int_t j = 0; j < this->fNcols; j++) {
2147 Error(
"operator/=",
"%d-diagonal element is zero",j);
2161 template<
class Element>
2162 TMatrixT<Element> &TMatrixT<Element>::operator*=(
const TMatrixTColumn_const<Element> &col)
2164 const TMatrixTBase<Element> *mt = col.GetMatrix();
2167 R__ASSERT(this->IsValid());
2168 R__ASSERT(mt->IsValid());
2169 if (this->fNrows != mt->GetNrows()) {
2170 Error(
"operator*=(const TMatrixTColumn_const &)",
"wrong column length");
2175 const Element *
const endp = col.GetPtr()+mt->GetNoElements();
2176 Element *mp = this->GetMatrixArray();
2177 const Element *
const mp_last = mp+this->fNelems;
2178 const Element *cp = col.GetPtr();
2179 const Int_t inc = col.GetInc();
2180 while (mp < mp_last) {
2181 R__ASSERT(cp < endp);
2182 for (Int_t j = 0; j < this->fNcols; j++)
2194 template<
class Element>
2195 TMatrixT<Element> &TMatrixT<Element>::operator/=(
const TMatrixTColumn_const<Element> &col)
2197 const TMatrixTBase<Element> *mt = col.GetMatrix();
2200 R__ASSERT(this->IsValid());
2201 R__ASSERT(mt->IsValid());
2202 if (this->fNrows != mt->GetNrows()) {
2203 Error(
"operator/=(const TMatrixTColumn_const &)",
"wrong column matrix");
2208 const Element *
const endp = col.GetPtr()+mt->GetNoElements();
2209 Element *mp = this->GetMatrixArray();
2210 const Element *
const mp_last = mp+this->fNelems;
2211 const Element *cp = col.GetPtr();
2212 const Int_t inc = col.GetInc();
2213 while (mp < mp_last) {
2214 R__ASSERT(cp < endp);
2216 for (Int_t j = 0; j < this->fNcols; j++)
2219 const Int_t icol = (cp-mt->GetMatrixArray())/inc;
2220 Error(
"operator/=",
"%d-row of matrix column is zero",icol);
2233 template<
class Element>
2234 TMatrixT<Element> &TMatrixT<Element>::operator*=(
const TMatrixTRow_const<Element> &row)
2236 const TMatrixTBase<Element> *mt = row.GetMatrix();
2239 R__ASSERT(this->IsValid());
2240 R__ASSERT(mt->IsValid());
2241 if (this->fNcols != mt->GetNcols()) {
2242 Error(
"operator*=(const TMatrixTRow_const &)",
"wrong row length");
2247 const Element *
const endp = row.GetPtr()+mt->GetNoElements();
2248 Element *mp = this->GetMatrixArray();
2249 const Element *
const mp_last = mp+this->fNelems;
2250 const Int_t inc = row.GetInc();
2251 while (mp < mp_last) {
2252 const Element *rp = row.GetPtr();
2253 for (Int_t j = 0; j < this->fNcols; j++) {
2254 R__ASSERT(rp < endp);
2267 template<
class Element>
2268 TMatrixT<Element> &TMatrixT<Element>::operator/=(
const TMatrixTRow_const<Element> &row)
2270 const TMatrixTBase<Element> *mt = row.GetMatrix();
2271 R__ASSERT(this->IsValid());
2272 R__ASSERT(mt->IsValid());
2274 if (this->fNcols != mt->GetNcols()) {
2275 Error(
"operator/=(const TMatrixTRow_const &)",
"wrong row length");
2279 const Element *
const endp = row.GetPtr()+mt->GetNoElements();
2280 Element *mp = this->GetMatrixArray();
2281 const Element *
const mp_last = mp+this->fNelems;
2282 const Int_t inc = row.GetInc();
2283 while (mp < mp_last) {
2284 const Element *rp = row.GetPtr();
2285 for (Int_t j = 0; j < this->fNcols; j++) {
2286 R__ASSERT(rp < endp);
2290 Error(
"operator/=",
"%d-col of matrix row is zero",j);
2306 template<
class Element>
2307 const TMatrixT<Element> TMatrixT<Element>::EigenVectors(TVectorT<Element> &eigenValues)
const
2309 if (!this->IsSymmetric())
2310 Warning(
"EigenVectors(TVectorT &)",
"Only real part of eigen-values will be returned");
2311 TMatrixDEigen eigen(*
this);
2312 eigenValues.ResizeTo(this->fNrows);
2313 eigenValues = eigen.GetEigenValuesRe();
2314 return eigen.GetEigenVectors();
2320 template<
class Element>
2321 TMatrixT<Element> operator+(
const TMatrixT<Element> &source1,
const TMatrixT<Element> &source2)
2323 TMatrixT<Element> target(source1);
2331 template<
class Element>
2332 TMatrixT<Element> operator+(
const TMatrixT<Element> &source1,
const TMatrixTSym<Element> &source2)
2334 TMatrixT<Element> target(source1);
2342 template<
class Element>
2343 TMatrixT<Element> operator+(
const TMatrixTSym<Element> &source1,
const TMatrixT<Element> &source2)
2345 return operator+(source2,source1);
2351 template<
class Element>
2352 TMatrixT<Element> operator+(
const TMatrixT<Element> &source,Element val)
2354 TMatrixT<Element> target(source);
2362 template<
class Element>
2363 TMatrixT<Element> operator+(Element val,
const TMatrixT<Element> &source)
2365 return operator+(source,val);
2371 template<
class Element>
2372 TMatrixT<Element> operator-(
const TMatrixT<Element> &source1,
const TMatrixT<Element> &source2)
2374 TMatrixT<Element> target(source1);
2382 template<
class Element>
2383 TMatrixT<Element> operator-(
const TMatrixT<Element> &source1,
const TMatrixTSym<Element> &source2)
2385 TMatrixT<Element> target(source1);
2393 template<
class Element>
2394 TMatrixT<Element> operator-(
const TMatrixTSym<Element> &source1,
const TMatrixT<Element> &source2)
2396 return Element(-1.0)*(operator-(source2,source1));
2402 template<
class Element>
2403 TMatrixT<Element> operator-(
const TMatrixT<Element> &source,Element val)
2405 TMatrixT<Element> target(source);
2413 template<
class Element>
2414 TMatrixT<Element> operator-(Element val,
const TMatrixT<Element> &source)
2416 return Element(-1.0)*operator-(source,val);
2422 template<
class Element>
2423 TMatrixT<Element> operator*(Element val,
const TMatrixT<Element> &source)
2425 TMatrixT<Element> target(source);
2433 template<
class Element>
2434 TMatrixT<Element> operator*(
const TMatrixT<Element> &source,Element val)
2436 return operator*(val,source);
2442 template<
class Element>
2443 TMatrixT<Element> operator*(
const TMatrixT<Element> &source1,
const TMatrixT<Element> &source2)
2445 TMatrixT<Element> target(source1,TMatrixT<Element>::kMult,source2);
2452 template<
class Element>
2453 TMatrixT<Element> operator*(
const TMatrixT<Element> &source1,
const TMatrixTSym<Element> &source2)
2455 TMatrixT<Element> target(source1,TMatrixT<Element>::kMult,source2);
2462 template<
class Element>
2463 TMatrixT<Element> operator*(
const TMatrixTSym<Element> &source1,
const TMatrixT<Element> &source2)
2465 TMatrixT<Element> target(source1,TMatrixT<Element>::kMult,source2);
2472 template<
class Element>
2473 TMatrixT<Element> operator*(
const TMatrixTSym<Element> &source1,
const TMatrixTSym<Element> &source2)
2475 TMatrixT<Element> target(source1,TMatrixT<Element>::kMult,source2);
2482 template<
class Element>
2483 TMatrixT<Element> operator&&(
const TMatrixT<Element> &source1,
const TMatrixT<Element> &source2)
2485 TMatrixT<Element> target;
2487 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2488 Error(
"operator&&(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2492 target.ResizeTo(source1);
2494 const Element *sp1 = source1.GetMatrixArray();
2495 const Element *sp2 = source2.GetMatrixArray();
2496 Element *tp = target.GetMatrixArray();
2497 const Element *
const tp_last = tp+target.GetNoElements();
2498 while (tp < tp_last)
2499 *tp++ = (*sp1++ != 0.0 && *sp2++ != 0.0);
2507 template<
class Element>
2508 TMatrixT<Element> operator&&(
const TMatrixT<Element> &source1,
const TMatrixTSym<Element> &source2)
2510 TMatrixT<Element> target;
2512 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2513 Error(
"operator&&(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2517 target.ResizeTo(source1);
2519 const Element *sp1 = source1.GetMatrixArray();
2520 const Element *sp2 = source2.GetMatrixArray();
2521 Element *tp = target.GetMatrixArray();
2522 const Element *
const tp_last = tp+target.GetNoElements();
2523 while (tp < tp_last)
2524 *tp++ = (*sp1++ != 0.0 && *sp2++ != 0.0);
2532 template<
class Element>
2533 TMatrixT<Element> operator&&(
const TMatrixTSym<Element> &source1,
const TMatrixT<Element> &source2)
2535 return operator&&(source2,source1);
2541 template<
class Element>
2542 TMatrixT<Element> operator||(
const TMatrixT<Element> &source1,
const TMatrixT<Element> &source2)
2544 TMatrixT<Element> target;
2546 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2547 Error(
"operator||(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2551 target.ResizeTo(source1);
2553 const Element *sp1 = source1.GetMatrixArray();
2554 const Element *sp2 = source2.GetMatrixArray();
2555 Element *tp = target.GetMatrixArray();
2556 const Element *
const tp_last = tp+target.GetNoElements();
2557 while (tp < tp_last)
2558 *tp++ = (*sp1++ != 0.0 || *sp2++ != 0.0);
2566 template<
class Element>
2567 TMatrixT<Element> operator||(
const TMatrixT<Element> &source1,
const TMatrixTSym<Element> &source2)
2569 TMatrixT<Element> target;
2571 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2572 Error(
"operator||(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2576 target.ResizeTo(source1);
2578 const Element *sp1 = source1.GetMatrixArray();
2579 const Element *sp2 = source2.GetMatrixArray();
2580 Element *tp = target.GetMatrixArray();
2581 const Element *
const tp_last = tp+target.GetNoElements();
2582 while (tp < tp_last)
2583 *tp++ = (*sp1++ != 0.0 || *sp2++ != 0.0);
2591 template<
class Element>
2592 TMatrixT<Element> operator||(
const TMatrixTSym<Element> &source1,
const TMatrixT<Element> &source2)
2594 return operator||(source2,source1);
2600 template<
class Element>
2601 TMatrixT<Element> operator>(
const TMatrixT<Element> &source1,
const TMatrixT<Element> &source2)
2603 TMatrixT<Element> target;
2605 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2606 Error(
"operator|(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2610 target.ResizeTo(source1);
2612 const Element *sp1 = source1.GetMatrixArray();
2613 const Element *sp2 = source2.GetMatrixArray();
2614 Element *tp = target.GetMatrixArray();
2615 const Element *
const tp_last = tp+target.GetNoElements();
2616 while (tp < tp_last) {
2617 *tp++ = (*sp1) > (*sp2); sp1++; sp2++;
2626 template<
class Element>
2627 TMatrixT<Element> operator>(
const TMatrixT<Element> &source1,
const TMatrixTSym<Element> &source2)
2629 TMatrixT<Element> target;
2631 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2632 Error(
"operator>(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2636 target.ResizeTo(source1);
2638 const Element *sp1 = source1.GetMatrixArray();
2639 const Element *sp2 = source2.GetMatrixArray();
2640 Element *tp = target.GetMatrixArray();
2641 const Element *
const tp_last = tp+target.GetNoElements();
2642 while (tp < tp_last) {
2643 *tp++ = (*sp1) > (*sp2); sp1++; sp2++;
2652 template<
class Element>
2653 TMatrixT<Element> operator>(
const TMatrixTSym<Element> &source1,
const TMatrixT<Element> &source2)
2655 return operator<=(source2,source1);
2661 template<
class Element>
2662 TMatrixT<Element> operator>=(
const TMatrixT<Element> &source1,
const TMatrixT<Element> &source2)
2664 TMatrixT<Element> target;
2666 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2667 Error(
"operator>=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2671 target.ResizeTo(source1);
2673 const Element *sp1 = source1.GetMatrixArray();
2674 const Element *sp2 = source2.GetMatrixArray();
2675 Element *tp = target.GetMatrixArray();
2676 const Element *
const tp_last = tp+target.GetNoElements();
2677 while (tp < tp_last) {
2678 *tp++ = (*sp1) >= (*sp2); sp1++; sp2++;
2687 template<
class Element>
2688 TMatrixT<Element> operator>=(
const TMatrixT<Element> &source1,
const TMatrixTSym<Element> &source2)
2690 TMatrixT<Element> target;
2692 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2693 Error(
"operator>=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2697 target.ResizeTo(source1);
2699 const Element *sp1 = source1.GetMatrixArray();
2700 const Element *sp2 = source2.GetMatrixArray();
2701 Element *tp = target.GetMatrixArray();
2702 const Element *
const tp_last = tp+target.GetNoElements();
2703 while (tp < tp_last) {
2704 *tp++ = (*sp1) >= (*sp2); sp1++; sp2++;
2713 template<
class Element>
2714 TMatrixT<Element> operator>=(
const TMatrixTSym<Element> &source1,
const TMatrixT<Element> &source2)
2716 return operator<(source2,source1);
2722 template<
class Element>
2723 TMatrixT<Element> operator<=(const TMatrixT<Element> &source1,
const TMatrixT<Element> &source2)
2725 TMatrixT<Element> target;
2727 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2728 Error(
"operator<=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2732 target.ResizeTo(source1);
2734 const Element *sp1 = source1.GetMatrixArray();
2735 const Element *sp2 = source2.GetMatrixArray();
2736 Element *tp = target.GetMatrixArray();
2737 const Element *
const tp_last = tp+target.GetNoElements();
2738 while (tp < tp_last) {
2739 *tp++ = (*sp1) <= (*sp2); sp1++; sp2++;
2748 template<
class Element>
2749 TMatrixT<Element> operator<=(const TMatrixT<Element> &source1,
const TMatrixTSym<Element> &source2)
2751 TMatrixT<Element> target;
2753 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2754 Error(
"operator<=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2758 target.ResizeTo(source1);
2760 const Element *sp1 = source1.GetMatrixArray();
2761 const Element *sp2 = source2.GetMatrixArray();
2762 Element *tp = target.GetMatrixArray();
2763 const Element *
const tp_last = tp+target.GetNoElements();
2764 while (tp < tp_last) {
2765 *tp++ = (*sp1) <= (*sp2); sp1++; sp2++;
2774 template<
class Element>
2775 TMatrixT<Element> operator<=(const TMatrixTSym<Element> &source1,
const TMatrixT<Element> &source2)
2777 return operator>(source2,source1);
2783 template<
class Element>
2784 TMatrixT<Element> operator<(const TMatrixT<Element> &source1,
const TMatrixT<Element> &source2)
2786 TMatrixT<Element> target;
2788 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2789 Error(
"operator<(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2793 const Element *sp1 = source1.GetMatrixArray();
2794 const Element *sp2 = source2.GetMatrixArray();
2795 Element *tp = target.GetMatrixArray();
2796 const Element *
const tp_last = tp+target.GetNoElements();
2797 while (tp < tp_last) {
2798 *tp++ = (*sp1) < (*sp2); sp1++; sp2++;
2807 template<
class Element>
2808 TMatrixT<Element> operator<(const TMatrixT<Element> &source1,
const TMatrixTSym<Element> &source2)
2810 TMatrixT<Element> target;
2812 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2813 Error(
"operator<(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2817 target.ResizeTo(source1);
2819 const Element *sp1 = source1.GetMatrixArray();
2820 const Element *sp2 = source2.GetMatrixArray();
2821 Element *tp = target.GetMatrixArray();
2822 const Element *
const tp_last = tp+target.GetNoElements();
2823 while (tp < tp_last) {
2824 *tp++ = (*sp1) < (*sp2); sp1++; sp2++;
2833 template<
class Element>
2834 TMatrixT<Element> operator<(const TMatrixTSym<Element> &source1,
const TMatrixT<Element> &source2)
2836 return operator>=(source2,source1);
2842 template<
class Element>
2843 TMatrixT<Element> operator!=(
const TMatrixT<Element> &source1,
const TMatrixT<Element> &source2)
2845 TMatrixT<Element> target;
2847 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2848 Error(
"operator!=(const TMatrixT&,const TMatrixT&)",
"matrices not compatible");
2852 target.ResizeTo(source1);
2854 const Element *sp1 = source1.GetMatrixArray();
2855 const Element *sp2 = source2.GetMatrixArray();
2856 Element *tp = target.GetMatrixArray();
2857 const Element *
const tp_last = tp+target.GetNoElements();
2858 while (tp != tp_last) {
2859 *tp++ = (*sp1) != (*sp2); sp1++; sp2++;
2868 template<
class Element>
2869 TMatrixT<Element> operator!=(
const TMatrixT<Element> &source1,
const TMatrixTSym<Element> &source2)
2871 TMatrixT<Element> target;
2873 if (gMatrixCheck && !AreCompatible(source1,source2)) {
2874 Error(
"operator!=(const TMatrixT&,const TMatrixTSym&)",
"matrices not compatible");
2878 target.ResizeTo(source1);
2880 const Element *sp1 = source1.GetMatrixArray();
2881 const Element *sp2 = source2.GetMatrixArray();
2882 Element *tp = target.GetMatrixArray();
2883 const Element *
const tp_last = tp+target.GetNoElements();
2884 while (tp != tp_last) {
2885 *tp++ = (*sp1) != (*sp2); sp1++; sp2++;
2894 template<
class Element>
2895 TMatrixT<Element> operator!=(
const TMatrixTSym<Element> &source1,
const TMatrixT<Element> &source2)
2897 return operator!=(source2,source1);
2904 template<class Element>
2905 TMatrixT<Element> operator!=(const TMatrixT<Element> &source1,Element val)
2907 TMatrixT<Element> target; target.ResizeTo(source1);
2909 const Element *sp = source1.GetMatrixArray();
2910 Element *tp = target.GetMatrixArray();
2911 const Element * const tp_last = tp+target.GetNoElements();
2912 while (tp != tp_last) {
2913 *tp++ = (*sp != val); sp++;
2922 template<class Element>
2923 TMatrixT<Element> operator!=(Element val,const TMatrixT<Element> &source1)
2925 return operator!=(source1,val);
2932 template<
class Element>
2933 TMatrixT<Element> &Add(TMatrixT<Element> &target,Element scalar,
const TMatrixT<Element> &source)
2935 if (gMatrixCheck && !AreCompatible(target,source)) {
2936 ::Error(
"Add(TMatrixT &,Element,const TMatrixT &)",
"matrices not compatible");
2940 const Element *sp = source.GetMatrixArray();
2941 Element *tp = target.GetMatrixArray();
2942 const Element *ftp = tp+target.GetNoElements();
2945 *tp++ = scalar * (*sp++);
2946 }
else if (scalar == 1.) {
2951 *tp++ += scalar * (*sp++);
2960 template<
class Element>
2961 TMatrixT<Element> &Add(TMatrixT<Element> &target,Element scalar,
const TMatrixTSym<Element> &source)
2963 if (gMatrixCheck && !AreCompatible(target,source)) {
2964 ::Error(
"Add(TMatrixT &,Element,const TMatrixTSym &)",
"matrices not compatible");
2968 const Element *sp = source.GetMatrixArray();
2969 Element *tp = target.GetMatrixArray();
2970 const Element *ftp = tp+target.GetNoElements();
2972 *tp++ += scalar * (*sp++);
2980 template<
class Element>
2981 TMatrixT<Element> &ElementMult(TMatrixT<Element> &target,
const TMatrixT<Element> &source)
2983 if (gMatrixCheck && !AreCompatible(target,source)) {
2984 ::Error(
"ElementMult(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
2988 const Element *sp = source.GetMatrixArray();
2989 Element *tp = target.GetMatrixArray();
2990 const Element *ftp = tp+target.GetNoElements();
3000 template<
class Element>
3001 TMatrixT<Element> &ElementMult(TMatrixT<Element> &target,
const TMatrixTSym<Element> &source)
3003 if (gMatrixCheck && !AreCompatible(target,source)) {
3004 ::Error(
"ElementMult(TMatrixT &,const TMatrixTSym &)",
"matrices not compatible");
3008 const Element *sp = source.GetMatrixArray();
3009 Element *tp = target.GetMatrixArray();
3010 const Element *ftp = tp+target.GetNoElements();
3020 template<
class Element>
3021 TMatrixT<Element> &ElementDiv(TMatrixT<Element> &target,
const TMatrixT<Element> &source)
3023 if (gMatrixCheck && !AreCompatible(target,source)) {
3024 ::Error(
"ElementDiv(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
3028 const Element *sp = source.GetMatrixArray();
3029 Element *tp = target.GetMatrixArray();
3030 const Element *ftp = tp+target.GetNoElements();
3031 while ( tp < ftp ) {
3035 const Int_t irow = (sp-source.GetMatrixArray())/source.GetNcols();
3036 const Int_t icol = (sp-source.GetMatrixArray())%source.GetNcols();
3037 Error(
"ElementDiv",
"source (%d,%d) is zero",irow,icol);
3048 template<
class Element>
3049 TMatrixT<Element> &ElementDiv(TMatrixT<Element> &target,
const TMatrixTSym<Element> &source)
3051 if (gMatrixCheck && !AreCompatible(target,source)) {
3052 ::Error(
"ElementDiv(TMatrixT &,const TMatrixTSym &)",
"matrices not compatible");
3056 const Element *sp = source.GetMatrixArray();
3057 Element *tp = target.GetMatrixArray();
3058 const Element *ftp = tp+target.GetNoElements();
3059 while ( tp < ftp ) {
3063 const Int_t irow = (sp-source.GetMatrixArray())/source.GetNcols();
3064 const Int_t icol = (sp-source.GetMatrixArray())%source.GetNcols();
3065 Error(
"ElementDiv",
"source (%d,%d) is zero",irow,icol);
3076 template<
class Element>
3077 void AMultB(
const Element *
const ap,Int_t na,Int_t ncolsa,
3078 const Element *
const bp,Int_t nb,Int_t ncolsb,Element *cp)
3080 const Element *arp0 = ap;
3081 while (arp0 < ap+na) {
3082 for (
const Element *bcp = bp; bcp < bp+ncolsb; ) {
3083 const Element *arp = arp0;
3085 while (bcp < bp+nb) {
3086 cij += *arp++ * *bcp;
3099 template<
class Element>
3100 void AtMultB(
const Element *
const ap,Int_t ncolsa,
3101 const Element *
const bp,Int_t nb,Int_t ncolsb,Element *cp)
3103 const Element *acp0 = ap;
3104 while (acp0 < ap+ncolsa) {
3105 for (
const Element *bcp = bp; bcp < bp+ncolsb; ) {
3106 const Element *acp = acp0;
3108 while (bcp < bp+nb) {
3123 template<
class Element>
3124 void AMultBt(
const Element *
const ap,Int_t na,Int_t ncolsa,
3125 const Element *
const bp,Int_t nb,Int_t ncolsb,Element *cp)
3127 const Element *arp0 = ap;
3128 while (arp0 < ap+na) {
3129 const Element *brp0 = bp;
3130 while (brp0 < bp+nb) {
3131 const Element *arp = arp0;
3132 const Element *brp = brp0;
3134 while (brp < brp0+ncolsb)
3135 cij += *arp++ * *brp++;
3146 template<
class Element>
3147 void TMatrixT<Element>::Streamer(TBuffer &R__b)
3149 if (R__b.IsReading()) {
3151 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
3154 R__b.ReadClassBuffer(TMatrixT<Element>::Class(),
this,R__v,R__s,R__c);
3155 }
else if (R__v == 2) {
3157 TObject::Streamer(R__b);
3159 R__b >> this->fNrows;
3160 R__b >> this->fNcols;
3161 R__b >> this->fNelems;
3162 R__b >> this->fRowLwb;
3163 R__b >> this->fColLwb;
3167 if (this->fNelems > 0) {
3168 fElements =
new Element[this->fNelems];
3169 R__b.ReadFastArray(fElements,this->fNelems);
3173 R__b.CheckByteCount(R__s,R__c,TMatrixT<Element>::IsA());
3175 TObject::Streamer(R__b);
3177 R__b >> this->fNrows;
3178 R__b >> this->fNcols;
3179 R__b >> this->fRowLwb;
3180 R__b >> this->fColLwb;
3181 this->fNelems = R__b.ReadArray(fElements);
3182 R__b.CheckByteCount(R__s,R__c,TMatrixT<Element>::IsA());
3185 if (R__v <= 2 && fElements) {
3186 for (Int_t i = 0; i < this->fNrows; i++) {
3187 const Int_t off_i = i*this->fNcols;
3188 for (Int_t j = i; j < this->fNcols; j++) {
3189 const Int_t off_j = j*this->fNrows;
3190 const Element tmp = fElements[off_i+j];
3191 fElements[off_i+j] = fElements[off_j+i];
3192 fElements[off_j+i] = tmp;
3196 if (this->fNelems > 0 && this->fNelems <= this->kSizeMax) {
3198 memcpy(fDataStack,fElements,this->fNelems*
sizeof(Element));
3199 delete [] fElements;
3201 fElements = fDataStack;
3202 }
else if (this->fNelems < 0)
3205 R__b.WriteClassBuffer(TMatrixT<Element>::Class(),
this);
3210 template class TMatrixT<Float_t>;
3215 template TMatrixF
operator+ <Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3216 template TMatrixF
operator+ <Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3217 template TMatrixF
operator+ <Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3218 template TMatrixF
operator+ <Float_t>(
const TMatrixF &source , Float_t val );
3219 template TMatrixF
operator+ <Float_t>( Float_t val ,
const TMatrixF &source );
3220 template TMatrixF
operator- <Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3221 template TMatrixF
operator- <Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3222 template TMatrixF
operator- <Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3223 template TMatrixF
operator- <Float_t>(
const TMatrixF &source , Float_t val );
3224 template TMatrixF
operator- <Float_t>( Float_t val ,
const TMatrixF &source );
3225 template TMatrixF
operator* <Float_t>( Float_t val ,
const TMatrixF &source );
3226 template TMatrixF
operator* <Float_t>(
const TMatrixF &source , Float_t val );
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 TMatrixFSym &source1,
const TMatrixFSym &source2);
3231 template TMatrixF
operator&& <Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3232 template TMatrixF
operator&& <Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3233 template TMatrixF
operator&& <Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3234 template TMatrixF
operator|| <Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3235 template TMatrixF
operator|| <Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3236 template TMatrixF
operator|| <Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3237 template TMatrixF
operator> <Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3238 template TMatrixF
operator> <Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3239 template TMatrixF
operator> <Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3240 template TMatrixF
operator>= <Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3241 template TMatrixF
operator>= <Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3242 template TMatrixF
operator>= <Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3243 template TMatrixF operator<= <Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3244 template TMatrixF operator<= <Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3245 template TMatrixF operator<= <Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3246 template TMatrixF operator< <Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3247 template TMatrixF operator< <Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3248 template TMatrixF operator< <Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3249 template TMatrixF
operator!= <Float_t>(
const TMatrixF &source1,
const TMatrixF &source2);
3250 template TMatrixF
operator!= <Float_t>(
const TMatrixF &source1,
const TMatrixFSym &source2);
3251 template TMatrixF
operator!= <Float_t>(
const TMatrixFSym &source1,
const TMatrixF &source2);
3253 template TMatrixF &Add <Float_t>(TMatrixF &target, Float_t scalar,
const TMatrixF &source);
3254 template TMatrixF &Add <Float_t>(TMatrixF &target, Float_t scalar,
const TMatrixFSym &source);
3255 template TMatrixF &ElementMult<Float_t>(TMatrixF &target,
const TMatrixF &source);
3256 template TMatrixF &ElementMult<Float_t>(TMatrixF &target,
const TMatrixFSym &source);
3257 template TMatrixF &ElementDiv <Float_t>(TMatrixF &target,
const TMatrixF &source);
3258 template TMatrixF &ElementDiv <Float_t>(TMatrixF &target,
const TMatrixFSym &source);
3260 template void AMultB <Float_t>(
const Float_t *
const ap,Int_t na,Int_t ncolsa,
3261 const Float_t *
const bp,Int_t nb,Int_t ncolsb,Float_t *cp);
3262 template void AtMultB<Float_t>(
const Float_t *
const ap,Int_t ncolsa,
3263 const Float_t *
const bp,Int_t nb,Int_t ncolsb,Float_t *cp);
3264 template void AMultBt<Float_t>(
const Float_t *
const ap,Int_t na,Int_t ncolsa,
3265 const Float_t *
const bp,Int_t nb,Int_t ncolsb,Float_t *cp);
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);
3287 template TMatrixD
operator* <Double_t>(
const TMatrixDSym &source1,
const TMatrixDSym &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);
3300 template TMatrixD operator<= <Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3301 template TMatrixD operator<= <Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3302 template TMatrixD operator<= <Double_t>(
const TMatrixDSym &source1,
const TMatrixD &source2);
3303 template TMatrixD operator< <Double_t>(
const TMatrixD &source1,
const TMatrixD &source2);
3304 template TMatrixD operator< <Double_t>(
const TMatrixD &source1,
const TMatrixDSym &source2);
3305 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);
3310 template TMatrixD &Add <Double_t>(TMatrixD &target, Double_t scalar,
const TMatrixD &source);
3311 template TMatrixD &Add <Double_t>(TMatrixD &target, Double_t scalar,
const TMatrixDSym &source);
3312 template TMatrixD &ElementMult<Double_t>(TMatrixD &target,
const TMatrixD &source);
3313 template TMatrixD &ElementMult<Double_t>(TMatrixD &target,
const TMatrixDSym &source);
3314 template TMatrixD &ElementDiv <Double_t>(TMatrixD &target,
const TMatrixD &source);
3315 template TMatrixD &ElementDiv <Double_t>(TMatrixD &target,
const TMatrixDSym &source);
3317 template void AMultB <Double_t>(
const Double_t *
const ap,Int_t na,Int_t ncolsa,
3318 const Double_t *
const bp,Int_t nb,Int_t ncolsb,Double_t *cp);
3319 template void AtMultB<Double_t>(
const Double_t *
const ap,Int_t ncolsa,
3320 const Double_t *
const bp,Int_t nb,Int_t ncolsb,Double_t *cp);
3321 template void AMultBt<Double_t>(
const Double_t *
const ap,Int_t na,Int_t ncolsa,
3322 const Double_t *
const bp,Int_t nb,Int_t ncolsb,Double_t *cp);