aoclsparse_export_?csr() - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English
aoclsparse_status aoclsparse_export_scsr(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **row_ptr, aoclsparse_int **col_ind, float **val)#
aoclsparse_status aoclsparse_export_dcsr(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **row_ptr, aoclsparse_int **col_ind, double **val)#
aoclsparse_status aoclsparse_export_ccsr(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **row_ptr, aoclsparse_int **col_ind, aoclsparse_float_complex **val)#
aoclsparse_status aoclsparse_export_zcsr(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **row_ptr, aoclsparse_int **col_ind, aoclsparse_double_complex **val)#

Export a CSR matrix.

aoclsparse_export_?csr exposes the components defining the CSR matrix in mat structure by copying out the data pointers. No additional memory is allocated. User should not modify the arrays and once aoclsparse_destroy() is called to free mat, these arrays will become inaccessible. If the matrix is not in CSR format, an error is obtained. aoclsparse_convert_csr() can be used to convert non-CSR format to CSR format.

Parameters:
  • mat[in] the pointer to the CSR sparse matrix.

  • base[out] aoclsparse_index_base_zero or aoclsparse_index_base_one.

  • m[out] number of rows of the sparse CSR matrix.

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

  • nnz[out] number of non-zero entries of the sparse CSR matrix.

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

  • col_ind[out] array of nnz elements containing the column indices of the sparse CSR matrix.

  • val[out] array of nnz elements of the sparse CSR matrix.

Return values:
  • aoclsparse_status_success – the operation completed successfully.

  • aoclsparse_status_invalid_pointermat or any of the output arguments are NULL.

  • aoclsparse_status_invalid_valuemat is not in CSR format.

  • aoclsparse_status_wrong_type – data type of mat does not match the function.