Example program to test inversion of symmetric matrix.  
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "TRandom3.h"
#include "TMatrixTSym.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 23 of file JMatrixNS.cc.
   30   size_t    numberOfInversions;
 
   36     JParser<> zap(
"Example program to test inversion of symmetric matrix.");
 
   46   catch(
const exception &error) {
 
   47     FATAL(error.what() << endl);
 
   51   gRandom->SetSeed(seed);
 
   53   const Double_t xmin = -1.0;
 
   54   const Double_t xmax = +1.0;
 
   58   for (
int i = 0; i != 
N; ++i) {
 
   60     A(i,i) = gRandom->Uniform(xmin,xmax); 
 
   62     for (
int j = 0; 
j != i; ++
j) {
 
   63       A(
j,i) = 
A(i,
j) = gRandom->Uniform(xmin,xmax); 
 
   70     DEBUG(
"Matrix A" << endl);
 
   79     for (
size_t i = 2*(numberOfInversions/2) + 1; i != 0; --i) {
 
   85     NOTICE(
"Elapsed time [us] " << setw(8) << timer.usec_wall << endl);
 
   86     DEBUG(
"Matrix A^-1" << endl);
 
   90       TMatrixTSym<double> 
R(B.size());
 
   92       for (
size_t row = 0; row != B.size(); ++row) {
 
   93         for (
size_t col = 0; col != B.size(); ++col) {
 
   94           R(row, col) = B(row, col);
 
  100       for (
size_t i = 2*(numberOfInversions/2) + 1; i != 0; --i) {
 
  106       NOTICE(
"Elapsed time (ROOT) [us] " << setw(8) << timer.usec_wall << endl);
 
  113     DEBUG(
"Matrix A x A^-1" << endl);
 
  116     NOTICE(
"A x A^-1 = I ? "                     << 
C.isIdentity(precision)                 << endl);
 
  118     if (!
C.isIdentity(precision)) {
 
  119       ERROR(
"Matrix A x A^-1 /= I" << endl);
 
  122     ASSERT (
C.isIdentity(precision));
 
  124     const double big = 1.0e5;
 
  126     for (
int i = 0; i != 
N; ++i) {
 
  137       NOTICE(
"Elapsed time [us] " << setw(8) << timer.usec_wall << endl);
 
  138       NOTICE(
"Pivot " << setw(2) << i << 
'+' << big << 
' ' << (JMatrixNS(
A).mul(B).isIdentity(precision) ? 
"okay" : 
"error") << endl);
 
  140       ASSERT(JMatrixNS(
A).mul(B).isIdentity(precision));
 
  148   catch (
const JException& error) {
 
  149     FATAL(error << endl);
 
Utility class to parse command line options. 
 
static const double C
Physics constants. 
 
#define ASSERT(A,...)
Assert macro. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
then usage $script[distance] fi case set_variable R
 
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.