aoclsparse_?csr2bsr() - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English
aoclsparse_status aoclsparse_scsr2bsr(aoclsparse_int m, aoclsparse_int n, const aoclsparse_mat_descr descr, const aoclsparse_order block_order, const float *csr_val, const aoclsparse_int *csr_row_ptr, const aoclsparse_int *csr_col_ind, aoclsparse_int block_dim, float *bsr_val, aoclsparse_int *bsr_row_ptr, aoclsparse_int *bsr_col_ind)#
aoclsparse_status aoclsparse_dcsr2bsr(aoclsparse_int m, aoclsparse_int n, const aoclsparse_mat_descr descr, const aoclsparse_order block_order, const double *csr_val, const aoclsparse_int *csr_row_ptr, const aoclsparse_int *csr_col_ind, aoclsparse_int block_dim, double *bsr_val, aoclsparse_int *bsr_row_ptr, aoclsparse_int *bsr_col_ind)#

Convert a sparse CSR matrix into a sparse BSR matrix.

aoclsparse_?csr2bsr converts a CSR matrix into a BSR matrix. It is assumed, that bsr_val, bsr_col_ind and bsr_row_ptr are allocated. Allocation size for bsr_row_ptr is computed as mb+1 where mb is the number of block rows in the BSR matrix. Allocation size for bsr_val and bsr_col_ind is computed using this function which also fills in bsr_row_ptr. The index base is preserved during the conversion.

Parameters:
  • m[in] number of rows in the sparse CSR matrix.

  • n[in] number of columns in the sparse CSR matrix.

  • descr[in] descriptor of the input sparse CSR matrix. Only the base index is used in the conversion process, the remaining descriptor elements are ignored.

  • block_order[in] storage order of the elements inside the blocks. Possible options are aoclsparse_order_row and aoclsparse_order_column.

  • csr_val[in] array of nnz elements containing the values of the sparse CSR matrix.

  • csr_row_ptr[in] array of m +1 elements that point to the start of every row of the sparse CSR matrix.

  • csr_col_ind[in] array of nnz elements containing the column indices of the sparse CSR matrix.

  • block_dim[in] size of the blocks in the sparse BSR matrix.

  • bsr_val[out] array of nnzb*block_dim*block_dim containing the values of the sparse BSR matrix.

  • bsr_row_ptr[out] array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.

  • bsr_col_ind[out] array of nnzb elements containing the block column indices of the sparse BSR matrix.

Return values:
  • aoclsparse_status_success – the operation completed successfully.

  • aoclsparse_status_invalid_sizem, or n, or block_dim is invalid.

  • aoclsparse_status_invalid_pointerbsr_val, bsr_row_ptr, bsr_col_ind, csr_val, csr_row_ptr or csr_col_ind pointer is invalid.