22 int main(
int argc,
char**argv)
32 JParser<> zap(
"Example program to test inversion and eigenvalue decomposition of 3D symmetric matrix.");
39 catch(
const exception &error) {
40 FATAL(error.what() << endl);
49 DEBUG(
"Matrix A" << endl);
60 DEBUG(
"Matrix A^-1" << endl);
67 DEBUG(
"Matrix A x A^-1" << endl);
70 NOTICE(
"Determinant (A x A^-1) = " <<
C.getDeterminant() << endl);
72 NOTICE(
"A x A^-1 = I ? " <<
C.isIdentity(precision) << endl);
74 if (!
C.isIdentity(precision)) {
75 ERROR(
"Matrix A x A^-1 /= I" << endl);
80 DEBUG(
"Matrix D = C - I" << endl);
83 DEBUG(
"Eigenvalues v of matrix A" << endl);
87 for (JMatrix3S::eigen_values::const_iterator i =
v.cbegin(); i !=
v.cend(); ++i) {
96 ASSERT(
JMatrix3S(A).sub(
v[0] * JMatrix3D::getIdentity()).getDeterminant() < precision);
97 ASSERT(
JMatrix3S(A).sub(
v[1] * JMatrix3D::getIdentity()).getDeterminant() < precision);
98 ASSERT(
JMatrix3S(A).sub(
v[2] * JMatrix3D::getIdentity()).getDeterminant() < precision);
100 ASSERT(
C.isIdentity(precision));
103 FATAL(error << endl);
int main(int argc, char **argv)
General purpose messaging.
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
double getDeterminant() const
Get determinant of matrix.
eigen_values getEigenValues(const double epsilon=1e-6) const
Get eigen values.
void invert()
Invert matrix.
Utility class to parse command line options.
static const double C
Physics constants.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.