Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ErrorSymMatrix.cc File Reference
#include "globals.hh"
#include <iostream>
#include <cmath>
#include "G4ErrorSymMatrix.hh"
#include "G4ErrorMatrix.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   3
 
#define A03   6
 
#define A04   10
 
#define A05   15
 
#define A10   1
 
#define A11   2
 
#define A12   4
 
#define A13   7
 
#define A14   11
 
#define A15   16
 
#define A20   3
 
#define A21   4
 
#define A22   5
 
#define A23   8
 
#define A24   12
 
#define A25   17
 
#define A30   6
 
#define A31   7
 
#define A32   8
 
#define A33   9
 
#define A34   13
 
#define A35   18
 
#define A40   10
 
#define A41   11
 
#define A42   12
 
#define A43   13
 
#define A44   14
 
#define A45   19
 
#define A50   15
 
#define A51   16
 
#define A52   17
 
#define A53   18
 
#define A54   19
 
#define A55   20
 

Functions

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

Macro Definition Documentation

◆ A00

#define A00   0

Definition at line 1258 of file G4ErrorSymMatrix.cc.

◆ A01

#define A01   1

Definition at line 1259 of file G4ErrorSymMatrix.cc.

◆ A02

#define A02   3

Definition at line 1260 of file G4ErrorSymMatrix.cc.

◆ A03

#define A03   6

Definition at line 1261 of file G4ErrorSymMatrix.cc.

◆ A04

#define A04   10

Definition at line 1262 of file G4ErrorSymMatrix.cc.

◆ A05

#define A05   15

Definition at line 1263 of file G4ErrorSymMatrix.cc.

◆ A10

#define A10   1

Definition at line 1265 of file G4ErrorSymMatrix.cc.

◆ A11

#define A11   2

Definition at line 1266 of file G4ErrorSymMatrix.cc.

◆ A12

#define A12   4

Definition at line 1267 of file G4ErrorSymMatrix.cc.

◆ A13

#define A13   7

Definition at line 1268 of file G4ErrorSymMatrix.cc.

◆ A14

#define A14   11

Definition at line 1269 of file G4ErrorSymMatrix.cc.

◆ A15

#define A15   16

Definition at line 1270 of file G4ErrorSymMatrix.cc.

◆ A20

#define A20   3

Definition at line 1272 of file G4ErrorSymMatrix.cc.

◆ A21

#define A21   4

Definition at line 1273 of file G4ErrorSymMatrix.cc.

◆ A22

#define A22   5

Definition at line 1274 of file G4ErrorSymMatrix.cc.

◆ A23

#define A23   8

Definition at line 1275 of file G4ErrorSymMatrix.cc.

◆ A24

#define A24   12

Definition at line 1276 of file G4ErrorSymMatrix.cc.

◆ A25

#define A25   17

Definition at line 1277 of file G4ErrorSymMatrix.cc.

◆ A30

#define A30   6

Definition at line 1279 of file G4ErrorSymMatrix.cc.

◆ A31

#define A31   7

Definition at line 1280 of file G4ErrorSymMatrix.cc.

◆ A32

#define A32   8

Definition at line 1281 of file G4ErrorSymMatrix.cc.

◆ A33

#define A33   9

Definition at line 1282 of file G4ErrorSymMatrix.cc.

◆ A34

#define A34   13

Definition at line 1283 of file G4ErrorSymMatrix.cc.

◆ A35

#define A35   18

Definition at line 1284 of file G4ErrorSymMatrix.cc.

◆ A40

#define A40   10

Definition at line 1286 of file G4ErrorSymMatrix.cc.

◆ A41

#define A41   11

Definition at line 1287 of file G4ErrorSymMatrix.cc.

◆ A42

#define A42   12

Definition at line 1288 of file G4ErrorSymMatrix.cc.

◆ A43

#define A43   13

Definition at line 1289 of file G4ErrorSymMatrix.cc.

◆ A44

#define A44   14

Definition at line 1290 of file G4ErrorSymMatrix.cc.

◆ A45

#define A45   19

Definition at line 1291 of file G4ErrorSymMatrix.cc.

◆ A50

#define A50   15

Definition at line 1293 of file G4ErrorSymMatrix.cc.

◆ A51

#define A51   16

Definition at line 1294 of file G4ErrorSymMatrix.cc.

◆ A52

#define A52   17

Definition at line 1295 of file G4ErrorSymMatrix.cc.

◆ A53

#define A53   18

Definition at line 1296 of file G4ErrorSymMatrix.cc.

◆ A54

#define A54   19

Definition at line 1297 of file G4ErrorSymMatrix.cc.

◆ A55

#define A55   20

Definition at line 1298 of file G4ErrorSymMatrix.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 63 of file G4ErrorSymMatrix.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 58 of file G4ErrorSymMatrix.cc.

