Changeset 1008 in Sophya


Ignore:
Timestamp:
May 16, 2000, 7:55:21 PM (25 years ago)
Author:
ansari
Message:

more options... cmv 16/5/00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/Tests/tsttminv.cc

    r998 r1008  
    1616#include <math.h>
    1717#include <unistd.h>
     18#include "timing.h"
    1819#include "ntoolsinit.h"
    1920#include "pexceptions.h"
     
    5556uint_4 nprline = 10;
    5657// Initialisation du pauvre de l'aleatoire
    57  uint_4 nalea = 0;
     58uint_4 nalea = 0;
     59// data scaling for gauss pivoting and determinant
     60int tscal = 1;
     61bool detok=false;
     62bool timok = false;
    5863//--------------------------------------------------------
    5964
    6065//-- Decodage arguments
    6166char c;
    62 while((c = getopt(narg,arg,"hv:l:a:")) != -1) {
     67while((c = getopt(narg,arg,"hdtv:l:a:n:")) != -1) {
    6368  switch (c) {
    6469  case 'v' :
     
    7176    sscanf(optarg,"%d",&nalea);
    7277    break;
     78  case 'n' :
     79    sscanf(optarg,"%d",&tscal);
     80    break;
     81  case 'd' :
     82    detok = true;
     83    break;
     84  case 't' :
     85    timok = true;
     86    break;
    7387  case 'h' :
    74     cout<<"tsttminv [-h] [-v N,scale,nbig,vbig] [-l nprline] [-a nalea]"<<endl;
    75     cout<<"matrix filled with : {[-1,1] +/- vbig(nbig time)}*scale"<<endl;
     88    cout<<"tsttminv [-h] [-v N,scale,nbig,vbig] [-l nprline] [-a nalea]"<<endl
     89        <<"         [-n typs] [-d] [-t]"<<endl
     90        <<"matrix filled with : {[-1,1] +/- vbig(nbig time)}*scale"<<endl
     91        <<"-n 0/1/2 : data scaling 0=no, 1=global (def), 2=row-by-row"<<endl
     92        <<"-d : also compute determinant"<<endl
     93        <<"-t : do timing"<<endl;
    7694    exit(-1);
    7795  }
     
    84102cout<<"Nombre de lignes de matrice a imprimer "<<nprline<<endl;
    85103cout<<"Initialisation de l aleatoire par "<<nalea<<" tirages"<<endl;
     104 cout<<"Data scaling "<<tscal<<" determinant="<<detok<<" timing="<<timok<<endl;
    86105cout<<endl;
    87106
    88107//-- Initialization arrays
    89108SophyaInit();
     109if(timok) InitTim();
    90110#ifdef ALSO_LAPACK
    91111  BaseArray::SetDefaultMemoryMapping(BaseArray::FortranMemoryMapping);
     
    101121A.Show();
    102122
     123SimpleMatrixOperation< TYPE >::SetGausPivScal(tscal);
     124
    103125//-- Mise a zero
    104126A    = (TYPE) 0;
     
    110132
    111133//-- Fill matrices
     134double vmax=-1.;
    112135uint_8 k;
    113136uint_4 i,j; double s;
     
    143166cout<<"------------ Inversion"<<endl;
    144167//InvA = Inverse(A);
    145 InvA = IdentityMatrix(1.,N); TYPE det = GausPiv(A,InvA); cout<<"Det = "<<det<<endl;
     168InvA = IdentityMatrix(1.,N);
     169if(timok) PrtTim("--- End of filling ---");
     170TYPE det = GausPiv(A,InvA,detok);
     171if(timok) PrtTim("--- End of GausPiv ---");
     172cout<<"Det = "<<det<<endl;
    146173cout<<"------------ TMatrix InvA = A^(-1):"<<endl;
    147174if(nprline>0) {cout<<InvA; cout<<endl<<endl;}
     
    154181
    155182//-- Check
    156 double vmax=-1.;
     183vmax=-1.;
    157184for(i=0;i<N;i++) {
    158185  double absv = ABS_VAL( 1. - AiA(i,i) );
     
    175202cout<<endl<<"LAPACK Cross-Check"<<endl;
    176203InvA = IdentityMatrix(1.,N);
     204if(timok) PrtTim("--- End of check ---");
    177205LapackLinSolve(Adum,InvA);
     206if(timok) PrtTim("--- End of LapackLinSolve ---");
    178207AiA = A * InvA;
    179208vmax=-1.;
     
    193222#endif
    194223
     224if(timok) PrtTim("--- End of Job ---");
    195225exit(0);
    196226}
Note: See TracChangeset for help on using the changeset viewer.