22 int main(
int argc,
char**argv)
34 JParser<> zap(
"Example program to test inversion of symmetric matrix.");
43 catch(
const exception &error) {
44 FATAL(error.what() << endl);
48 gRandom->SetSeed(seed);
50 const Double_t xmin = -1.0;
51 const Double_t xmax = +1.0;
55 for (
int i = 0; i != N; ++i) {
57 A(i,i) = gRandom->Uniform(xmin,xmax);
59 for (
int j = 0;
j != i; ++
j) {
60 A(
j,i) = A(i,
j) = gRandom->Uniform(xmin,xmax);
67 DEBUG(
"Matrix A" << endl);
80 NOTICE(
"Elapsed time [us] " << setw(8) << timer.usec_wall << endl);
81 DEBUG(
"Matrix A^-1" << endl);
88 DEBUG(
"Matrix A x A^-1" << endl);
91 NOTICE(
"A x A^-1 = I ? " <<
C.isIdentity(precision) << endl);
93 if (!
C.isIdentity(precision)) {
94 ERROR(
"Matrix A x A^-1 /= I" << endl);
97 ASSERT (
C.isIdentity(precision));
99 const double big = 1.0e5;
101 for (
int i = 0; i != N; ++i) {
112 NOTICE(
"Elapsed time [us] " << setw(8) << timer.usec_wall << endl);
113 NOTICE(
"Pivot " << setw(2) << i <<
'+' << big <<
' ' << (JMatrixNS(A).mul(B).isIdentity(precision) ?
"okay" :
"error") << endl);
115 ASSERT(JMatrixNS(A).mul(B).isIdentity(precision));
123 catch (
const JException& error) {
124 FATAL(error << endl);