◆ SIMPLE_BOP

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

Definition at line 45 of file G4ErrorSymMatrix.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.begin()+mat1.num_size(); \
for( ;a<e; a++, b++, t++) (*t) = (*a) OPER (*b);

Definition at line 51 of file G4ErrorSymMatrix.cc.

◆ SIMPLE_UOP

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

Definition at line 40 of file G4ErrorSymMatrix.cc.

Function Documentation

◆ dsum()

G4ErrorSymMatrix dsum ( const G4ErrorSymMatrix mat1,
const G4ErrorSymMatrix mat2 
)

Definition at line 182 of file G4ErrorSymMatrix.cc.

184{
185 G4ErrorSymMatrix mret(mat1.num_row() + mat2.num_row(), 0);
186 mret.sub(1,mat1);
187 mret.sub(mat1.num_row()+1,mat2);
188 return mret;
189}
G4int num_row() const

◆ operator*() [1/5]

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

Definition at line 286 of file G4ErrorSymMatrix.cc.

287{
288 G4ErrorMatrix mret(mat1.num_row(),mat2.num_col());
289 CHK_DIM_1(mat1.num_col(),mat2.num_row(),*);
290 G4ErrorMatrixConstIter mit1, mit2, sp,snp; //mit2=0
291 G4double temp;
292 G4ErrorMatrixIter mir=mret.m.begin();
293 for(mit1=mat1.m.begin();
294 mit1<mat1.m.begin()+mat1.num_row()*mat1.num_col();
295 mit1 = mit2)
296 {
297 snp=mat2.m.begin();
298 for(int step=1;step<=mat2.num_row();++step)
299 {
300 mit2=mit1;
301 sp=snp;
302 snp+=step;
303 temp=0;
304 while(sp<snp) // Loop checking, 06.08.2015, G.Cosmo
305 { temp+=*(sp++)*(*(mit2++)); }
306 if( step<mat2.num_row() ) { // only if we aren't on the last row
307 sp+=step-1;
308 for(int stept=step+1;stept<=mat2.num_row();stept++)
309 {
310 temp+=*sp*(*(mit2++));
311 if(stept<mat2.num_row()) sp+=stept;
312 }
313 } // if(step
314 *(mir++)=temp;
315 } // for(step
316 } // for(mit1
317 return mret;
318}
#define CHK_DIM_1(c1, r2, fun)
double G4double
Definition: G4Types.hh:83
virtual G4int num_col() const
virtual G4int num_row() const
G4int num_col() const

◆ operator*() [2/5]

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

Definition at line 320 of file G4ErrorSymMatrix.cc.

321{
322 G4ErrorMatrix mret(mat1.num_row(),mat2.num_col());
323 CHK_DIM_1(mat1.num_col(),mat2.num_row(),*);
324 G4int step,stept;
325 G4ErrorMatrixConstIter mit1,mit2,sp,snp;
326 G4double temp;
327 G4ErrorMatrixIter mir=mret.m.begin();
328 for(step=1,snp=mat1.m.begin();step<=mat1.num_row();snp+=step++)
329 {
330 for(mit1=mat2.m.begin();mit1<mat2.m.begin()+mat2.num_col();mit1++)
331 {
332 mit2=mit1;
333 sp=snp;
334 temp=0;
335 while(sp<snp+step) // Loop checking, 06.08.2015, G.Cosmo
336 {
337 temp+=*mit2*(*(sp++));
338 mit2+=mat2.num_col();
339 }
340 sp+=step-1;
341 for(stept=step+1;stept<=mat1.num_row();stept++)
342 {
343 temp+=*mit2*(*sp);
344 mit2+=mat2.num_col();
345 sp+=stept;
346 }
347 *(mir++)=temp;
348 }
349 }
350 return mret;
351}
int G4int
Definition: G4Types.hh:85

◆ operator*() [3/5]

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

Definition at line 353 of file G4ErrorSymMatrix.cc.

