aoclsparse_?csr2dia() - aoclsparse_?csr2dia() - 5.3 English - 68552

AOCL API Guide (68552)

Document_ID
68552
Release_Date
2026-05-13
Version
5.3 English
aoclsparse_status aoclsparse_scsr2dia(aoclsparse_int m, aoclsparse_int n, const aoclsparse_mat_descr descr, const aoclsparse_int *csr_row_ptr, const aoclsparse_int *csr_col_ind, const float *csr_val, aoclsparse_int dia_num_diag, aoclsparse_int *dia_offset, float *dia_val)#
aoclsparse_status aoclsparse_dcsr2dia(aoclsparse_int m, aoclsparse_int n, const aoclsparse_mat_descr descr, const aoclsparse_int *csr_row_ptr, const aoclsparse_int *csr_col_ind, const double *csr_val, aoclsparse_int dia_num_diag, aoclsparse_int *dia_offset, double *dia_val)#

Convert a sparse CSR matrix into a sparse DIA matrix.

aoclsparse_?csr2dia converts a CSR matrix into an DIA matrix. It is assumed, that dia_val and dia_offset are allocated. Allocation size is computed by the number of rows times the number of diagonals. The number of DIA diagonals is obtained by aoclsparse_csr2dia_ndiag().The index base is preserved during the conversion.

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

  • n – [in] number of cols of 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.

  • 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 containing the column indices of the sparse CSR matrix.

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

  • dia_num_diag – [in] number of diagoanls in ELL storage format.

  • dia_offset – [out] array of dia_num_diag elements containing the diagonal offsets from main diagonal.

  • dia_val – [out] array of m times dia_num_diag elements of the sparse DIA matrix.

Return values:
  • aoclsparse_status_success – the operation completed successfully.

  • aoclsparse_status_invalid_handle – the library context was not initialized.

  • aoclsparse_status_invalid_size – m or ell_width is invalid.

  • aoclsparse_status_invalid_pointer – csr_val, csr_row_ptr, csr_col_ind, ell_val or ell_col_ind pointer is invalid.