[ create a new paste ] login | about

Link: http://codepad.org/gmjl15by    [ raw code | fork ]

C, pasted on Mar 18:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void matmult(int M, double *y, double *val, int *row,
int *col, double *x, int cycles) {
    int reps;
    int r;
    int i;
    for (reps = 0; reps < cycles; reps++) {
        for (r = 0; r < M; r++) {
            double sum = 0.0;
            for (i = row[r]; i < row[r + 1]; i++)
                sum += x[col[i]] * val[i];
            y[r] = sum;
        }
    }
}


Create a new paste based on this one


Comments: