Geant4 10.7.0
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

#define A00   0

Definition at line 817 of file G4ErrorMatrix.cc.

◆ A01

#define A01   1

Definition at line 818 of file G4ErrorMatrix.cc.

◆ A02

#define A02   2

Definition at line 819 of file G4ErrorMatrix.cc.

◆ A03

#define A03   3

Definition at line 820 of file G4ErrorMatrix.cc.

◆ A04

#define A04   4

Definition at line 821 of file G4ErrorMatrix.cc.

◆ A05

#define A05   5

Definition at line 822 of file G4ErrorMatrix.cc.

◆ A10

#define A10   6

Definition at line 824 of file G4ErrorMatrix.cc.

◆ A11

#define A11   7

Definition at line 825 of file G4ErrorMatrix.cc.

◆ A12

#define A12   8

Definition at line 826 of file G4ErrorMatrix.cc.

◆ A13

#define A13   9

Definition at line 827 of file G4ErrorMatrix.cc.

◆ A14

#define A14   10

Definition at line 828 of file G4ErrorMatrix.cc.

◆ A15

#define A15   11

Definition at line 829 of file G4ErrorMatrix.cc.

◆ A20

#define A20   12

Definition at line 831 of file G4ErrorMatrix.cc.

◆ A21

#define A21   13

Definition at line 832 of file G4ErrorMatrix.cc.

◆ A22

#define A22   14

Definition at line 833 of file G4ErrorMatrix.cc.

◆ A23

#define A23   15

Definition at line 834 of file G4ErrorMatrix.cc.

◆ A24

#define A24   16

Definition at line 835 of file G4ErrorMatrix.cc.

◆ A25

#define A25   17

Definition at line 836 of file G4ErrorMatrix.cc.

◆ A30

#define A30   18

Definition at line 838 of file G4ErrorMatrix.cc.

◆ A31

#define A31   19

Definition at line 839 of file G4ErrorMatrix.cc.

◆ A32

#define A32   20

Definition at line 840 of file G4ErrorMatrix.cc.

◆ A33

#define A33   21

Definition at line 841 of file G4ErrorMatrix.cc.

◆ A34

#define A34   22

Definition at line 842 of file G4ErrorMatrix.cc.

◆ A35

#define A35   23

Definition at line 843 of file G4ErrorMatrix.cc.

◆ A40

#define A40   24

Definition at line 845 of file G4ErrorMatrix.cc.

◆ A41

#define A41   25

Definition at line 846 of file G4ErrorMatrix.cc.

◆ A42

#define A42   26

Definition at line 847 of file G4ErrorMatrix.cc.

◆ A43

#define A43   27

Definition at line 848 of file G4ErrorMatrix.cc.

◆ A44

#define A44   28

Definition at line 849 of file G4ErrorMatrix.cc.

◆ A45

#define A45   29

Definition at line 850 of file G4ErrorMatrix.cc.

◆ A50

#define A50   30

Definition at line 852 of file G4ErrorMatrix.cc.

◆ A51

#define A51   31

Definition at line 853 of file G4ErrorMatrix.cc.

◆ A52

#define A52   32

Definition at line 854 of file G4ErrorMatrix.cc.

◆ A53

#define A53   33

Definition at line 855 of file G4ErrorMatrix.cc.

◆ A54

#define A54   34

Definition at line 856 of file G4ErrorMatrix.cc.

◆ A55

#define A55   35

Definition at line 857 of file G4ErrorMatrix.cc.

◆ 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 66 of file G4ErrorMatrix.cc.

◆ 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 61 of file G4ErrorMatrix.cc.

◆ F00

#define F00   0

Definition at line 889 of file G4ErrorMatrix.cc.

◆ F01

#define F01   1

Definition at line 890 of file G4ErrorMatrix.cc.

◆ F02

#define F02   2

Definition at line 891 of file G4ErrorMatrix.cc.

◆ F03

#define F03   3

Definition at line 892 of file G4ErrorMatrix.cc.

◆ F10

#define F10   4

Definition at line 894 of file G4ErrorMatrix.cc.

◆ F11

#define F11   5

Definition at line 895 of file G4ErrorMatrix.cc.

◆ F12

#define F12   6

Definition at line 896 of file G4ErrorMatrix.cc.

◆ F13

#define F13   7

Definition at line 897 of file G4ErrorMatrix.cc.

◆ F20

#define F20   8

Definition at line 899 of file G4ErrorMatrix.cc.

◆ F21

#define F21   9

Definition at line 900 of file G4ErrorMatrix.cc.

◆ F22

#define F22   10

Definition at line 901 of file G4ErrorMatrix.cc.

◆ F23

#define F23   11

Definition at line 902 of file G4ErrorMatrix.cc.

◆ F30

#define F30   12

Definition at line 904 of file G4ErrorMatrix.cc.

◆ F31

#define F31   13

Definition at line 905 of file G4ErrorMatrix.cc.

◆ F32

#define F32   14

Definition at line 906 of file G4ErrorMatrix.cc.

◆ F33

#define F33   15

Definition at line 907 of file G4ErrorMatrix.cc.

◆ M00

#define M00   0

Definition at line 859 of file G4ErrorMatrix.cc.

◆ M01

#define M01   1

Definition at line 860 of file G4ErrorMatrix.cc.

◆ M02

#define M02   2

Definition at line 861 of file G4ErrorMatrix.cc.

◆ M03

#define M03   3

Definition at line 862 of file G4ErrorMatrix.cc.

◆ M04

#define M04   4

Definition at line 863 of file G4ErrorMatrix.cc.

◆ M10

#define M10   5

Definition at line 865 of file G4ErrorMatrix.cc.

◆ M11

#define M11   6

Definition at line 866 of file G4ErrorMatrix.cc.

◆ M12

