Auxiliary Functions#
aoclsparse_create_mat_descr()#
-
aoclsparse_status aoclsparse_create_mat_descr(aoclsparse_mat_descr *descr)#
Create a matrix descriptor.
aoclsparse_create_mat_descrcreates a matrix descriptor. It initializes aoclsparse_matrix_type to aoclsparse_matrix_type_general and aoclsparse_index_base to aoclsparse_index_base_zero. It should be destroyed at the end using aoclsparse_destroy_mat_descr().- Parameters
descr – [out] the pointer to the matrix descriptor.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
descrpointer is invalid.
aoclsparse_destroy_mat_descr()#
-
aoclsparse_status aoclsparse_destroy_mat_descr(aoclsparse_mat_descr descr)#
Destroy a matrix descriptor.
aoclsparse_destroy_mat_descrdestroys a matrix descriptor and releases all resources used by the descriptor.- Parameters
descr – [in] the matrix descriptor.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
descris invalid.
aoclsparse_copy_mat_descr()#
-
aoclsparse_status aoclsparse_copy_mat_descr(aoclsparse_mat_descr dest, const aoclsparse_mat_descr src)#
Copy a matrix descriptor.
aoclsparse_copy_mat_descrcopies a matrix descriptor. Both, source and destination matrix descriptors must be initialized prior to callingaoclsparse_copy_mat_descr.- Parameters
dest – [out] the pointer to the destination matrix descriptor.
src – [in] the pointer to the source matrix descriptor.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
srcordestpointer is invalid.
aoclsparse_create_?csr()#
-
aoclsparse_status aoclsparse_create_scsr(aoclsparse_matrix *mat, aoclsparse_index_base base, aoclsparse_int M, aoclsparse_int N, aoclsparse_int nnz, aoclsparse_int *row_ptr, aoclsparse_int *col_idx, float *val)#
-
aoclsparse_status aoclsparse_create_dcsr(aoclsparse_matrix *mat, aoclsparse_index_base base, aoclsparse_int M, aoclsparse_int N, aoclsparse_int nnz, aoclsparse_int *row_ptr, aoclsparse_int *col_idx, double *val)#
-
aoclsparse_status aoclsparse_create_ccsr(aoclsparse_matrix *mat, aoclsparse_index_base base, aoclsparse_int M, aoclsparse_int N, aoclsparse_int nnz, aoclsparse_int *row_ptr, aoclsparse_int *col_idx, aoclsparse_float_complex *val)#
-
aoclsparse_status aoclsparse_create_zcsr(aoclsparse_matrix *mat, aoclsparse_index_base base, aoclsparse_int M, aoclsparse_int N, aoclsparse_int nnz, aoclsparse_int *row_ptr, aoclsparse_int *col_idx, aoclsparse_double_complex *val)#
Creates a new aoclsparse_matrix based on CSR (Compressed Sparse Row) format.
aoclsparse_create_?csrcreates aoclsparse_matrix and initializes it with input parameters passed. The input arrays are left unchanged by the library except for the call to aoclsparse_order_mat(), which performs ordering of column indices of the matrix, or aoclsparse_sset_value(), aoclsparse_supdate_values() and variants, which modify the values of a nonzero element. To avoid any changes to the input data, aoclsparse_copy() can be used. To convert any other format to CSR, aoclsparse_convert_csr() can be used. Matrix should be destroyed at the end using aoclsparse_destroy().- Parameters
mat – [out] the pointer to the CSR sparse matrix allocated in the API.
base – [in] aoclsparse_index_base_zero or aoclsparse_index_base_one.
M – [in] number of rows of the sparse CSR matrix.
N – [in] number of columns of the sparse CSR matrix.
nnz – [in] number of non-zero entries of the sparse CSR matrix.
row_ptr – [in] array of
m+1elements that point to the start of every row of the sparse CSR matrix.col_idx – [in] array of
nnzelements containing the column indices of the sparse CSR matrix.val – [in] array of
nnzelements of the sparse CSR matrix.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer – at least one of
row_ptr,col_idxorvalpointer is NULL.aoclsparse_status_invalid_size – at least one of
M,Nornnzhas a negative value.aoclsparse_status_invalid_index_value – any
col_idxvalue is not within N.aoclsparse_status_memory_error – memory allocation for matrix failed.
aoclsparse_create_?tcsr()#
-
aoclsparse_status aoclsparse_create_stcsr(aoclsparse_matrix *mat, const aoclsparse_index_base base, const aoclsparse_int M, const aoclsparse_int N, const aoclsparse_int nnz, aoclsparse_int *row_ptr_L, aoclsparse_int *row_ptr_U, aoclsparse_int *col_idx_L, aoclsparse_int *col_idx_U, float *val_L, float *val_U)#
-
aoclsparse_status aoclsparse_create_dtcsr(aoclsparse_matrix *mat, const aoclsparse_index_base base, const aoclsparse_int M, const aoclsparse_int N, const aoclsparse_int nnz, aoclsparse_int *row_ptr_L, aoclsparse_int *row_ptr_U, aoclsparse_int *col_idx_L, aoclsparse_int *col_idx_U, double *val_L, double *val_U)#
-
aoclsparse_status aoclsparse_create_ctcsr(aoclsparse_matrix *mat, const aoclsparse_index_base base, const aoclsparse_int M, const aoclsparse_int N, const aoclsparse_int nnz, aoclsparse_int *row_ptr_L, aoclsparse_int *row_ptr_U, aoclsparse_int *col_idx_L, aoclsparse_int *col_idx_U, aoclsparse_float_complex *val_L, aoclsparse_float_complex *val_U)#
-
aoclsparse_status aoclsparse_create_ztcsr(aoclsparse_matrix *mat, const aoclsparse_index_base base, const aoclsparse_int M, const aoclsparse_int N, const aoclsparse_int nnz, aoclsparse_int *row_ptr_L, aoclsparse_int *row_ptr_U, aoclsparse_int *col_idx_L, aoclsparse_int *col_idx_U, aoclsparse_double_complex *val_L, aoclsparse_double_complex *val_U)#
Creates a new aoclsparse_matrix based on TCSR (Triangular Compressed Sparse Row) format.
aoclsparse_create_?tcsrcreates aoclsparse_matrix and initializes it with input parameters passed. Array data must not be modified by the user while matrix is being used as the pointers are copied, not the data. The input arrays are not modified by the library and the matrix should be destroyed at the end using aoclsparse_destroy().TCSR matrix structure holds lower triangular (L) and upper triangular (U) part of the matrix separately with diagonal (D) elements stored in both the parts. Both triangles (L+D and D+U) are stored like CSR and assumes partial sorting (L+D and D+U order is followed, but the indices within L or U group may not be sorted)
One array with L elements potentially unsorted, followed by D elements in the L+D part for each row of the matrix.
Another array with D elements, followed by U elements potentially unsorted in the D+U part for each row of the matrix.
Currently TCSR storage format supports only square matrices with full(non-zero) diagonals.
- Parameters
mat – [out] The pointer to the TCSR sparse matrix.
base – [in] aoclsparse_index_base_zero or aoclsparse_index_base_one.
M – [in] Total number of rows in the
mat.N – [in] Total number of columns in the
mat.nnz – [in] Number of non-zero entries in the
mat.row_ptr_L – [in] Array of lower triangular elements that point to the start of every row of the
matincol_idx_Landval_L.row_ptr_U – [in] Array of upper triangular elements that point to the start of every row of the
matincol_idx_Uandval_U.col_idx_L – [in] Array of lower triangular elements containing column indices of the
mat.col_idx_U – [in] Array of upper triangular elements containing column indices of the
mat.val_L – [in] Array of lower triangular elements of the
mat.val_U – [in] Array of upper triangular elements of the
mat.
- Return values
aoclsparse_status_success – The operation completed successfully.
aoclsparse_status_invalid_pointer – Pointer given to API is invalid or nullptr.
aoclsparse_status_invalid_size – M, N, nnz is invalid.
aoclsparse_status_invalid_index_value – Index given for
matis out of matrix bounds depending on base given.aoclsparse_status_invalid_value – The cooridante
row_ptrorcol_idxis out of matrix bound ormathas duplicate diagonals ormatdoes not have full diagonals.aoclsparse_status_unsorted_input – The
matis unsorted. It supports only fully sorted and partially sorted matrix as input. The lower triangular part must not contain U elements, the upper triangular part must not contain L elements, and the position of the diagonal element must not be altered.aoclsparse_status_memory_error – Memory allocation for matrix failed.
aoclsparse_create_?coo()#
-
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_?coocreates 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
nnzelements that point to the row of the element in co-ordinate Format.col_ind – [in] array of
nnzelements that point to the column of the element in co-ordinate Format.val – [in] array of
nnzelements 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_size –
coodimension of matrix or non-zero elements is invalid.aoclsparse_status_invalid_index_value – index given for
coois out of matrix bounds depending on base givenaoclsparse_status_memory_error – memory allocation for matrix failed.
aoclsparse_create_?csc()#
-
aoclsparse_status aoclsparse_create_scsc(aoclsparse_matrix *mat, aoclsparse_index_base base, aoclsparse_int M, aoclsparse_int N, aoclsparse_int nnz, aoclsparse_int *col_ptr, aoclsparse_int *row_idx, float *val)#
-
aoclsparse_status aoclsparse_create_dcsc(aoclsparse_matrix *mat, aoclsparse_index_base base, aoclsparse_int M, aoclsparse_int N, aoclsparse_int nnz, aoclsparse_int *col_ptr, aoclsparse_int *row_idx, double *val)#
-
aoclsparse_status aoclsparse_create_ccsc(aoclsparse_matrix *mat, aoclsparse_index_base base, aoclsparse_int M, aoclsparse_int N, aoclsparse_int nnz, aoclsparse_int *col_ptr, aoclsparse_int *row_idx, aoclsparse_float_complex *val)#
-
aoclsparse_status aoclsparse_create_zcsc(aoclsparse_matrix *mat, aoclsparse_index_base base, aoclsparse_int M, aoclsparse_int N, aoclsparse_int nnz, aoclsparse_int *col_ptr, aoclsparse_int *row_idx, aoclsparse_double_complex *val)#
Creates a new aoclsparse_matrix based on CSC (Compressed Sparse Column) format.
aoclsparse_create_?csccreates aoclsparse_matrix and initializes it with input parameters passed. The input arrays are left unchanged by the library except for the call to aoclsparse_order_mat(), which performs ordering of row indices of the matrix, or aoclsparse_sset_value(), aoclsparse_supdate_values() and variants, which modify the value of a nonzero element. To avoid any changes to the input data, aoclsparse_copy() can be used. Matrix should be destroyed at the end using aoclsparse_destroy().- Parameters
mat – [inout] the pointer to the CSC sparse matrix allocated in the API.
base – [in] aoclsparse_index_base_zero or aoclsparse_index_base_one.
M – [in] number of rows of the sparse CSC matrix.
N – [in] number of columns of the sparse CSC matrix.
nnz – [in] number of non-zero entries of the sparse CSC matrix.
col_ptr – [in] array of
n+1 elements that points to the start of every column in row_idx array of the sparse CSC matrix.row_idx – [in] array of
nnzelements containing the row indices of the sparse CSC matrix.val – [in] array of
nnzelements of the sparse CSC matrix.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
col_ptr,row_idxorvalpointer is NULL.aoclsparse_status_invalid_size –
M,Nornnzare negative values.aoclsparse_status_invalid_index_value – any
row_idxvalue is not within M.aoclsparse_status_memory_error – memory allocation for matrix failed.
aoclsparse_destroy()#
-
aoclsparse_status aoclsparse_destroy(aoclsparse_matrix *mat)#
Destroy a sparse matrix structure.
aoclsparse_destroydestroys a structure that holds matrixmat.- Parameters
mat – [in] the pointer to the sparse matrix.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
matrixstructure pointer is invalid.
aoclsparse_copy()#
-
aoclsparse_status aoclsparse_copy(const aoclsparse_matrix src, const aoclsparse_mat_descr descr, aoclsparse_matrix *dest)#
Creates a copy of source aoclsparse_matrix.
aoclsparse_copycreates a deep copy of source aoclsparse_matrix (hints and optimized data are not copied). Matrix should be destroyed using aoclsparse_destroy(). aoclsparse_convert_csr() can also be used to create a copy of the source matrix while converting it in CSR format.- Parameters
src – [in] the source aoclsparse_matrix to copy.
descr – [in] the source matrix descriptor, this argument is reserved for future releases and it will not be referenced.
dest – [out] pointer to the newly allocated copied aoclsparse_matrix.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
src,destor internal pointers are invalid. or dest points to src.aoclsparse_status_memory_error – memory allocation for matrix failed.
aoclsparse_status_invalid_value –
srcmatrix type is invalid.aoclsparse_status_wrong_type –
srcmatrix data type is invalid.
aoclsparse_order_mat()#
-
aoclsparse_status aoclsparse_order_mat(aoclsparse_matrix mat)#
Performs ordering of index array of the matrix.
aoclsparse_orderorders column indices within a row for matrix in CSR format and row indices within a column for CSC format. It also adjusts value array accordingly. Ordering is implemented only for CSR and CSC format. aoclsparse_copy() can be used to get exact copy of data aoclsparse_convert_csr() can be used to convert any format to CSR. Matrix should be destroyed at the end using aoclsparse_destroy().- Parameters
mat – [inout] pointer to matrix in either CSR or CSC format
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
matpointer is invalid.aoclsparse_status_memory_error – internal memory allocation failed.
aoclsparse_status_not_implemented – matrix is not in CSR format.
aoclsparse_?set_value()#
-
aoclsparse_status aoclsparse_sset_value(aoclsparse_matrix A, aoclsparse_int row_idx, aoclsparse_int col_idx, float val)#
-
aoclsparse_status aoclsparse_dset_value(aoclsparse_matrix A, aoclsparse_int row_idx, aoclsparse_int col_idx, double val)#
-
aoclsparse_status aoclsparse_cset_value(aoclsparse_matrix A, aoclsparse_int row_idx, aoclsparse_int col_idx, aoclsparse_float_complex val)#
-
aoclsparse_status aoclsparse_zset_value(aoclsparse_matrix A, aoclsparse_int row_idx, aoclsparse_int col_idx, aoclsparse_double_complex val)#
Set a new value to an existing nonzero in the matrix.
aoclsparse_?set_valuemodifies the value of an existing nonzero element specified by its coordinates. The row and column coordinates need to match the base (0 or 1-base) of the matrix. The change directly affects user’s arrays if the matrix was created using aoclsparse_create_scsr(), aoclsparse_create_scsc(), aoclsparse_create_scoo() or other variants.Note
The successful modification invalidates existing optimized data so it is desirable to call aoclsparse_optimize() once all modifications are performed.
- Parameters
A – [inout] The sparse matrix to be modified.
row_idx – [in] The row index of the element to be updated.
col_idx – [in] The column index of the element to be updated.
val – [in] The value to be updated.
- Return values
aoclsparse_status_success – The operation completed successfully.
aoclsparse_status_invalid_pointer – The matrix handler
Ais invalidaoclsparse_status_invalid_value – The cooridante
row_idxorcol_idxis out of matrix boundaoclsparse_status_wrong_type – Matrix has different data type then the one used in API
aoclsparse_status_not_implemented – Matrix format is not supported for this operation
aoclsparse_status_invalid_index_value – The specified element does not exist in the matrix
aoclsparse_?update_values()#
-
aoclsparse_status aoclsparse_supdate_values(aoclsparse_matrix A, aoclsparse_int len, float *val)#
-
aoclsparse_status aoclsparse_dupdate_values(aoclsparse_matrix A, aoclsparse_int len, double *val)#
-
aoclsparse_status aoclsparse_cupdate_values(aoclsparse_matrix A, aoclsparse_int len, aoclsparse_float_complex *val)#
-
aoclsparse_status aoclsparse_zupdate_values(aoclsparse_matrix A, aoclsparse_int len, aoclsparse_double_complex *val)#
Set new values to all existing nonzero element in the matrix.
aoclsparse_?update_valuesoverwrites all existing nonzeros in the matrix with the new values provided invalarray. The order of elements must match the order in the matrix. That would be either the order at the creation of the matrix or the sorted order if aoclsparse_order_mat() has been called. The change directly affects user’s arrays if the matrix was created using aoclsparse_create_scsr(), aoclsparse_create_scsc(), aoclsparse_create_scoo() or other variants.Note
The successful update invalidates existing optimized data so it is desirable to call aoclsparse_optimize() once all modifications are performed.
- Parameters
A – [inout] The sparse matrix to be modified.
len – [in] Length of the
valarray and the number of nonzeros in the matrix.val – [in] Array with the values to be copied.
- Return values
aoclsparse_status_success – The operation completed successfully.
aoclsparse_status_invalid_pointer – The matrix
Ais invalid orvalin NULLaoclsparse_status_invalid_size –
lenis not equal to nnz of matrixaoclsparse_status_wrong_type – Matrix has different data type then the one used in API
aoclsparse_status_not_implemented – Matrix format is not supported for this operation
aoclsparse_export_?csr()#
-
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
CSRmatrix.aoclsparse_export_?csrexposes the components defining theCSRmatrix inmatstructure by copying out the data pointers. No additional memory is allocated. User should not modify the arrays and once aoclsparse_destroy() is called to freemat, these arrays will become inaccessible. If the matrix is not inCSRformat, an error is obtained. aoclsparse_convert_csr() can be used to convert non-CSR format toCSRformat.- 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
nnzelements containing the column indices of the sparse CSR matrix.val – [out] array of
nnzelements of the sparse CSR matrix.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
mator any of the output arguments are NULL.aoclsparse_status_invalid_value –
matis not in CSR format.aoclsparse_status_wrong_type – data type of
matdoes not match the function.
aoclsparse_export_?csc()#
-
aoclsparse_status aoclsparse_export_scsc(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **col_ptr, aoclsparse_int **row_ind, float **val)#
-
aoclsparse_status aoclsparse_export_dcsc(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **col_ptr, aoclsparse_int **row_ind, double **val)#
-
aoclsparse_status aoclsparse_export_ccsc(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **col_ptr, aoclsparse_int **row_ind, aoclsparse_float_complex **val)#
-
aoclsparse_status aoclsparse_export_zcsc(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **col_ptr, aoclsparse_int **row_ind, aoclsparse_double_complex **val)#
Export
CSCmatrix.aoclsparse_export_?cscexposes the components defining theCSCmatrix inmatstructure by copying out the data pointers. No additional memory is allocated. User should not modify the arrays and once aoclsparse_destroy() is called to freemat, these arrays will become inaccessible. If the matrix is not inCSCformat, an error is obtained.- Parameters
mat – [in] the pointer to the CSC sparse matrix.
base – [out] aoclsparse_index_base_zero or aoclsparse_index_base_one.
m – [out] number of rows of the sparse CSC matrix.
n – [out] number of columns of the sparse CSC matrix.
nnz – [out] number of non-zero entries of the sparse CSC matrix.
col_ptr – [out] array of
n+1elements that point to the start of every col of the sparse CSC matrix.row_ind – [out] array of
nnzelements containing the row indices of the sparse CSC matrix.val – [out] array of
nnzelements of the sparse CSC matrix.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
mator any of the output arguments are invalid.aoclsparse_status_invalid_value –
matis not in CSC format.aoclsparse_status_wrong_type – data type of
matdoes not match the function data type.
aoclsparse_export_?coo()#
-
aoclsparse_status aoclsparse_export_scoo(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **row_ptr, aoclsparse_int **col_ptr, float **val)#
-
aoclsparse_status aoclsparse_export_dcoo(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **row_ptr, aoclsparse_int **col_ptr, double **val)#
-
aoclsparse_status aoclsparse_export_ccoo(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **row_ptr, aoclsparse_int **col_ptr, aoclsparse_float_complex **val)#
-
aoclsparse_status aoclsparse_export_zcoo(const aoclsparse_matrix mat, aoclsparse_index_base *base, aoclsparse_int *m, aoclsparse_int *n, aoclsparse_int *nnz, aoclsparse_int **row_ptr, aoclsparse_int **col_ptr, aoclsparse_double_complex **val)#
Export a
COOmatrix.aoclsparse_export_?cooexposes the components defining theCOOmatrix inmatstructure by copying out the data pointers. No additional memory is allocated. User should not modify the arrays and once aoclsparse_destroy() is called to freemat, these arrays will become inaccessible. If the matrix is not inCOOformat, an error is obtained.- Parameters
mat – [in] the pointer to the COO sparse matrix.
base – [out] aoclsparse_index_base_zero or aoclsparse_index_base_one.
m – [out] number of rows of the sparse COO matrix.
n – [out] number of columns of the sparse COO matrix.
nnz – [out] number of non-zero entries of the sparse CSR matrix.
row_ptr – [out] array of
nnzelements containing the row indices of the sparse COO matrix.col_ptr – [out] array of
nnzelements containing the column indices of the sparse COO matrix.val – [out] array of
nnzelements of the sparse COO matrix.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
mator any of the output arguments are NULL.aoclsparse_status_invalid_value –
matis not in COO format.aoclsparse_status_wrong_type – data type of
matdoes not match the function.
aoclsparse_get_mat_diag_type()#
-
aoclsparse_diag_type aoclsparse_get_mat_diag_type(const aoclsparse_mat_descr descr)#
Get the matrix diagonal type of a matrix descriptor.
aoclsparse_get_mat_diag_typereturns the matrix diagonal type of a matrix descriptor.- Parameters
descr – [in] the matrix descriptor.
- Returns
aoclsparse_diag_type_unit or aoclsparse_diag_type_non_unit or aoclsparse_diag_type_zero.
aoclsparse_get_mat_fill_mode()#
-
aoclsparse_fill_mode aoclsparse_get_mat_fill_mode(const aoclsparse_mat_descr descr)#
Get the matrix fill mode of a matrix descriptor.
aoclsparse_get_mat_fill_modereturns the matrix fill mode of a matrix descriptor.- Parameters
descr – [in] the matrix descriptor.
- Returns
aoclsparse_get_mat_index_base()#
-
aoclsparse_index_base aoclsparse_get_mat_index_base(const aoclsparse_mat_descr descr)#
Get the index base of a matrix descriptor.
aoclsparse_get_mat_index_basereturns the index base of a matrix descriptor.- Parameters
descr – [in] the matrix descriptor.
- Returns
aoclsparse_get_mat_type()#
-
aoclsparse_matrix_type aoclsparse_get_mat_type(const aoclsparse_mat_descr descr)#
Get the matrix type of a matrix descriptor.
aoclsparse_get_mat_typereturns the matrix type of a matrix descriptor.- Parameters
descr – [in] the matrix descriptor.
- Returns
aoclsparse_matrix_type_general, aoclsparse_matrix_type_symmetric, aoclsparse_matrix_type_hermitian or aoclsparse_matrix_type_triangular.
aoclsparse_get_version()#
-
const char *aoclsparse_get_version()#
Get AOCL-Sparse Library version.
- Returns
AOCL-Sparse Library version number in the format “AOCL-Sparse <major>.<minor>.<patch>”
aoclsparse_set_mat_diag_type()#
-
aoclsparse_status aoclsparse_set_mat_diag_type(aoclsparse_mat_descr descr, aoclsparse_diag_type diag_type)#
Specify the matrix diagonal type of a matrix descriptor.
aoclsparse_set_mat_diag_typesets the matrix diagonal type of a matrix descriptor. Valid diagonal types are aoclsparse_diag_type_unit, aoclsparse_diag_type_non_unit or aoclsparse_diag_type_zero.- Parameters
descr – [inout] the matrix descriptor.
diag_type – [in] aoclsparse_diag_type_unit or aoclsparse_diag_type_non_unit or aoclsparse_diag_type_zero.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
descrpointer is invalid.aoclsparse_status_invalid_value –
diag_typeis invalid.
aoclsparse_set_mat_fill_mode()#
-
aoclsparse_status aoclsparse_set_mat_fill_mode(aoclsparse_mat_descr descr, aoclsparse_fill_mode fill_mode)#
Specify the matrix fill mode of a matrix descriptor.
aoclsparse_set_mat_fill_modesets the matrix fill mode of a matrix descriptor. Valid fill modes are aoclsparse_fill_mode_lower or aoclsparse_fill_mode_upper.- Parameters
descr – [inout] the matrix descriptor.
fill_mode – [in] aoclsparse_fill_mode_lower or aoclsparse_fill_mode_upper.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
descrpointer is invalid.aoclsparse_status_invalid_value –
fill_modeis invalid.
aoclsparse_set_mat_index_base()#
-
aoclsparse_status aoclsparse_set_mat_index_base(aoclsparse_mat_descr descr, aoclsparse_index_base base)#
Specify the index base of a matrix descriptor.
aoclsparse_set_mat_index_basesets the index base of a matrix descriptor. Valid options are aoclsparse_index_base_zero or aoclsparse_index_base_one.- Parameters
descr – [inout] the matrix descriptor.
base – [in] aoclsparse_index_base_zero or aoclsparse_index_base_one.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
descrpointer is invalid.aoclsparse_status_invalid_value –
baseis invalid.
aoclsparse_set_mat_type()#
-
aoclsparse_status aoclsparse_set_mat_type(aoclsparse_mat_descr descr, aoclsparse_matrix_type type)#
Specify the matrix type of a matrix descriptor.
aoclsparse_set_mat_typesets the matrix type of a matrix descriptor. Valid matrix types are aoclsparse_matrix_type_general, aoclsparse_matrix_type_symmetric, aoclsparse_matrix_type_hermitian or aoclsparse_matrix_type_triangular.- Parameters
descr – [inout] the matrix descriptor.
type – [in] aoclsparse_matrix_type_general, aoclsparse_matrix_type_symmetric, aoclsparse_matrix_type_hermitian or aoclsparse_matrix_type_triangular.
- Return values
aoclsparse_status_success – the operation completed successfully.
aoclsparse_status_invalid_pointer –
descrpointer is invalid.aoclsparse_status_invalid_value –
typeis invalid.