24{
27
28 double precision;
29 int numberOfEvents;
31
32 try {
33
34 JParser<> zap(
"Example program to test inversion of symmetric matrix.");
35
39
41 }
42 catch(const exception &error) {
44 }
45
46
47 ASSERT(numberOfEvents > 0);
48
50
53
54 for (int i = 0; i != numberOfEvents; ++i) {
55
57
59
61
62 R(0,0) = A.a00; R(0,1) = A.a01; R(0,2) = A.a02; R(0,3) = A.a03;
63 R(1,0) = A.a10; R(1,1) = A.a11; R(1,2) = A.a12; R(1,3) = A.a13;
64 R(2,0) = A.a20; R(2,1) = A.a21; R(2,2) = A.a22; R(2,3) = A.a23;
65 R(3,0) = A.a30; R(3,1) = A.a31; R(3,2) = A.a32; R(3,3) = A.a33;
66
67
70
71 DEBUG(
"Determinant A " << A.getDeterminant() <<
endl);
72
73 try {
74
76
77 t1.start();
78
79 for (int i = 11; i != 0; --i) {
80 B.invert();
81 }
82
83 t1.stop();
84
85 t2.start();
86
87 for (int i = 11; i != 0; --i) {
88 R.Invert();
89 }
90
91 t2.stop();
92
95
96 DEBUG(
"Determinant A^-1 = " << B.getDeterminant() <<
endl);
97
99
102
103 DEBUG(
"Determinant (A x A^-1) = " << C.getDeterminant() <<
endl);
104 DEBUG(
"Determinant A x Determinant A^-1 = " << A.getDeterminant() * B.getDeterminant() <<
endl);
105 DEBUG(
"A x A^-1 = I ? " << C.isIdentity(precision) <<
endl);
106
107 if (!C.isIdentity(precision)) {
109 }
110
111 JMatrix4D D = C - JMatrix4D::getIdentity();
112
115
116 ASSERT(C.isIdentity(precision));
117 }
120 }
121 }
123
124 if (numberOfEvents > 0) {
125
126 const double factor = 1.0;
127
128 t1.print(
cout, factor, micro_t);
129 t2.print(
cout, factor, micro_t);
130 }
131
132 return 0;
133}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class for CPU timing and usage.
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).