Changeset 995 in Sophya for trunk/SophyaProg/Tests


Ignore:
Timestamp:
May 2, 2000, 5:48:24 PM (25 years ago)
Author:
ansari
Message:

add LaPack comparison 2/5/00 cmv

File:
1 edited

Legend:

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

    r975 r995  
    11// Test de l'inversion de matrice (cmv 14/04/00)
     2// Pb numeriques: dapax22 et daplxa115
     3//                tsttminv -v 55,100,130,1000000000 -l 0 -a 1
     4
     5// if defined COMPLEX , if not REAL
     6//#define COMPLEX
     7// if defined 32 bits precision, if not 64 bits
     8// #define PRECIS32
     9#define ALSO_LAPACK
     10
    211#include "machdefs.h"
    312#include <iostream.h>
     
    1221#include "srandgen.h"
    1322
    14 // if defined COMPLEX , if not REAL
    15 #define COMPLEX
    16 // if defined 32 bits precision, if not 64 bits
    17 // #define PRECIS32
     23#ifdef ALSO_LAPACK
     24#include "intflapack.h"
     25#endif
     26
    1827
    1928#if defined(COMPLEX)
     
    7988//-- Initialization arrays
    8089SophyaInit();
     90#ifdef ALSO_LAPACK
     91  BaseArray::SetDefaultMemoryMapping(BaseArray::FortranMemoryMapping);
     92#endif
    8193
    8294//-- Definition arrays
     
    8597TMatrix< TYPE > AiA(N,N);
    8698TMatrix< TYPE > B(N,N);
    87 TMatrix< TYPE > C(N,N);
     99TMatrix< TYPE > Adum(N,N);
    88100TVector< int >  Vind(N*N);
    89101A.Show();
     
    94106AiA  = (TYPE) 0;
    95107B    = (TYPE) 0;
    96 C    = (TYPE) 0;
     108Adum = (TYPE) 0;
    97109BaseArray::SetMaxPrint(nprline*N,0);
    98110
     
    122134#endif
    123135cout<<"Nombre de valeurs BIG reelles = "<<nbr<<", imaginaires = "<<nbi<<endl;
     136Adum = A;
    124137
    125138//-- Print matrice A
     
    154167cout<<"Ecart maximum par rapport a 0 hors diagonale = "<<vmax<<endl;
    155168
     169////////////////////////////////////
     170///////// Test avec Lapack /////////
     171////////////////////////////////////
     172#ifdef ALSO_LAPACK
     173
     174cout<<endl<<"LAPACK Cross-Check"<<endl;
     175InvA = IdentityMatrix(1.,N);
     176LapackLinSolve(Adum,InvA);
     177AiA = A * InvA;
     178vmax=-1.;
     179for(i=0;i<N;i++) {
     180  double absv = ABS_VAL( 1. - AiA(i,i) );
     181  if( absv > vmax ) vmax = absv;
     182}
     183cout<<"Ecart maximum par rapport a 1 sur diagonale = "<<vmax<<endl;
     184vmax = -1.;
     185for(i=0;i<N;i++) for(j=0;j<N;j++) {
     186  if( i == j ) continue;
     187  double absv = ABS_VAL( AiA(i,j) );
     188  if( absv > vmax ) vmax = absv;
     189}
     190cout<<"Ecart maximum par rapport a 0 hors diagonale = "<<vmax<<endl;
     191
     192#endif
     193
    156194exit(0);
    157195}
Note: See TracChangeset for help on using the changeset viewer.