Example program to test inversion of symmetric matrix.  
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "TRandom3.h"
#include "JLang/JException.hh"
#include "JMath/JMatrixNS.hh"
#include "JMath/JMathTestkit.hh"
#include "Jeep/JTimer.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
 
Go to the source code of this file.
 | 
| int  | main (int argc, char **argv) | 
|   | 
Example program to test inversion of symmetric matrix. 
- Author
 - mdejong 
 
Definition in file JMatrixNS.cc.
 
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char **  | 
          argv  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 22 of file JMatrixNS.cc.
   29   size_t    numberOfInversions;
 
   35     JParser<> zap(
"Example program to test inversion of symmetric matrix.");
 
   45   catch(
const exception &error) {
 
   46     FATAL(error.what() << endl);
 
   50   gRandom->SetSeed(seed);
 
   52   const Double_t xmin = -1.0;
 
   53   const Double_t xmax = +1.0;
 
   57   for (
int i = 0; i != 
N; ++i) {
 
   59     A(i,i) = gRandom->Uniform(xmin,xmax); 
 
   61     for (
int j = 0; 
j != i; ++
j) {
 
   62       A(
j,i) = 
A(i,
j) = gRandom->Uniform(xmin,xmax); 
 
   69     DEBUG(
"Matrix A" << endl);
 
   78     for (
size_t i = 2*(numberOfInversions/2) + 1; i != 0; --i) {
 
   84     NOTICE(
"Elapsed time [us] " << setw(8) << timer.usec_wall << endl);
 
   85     DEBUG(
"Matrix A^-1" << endl);
 
   92     DEBUG(
"Matrix A x A^-1" << endl);
 
   95     NOTICE(
"A x A^-1 = I ? "                     << 
C.isIdentity(precision)                 << endl);
 
   97     if (!
C.isIdentity(precision)) {
 
   98       ERROR(
"Matrix A x A^-1 /= I" << endl);
 
  101     ASSERT (
C.isIdentity(precision));
 
  103     const double big = 1.0e5;
 
  105     for (
int i = 0; i != 
N; ++i) {
 
  116       NOTICE(
"Elapsed time [us] " << setw(8) << timer.usec_wall << endl);
 
  117       NOTICE(
"Pivot " << setw(2) << i << 
'+' << big << 
' ' << (JMatrixNS(
A).mul(B).isIdentity(precision) ? 
"okay" : 
"error") << endl);
 
  119       ASSERT(JMatrixNS(
A).mul(B).isIdentity(precision));
 
  127   catch (
const JException& error) {
 
  128     FATAL(error << endl);
 
Utility class to parse command line options. 
 
#define ASSERT(A,...)
Assert macro. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
then usage $script[input file[working directory[option]]] nWhere option can be N
 
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
 
#define DEBUG(A)
Message macros.