Function to stack CSR matrices in a column This function stacks two CSR matrices in a column The output matrix is the concatenation of the two input matrices The output matrix is stored in CSR format C = [alpha*A; beta*B]
| 10 | // The output matrix is stored in CSR format |
| 11 | // C = [alpha*A; beta*B] |
| 12 | __global__ void stackCSRColumn(const int* row_ptr1, const int* col_ind1, const double* values1, int nnz1, |
| 13 | const int* row_ptr2, const int* col_ind2, const double* values2, int nnz2, |
| 14 | int* row_ptr_out, int* col_ind_out, double* values_out, int num_rows1, int num_rows2, |
| 15 | double alpha, double beta){ |
| 16 | int i = blockIdx.x * blockDim.x + threadIdx.x; |
| 17 | if(i < nnz1){ |
| 18 | col_ind_out[i] = col_ind1[i]; |
| 19 | values_out[i] = alpha * values1[i]; |
| 20 | } |
| 21 | if(i < nnz2){ |
| 22 | col_ind_out[i + nnz1] = col_ind2[i]; |
| 23 | values_out[i + nnz1] = beta * values2[i]; |
| 24 | } |
| 25 | if(i < num_rows1){ |
| 26 | row_ptr_out[i] = row_ptr1[i]; |
| 27 | } |
| 28 | if(i < num_rows2){ |
| 29 | row_ptr_out[i + num_rows1] = row_ptr2[i] + nnz1; |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // Function to stack CSR matrices in a row |
| 34 | // This function stacks two CSR matrices in a row |
nothing calls this directly
no outgoing calls
no test coverage detected