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) {
52 NOTICE(
"Determinant A " << A.getDeterminant() <<
endl);
63 NOTICE(
"Determinant A^-1 = " << B.getDeterminant() <<
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)) {
78 JMatrix3D D = C - JMatrix3D::getIdentity();
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));