#include <DiagMatrix.h>
|
| HepDiagMatrix () |
|
| HepDiagMatrix (int p) |
|
| HepDiagMatrix (int p, int) |
|
| HepDiagMatrix (int p, HepRandom &r) |
|
| HepDiagMatrix (const HepDiagMatrix &hm1) |
|
virtual | ~HepDiagMatrix () |
|
int | num_row () const |
|
int | num_col () const |
|
double & | operator() (int row, int col) |
|
const double & | operator() (int row, int col) const |
|
double & | fast (int row, int col) |
|
const double & | fast (int row, int col) const |
|
void | assign (const HepMatrix &hm2) |
|
void | assign (const HepSymMatrix &hm2) |
|
void | assign (const HepDiagMatrix &hm2) |
|
HepDiagMatrix & | operator*= (double t) |
|
HepDiagMatrix & | operator/= (double t) |
|
HepDiagMatrix & | operator+= (const HepDiagMatrix &hm2) |
|
HepDiagMatrix & | operator-= (const HepDiagMatrix &hm2) |
|
HepDiagMatrix & | operator= (const HepDiagMatrix &hm2) |
|
HepDiagMatrix | operator- () const |
|
HepDiagMatrix | T () const |
|
HepDiagMatrix | apply (double(*f)(double, int, int)) const |
|
HepSymMatrix | similarity (const HepMatrix &hm1) const |
|
HepSymMatrix | similarityT (const HepMatrix &hm1) const |
|
double | similarity (const HepVector &) const |
|
HepDiagMatrix | sub (int min_row, int max_row) const |
|
HepDiagMatrix | sub (int min_row, int max_row) |
|
void | sub (int row, const HepDiagMatrix &hm1) |
|
HepDiagMatrix | inverse (int &ierr) const |
|
void | invert (int &ierr) |
|
void | invert () |
|
HepDiagMatrix | inverse () const |
|
double | determinant () const |
|
double | trace () const |
|
HepDiagMatrix_row | operator[] (int) |
|
HepDiagMatrix_row_const | operator[] (int) const |
|
virtual | ~HepGenMatrix () |
|
virtual int | num_row () const =0 |
|
virtual int | num_col () const =0 |
|
virtual const double & | operator() (int row, int col) const =0 |
|
virtual double & | operator() (int row, int col)=0 |
|
virtual void | invert (int &)=0 |
|
HepGenMatrix_row | operator[] (int) |
|
const HepGenMatrix_row_const | operator[] (int) const |
|
virtual bool | operator== (const HepGenMatrix &) const |
|
|
enum | { size_max = 25
} |
|
typedef std::vector< double, Alloc< double, 25 > >::iterator | mIter |
|
typedef std::vector< double, Alloc< double, 25 > >::const_iterator | mcIter |
|
static void | swap (int &, int &) |
|
static void | swap (std::vector< double, Alloc< double, 25 > > &, std::vector< double, Alloc< double, 25 > > &) |
|
static void | error (const char *s) |
|
- Author
Definition at line 35 of file DiagMatrix.h.
◆ HepDiagMatrix() [1/5]
CLHEP::HepDiagMatrix::HepDiagMatrix |
( |
| ) |
|
|
inline |
◆ HepDiagMatrix() [2/5]
CLHEP::HepDiagMatrix::HepDiagMatrix |
( |
int |
p | ) |
|
|
explicit |
◆ HepDiagMatrix() [3/5]
CLHEP::HepDiagMatrix::HepDiagMatrix |
( |
int |
p, |
|
|
int |
init |
|
) |
| |
Definition at line 72 of file DiagMatrix.cc.
73 : m(p), nrow(p)
74{
76 {
77 case 0:
78 m.assign(nrow,0);
79 break;
80
81 case 1:
82 {
85 for( ; a<b; a++) *a = 1.0;
86 break;
87 }
88 default:
89 error(
"DiagMatrix: initialization must be either 0 or 1.");
90 }
91}
std::vector< double, Alloc< double, 25 > >::iterator mIter
static void error(const char *s)
◆ HepDiagMatrix() [4/5]
CLHEP::HepDiagMatrix::HepDiagMatrix |
( |
int |
p, |
|
|
HepRandom & |
r |
|
) |
| |
Definition at line 93 of file DiagMatrix.cc.
94 : m(p), nrow(p)
95{
98 for(;a<b;a++) *a = r();
99}
◆ HepDiagMatrix() [5/5]
Definition at line 106 of file DiagMatrix.cc.
107 : HepGenMatrix(hm1), m(hm1.nrow), nrow(hm1.nrow)
108{
109 m = hm1.m;
110}
◆ ~HepDiagMatrix()
CLHEP::HepDiagMatrix::~HepDiagMatrix |
( |
| ) |
|
|
virtual |
◆ apply()
Definition at line 581 of file DiagMatrix.cc.
585{
586#else
587{
589#endif
592 for(
int ir=1;ir<=
num_row();ir++) {
593 *(b++) = (*
f)(*(a++), ir, ir);
594 }
595 return mret;
596}
std::vector< double, Alloc< double, 25 > >::const_iterator mcIter
Referenced by main().
◆ assign() [1/3]
◆ assign() [2/3]
void CLHEP::HepDiagMatrix::assign |
( |
const HepMatrix & |
hm2 | ) |
|
Definition at line 598 of file DiagMatrix.cc.
599{
600 if(hm1.num_row()!=nrow)
601 {
602 nrow = hm1.num_row();
603 m.resize(nrow);
604 }
607 for(int r=1;r<=nrow;r++) {
608 *(b++) = *a;
609 if(r<nrow) a += (nrow+1);
610 }
611}
Referenced by main().
◆ assign() [3/3]
void CLHEP::HepDiagMatrix::assign |
( |
const HepSymMatrix & |
hm2 | ) |
|
Definition at line 613 of file DiagMatrix.cc.
614{
615 if(hm1.num_row()!=nrow)
616 {
617 nrow = hm1.num_row();
618 m.resize(nrow);
619 }
622 for(int r=1;r<=nrow;r++) {
623 *(b++) = *a;
624 if(r<nrow) a += (r+1);
625 }
626}
◆ determinant()
double CLHEP::HepDiagMatrix::determinant |
( |
| ) |
const |
Definition at line 711 of file DiagMatrix.cc.
711 {
712 double d = 1.0;
715 d *= *p;
716 return d;
717}
◆ fast() [1/2]
double & CLHEP::HepDiagMatrix::fast |
( |
int |
row, |
|
|
int |
col |
|
) |
| |
◆ fast() [2/2]
const double & CLHEP::HepDiagMatrix::fast |
( |
int |
row, |
|
|
int |
col |
|
) |
| const |
◆ inverse() [1/2]
◆ inverse() [2/2]
◆ invert() [1/2]
void CLHEP::HepDiagMatrix::invert |
( |
| ) |
|
|
inline |
◆ invert() [2/2]
void CLHEP::HepDiagMatrix::invert |
( |
int & |
ierr | ) |
|
|
virtual |
Implements CLHEP::HepGenMatrix.
Definition at line 695 of file DiagMatrix.cc.
695 {
697 ierr = 1;
699 int i;
701 if(*(hmm++)==0) return;
702 }
703 ierr = 0;
704 hmm = m.begin();
706 *hmm = 1.0 / *hmm;
707 hmm++;
708 }
709}
◆ num_col()
int CLHEP::HepDiagMatrix::num_col |
( |
| ) |
const |
|
inlinevirtual |
◆ num_row()
int CLHEP::HepDiagMatrix::num_row |
( |
| ) |
const |
|
inlinevirtual |
Implements CLHEP::HepGenMatrix.
Referenced by invert(), main(), CLHEP::HepMatrix::operator+=(), operator+=(), CLHEP::HepSymMatrix::operator+=(), CLHEP::HepMatrix::operator-=(), operator-=(), CLHEP::HepSymMatrix::operator-=(), CLHEP::operator<<(), similarity(), and sub().
◆ num_size()
int CLHEP::HepDiagMatrix::num_size |
( |
| ) |
const |
|
inlineprotectedvirtual |
◆ operator()() [1/2]
double & CLHEP::HepDiagMatrix::operator() |
( |
int |
row, |
|
|
int |
col |
|
) |
| |
|
virtual |
◆ operator()() [2/2]
const double & CLHEP::HepDiagMatrix::operator() |
( |
int |
row, |
|
|
int |
col |
|
) |
| const |
|
virtual |
◆ operator*=()
◆ operator+=()
Definition at line 476 of file DiagMatrix.cc.
477{
480 return (*this);
481}
#define CHK_DIM_2(r1, r2, c1, c2, fun)
◆ operator-()
Definition at line 176 of file DiagMatrix.cc.
179{
180#else
181{
183#endif
187 for(;a<e; a++, b++) (*b) = -(*a);
188 return hm2;
189}
◆ operator-=()
◆ operator/=()
◆ operator=()
Definition at line 547 of file DiagMatrix.cc.
548{
549 if(hm1.nrow != nrow)
550 {
551 nrow = hm1.nrow;
552 m.resize(nrow);
553 }
554 m=hm1.m;
555 return (*this);
556}
◆ operator[]() [1/2]
◆ operator[]() [2/2]
◆ similarity() [1/2]
Definition at line 628 of file DiagMatrix.cc.
631{
632#else
633{
635#endif
637
638
639
641 for(int r=1;r<=mret.num_row();r++) {
644 for(int c=1;c<=r;c++) {
646 double tmp = 0;
648 for(int i=0;i<hm1.num_col();i++)
649 tmp+=*(mr++) * *(mc++) * *(mi++);
650 *(mrc++) = tmp;
651 }
652 }
653 return mret;
654}
#define CHK_DIM_1(c1, r2, fun)
friend class HepSymMatrix
Referenced by main(), and similarity().
◆ similarity() [2/2]
Definition at line 656 of file DiagMatrix.cc.
657{
658 double mret;
662 mret = *(mv)* *(mv)* *(mi++);
663 mv++;
664 for(int i=2;i<=hm1.num_row();i++) {
665 mret+=*(mv)* *(mv)* *(mi++);
666 mv++;
667 }
668 return mret;
669}
HepSymMatrix similarity(const HepMatrix &hm1) const
◆ similarityT()
Definition at line 671 of file DiagMatrix.cc.
674{
675#else
676{
678#endif
680
681
682
683 for(int r=1;r<=mret.num_row();r++)
684 for(int c=1;c<=r;c++)
685 {
687 double tmp = hm1(1,r)*hm1(1,c)* *(mi++);
688 for(int i=2;i<=hm1.num_row();i++)
689 tmp+=hm1(i,r)*hm1(i,c)* *(mi++);
690 mret.fast(r,c) = tmp;
691 }
692 return mret;
693}
HepSymMatrix similarityT(const HepMatrix &hm1) const
Referenced by main().
◆ sub() [1/3]
HepDiagMatrix CLHEP::HepDiagMatrix::sub |
( |
int |
min_row, |
|
|
int |
max_row |
|
) |
| |
Definition at line 135 of file DiagMatrix.cc.
136{
139 error(
"HepDiagMatrix::sub: Index out of range");
143 for(;a<e;) *(a++) = *(b++);
144 return mret;
145}
◆ sub() [2/3]
HepDiagMatrix CLHEP::HepDiagMatrix::sub |
( |
int |
min_row, |
|
|
int |
max_row |
|
) |
| const |
Definition at line 118 of file DiagMatrix.cc.
121{
122#else
123{
125#endif
127 error(
"HepDiagMatrix::sub: Index out of range");
131 for(;a<e;) *(a++) = *(b++);
132 return mret;
133}
Referenced by diagmatrix_test(), and main().
◆ sub() [3/3]
void CLHEP::HepDiagMatrix::sub |
( |
int |
row, |
|
|
const HepDiagMatrix & |
hm1 |
|
) |
| |
Definition at line 147 of file DiagMatrix.cc.
148{
149 if(row <1 || row+hm1.num_row()-1 >
num_row() )
150 error(
"HepDiagMatrix::sub: Index out of range");
154 for(;a<e;) *(b++) = *(a++);
155}
◆ T()
◆ trace()
double CLHEP::HepDiagMatrix::trace |
( |
| ) |
const |
Definition at line 719 of file DiagMatrix.cc.
719 {
720 double d = 0.0;
723 d += *p;
724 return d;
725}
◆ HepDiagMatrix_row
◆ HepDiagMatrix_row_const
◆ HepMatrix
◆ HepSymMatrix
◆ operator* [1/4]
Definition at line 413 of file DiagMatrix.cc.
416{
417#else
418{
420#endif
421 CHK_DIM_1(hm1.num_col(),hm2.num_row(),*);
426 for(;a<e;) *(a++) = *(b++) * (*(c++));
427 return mret;
428}
◆ operator* [2/4]
Definition at line 392 of file DiagMatrix.cc.
395{
396#else
397{
398 HepMatrix mret(hm1.num_row(),hm2.num_col());
399#endif
400 CHK_DIM_1(hm1.num_col(),hm2.num_row(),*);
404 for(int irow=1;irow<=hm2.num_row();irow++) {
405 for(int icol=1;icol<=hm2.num_col();icol++) {
406 *(mir++) = *(mit1++) * (*mrr);
407 }
408 mrr++;
409 }
410 return mret;
411}
◆ operator* [3/4]
Definition at line 430 of file DiagMatrix.cc.
433{
434#else
435{
436 HepVector mret(hm1.num_row());
437#endif
438 CHK_DIM_1(hm1.num_col(),hm2.num_row(),*);
441 for(int icol=1;icol<=hm1.num_col();icol++) {
442 *(mir++) = *(mi1++) * *(mi2++);
443 }
444 return mret;
445}
◆ operator* [4/4]
Definition at line 372 of file DiagMatrix.cc.
375{
376#else
377 {
378 HepMatrix mret(hm1.num_row(),hm2.num_col());
379#endif
380 CHK_DIM_1(hm1.num_col(),hm2.num_row(),*);
383 for(int irow=1;irow<=hm1.num_row();irow++) {
385 for(int icol=1;icol<=hm1.num_col();icol++) {
386 *(mir++) = *(mit1++) * (*(mcc++));
387 }
388 }
389 return mret;
390 }
◆ operator+
Definition at line 221 of file DiagMatrix.cc.
224{
225#else
226{
228#endif
231 return mret;
232}
◆ operator-
Definition at line 291 of file DiagMatrix.cc.
294{
295#else
296{
298#endif
299 CHK_DIM_1(hm1.num_row(),hm2.num_row(),-);
301 return mret;
302}
The documentation for this class was generated from the following files: