|
2 | 2 | #define CSR_MATRIX_H |
3 | 3 | #include <stdbool.h> |
4 | 4 |
|
| 5 | +/* forward declaration */ |
| 6 | +struct int_double_pair; |
| 7 | + |
5 | 8 | /* CSR (Compressed Sparse Row) Matrix Format |
6 | 9 | * |
7 | 10 | * For an m x n matrix with nnz nonzeros: |
@@ -59,11 +62,24 @@ void sum_csr_matrices(const CSR_Matrix *A, const CSR_Matrix *B, CSR_Matrix *C); |
59 | 62 | void sum_scaled_csr_matrices(const CSR_Matrix *A, const CSR_Matrix *B, CSR_Matrix *C, |
60 | 63 | const double *d1, const double *d2); |
61 | 64 |
|
| 65 | +/* Sum all rows of A into a single row matrix C */ |
| 66 | +void sum_all_rows_csr(const CSR_Matrix *A, CSR_Matrix *C, |
| 67 | + struct int_double_pair *pairs); |
| 68 | + |
| 69 | +/* Sum blocks of rows of A into a matrix C */ |
| 70 | +void sum_block_of_rows_csr(const CSR_Matrix *A, CSR_Matrix *C, |
| 71 | + struct int_double_pair *pairs, int row_block_size); |
| 72 | + |
| 73 | +/* Sum evenly spaced rows of A into a matrix C */ |
| 74 | +void sum_evenly_spaced_rows_csr(const CSR_Matrix *A, CSR_Matrix *C, |
| 75 | + struct int_double_pair *pairs, int row_spacing); |
| 76 | + |
62 | 77 | /* Count number of columns with nonzero entries */ |
63 | 78 | int count_nonzero_cols(const CSR_Matrix *A, bool *col_nz); |
64 | 79 |
|
65 | 80 | /* inserts 'idx' into array 'arr' in sorted order, and moves the other elements */ |
66 | 81 | void insert_idx(int idx, int *arr, int len); |
67 | 82 |
|
68 | 83 | CSR_Matrix *transpose(const CSR_Matrix *A, int *iwork); |
| 84 | + |
69 | 85 | #endif /* CSR_MATRIX_H */ |
0 commit comments