Statistics
| Branch: | Revision:

root / synthbench / euroben-ports / base / C / mod2am_std / .svn / text-base / check.c.svn-base @ 0:839f52ef7657

History | View | Annotate | Download (760 Bytes)

1 0:839f52ef7657 louridas
#include<math.h>
2 0:839f52ef7657 louridas
#include<float.h>
3 0:839f52ef7657 louridas
4 0:839f52ef7657 louridas
int check( int m, int l, int n, double **c )
5 0:839f52ef7657 louridas
// ---------------------------------------------------------------------
6 0:839f52ef7657 louridas
// --- Routine 'check' does the correctness check for the matrix-matrix
7 0:839f52ef7657 louridas
//     multiplication in function 'mxm'. Because of the particular
8 0:839f52ef7657 louridas
//     data that are generatedin function 'gendat', this check can be
9 0:839f52ef7657 louridas
//     used.
10 0:839f52ef7657 louridas
// ---------------------------------------------------------------------
11 0:839f52ef7657 louridas
{
12 0:839f52ef7657 louridas
   double eps, tvalue = (double)l;
13 0:839f52ef7657 louridas
   int    i, j, ok = 0;
14 0:839f52ef7657 louridas
// ---------------------------------------------------------------------
15 0:839f52ef7657 louridas
   eps = 2.0*l*l*DBL_EPSILON;
16 0:839f52ef7657 louridas
   for( i = 0; i < m; i++ ) {
17 0:839f52ef7657 louridas
      for( j = 0; j < n; j++ ){
18 0:839f52ef7657 louridas
         if ( fabs( tvalue - c[i][j] ) > eps ) ok++;
19 0:839f52ef7657 louridas
      }
20 0:839f52ef7657 louridas
   }
21 0:839f52ef7657 louridas
   return( ok );
22 0:839f52ef7657 louridas
}