354{
355 G4ErrorMatrix mret(mat1.num_row(),mat1.num_row());
356 CHK_DIM_1(mat1.num_col(),mat2.num_row(),*);
357 G4int step1,stept1,step2,stept2;
358 G4ErrorMatrixConstIter snp1,sp1,snp2,sp2;
359 G4double temp;
360 G4ErrorMatrixIter mr = mret.m.begin();
361 for(step1=1,snp1=mat1.m.begin();step1<=mat1.num_row();snp1+=step1++)
362 {
363 for(step2=1,snp2=mat2.m.begin();step2<=mat2.num_row();)
364 {
365 sp1=snp1;
366 sp2=snp2;
367 snp2+=step2;
368 temp=0;
369 if(step1<step2)
370 {
371 while(sp1<snp1+step1) // Loop checking, 06.08.2015, G.Cosmo
372 { temp+=(*(sp1++))*(*(sp2++)); }
373 sp1+=step1-1;
374 for(stept1=step1+1;stept1!=step2+1;sp1+=stept1++)
375 { temp+=(*sp1)*(*(sp2++)); }
376 sp2+=step2-1;
377 for(stept2=++step2;stept2<=mat2.num_row();sp1+=stept1++,sp2+=stept2++)
378 { temp+=(*sp1)*(*sp2); }
379 }
380 else
381 {
382 while(sp2<snp2) // Loop checking, 06.08.2015, G.Cosmo
383 { temp+=(*(sp1++))*(*(sp2++)); }
384 sp2+=step2-1;
385 for(stept2=++step2;stept2!=step1+1;sp2+=stept2++)
386 { temp+=(*(sp1++))*(*sp2); }
387 sp1+=step1-1;
388 for(stept1=step1+1;stept1<=mat1.num_row();sp1+=stept1++,sp2+=stept2++)
389 { temp+=(*sp1)*(*sp2); }
390 }
391 *(mr++)=temp;
392 }
393 }
394 return mret;
395}

◆ operator*() [4/5]

G4ErrorSymMatrix operator* ( const G4ErrorSymMatrix mat1,
G4double  t 
)

Definition at line 272 of file G4ErrorSymMatrix.cc.

273{
274 G4ErrorSymMatrix mret(mat1);
275 mret *= t;
276 return mret;
277}

◆ operator*() [5/5]

G4ErrorSymMatrix operator* ( G4double  t,
const G4ErrorSymMatrix mat1 
)

Definition at line 279 of file G4ErrorSymMatrix.cc.

280{
281 G4ErrorSymMatrix mret(mat1);
282 mret *= t;
283 return mret;
284}

◆ operator+() [1/3]

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

Definition at line 206 of file G4ErrorSymMatrix.cc.

207{
208 G4ErrorMatrix mret(mat1);
209 CHK_DIM_2(mat1.num_row(),mat2.num_row(), mat1.num_col(),mat2.num_col(),+);
210 mret += mat2;
211 return mret;
212}
#define CHK_DIM_2(r1, r2, c1, c2, fun)

◆ operator+() [2/3]

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

Definition at line 214 of file G4ErrorSymMatrix.cc.

215{
216 G4ErrorMatrix mret(mat2);
217 CHK_DIM_2(mat1.num_row(),mat2.num_row(),mat1.num_col(),mat2.num_col(),+);
218 mret += mat1;
219 return mret;
220}

◆ operator+() [3/3]

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

Definition at line 222 of file G4ErrorSymMatrix.cc.

224{
225 G4ErrorSymMatrix mret(mat1.nrow);
226 CHK_DIM_1(mat1.nrow, mat2.nrow,+);
227 SIMPLE_TOP(+)
228 return mret;
229}
#define SIMPLE_TOP(OPER)

◆ operator-() [1/3]

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

Definition at line 235 of file G4ErrorSymMatrix.cc.

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

◆ operator-() [2/3]

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

Definition at line 243 of file G4ErrorSymMatrix.cc.

244{
245 G4ErrorMatrix mret(mat1);
246 CHK_DIM_2(mat1.num_row(),mat2.num_row(),mat1.num_col(),mat2.num_col(),-);
247 mret -= mat2;
248 return mret;
249}

◆ operator-() [3/3]

G4ErrorSymMatrix operator- ( const G4ErrorSymMatrix mat1,
const G4ErrorSymMatrix mat2 
)

Definition at line 251 of file G4ErrorSymMatrix.cc.

253{
254 G4ErrorSymMatrix mret(mat1.num_row());
255 CHK_DIM_1(mat1.num_row(),mat2.num_row(),-);
256 SIMPLE_TOP(-)
257 return mret;
258}

◆ operator/()

G4ErrorSymMatrix operator/ ( const G4ErrorSymMatrix mat1,
G4double  t 
)

Definition at line 265 of file G4ErrorSymMatrix.cc.

266{
267 G4ErrorSymMatrix mret(mat1);
268 mret /= t;
269 return mret;
270}

◆ operator<<()

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

Definition at line 523 of file G4ErrorSymMatrix.cc.

524{
525 os << G4endl;
526
527 // Fixed format needs 3 extra characters for field,
528 // while scientific needs 7
529
530 G4int width;
531 if(os.flags() & std::ios::fixed)
532 {
533 width = os.precision()+3;
534 }
535 else
536 {
537 width = os.precision()+7;
538 }
539 for(G4int irow = 1; irow<= q.num_row(); irow++)
540 {
541 for(G4int icol = 1; icol <= q.num_col(); icol++)
542 {
543 os.width(width);
544 os << q(irow,icol) << " ";
545 }
546 os << G4endl;
547 }
548 return os;
549}
#define G4endl
Definition: G4ios.hh:57