Example program to test inversion of symmetric matrix.
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "TRandom3.h"
#include "TMatrixTSym.h"
#include "JLang/JException.hh"
#include "JMath/JMatrix5S.hh"
#include "JMath/JMathTestkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "Jeep/JTimer.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Example program to test inversion of symmetric matrix.
- Author
- mdejong
Definition in file JMatrix5S.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 23 of file JMatrix5S.cc.
34 JParser<> zap(
"Example program to test inversion of symmetric matrix.");
42 catch(
const exception &error) {
43 FATAL(error.what() << endl);
47 ASSERT(numberOfEvents > 0);
54 for (
int i = 0; i != numberOfEvents; ++i) {
56 if (i%100 == 0) {
STATUS(setw(8) << i <<
'\r');
DEBUG(endl); }
58 JMatrix5S
A = getRandom<JMatrix5S>();
60 TMatrixTSym<double>
R(5);
62 R(0,0) = A.a00;
R(0,1) = A.a01;
R(0,2) = A.a02;
R(0,3) = A.a03;
R(0,4) = A.a04;
63 R(1,0) = A.a10;
R(1,1) = A.a11;
R(1,2) = A.a12;
R(1,3) = A.a13;
R(1,4) = A.a14;
64 R(2,0) = A.a20;
R(2,1) = A.a21;
R(2,2) = A.a22;
R(2,3) = A.a23;
R(2,4) = A.a24;
65 R(3,0) = A.a30;
R(3,1) = A.a31;
R(3,2) = A.a32;
R(3,3) = A.a33;
R(3,4) = A.a34;
66 R(4,0) = A.a40;
R(4,1) = A.a41;
R(4,2) = A.a42;
R(4,3) = A.a43;
R(4,4) = A.a44;
69 DEBUG(
"Matrix A" << endl);
72 DEBUG(
"Determinant A " << A.getDeterminant() << endl);
80 for (
int i = 11; i != 0; --i) {
88 for (
int i = 11; i != 0; --i) {
94 DEBUG(
"Matrix A^-1" << endl);
97 DEBUG(
"Determinant A^-1 = " << B.getDeterminant() << endl);
101 DEBUG(
"Matrix A x A^-1" << endl);
104 DEBUG(
"Determinant (A x A^-1) = " <<
C.getDeterminant() << endl);
105 DEBUG(
"Determinant A x Determinant A^-1 = " << A.getDeterminant() * B.getDeterminant() << endl);
106 DEBUG(
"A x A^-1 = I ? " <<
C.isIdentity(precision) << endl);
108 if (!
C.isIdentity(precision)) {
109 ERROR(
"Matrix A x A^-1 /= I" << endl);
112 JMatrix5D
D =
C - JMatrix5D::getIdentity();
114 DEBUG(
"Matrix D = C - I" << endl);
117 ASSERT (
C.isIdentity(precision));
119 catch (
const JException& error) {
120 FATAL(error << endl);
125 if (numberOfEvents > 0) {
127 const double factor = 1.0;
129 t1.print(cout, factor,
micro_t);
130 t2.print(cout, factor,
micro_t);
Utility class to parse command line options.
static const double C
Physics constants.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then usage $script[distance] fi case set_variable R
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
do echo Generating $dir eval D