#define M12   7

Definition at line 867 of file G4ErrorMatrix.cc.

◆ M13

#define M13   8

Definition at line 868 of file G4ErrorMatrix.cc.

◆ M14

#define M14   9

Definition at line 869 of file G4ErrorMatrix.cc.

◆ M20

#define M20   10

Definition at line 871 of file G4ErrorMatrix.cc.

◆ M21

#define M21   11

Definition at line 872 of file G4ErrorMatrix.cc.

◆ M22

#define M22   12

Definition at line 873 of file G4ErrorMatrix.cc.

◆ M23

#define M23   13

Definition at line 874 of file G4ErrorMatrix.cc.

◆ M24

#define M24   14

Definition at line 875 of file G4ErrorMatrix.cc.

◆ M30

#define M30   15

Definition at line 877 of file G4ErrorMatrix.cc.

◆ M31

#define M31   16

Definition at line 878 of file G4ErrorMatrix.cc.

◆ M32

#define M32   17

Definition at line 879 of file G4ErrorMatrix.cc.

◆ M33

#define M33   18

Definition at line 880 of file G4ErrorMatrix.cc.

◆ M34

#define M34   19

Definition at line 881 of file G4ErrorMatrix.cc.

◆ M40

#define M40   20

Definition at line 883 of file G4ErrorMatrix.cc.

◆ M41

#define M41   21

Definition at line 884 of file G4ErrorMatrix.cc.

◆ M42

#define M42   22

Definition at line 885 of file G4ErrorMatrix.cc.

◆ M43

#define M43   23

Definition at line 886 of file G4ErrorMatrix.cc.

◆ M44

#define M44   24

Definition at line 887 of file G4ErrorMatrix.cc.

◆ 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 46 of file G4ErrorMatrix.cc.

◆ 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 52 of file G4ErrorMatrix.cc.

◆ 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.

Function Documentation

◆ dsum()

G4ErrorMatrix dsum ( const G4ErrorMatrix mat1,
const G4ErrorMatrix mat2 
)

Definition at line 200 of file G4ErrorMatrix.cc.

201{
202 G4ErrorMatrix mret(mat1.num_row() + mat2.num_row(),
203 mat1.num_col() + mat2.num_col(), 0);
204 mret.sub(1,1,mat1);
205 mret.sub(mat1.num_row()+1,mat1.num_col()+1,mat2);
206 return mret;
207}
virtual G4int num_col() const
virtual G4int num_row() const

◆ operator*() [1/3]

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

Definition at line 271 of file G4ErrorMatrix.cc.

272{
273 // initialize matrix to 0.0
274 G4ErrorMatrix mret(mat1.nrow,mat2.ncol,0);
275 CHK_DIM_1(mat1.ncol,mat2.nrow,*);
276
277 G4int m1cols = mat1.ncol;
278 G4int m2cols = mat2.ncol;
279
280 for (G4int i=0; i<mat1.nrow; i++)
281 {
282 for (G4int j=0; j<m1cols; j++)
283 {
284 G4double temp = mat1.m[i*m1cols+j];
285 G4ErrorMatrixIter pt = mret.m.begin() + i*m2cols;
286
287 // Loop over k (the column index in matrix mat2)
288 G4ErrorMatrixConstIter pb = mat2.m.begin() + m2cols*j;
289 const G4ErrorMatrixConstIter pblast = pb + m2cols;
290 while (pb < pblast) // Loop checking, 06.08.2015, G.Cosmo
291 {
292 (*pt) += temp * (*pb);
293 pb++;
294 pt++;
295 }
296 }
297 }
298 return mret;
299}
#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 257 of file G4ErrorMatrix.cc.

258{
259 G4ErrorMatrix mret(mat1);
260 mret *= t;
261 return mret;
262}

◆ operator*() [3/3]

G4ErrorMatrix operator* ( G4double  t,
const G4ErrorMatrix mat1 
)

Definition at line 264 of file G4ErrorMatrix.cc.

265{
266 G4ErrorMatrix mret(mat1);
267 mret *= t;
268 return mret;
269}

◆ operator+()

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

Definition at line 224 of file G4ErrorMatrix.cc.

225{
226 G4ErrorMatrix mret(mat1.nrow, mat1.ncol);
227 CHK_DIM_2(mat1.num_row(),mat2.num_row(), mat1.num_col(),mat2.num_col(),+);
228 SIMPLE_TOP(+)
229 return mret;
230}
#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 236 of file G4ErrorMatrix.cc.

237{
238 G4ErrorMatrix mret(mat1.num_row(), mat1.num_col());
239 CHK_DIM_2(mat1.num_row(),mat2.num_row(),
240 mat1.num_col(),mat2.num_col(),-);
241 SIMPLE_TOP(-)
242 return mret;
243}

◆ operator/()

G4ErrorMatrix operator/ ( const G4ErrorMatrix mat1,
G4double  t 
)

Definition at line 250 of file G4ErrorMatrix.cc.

251{
252 G4ErrorMatrix mret(mat1);
253 mret /= t;
254 return mret;
255}

◆ operator<<()

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

Definition at line 349 of file G4ErrorMatrix.cc.

350{
351 os << "\n";
352
353 // Fixed format needs 3 extra characters for field,
354 // while scientific needs 7
355
356 G4int width;
357 if(os.flags() & std::ios::fixed)
358 { width = os.precision()+3; }
359 else
360 { width = os.precision()+7; }
361 for(G4int irow = 1; irow<= q.num_row(); irow++)
362 {
363 for(G4int icol = 1; icol <= q.num_col(); icol++)
364 {
365 os.width(width);
366 os << q(irow,icol) << " ";
367 }
368 os << G4endl;
369 }
370 return os;
371}
#define G4endl
Definition: G4ios.hh:57