// Test de l'inversion de matrice (cmv 14/04/00) // Pb numeriques: dapax22 et daplxa115 // tsttminv -v 55,100,130,1000000000 -l 0 -a 1 // if defined COMPLEX , if not REAL //#define COMPLEX // if defined 32 bits precision, if not 64 bits // #define PRECIS32 #define ALSO_LAPACK #include "machdefs.h" #include #include #include #include #include #include #include "timing.h" #include "ntoolsinit.h" #include "pexceptions.h" #include "array.h" #include "srandgen.h" #ifdef ALSO_LAPACK #include "intflapack.h" #endif #if defined(COMPLEX) #define ABS_VAL(_x_) sqrt((double)((_x_).real()*(_x_).real() + (_x_).imag()*(_x_).imag())) #if defined(PRECIS32) #define TYPE complex #else #define TYPE complex #endif #else #define ABS_VAL(_x_) fabs((double)_x_) #if defined(PRECIS32) #define TYPE r_4 #else #define TYPE r_8 #endif #endif int main(int narg,char *arg[]) { //-------------------------------------------------------- // number of lines/columns uint_4 N = 5; // scale of the value (if =1 values between -1 and 1) r_8 scale = 1.; // number of values change by +/- vbig uint_4 nbig = N; r_8 vbig = 1000.; // Nombre de lignes de matrice a imprimer uint_4 nprline = 10; // Initialisation du pauvre de l'aleatoire uint_4 nalea = 0; // data scaling for gauss pivoting and determinant int tscal = 1; bool detok=false; bool timok = false; //-------------------------------------------------------- //-- Decodage arguments char c; while((c = getopt(narg,arg,"hdtv:l:a:n:")) != -1) { switch (c) { case 'v' : sscanf(optarg,"%d,%lf,%d,%lf",&N,&scale,&nbig,&vbig); break; case 'l' : sscanf(optarg,"%d",&nprline); break; case 'a' : sscanf(optarg,"%d",&nalea); break; case 'n' : sscanf(optarg,"%d",&tscal); break; case 'd' : detok = true; break; case 't' : timok = true; break; case 'h' : cout<<"tsttminv [-h] [-v N,scale,nbig,vbig] [-l nprline] [-a nalea]"<0) {cout<0) {cout<0) {cout< vmax ) vmax = absv; } cout<<"Ecart maximum par rapport a 1 sur diagonale = "< vmax ) vmax = absv; } cout<<"Ecart maximum par rapport a 0 hors diagonale = "< vmax ) vmax = absv; } cout<<"Ecart maximum par rapport a 1 sur diagonale = "< vmax ) vmax = absv; } cout<<"Ecart maximum par rapport a 0 hors diagonale = "<