Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (585 Bytes)

1
#include<math.h>
2
#include<float.h>
3
#include<stdio.h>
4

    
5
int check( int ncols, int nrows, int nelmts, int indx[], int rowp[],
6
              double outvec[] )
7
{
8
   double eps, rowsum;
9
   double diff;
10
   int    i, ok = 0;
11
// ----------------------------------------------------------------
12
   eps = 2.0*ncols*DBL_EPSILON;
13
   for( i = 0; i < nrows - 1; i++ ) {
14
      rowsum = (double)(rowp[i+1] - rowp[i]);
15
      if ( fabs( outvec[i] - rowsum ) > eps ) ok++;
16
   }
17
   rowsum = (double)(nelmts - rowp[nrows-1]);
18
   if ( fabs( outvec[nrows-1] - rowsum ) > eps ) ok++;
19
   return( ok );
20
}
21