Jpp
15.0.1-rc.1-highqe
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JMath
JMatrix2S.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "TRandom3.h"
6
7
#include "
JLang/JException.hh
"
8
#include "
JMath/JMatrix2S.hh
"
9
#include "
JMath/JMathTestkit.hh
"
10
11
#include "
Jeep/JParser.hh
"
12
#include "
Jeep/JMessage.hh
"
13
14
15
/**
16
* \file
17
*
18
* Example program to test inversion of symmetric matrix.
19
* \author mdejong
20
*/
21
int
main
(
int
argc,
char
**argv)
22
{
23
using namespace
std;
24
using namespace
JPP;
25
26
double
precision;
27
int
debug
;
28
29
try
{
30
31
JParser<>
zap(
"Example program to test inversion of symmetric matrix."
);
32
33
zap[
'e'
] =
make_field
(precision) = 1.0e-6;
34
zap[
'd'
] =
make_field
(
debug
) = 3;
35
36
zap(argc, argv);
37
}
38
catch
(
const
exception &error) {
39
FATAL
(error.what() << endl);
40
}
41
42
43
gRandom->SetSeed(0);
44
45
46
JMatrix2S
A
= getRandom<JMatrix2S>();
47
48
DEBUG
(
"Matrix A"
<< endl);
49
DEBUG
(
A
<< endl);
50
51
NOTICE
(
"Determinant A "
<<
A
.getDeterminant() << endl);
52
53
try
{
54
55
JMatrix2S B(
A
);
56
57
B.invert();
58
59
DEBUG
(
"Matrix A^-1"
<< endl);
60
DEBUG
(B << endl);
61
62
NOTICE
(
"Determinant A^-1 = "
<< B.getDeterminant() << endl);
63
64
JMatrix2D
C
(
A
* B);
65
66
DEBUG
(
"Matrix A x A^-1"
<< endl);
67
DEBUG
(C << endl);
68
69
NOTICE
(
"Determinant (A x A^-1) = "
<< C.getDeterminant() << endl);
70
NOTICE
(
"Determinant A x Determinant A^-1 = "
<<
A
.getDeterminant() * B.getDeterminant() << endl);
71
NOTICE
(
"A x A^-1 = I ? "
<< C.isIdentity(precision) << endl);
72
73
if
(!C.isIdentity(precision)) {
74
ERROR
(
"Matrix A x A^-1 /= I"
<< endl);
75
}
76
77
JMatrix2D
D
= C - JMatrix2D::getIdentity();
78
79
DEBUG
(
"Matrix D = C - I"
<< endl);
80
DEBUG
(D << endl);
81
82
ASSERT
(C.isIdentity(precision));
83
}
84
catch
(
const
JException& error) {
85
FATAL
(error << endl);
86
}
87
88
return
0;
89
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
JException.hh
Exceptions.
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JMathTestkit.hh
JPHYSICS::C
static const double C
Physics constants.
Definition:
JPhysics/JConstants.hh:25
ASSERT
#define ASSERT(A,...)
Assert macro.
Definition:
JMessage.hh:90
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
NOTICE
#define NOTICE(A)
Definition:
JMessage.hh:64
ERROR
#define ERROR(A)
Definition:
JMessage.hh:66
debug
int debug
debug level
Definition:
JSirene.cc:63
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JMatrix2S.hh
JParser.hh
Utility class to parse command line options.
DEBUG
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
Definition:
JCalibratePMT.sh:21
D
do echo Generating $dir eval D
Definition:
JDrawLED.sh:53
A
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
Definition:
JShellParser.csh:15
Generated by
1.8.5