PandA-2024.02
spmv.c
Go to the documentation of this file.
1 /*
2 Based on algorithm described here:
3 http://www.cs.berkeley.edu/~mhoemmen/matrix-seminar/slides/UCB_sparse_tutorial_1.pdf
4 */
5 
6 #include "spmv.h"
7 
8 void spmv(TYPE val[NNZ], int32_t cols[NNZ], int32_t rowDelimiters[N+1], TYPE vec[N], TYPE out[N]){
9  int i, j;
10  TYPE sum, Si;
11 
12  spmv_1 : for(i = 0; i < N; i++){
13  sum = 0; Si = 0;
14  int tmp_begin = rowDelimiters[i];
15  int tmp_end = rowDelimiters[i+1];
16  spmv_2 : for (j = tmp_begin; j < tmp_end; j++){
17  Si = val[j] * vec[cols[j]];
18  sum = sum + Si;
19  }
20  out[i] = sum;
21  }
22 }
23 
24 
void spmv(TYPE val[NNZ], int32_t cols[NNZ], int32_t rowDelimiters[N+1], TYPE vec[N], TYPE out[N])
Definition: spmv.c:8
#define TYPE
Definition: backprop.h:21
int sum
Definition: dotproduct.h:3
#define NNZ
Definition: spmv.h:11
#define N
Definition: dfdiv.c:60

Generated on Mon Feb 12 2024 13:02:50 for PandA-2024.02 by doxygen 1.8.13