File indexing completed on 2024-04-06 12:32:56
0001
0002
0003
0004 double SparseCompRow_num_flops(int N, int nz, int num_iterations)
0005 {
0006
0007
0008
0009 int actual_nz = (nz/N) * N;
0010 return ((double)actual_nz) * 2.0 * ((double) num_iterations);
0011 }
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 void SparseCompRow_matmult( int M, double *y, double *val, int *row,
0023 int *col, double *x, int NUM_ITERATIONS)
0024 {
0025 int reps;
0026 int r;
0027 int i;
0028
0029 for (reps=0; reps<NUM_ITERATIONS; reps++)
0030 {
0031
0032 for (r=0; r<M; r++)
0033 {
0034 double sum = 0.0;
0035 int rowR = row[r];
0036 int rowRp1 = row[r+1];
0037 for (i=rowR; i<rowRp1; i++)
0038 sum += x[ col[i] ] * val[i];
0039 y[r] = sum;
0040 }
0041 }
0042 }
0043