#include "globals.hh"
#include <iostream>
#include <cmath>
#include "G4ErrorSymMatrix.hh"
#include "G4ErrorMatrix.hh"
Go to the source code of this file.
Defines | |
#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) |
#define A00 0 |
Definition at line 1252 of file G4ErrorSymMatrix.cc.
#define A01 1 |
Definition at line 1253 of file G4ErrorSymMatrix.cc.
#define A02 3 |
Definition at line 1254 of file G4ErrorSymMatrix.cc.
#define A03 6 |
Definition at line 1255 of file G4ErrorSymMatrix.cc.
#define A04 10 |
Definition at line 1256 of file G4ErrorSymMatrix.cc.
#define A05 15 |
Definition at line 1257 of file G4ErrorSymMatrix.cc.
#define A10 1 |
Definition at line 1259 of file G4ErrorSymMatrix.cc.
#define A11 2 |
Definition at line 1260 of file G4ErrorSymMatrix.cc.
#define A12 4 |
Definition at line 1261 of file G4ErrorSymMatrix.cc.
#define A13 7 |
Definition at line 1262 of file G4ErrorSymMatrix.cc.
#define A14 11 |
Definition at line 1263 of file G4ErrorSymMatrix.cc.
#define A15 16 |
Definition at line 1264 of file G4ErrorSymMatrix.cc.
#define A20 3 |
Definition at line 1266 of file G4ErrorSymMatrix.cc.
#define A21 4 |
Definition at line 1267 of file G4ErrorSymMatrix.cc.
#define A22 5 |
Definition at line 1268 of file G4ErrorSymMatrix.cc.
#define A23 8 |
Definition at line 1269 of file G4ErrorSymMatrix.cc.
#define A24 12 |
Definition at line 1270 of file G4ErrorSymMatrix.cc.
#define A25 17 |
Definition at line 1271 of file G4ErrorSymMatrix.cc.
#define A30 6 |
Definition at line 1273 of file G4ErrorSymMatrix.cc.
#define A31 7 |
Definition at line 1274 of file G4ErrorSymMatrix.cc.
#define A32 8 |
Definition at line 1275 of file G4ErrorSymMatrix.cc.
#define A33 9 |
Definition at line 1276 of file G4ErrorSymMatrix.cc.
#define A34 13 |
Definition at line 1277 of file G4ErrorSymMatrix.cc.
#define A35 18 |
Definition at line 1278 of file G4ErrorSymMatrix.cc.
#define A40 10 |
Definition at line 1280 of file G4ErrorSymMatrix.cc.
#define A41 11 |
Definition at line 1281 of file G4ErrorSymMatrix.cc.
#define A42 12 |
Definition at line 1282 of file G4ErrorSymMatrix.cc.
#define A43 13 |
Definition at line 1283 of file G4ErrorSymMatrix.cc.
#define A44 14 |
Definition at line 1284 of file G4ErrorSymMatrix.cc.
#define A45 19 |
Definition at line 1285 of file G4ErrorSymMatrix.cc.
#define A50 15 |
Definition at line 1287 of file G4ErrorSymMatrix.cc.
#define A51 16 |
Definition at line 1288 of file G4ErrorSymMatrix.cc.
#define A52 17 |
Definition at line 1289 of file G4ErrorSymMatrix.cc.
#define A53 18 |
Definition at line 1290 of file G4ErrorSymMatrix.cc.
#define A54 19 |
Definition at line 1291 of file G4ErrorSymMatrix.cc.
#define A55 20 |
Definition at line 1292 of file G4ErrorSymMatrix.cc.
#define CHK_DIM_1 | ( | c1, | |||
r2, | |||||
fun | ) |
Value:
if (c1!=r2) { \ G4ErrorMatrix::error("Range error in Matrix function " #fun "(2)."); \ }
Definition at line 64 of file G4ErrorSymMatrix.cc.
#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 59 of file G4ErrorSymMatrix.cc.
#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);
Definition at line 46 of file G4ErrorSymMatrix.cc.
#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 52 of file G4ErrorSymMatrix.cc.
#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 41 of file G4ErrorSymMatrix.cc.
G4ErrorSymMatrix dsum | ( | const G4ErrorSymMatrix & | mat1, | |
const G4ErrorSymMatrix & | mat2 | |||
) |
Definition at line 183 of file G4ErrorSymMatrix.cc.
References G4ErrorSymMatrix::num_row(), and G4ErrorMatrix::sub().
00185 { 00186 G4ErrorSymMatrix mret(mat1.num_row() + mat2.num_row(), 0); 00187 mret.sub(1,mat1); 00188 mret.sub(mat1.num_row()+1,mat2); 00189 return mret; 00190 }
G4ErrorMatrix operator * | ( | const G4ErrorSymMatrix & | mat1, | |
const G4ErrorSymMatrix & | mat2 | |||
) |
Definition at line 354 of file G4ErrorSymMatrix.cc.
References CHK_DIM_1, G4ErrorSymMatrix::m, G4ErrorSymMatrix::num_col(), and G4ErrorSymMatrix::num_row().
00355 { 00356 G4ErrorMatrix mret(mat1.num_row(),mat1.num_row()); 00357 CHK_DIM_1(mat1.num_col(),mat2.num_row(),*); 00358 G4int step1,stept1,step2,stept2; 00359 G4ErrorMatrixConstIter snp1,sp1,snp2,sp2; 00360 G4double temp; 00361 G4ErrorMatrixIter mr = mret.m.begin(); 00362 for(step1=1,snp1=mat1.m.begin();step1<=mat1.num_row();snp1+=step1++) 00363 { 00364 for(step2=1,snp2=mat2.m.begin();step2<=mat2.num_row();) 00365 { 00366 sp1=snp1; 00367 sp2=snp2; 00368 snp2+=step2; 00369 temp=0; 00370 if(step1<step2) 00371 { 00372 while(sp1<snp1+step1) 00373 { temp+=(*(sp1++))*(*(sp2++)); } 00374 sp1+=step1-1; 00375 for(stept1=step1+1;stept1!=step2+1;sp1+=stept1++) 00376 { temp+=(*sp1)*(*(sp2++)); } 00377 sp2+=step2-1; 00378 for(stept2=++step2;stept2<=mat2.num_row();sp1+=stept1++,sp2+=stept2++) 00379 { temp+=(*sp1)*(*sp2); } 00380 } 00381 else 00382 { 00383 while(sp2<snp2) 00384 { temp+=(*(sp1++))*(*(sp2++)); } 00385 sp2+=step2-1; 00386 for(stept2=++step2;stept2!=step1+1;sp2+=stept2++) 00387 { temp+=(*(sp1++))*(*sp2); } 00388 sp1+=step1-1; 00389 for(stept1=step1+1;stept1<=mat1.num_row();sp1+=stept1++,sp2+=stept2++) 00390 { temp+=(*sp1)*(*sp2); } 00391 } 00392 *(mr++)=temp; 00393 } 00394 } 00395 return mret; 00396 }
G4ErrorMatrix operator * | ( | const G4ErrorSymMatrix & | mat1, | |
const G4ErrorMatrix & | mat2 | |||
) |
Definition at line 321 of file G4ErrorSymMatrix.cc.
References CHK_DIM_1, G4ErrorMatrix::m, G4ErrorSymMatrix::m, G4ErrorSymMatrix::num_col(), G4ErrorMatrix::num_col(), G4ErrorMatrix::num_row(), G4ErrorSymMatrix::num_row(), and G4InuclParticleNames::sp.
00322 { 00323 G4ErrorMatrix mret(mat1.num_row(),mat2.num_col()); 00324 CHK_DIM_1(mat1.num_col(),mat2.num_row(),*); 00325 G4int step,stept; 00326 G4ErrorMatrixConstIter mit1,mit2,sp,snp; 00327 G4double temp; 00328 G4ErrorMatrixIter mir=mret.m.begin(); 00329 for(step=1,snp=mat1.m.begin();step<=mat1.num_row();snp+=step++) 00330 { 00331 for(mit1=mat2.m.begin();mit1<mat2.m.begin()+mat2.num_col();mit1++) 00332 { 00333 mit2=mit1; 00334 sp=snp; 00335 temp=0; 00336 while(sp<snp+step) 00337 { 00338 temp+=*mit2*(*(sp++)); 00339 mit2+=mat2.num_col(); 00340 } 00341 sp+=step-1; 00342 for(stept=step+1;stept<=mat1.num_row();stept++) 00343 { 00344 temp+=*mit2*(*sp); 00345 mit2+=mat2.num_col(); 00346 sp+=stept; 00347 } 00348 *(mir++)=temp; 00349 } 00350 } 00351 return mret; 00352 }
G4ErrorMatrix operator * | ( | const G4ErrorMatrix & | mat1, | |
const G4ErrorSymMatrix & | mat2 | |||
) |
Definition at line 287 of file G4ErrorSymMatrix.cc.
References CHK_DIM_1, G4ErrorSymMatrix::m, G4ErrorMatrix::m, G4ErrorMatrix::num_col(), G4ErrorSymMatrix::num_col(), G4ErrorSymMatrix::num_row(), G4ErrorMatrix::num_row(), and G4InuclParticleNames::sp.
00288 { 00289 G4ErrorMatrix mret(mat1.num_row(),mat2.num_col()); 00290 CHK_DIM_1(mat1.num_col(),mat2.num_row(),*); 00291 G4ErrorMatrixConstIter mit1, mit2, sp,snp; //mit2=0 00292 G4double temp; 00293 G4ErrorMatrixIter mir=mret.m.begin(); 00294 for(mit1=mat1.m.begin(); 00295 mit1<mat1.m.begin()+mat1.num_row()*mat1.num_col(); 00296 mit1 = mit2) 00297 { 00298 snp=mat2.m.begin(); 00299 for(int step=1;step<=mat2.num_row();++step) 00300 { 00301 mit2=mit1; 00302 sp=snp; 00303 snp+=step; 00304 temp=0; 00305 while(sp<snp) 00306 temp+=*(sp++)*(*(mit2++)); 00307 if( step<mat2.num_row() ) { // only if we aren't on the last row 00308 sp+=step-1; 00309 for(int stept=step+1;stept<=mat2.num_row();stept++) 00310 { 00311 temp+=*sp*(*(mit2++)); 00312 if(stept<mat2.num_row()) sp+=stept; 00313 } 00314 } // if(step 00315 *(mir++)=temp; 00316 } // for(step 00317 } // for(mit1 00318 return mret; 00319 }
G4ErrorSymMatrix operator * | ( | G4double | t, | |
const G4ErrorSymMatrix & | mat1 | |||
) |
Definition at line 280 of file G4ErrorSymMatrix.cc.
00281 { 00282 G4ErrorSymMatrix mret(mat1); 00283 mret *= t; 00284 return mret; 00285 }
G4ErrorSymMatrix operator * | ( | const G4ErrorSymMatrix & | mat1, | |
G4double | t | |||
) |
Definition at line 273 of file G4ErrorSymMatrix.cc.
00274 { 00275 G4ErrorSymMatrix mret(mat1); 00276 mret *= t; 00277 return mret; 00278 }
G4ErrorSymMatrix operator+ | ( | const G4ErrorSymMatrix & | mat1, | |
const G4ErrorSymMatrix & | mat2 | |||
) |
Definition at line 223 of file G4ErrorSymMatrix.cc.
References CHK_DIM_1, G4ErrorSymMatrix::nrow, and SIMPLE_TOP.
00225 { 00226 G4ErrorSymMatrix mret(mat1.nrow); 00227 CHK_DIM_1(mat1.nrow, mat2.nrow,+); 00228 SIMPLE_TOP(+) 00229 return mret; 00230 }
G4ErrorMatrix operator+ | ( | const G4ErrorSymMatrix & | mat1, | |
const G4ErrorMatrix & | mat2 | |||
) |
Definition at line 215 of file G4ErrorSymMatrix.cc.
References CHK_DIM_2, G4ErrorMatrix::num_col(), G4ErrorSymMatrix::num_col(), G4ErrorMatrix::num_row(), and G4ErrorSymMatrix::num_row().
00216 { 00217 G4ErrorMatrix mret(mat2); 00218 CHK_DIM_2(mat1.num_row(),mat2.num_row(),mat1.num_col(),mat2.num_col(),+); 00219 mret += mat1; 00220 return mret; 00221 }
G4ErrorMatrix operator+ | ( | const G4ErrorMatrix & | mat1, | |
const G4ErrorSymMatrix & | mat2 | |||
) |
Definition at line 207 of file G4ErrorSymMatrix.cc.
References CHK_DIM_2, G4ErrorSymMatrix::num_col(), G4ErrorMatrix::num_col(), G4ErrorSymMatrix::num_row(), and G4ErrorMatrix::num_row().
00208 { 00209 G4ErrorMatrix mret(mat1); 00210 CHK_DIM_2(mat1.num_row(),mat2.num_row(), mat1.num_col(),mat2.num_col(),+); 00211 mret += mat2; 00212 return mret; 00213 }
G4ErrorSymMatrix operator- | ( | const G4ErrorSymMatrix & | mat1, | |
const G4ErrorSymMatrix & | mat2 | |||
) |
Definition at line 252 of file G4ErrorSymMatrix.cc.
References CHK_DIM_1, G4ErrorSymMatrix::num_row(), and SIMPLE_TOP.
00254 { 00255 G4ErrorSymMatrix mret(mat1.num_row()); 00256 CHK_DIM_1(mat1.num_row(),mat2.num_row(),-); 00257 SIMPLE_TOP(-) 00258 return mret; 00259 }
G4ErrorMatrix operator- | ( | const G4ErrorSymMatrix & | mat1, | |
const G4ErrorMatrix & | mat2 | |||
) |
Definition at line 244 of file G4ErrorSymMatrix.cc.
References CHK_DIM_2, G4ErrorMatrix::num_col(), G4ErrorSymMatrix::num_col(), G4ErrorMatrix::num_row(), and G4ErrorSymMatrix::num_row().
00245 { 00246 G4ErrorMatrix mret(mat1); 00247 CHK_DIM_2(mat1.num_row(),mat2.num_row(),mat1.num_col(),mat2.num_col(),-); 00248 mret -= mat2; 00249 return mret; 00250 }
G4ErrorMatrix operator- | ( | const G4ErrorMatrix & | mat1, | |
const G4ErrorSymMatrix & | mat2 | |||
) |
Definition at line 236 of file G4ErrorSymMatrix.cc.
References CHK_DIM_2, G4ErrorSymMatrix::num_col(), G4ErrorMatrix::num_col(), G4ErrorSymMatrix::num_row(), and G4ErrorMatrix::num_row().
00237 { 00238 G4ErrorMatrix mret(mat1); 00239 CHK_DIM_2(mat1.num_row(),mat2.num_row(),mat1.num_col(),mat2.num_col(),-); 00240 mret -= mat2; 00241 return mret; 00242 }
G4ErrorSymMatrix operator/ | ( | const G4ErrorSymMatrix & | mat1, | |
G4double | t | |||
) |
Definition at line 266 of file G4ErrorSymMatrix.cc.
00267 { 00268 G4ErrorSymMatrix mret(mat1); 00269 mret /= t; 00270 return mret; 00271 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const G4ErrorSymMatrix & | q | |||
) |
Definition at line 524 of file G4ErrorSymMatrix.cc.
References G4endl, G4ErrorSymMatrix::num_col(), and G4ErrorSymMatrix::num_row().
00525 { 00526 os << G4endl; 00527 00528 // Fixed format needs 3 extra characters for field, 00529 // while scientific needs 7 00530 00531 G4int width; 00532 if(os.flags() & std::ios::fixed) 00533 { 00534 width = os.precision()+3; 00535 } 00536 else 00537 { 00538 width = os.precision()+7; 00539 } 00540 for(G4int irow = 1; irow<= q.num_row(); irow++) 00541 { 00542 for(G4int icol = 1; icol <= q.num_col(); icol++) 00543 { 00544 os.width(width); 00545 os << q(irow,icol) << " "; 00546 } 00547 os << G4endl; 00548 } 00549 return os; 00550 }