Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ErrorMatrix.cc File Reference
#include "globals.hh"
#include <cmath>
#include <iostream>
#include "G4ErrorMatrix.hh"
#include "G4ErrorSymMatrix.hh"

Go to the source code of this file.

Macros

#define SIMPLE_UOP(OPER)
 
#define SIMPLE_BOP(OPER)
 
#define SIMPLE_TOP(OPER)
 
#define CHK_DIM_2(r1, r2, c1, c2, fun)
 
#define CHK_DIM_1(c1, r2, fun)
 
#define A00   0
 
#define A01   1
 
#define A02   2
 
#define A03   3
 
#define A04   4
 
#define A05   5
 
#define A10   6
 
#define A11   7
 
#define A12   8
 
#define A13   9
 
#define A14   10
 
#define A15   11
 
#define A20   12
 
#define A21   13
 
#define A22   14
 
#define A23   15
 
#define A24   16
 
#define A25   17
 
#define A30   18
 
#define A31   19
 
#define A32   20
 
#define A33   21
 
#define A34   22
 
#define A35   23
 
#define A40   24
 
#define A41   25
 
#define A42   26
 
#define A43   27
 
#define A44   28
 
#define A45   29
 
#define A50   30
 
#define A51   31
 
#define A52   32
 
#define A53   33
 
#define A54   34
 
#define A55   35
 
#define M00   0
 
#define M01   1
 
#define M02   2
 
#define M03   3
 
#define M04   4
 
#define M10   5
 
#define M11   6
 
#define M12   7
 
#define M13   8
 
#define M14   9
 
#define M20   10
 
#define M21   11
 
#define M22   12
 
#define M23   13
 
#define M24   14
 
#define M30   15
 
#define M31   16
 
#define M32   17
 
#define M33   18
 
#define M34   19
 
#define M40   20
 
#define M41   21
 
#define M42   22
 
#define M43   23
 
#define M44   24
 
#define F00   0
 
#define F01   1
 
#define F02   2
 
#define F03   3
 
#define F10   4
 
#define F11   5
 
#define F12   6
 
#define F13   7
 
#define F20   8
 
#define F21   9
 
#define F22   10
 
#define F23   11
 
#define F30   12
 
#define F31   13
 
#define F32   14
 
#define F33   15
 

Functions

G4ErrorMatrix dsum (const G4ErrorMatrix &mat1, const G4ErrorMatrix &mat2)
 
G4ErrorMatrix operator+ (const G4ErrorMatrix &mat1, const G4ErrorMatrix &mat2)
 
G4ErrorMatrix operator- (const G4ErrorMatrix &mat1, const G4ErrorMatrix &mat2)
 
G4ErrorMatrix operator/ (const G4ErrorMatrix &mat1, G4double t)
 
G4ErrorMatrix operator* (const G4ErrorMatrix &mat1, G4double t)
 
G4ErrorMatrix operator* (G4double t, const G4ErrorMatrix &mat1)
 
G4ErrorMatrix operator* (const G4ErrorMatrix &mat1, const G4ErrorMatrix &mat2)
 
std::ostream & operator<< (std::ostream &os, const G4ErrorMatrix &q)
 

Macro Definition Documentation

◆ A00

◆ A01

◆ A02

◆ A03

◆ A04

◆ A05

◆ A10

◆ A11

◆ A12

◆ A13

◆ A14

◆ A15

◆ A20

◆ A21

◆ A22

◆ A23

◆ A24

◆ A25

◆ A30

◆ A31

◆ A32

◆ A33

◆ A34

◆ A35

◆ A40

◆ A41

◆ A42

◆ A43

◆ A44

◆ A45

◆ A50

◆ A51

◆ A52

◆ A53

◆ A54

◆ A55

◆ CHK_DIM_1

