4 #define ran (TYPE)(((double) rand() / (MAX)) * (MAX-MIN) + MIN) 9 for (j = 0; j <
NNZ; j++){
18 for (j = 0; j <
N; j++)
27 float prob = (float)NNZ / ((
float)
N * (float)
N);
30 int fillRemaining = 0;
32 for (i = 0; i <
N; i++)
34 rowDelimiters[i] = nnzAssigned;
35 for (j = 0; j <
N; j++)
37 int numEntriesLeft = (N *
N) - ((i * N) + j);
38 int needToAssign = NNZ - nnzAssigned;
39 if (numEntriesLeft <= needToAssign) {
42 if ((nnzAssigned < NNZ && drand48() <= prob) || fillRemaining == 1)
44 colind[nnzAssigned] = j;
49 rowDelimiters[
N] =
NNZ;
74 spmv(nzval, colind, rowptr, x, y);
77 for(i = 0; i <
N; i++){
void spmv(TYPE val[NNZ], int32_t cols[NNZ], int32_t rowDelimiters[N+1], TYPE vec[N], TYPE out[N])
void fillVal(TYPE A[NNZ])
void initMat(int colind[NNZ], int rowDelimiters[N+1])
x
Return the smallest n such that 2^n >= _x.