22int 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);
52 NOTICE(
"Determinant A " << A.getDeterminant() << endl);
60 DEBUG(
"Matrix A^-1" << endl);
63 NOTICE(
"Determinant A^-1 = " << B.getDeterminant() << endl);
67 DEBUG(
"Matrix A x A^-1" << endl);
70 NOTICE(
"Determinant (A x A^-1) = " << C.getDeterminant() << endl);
71 NOTICE(
"Determinant A x Determinant A^-1 = " << A.getDeterminant() * B.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);
78 JMatrix3D D = C - JMatrix3D::getIdentity();
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) {
93 ASSERT(fabs(v[0]) > fabs(v[1]));
94 ASSERT(fabs(v[1]) > fabs(v[2]));
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);