#define CHK_DIM_1 ( c1,
r2,
fun )
Value:
if(c1 != r2) \
{ \
G4ErrorMatrix::error("Range error in Matrix function " #fun "(2)."); \
}

Definition at line 70 of file G4ErrorMatrix.cc.

70#define CHK_DIM_1(c1, r2, fun) \
71 if(c1 != r2) \
72 { \
73 G4ErrorMatrix::error("Range error in Matrix function " #fun "(2)."); \
74 }

◆ CHK_DIM_2

#define CHK_DIM_2 ( r1,
r2,
c1,
c2,
fun )
Value:
if(r1 != r2 || c1 != c2) \
{ \
G4ErrorMatrix::error("Range error in Matrix function " #fun "(1)."); \
}

Definition at line 64 of file G4ErrorMatrix.cc.

64#define CHK_DIM_2(r1, r2, c1, c2, fun) \
65 if(r1 != r2 || c1 != c2) \
66 { \
67 G4ErrorMatrix::error("Range error in Matrix function " #fun "(1)."); \
68 }

Referenced by G4ErrorMatrix::operator+=(), G4ErrorMatrix::operator+=(), G4ErrorSymMatrix::operator+=(), G4ErrorMatrix::operator-=(), G4ErrorMatrix::operator-=(), and G4ErrorSymMatrix::operator-=().

◆ F00

#define F00   0

◆ F01

#define F01   1

Definition at line 940 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ F02

#define F02   2

Definition at line 941 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ F03

#define F03   3

Definition at line 942 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ F10

◆ F11

#define F11   5

Definition at line 945 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ F12

#define F12   6

Definition at line 946 of file G4ErrorMatrix.cc.

Referenced by G4hhElastic::GetdsdtF12qQgG(), and G4ErrorMatrix::invertHaywood4().

◆ F13

#define F13   7

Definition at line 947 of file G4ErrorMatrix.cc.

Referenced by G4hhElastic::GetdsdtF13qQG(), and G4ErrorMatrix::invertHaywood4().

◆ F20

◆ F21

#define F21   9

Definition at line 950 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ F22

#define F22   10

Definition at line 951 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ F23

#define F23   11

Definition at line 952 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ F30

#define F30   12

Definition at line 954 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ F31

#define F31   13

Definition at line 955 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ F32

#define F32   14

Definition at line 956 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ F33

#define F33   15

Definition at line 957 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood4().

◆ M00

#define M00   0

Definition at line 909 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M01

#define M01   1

Definition at line 910 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M02

#define M02   2

Definition at line 911 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M03

#define M03   3

Definition at line 912 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M04

#define M04   4

Definition at line 913 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M10

#define M10   5

Definition at line 915 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M11

#define M11   6

Definition at line 916 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M12

#define M12   7

Definition at line 917 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M13

#define M13   8

Definition at line 918 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M14

#define M14   9

Definition at line 919 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M20

#define M20   10

Definition at line 921 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M21

#define M21   11

Definition at line 922 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M22

#define M22   12

Definition at line 923 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M23

#define M23   13

Definition at line 924 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M24

#define M24   14

Definition at line 925 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M30

#define M30   15

Definition at line 927 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M31

#define M31   16

Definition at line 928 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M32

#define M32   17

Definition at line 929 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M33

#define M33   18

Definition at line 930 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M34

#define M34   19

Definition at line 931 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M40

#define M40   20

Definition at line 933 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M41

#define M41   21

Definition at line 934 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M42

#define M42   22

Definition at line 935 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M43

#define M43   23

Definition at line 936 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ M44

#define M44   24

Definition at line 937 of file G4ErrorMatrix.cc.

Referenced by G4ErrorMatrix::invertHaywood5().

◆ SIMPLE_BOP

#define SIMPLE_BOP ( OPER)
Value:
G4ErrorMatrixIter a = m.begin(); \
G4ErrorMatrixConstIter b = mat2.m.begin(); \
G4ErrorMatrixIter e = m.end(); \
for(; a != e; a++, b++) \
(*a) OPER(*b);
std::vector< G4double >::iterator G4ErrorMatrixIter
std::vector< G4double >::const_iterator G4ErrorMatrixConstIter

Definition at line 47 of file G4ErrorMatrix.cc.

47#define SIMPLE_BOP(OPER) \
48 G4ErrorMatrixIter a = m.begin(); \
49 G4ErrorMatrixConstIter b = mat2.m.begin(); \
50 G4ErrorMatrixIter e = m.end(); \
51 for(; a != e; a++, b++) \
52 (*a) OPER(*b);

Referenced by G4ErrorMatrix::operator+=(), G4ErrorSymMatrix::operator+=(), G4ErrorMatrix::operator-=(), and G4ErrorSymMatrix::operator-=().

◆ SIMPLE_TOP

#define SIMPLE_TOP ( OPER)
Value:
G4ErrorMatrixConstIter a = mat1.m.begin(); \
G4ErrorMatrixConstIter b = mat2.m.begin(); \
G4ErrorMatrixIter t = mret.m.begin(); \
G4ErrorMatrixConstIter e = mat1.m.end(); \
for(; a != e; a++, b++, t++) \
(*t) = (*a) OPER(*b);

Definition at line 54 of file G4ErrorMatrix.cc.

54#define SIMPLE_TOP(OPER) \
55 G4ErrorMatrixConstIter a = mat1.m.begin(); \
56 G4ErrorMatrixConstIter b = mat2.m.begin(); \
57 G4ErrorMatrixIter t = mret.m.begin(); \
58 G4ErrorMatrixConstIter e = mat1.m.end(); \
59 for(; a != e; a++, b++, t++) \
60 (*t) = (*a) OPER(*b);

◆ SIMPLE_UOP

#define SIMPLE_UOP ( OPER)
Value:
G4ErrorMatrixIter a = m.begin(); \
G4ErrorMatrixIter e = m.end(); \
for(; a != e; a++) \
(*a) OPER t;

Definition at line 41 of file G4ErrorMatrix.cc.

41#define SIMPLE_UOP(OPER) \
42 G4ErrorMatrixIter a = m.begin(); \
43 G4ErrorMatrixIter e = m.end(); \
44 for(; a != e; a++) \
45 (*a) OPER t;

Referenced by G4ErrorMatrix::operator*=(), G4ErrorSymMatrix::operator*=(), G4ErrorMatrix::operator/=(), and G4ErrorSymMatrix::operator/=().

Function Documentation

◆ dsum()

G4ErrorMatrix dsum ( const G4ErrorMatrix & mat1,
const G4ErrorMatrix & mat2 )

Definition at line 220 of file G4ErrorMatrix.cc.

221{
222 G4ErrorMatrix mret(mat1.num_row() + mat2.num_row(),
223 mat1.num_col() + mat2.num_col(), 0);
224 mret.sub(1, 1, mat1);
225 mret.sub(mat1.num_row() + 1, mat1.num_col() + 1, mat2);
226 return mret;
227}
virtual G4int num_col() const
virtual G4int num_row() const

◆ operator*() [1/3]

G4ErrorMatrix operator* ( const G4ErrorMatrix & mat1,
const G4ErrorMatrix & mat2 )

Definition at line 291 of file G4ErrorMatrix.cc.

292{
293 // initialize matrix to 0.0
294 G4ErrorMatrix mret(mat1.nrow, mat2.ncol, 0);
295 CHK_DIM_1(mat1.ncol, mat2.nrow, *);
296
297 G4int m1cols = mat1.ncol;
298 G4int m2cols = mat2.ncol;
299
300 for(G4int i = 0; i < mat1.nrow; i++)
301 {
302 for(G4int j = 0; j < m1cols; j++)
303 {
304 G4double temp = mat1.m[i * m1cols + j];
305 G4ErrorMatrixIter pt = mret.m.begin() + i * m2cols;
306
307 // Loop over k (the column index in matrix mat2)
308 G4ErrorMatrixConstIter pb = mat2.m.begin() + m2cols * j;
309 const G4ErrorMatrixConstIter pblast = pb + m2cols;
310 while(pb < pblast) // Loop checking, 06.08.2015, G.Cosmo
311 {
312 (*pt) += temp * (*pb);
313 pb++;
314 pt++;
315 }
316 }
317 }
318 return mret;
319}
#define CHK_DIM_1(c1, r2, fun)
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85

◆ operator*() [2/3]

G4ErrorMatrix operator* ( const G4ErrorMatrix & mat1,
G4double t )

Definition at line 277 of file G4ErrorMatrix.cc.

278{
279 G4ErrorMatrix mret(mat1);
280 mret *= t;
281 return mret;
282}

◆ operator*() [3/3]

G4ErrorMatrix operator* ( G4double t,
const G4ErrorMatrix & mat1 )

Definition at line 284 of file G4ErrorMatrix.cc.

285{
286 G4ErrorMatrix mret(mat1);
287 mret *= t;
288 return mret;
289}

◆ operator+()

G4ErrorMatrix operator+ ( const G4ErrorMatrix & mat1,
const G4ErrorMatrix & mat2 )

Definition at line 245 of file G4ErrorMatrix.cc.

246{
247 G4ErrorMatrix mret(mat1.nrow, mat1.ncol);
248 CHK_DIM_2(mat1.num_row(), mat2.num_row(), mat1.num_col(), mat2.num_col(), +);
249 SIMPLE_TOP(+)
250 return mret;
251}
#define CHK_DIM_2(r1, r2, c1, c2, fun)
#define SIMPLE_TOP(OPER)

◆ operator-()

G4ErrorMatrix operator- ( const G4ErrorMatrix & mat1,
const G4ErrorMatrix & mat2 )

Definition at line 257 of file G4ErrorMatrix.cc.

258{
259 G4ErrorMatrix mret(mat1.num_row(), mat1.num_col());
260 CHK_DIM_2(mat1.num_row(), mat2.num_row(), mat1.num_col(), mat2.num_col(), -);
261 SIMPLE_TOP(-)
262 return mret;
263}

◆ operator/()

G4ErrorMatrix operator/ ( const G4ErrorMatrix & mat1,
G4double t )

Definition at line 270 of file G4ErrorMatrix.cc.

271{
272 G4ErrorMatrix mret(mat1);
273 mret /= t;
274 return mret;
275}

◆ operator<<()

std::ostream & operator<< ( std::ostream & os,
const G4ErrorMatrix & q )

Definition at line 371 of file G4ErrorMatrix.cc.

372{
373 os << "\n";
374
375 // Fixed format needs 3 extra characters for field,
376 // while scientific needs 7
377
378 std::size_t width;
379 if(os.flags() & std::ios::fixed)
380 {
381 width = os.precision() + 3;
382 }
383 else
384 {
385 width = os.precision() + 7;
386 }
387 for(G4int irow = 1; irow <= q.num_row(); ++irow)
388 {
389 for(G4int icol = 1; icol <= q.num_col(); ++icol)
390 {
391 os.width(width);
392 os << q(irow, icol) << " ";
393 }
394 os << G4endl;
395 }
396 return os;
397}
#define G4endl
Definition G4ios.hh:67