aoclsparse_create_?coo() - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English
aoclsparse_status aoclsparse_create_scoo(aoclsparse_matrix *mat, const aoclsparse_index_base base, const aoclsparse_int M, const aoclsparse_int N, const aoclsparse_int nnz, aoclsparse_int *row_ind, aoclsparse_int *col_ind, float *val)#
aoclsparse_status aoclsparse_create_dcoo(aoclsparse_matrix *mat, const aoclsparse_index_base base, const aoclsparse_int M, const aoclsparse_int N, const aoclsparse_int nnz, aoclsparse_int *row_ind, aoclsparse_int *col_ind, double *val)#
aoclsparse_status aoclsparse_create_ccoo(aoclsparse_matrix *mat, const aoclsparse_index_base base, const aoclsparse_int M, const aoclsparse_int N, const aoclsparse_int nnz, aoclsparse_int *row_ind, aoclsparse_int *col_ind, aoclsparse_float_complex *val)#
aoclsparse_status aoclsparse_create_zcoo(aoclsparse_matrix *mat, const aoclsparse_index_base base, const aoclsparse_int M, const aoclsparse_int N, const aoclsparse_int nnz, aoclsparse_int *row_ind, aoclsparse_int *col_ind, aoclsparse_double_complex *val)#

Creates a new aoclsparse_matrix based on COO (Co-ordinate format).

aoclsparse_create_?coo creates aoclsparse_matrix and initializes it with input parameters passed. Array data must not be modified by the user while matrix is alive as the pointers are copied, not the data. The input arrays are left unchanged by the library except for the call to aoclsparse_sset_value(), aoclsparse_supdate_values() and variants, which modify the value of a nonzero element. Matrix should be destroyed at the end using aoclsparse_destroy().

Parameters:
  • mat[inout] the pointer to the COO sparse matrix.

  • base[in] aoclsparse_index_base_zero or aoclsparse_index_base_one depending on whether the index first element starts from 0 or 1.

  • M[in] total number of rows of the sparse COO matrix.

  • N[in] total number of columns of the sparse COO matrix.

  • nnz[in] number of non-zero entries of the sparse COO matrix.

  • row_ind[in] array of nnz elements that point to the row of the element in co-ordinate Format.

  • col_ind[in] array of nnz elements that point to the column of the element in co-ordinate Format.

  • val[in] array of nnz elements of the sparse COO matrix.

Return values:
  • aoclsparse_status_success – the operation completed successfully.

  • aoclsparse_status_invalid_pointer – pointer given to API is invalid or nullptr.

  • aoclsparse_status_invalid_sizecoo dimension of matrix or non-zero elements is invalid.

  • aoclsparse_status_invalid_index_value – index given for coo is out of matrix bounds depending on base given

  • aoclsparse_status_memory_error – memory allocation for matrix failed.