Skip to main content
`Ctrl`+`K`

# Sparse auxiliary functions

This module contains all sparse auxiliary functions.

The functions that are contained in the auxiliary module describe all available helper functions that are required for subsequent library calls. These functions do not support execution in a `hipGraph` context.

## rocsparse_create_handle()

rocsparse_status rocsparse_create_handle(rocsparse_handle *handle)

  Create a rocsparse handle.

  `rocsparse_create_handle` creates the rocSPARSE library context. It must be initialized before any other rocSPARSE API function is invoked and must be passed to all subsequent library function calls. The handle should be destroyed at the end using rocsparse_destroy_handle().

  Parameters:

    handle – [out] the pointer to the handle to the rocSPARSE library context.

  Return values:

    - rocsparse_status_success – the initialization succeeded.

    - rocsparse_status_invalid_handle – `handle` pointer is invalid.

    - rocsparse_status_internal_error – an internal error occurred.

## rocsparse_destroy_handle()

rocsparse_status rocsparse_destroy_handle(rocsparse_handle handle)

  Destroy a rocsparse handle.

  `rocsparse_destroy_handle` destroys the rocSPARSE library context and releases all resources used by the rocSPARSE library.

  Parameters:

    handle – [in] the handle to the rocSPARSE library context.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_handle – `handle` is invalid.

    - rocsparse_status_internal_error – an internal error occurred.

## rocsparse_set_stream()

rocsparse_status rocsparse_set_stream(rocsparse_handle handle, hipStream_t stream)

  Specify user defined HIP stream.

  `rocsparse_set_stream` specifies the stream to be used by the rocSPARSE library context and all subsequent function calls.

  Example

    This example illustrates, how a user defined stream can be used in rocSPARSE.

        // Create rocSPARSE handle
        rocsparse_handle handle;
        rocsparse_create_handle(&handle);

        // Create stream
        hipStream_t stream;
        hipStreamCreate(&stream);

        // Set stream to rocSPARSE handle
        rocsparse_set_stream(handle, stream);

        // Do some work
        // ...

        // Clean up
        rocsparse_destroy_handle(handle);
        hipStreamDestroy(stream);

  Parameters:

    - handle – [inout] the handle to the rocSPARSE library context.

    - stream – [in] the stream to be used by the rocSPARSE library context.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_handle – `handle` is invalid.

## rocsparse_get_stream()

rocsparse_status rocsparse_get_stream(rocsparse_handle handle, hipStream_t *stream)

  Get current stream from library context.

  `rocsparse_get_stream` gets the rocSPARSE library context stream which is currently used for all subsequent function calls.

  Parameters:

    - handle – [in] the handle to the rocSPARSE library context.

    - stream – [out] the stream currently used by the rocSPARSE library context.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_handle – `handle` is invalid.

## rocsparse_set_pointer_mode()

rocsparse_status rocsparse_set_pointer_mode(rocsparse_handle handle, rocsparse_pointer_mode pointer_mode)

  Specify pointer mode.

  `rocsparse_set_pointer_mode` specifies the pointer mode to be used by the rocSPARSE library context and all subsequent function calls. For example, many rocSPARSE routines take \(\alpha\) and \(\beta\) pointers as parameters. These can be either host memory pointers or device memory pointers depending on what the pointer mode is set to. By default, all values are passed using host pointer mode. Valid pointer modes are rocsparse_pointer_mode_host or rocsparse_pointer_mode_device.

  Parameters:

    - handle – [in] the handle to the rocSPARSE library context.

    - pointer_mode – [in] the pointer mode to be used by the rocSPARSE library context.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_handle – `handle` is invalid.

## rocsparse_get_pointer_mode()

rocsparse_status rocsparse_get_pointer_mode(rocsparse_handle handle, rocsparse_pointer_mode *pointer_mode)

  Get current pointer mode from library context.

  `rocsparse_get_pointer_mode` gets the rocSPARSE library context pointer mode which is currently used for all subsequent function calls.

  Parameters:

    - handle – [in] the handle to the rocSPARSE library context.

    - pointer_mode – [out] the pointer mode that is currently used by the rocSPARSE library context.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_handle – `handle` is invalid.

## rocsparse_get_version()

rocsparse_status rocsparse_get_version(rocsparse_handle handle, int *version)

  Get rocSPARSE version.

  `rocsparse_get_version` gets the rocSPARSE library version number.

  - patch = version % 100

  - minor = version / 100 % 1000

  - major = version / 100000

  Example

        rocsparse_handle handle;
        rocsparse_create_handle(&handle);
        rocsparse_get_version(handle, &rocsparse_ver);
        rocsparse_destroy_handle(handle);

  Parameters:

    - handle – [in] the handle to the rocSPARSE library context.

    - version – [out] the version number of the rocSPARSE library.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_handle – `handle` is invalid.

## rocsparse_get_git_rev()

rocsparse_status rocsparse_get_git_rev(rocsparse_handle handle, char *rev)

  Get rocSPARSE git revision.

  `rocsparse_get_git_rev` gets the rocSPARSE library git commit revision (SHA-1).

  Example

        rocsparse_handle handle;
        rocsparse_create_handle(&handle);
        rocsparse_get_git_rev(handle, rocsparse_rev);
        rocsparse_destroy_handle(handle);

  Parameters:

    - handle – [in] the handle to the rocSPARSE library context.

    - rev – [out] the git commit revision (SHA-1).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_handle – `handle` is invalid.

## rocsparse_destroy_error()

rocsparse_status rocsparse_destroy_error(rocsparse_error error)

  Destroy a rocsparse error descriptor.

  `rocsparse_destroy_error` destroys the rocSPARSE error descriptor.

  Parameters:

    error – [in] the pointer to the rocSPARSE error descriptor, it can be a null pointer.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_internal_error – an internal error occurred.

## rocsparse_error_get_message()

const char *rocsparse_error_get_message(rocsparse_error error)

  Eerror message from a rocsparse error descriptor.

  `rocsparse_error_message` returns a C-style string that provides detail for the error.

  Parameters:

    error – [in] the error to the rocSPARSE error descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_internal_error – an internal error occurred.

  Returns:

    an error message from a rocsparse error descriptor.

## rocsparse_create_mat_descr()

rocsparse_status rocsparse_create_mat_descr(rocsparse_mat_descr *descr)

  Create a matrix descriptor.

  `rocsparse_create_mat_descr` creates a matrix descriptor. It initializes rocsparse_matrix_type to rocsparse_matrix_type_general, rocsparse_fill_mode to rocsparse_fill_mode_lower, rocsparse_diag_type to rocsparse_diag_type_non_unit, rocsparse_index_base to rocsparse_index_base_zero, and rocsparse_storage_mode to rocsparse_storage_mode_sorted. It should be destroyed at the end using rocsparse_destroy_mat_descr().

  The matrix type, fill mode, diag type, index base, and storage mode can be set using the rocsparse_set_mat_type, rocsparse_set_mat_fill_mode, rocsparse_set_mat_diag_type, rocsparse_set_mat_index_base, and rocsparse_set_mat_storage_mode APIs respectively.

  Parameters:

    descr – [out] the pointer to the matrix descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` pointer is invalid.

## rocsparse_destroy_mat_descr()

rocsparse_status rocsparse_destroy_mat_descr(rocsparse_mat_descr descr)

  Destroy a matrix descriptor.

  `rocsparse_destroy_mat_descr` destroys a matrix descriptor and releases all resources used by the descriptor.

  Parameters:

    descr – [in] the matrix descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` is invalid.

## rocsparse_copy_mat_descr()

rocsparse_status rocsparse_copy_mat_descr(rocsparse_mat_descr dest, const rocsparse_mat_descr src)

  Copy a matrix descriptor.

  `rocsparse_copy_mat_descr` copies a matrix descriptor. Both, source and destination matrix descriptors must be initialized prior to calling `rocsparse_copy_mat_descr`.

  Parameters:

    - dest – [out] the pointer to the destination matrix descriptor.

    - src – [in] the pointer to the source matrix descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `src` or `dest` pointer is invalid.

## rocsparse_set_mat_index_base()

rocsparse_status rocsparse_set_mat_index_base(rocsparse_mat_descr descr, rocsparse_index_base base)

  Specify the index base of a matrix descriptor.

  `rocsparse_set_mat_index_base` sets the index base of a matrix descriptor. Valid options are rocsparse_index_base_zero or rocsparse_index_base_one.

  Parameters:

    - descr – [inout] the matrix descriptor.

    - base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` pointer is invalid.

    - rocsparse_status_invalid_value – `base` is invalid.

## rocsparse_get_mat_index_base()

rocsparse_index_base rocsparse_get_mat_index_base(const rocsparse_mat_descr descr)

  Get the index base of a matrix descriptor.

  `rocsparse_get_mat_index_base` returns the index base of a matrix descriptor.

  Parameters:

    descr – [in] the matrix descriptor.

  Returns:

    rocsparse_index_base_zero or rocsparse_index_base_one.

## rocsparse_set_mat_type()

rocsparse_status rocsparse_set_mat_type(rocsparse_mat_descr descr, rocsparse_matrix_type type)

  Specify the matrix type of a matrix descriptor.

  `rocsparse_set_mat_type` sets the matrix type of a matrix descriptor. Valid matrix types are rocsparse_matrix_type_general, rocsparse_matrix_type_symmetric, rocsparse_matrix_type_hermitian or rocsparse_matrix_type_triangular.

  Parameters:

    - descr – [inout] the matrix descriptor.

    - type – [in] rocsparse_matrix_type_general, rocsparse_matrix_type_symmetric, rocsparse_matrix_type_hermitian or rocsparse_matrix_type_triangular.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` pointer is invalid.

    - rocsparse_status_invalid_value – `type` is invalid.

## rocsparse_get_mat_type()

rocsparse_matrix_type rocsparse_get_mat_type(const rocsparse_mat_descr descr)

  Get the matrix type of a matrix descriptor.

  `rocsparse_get_mat_type` returns the matrix type of a matrix descriptor.

  Parameters:

    descr – [in] the matrix descriptor.

  Returns:

    rocsparse_matrix_type_general, rocsparse_matrix_type_symmetric, rocsparse_matrix_type_hermitian or rocsparse_matrix_type_triangular.

## rocsparse_set_mat_fill_mode()

rocsparse_status rocsparse_set_mat_fill_mode(rocsparse_mat_descr descr, rocsparse_fill_mode fill_mode)

  Specify the matrix fill mode of a matrix descriptor.

  `rocsparse_set_mat_fill_mode` sets the matrix fill mode of a matrix descriptor. Valid fill modes are rocsparse_fill_mode_lower or rocsparse_fill_mode_upper.

  Parameters:

    - descr – [inout] the matrix descriptor.

    - fill_mode – [in] rocsparse_fill_mode_lower or rocsparse_fill_mode_upper.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` pointer is invalid.

    - rocsparse_status_invalid_value – `fill_mode` is invalid.

## rocsparse_get_mat_fill_mode()

rocsparse_fill_mode rocsparse_get_mat_fill_mode(const rocsparse_mat_descr descr)

  Get the matrix fill mode of a matrix descriptor.

  `rocsparse_get_mat_fill_mode` returns the matrix fill mode of a matrix descriptor.

  Parameters:

    descr – [in] the matrix descriptor.

  Returns:

    rocsparse_fill_mode_lower or rocsparse_fill_mode_upper.

## rocsparse_set_mat_diag_type()

rocsparse_status rocsparse_set_mat_diag_type(rocsparse_mat_descr descr, rocsparse_diag_type diag_type)

  Specify the matrix diagonal type of a matrix descriptor.

  `rocsparse_set_mat_diag_type` sets the matrix diagonal type of a matrix descriptor. Valid diagonal types are rocsparse_diag_type_unit or rocsparse_diag_type_non_unit.

  Parameters:

    - descr – [inout] the matrix descriptor.

    - diag_type – [in] rocsparse_diag_type_unit or rocsparse_diag_type_non_unit.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` pointer is invalid.

    - rocsparse_status_invalid_value – `diag_type` is invalid.

## rocsparse_get_mat_diag_type()

rocsparse_diag_type rocsparse_get_mat_diag_type(const rocsparse_mat_descr descr)

  Get the matrix diagonal type of a matrix descriptor.

  `rocsparse_get_mat_diag_type` returns the matrix diagonal type of a matrix descriptor.

  Parameters:

    descr – [in] the matrix descriptor.

  Returns:

    rocsparse_diag_type_unit or rocsparse_diag_type_non_unit.

## rocsparse_set_mat_storage_mode()

rocsparse_status rocsparse_set_mat_storage_mode(rocsparse_mat_descr descr, rocsparse_storage_mode storage_mode)

  Specify the matrix storage mode of a matrix descriptor.

  `rocsparse_set_mat_storage_mode` sets the matrix storage mode of a matrix descriptor. Valid fill modes are rocsparse_storage_mode_sorted or rocsparse_storage_mode_unsorted.

  Parameters:

    - descr – [inout] the matrix descriptor.

    - storage_mode – [in] rocsparse_storage_mode_sorted or rocsparse_storage_mode_unsorted.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` pointer is invalid.

    - rocsparse_status_invalid_value – `storage_mode` is invalid.

## rocsparse_get_mat_storage_mode()

rocsparse_storage_mode rocsparse_get_mat_storage_mode(const rocsparse_mat_descr descr)

  Get the matrix storage mode of a matrix descriptor.

  `rocsparse_get_mat_storage_mode` returns the matrix storage mode of a matrix descriptor.

  Parameters:

    descr – [in] the matrix descriptor.

  Returns:

    rocsparse_storage_mode_sorted or rocsparse_storage_mode_unsorted.

## rocsparse_create_hyb_mat()

rocsparse_status rocsparse_create_hyb_mat(rocsparse_hyb_mat *hyb)

  Create a `HYB` matrix structure.

  `rocsparse_create_hyb_mat` creates a structure that holds the matrix in `HYB` storage format. It should be destroyed at the end using rocsparse_destroy_hyb_mat().

  Parameters:

    hyb – [inout] the pointer to the hybrid matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `hyb` pointer is invalid.

## rocsparse_destroy_hyb_mat()

rocsparse_status rocsparse_destroy_hyb_mat(rocsparse_hyb_mat hyb)

  Destroy a `HYB` matrix structure.

  `rocsparse_destroy_hyb_mat` destroys a `HYB` structure.

  Parameters:

    hyb – [in] the hybrid matrix structure.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `hyb` pointer is invalid.

    - rocsparse_status_internal_error – an internal error occurred.

## rocsparse_copy_hyb_mat()

rocsparse_status rocsparse_copy_hyb_mat(rocsparse_hyb_mat dest, const rocsparse_hyb_mat src)

  Copy a `HYB` matrix structure.

  `rocsparse_copy_hyb_mat` copies a matrix info structure. Both, source and destination matrix info structure must be initialized prior to calling `rocsparse_copy_hyb_mat`.

  Parameters:

    - dest – [out] the pointer to the destination matrix info structure.

    - src – [in] the pointer to the source matrix info structure.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `hyb` pointer is invalid.

## rocsparse_create_mat_info()

rocsparse_status rocsparse_create_mat_info(rocsparse_mat_info *info)

  Create a matrix info structure.

  `rocsparse_create_mat_info` creates a structure that holds the matrix info data that is gathered during the analysis routines available. It should be destroyed at the end using rocsparse_destroy_mat_info().

  Parameters:

    info – [inout] the pointer to the info structure.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `info` pointer is invalid.

## rocsparse_copy_mat_info()

rocsparse_status rocsparse_copy_mat_info(rocsparse_mat_info dest, const rocsparse_mat_info src)

  Copy a matrix info structure.

  `rocsparse_copy_mat_info` copies a matrix info structure. Both, source and destination matrix info structure must be initialized prior to calling `rocsparse_copy_mat_info`.

  Parameters:

    - dest – [out] the pointer to the destination matrix info structure.

    - src – [in] the pointer to the source matrix info structure.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `src` or `dest` pointer is invalid.

## rocsparse_destroy_mat_info()

rocsparse_status rocsparse_destroy_mat_info(rocsparse_mat_info info)

  Destroy a matrix info structure.

  `rocsparse_destroy_mat_info` destroys a matrix info structure.

  Parameters:

    info – [in] the info structure.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `info` pointer is invalid.

    - rocsparse_status_internal_error – an internal error occurred.

## rocsparse_create_color_info()

rocsparse_status rocsparse_create_color_info(rocsparse_color_info *info)

  Create a color info structure.

  `rocsparse_create_color_info` creates a structure that holds the color info data that is gathered during the analysis routines available. It should be destroyed at the end using rocsparse_destroy_color_info().

  Parameters:

    info – [inout] the pointer to the info structure.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `info` pointer is invalid.

## rocsparse_destroy_color_info()

rocsparse_status rocsparse_destroy_color_info(rocsparse_color_info info)

  Destroy a color info structure.

  `rocsparse_destroy_color_info` destroys a color info structure.

  Parameters:

    info – [in] the info structure.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `info` pointer is invalid.

    - rocsparse_status_internal_error – an internal error occurred.

## rocsparse_copy_color_info()

rocsparse_status rocsparse_copy_color_info(rocsparse_color_info dest, const rocsparse_color_info src)

  Copy a color info structure.

  `rocsparse_copy_color_info` copies a color info structure. Both, source and destination color info structure must be initialized prior to calling `rocsparse_copy_color_info`.

  Parameters:

    - dest – [out] the pointer to the destination color info structure.

    - src – [in] the pointer to the source color info structure.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `src` or `dest` pointer is invalid.

## rocsparse_create_spvec_descr()

rocsparse_status rocsparse_create_spvec_descr(rocsparse_spvec_descr *descr, int64_t size, int64_t nnz, void *indices, void *values, rocsparse_indextype idx_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse vector descriptor.

  `rocsparse_create_spvec_descr` creates a sparse vector descriptor. It should be destroyed at the end using rocsparse_destroy_mat_descr().

  Parameters:

    - descr – [out] the pointer to the sparse vector descriptor.

    - size – [in] size of the sparse vector.

    - nnz – [in] number of non-zeros in sparse vector.

    - indices – [in] indices of the sparse vector where non-zeros occur (must be array of length `nnz` ).

    - values – [in] non-zero values in the sparse vector (must be array of length `nnz` ).

    - idx_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `indices` or `values` is invalid.

    - rocsparse_status_invalid_size – if `size` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_destroy_spvec_descr()

rocsparse_status rocsparse_destroy_spvec_descr(rocsparse_const_spvec_descr descr)

  Destroy a sparse vector descriptor.

  `rocsparse_destroy_spvec_descr` destroys a sparse vector descriptor and releases all resources used by the descriptor.

  Parameters:

    descr – [in] the matrix descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` is invalid.

## rocsparse_spvec_get()

rocsparse_status rocsparse_spvec_get(const rocsparse_spvec_descr descr, int64_t *size, int64_t *nnz, void **indices, void **values, rocsparse_indextype *idx_type, rocsparse_index_base *idx_base, rocsparse_datatype *data_type)

  Get the fields of the sparse vector descriptor.

  `rocsparse_spvec_get` gets the fields of the sparse vector descriptor

  Parameters:

    - descr – [in] the pointer to the sparse vector descriptor.

    - size – [out] size of the sparse vector.

    - nnz – [out] number of non-zeros in sparse vector.

    - indices – [out] indices of the sparse vector where non-zeros occur (must be array of length `nnz` ).

    - values – [out] non-zero values in the sparse vector (must be array of length `nnz` ).

    - idx_type – [out] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [out] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [out] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `indices` or `values` is invalid.

    - rocsparse_status_invalid_size – if `size` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_spvec_get_index_base()

rocsparse_status rocsparse_spvec_get_index_base(rocsparse_const_spvec_descr descr, rocsparse_index_base *idx_base)

  Get the index base stored in the sparse vector descriptor.

  Parameters:

    - descr – [in] the pointer to the sparse vector descriptor.

    - idx_base – [out] rocsparse_index_base_zero or rocsparse_index_base_one.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_value – if `idx_base` is invalid.

## rocsparse_spvec_get_values()

rocsparse_status rocsparse_spvec_get_values(const rocsparse_spvec_descr descr, void **values)

  Get the values array stored in the sparse vector descriptor.

  Parameters:

    - descr – [in] the pointer to the sparse vector descriptor.

    - values – [out] non-zero values in the sparse vector (must be array of length `nnz` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

## rocsparse_spvec_set_values()

rocsparse_status rocsparse_spvec_set_values(rocsparse_spvec_descr descr, void *values)

  Set the values array in the sparse vector descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse vector descriptor.

    - values – [in] non-zero values in the sparse vector (must be array of length `nnz` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

## rocsparse_create_coo_descr

rocsparse_status rocsparse_create_coo_descr(rocsparse_spmat_descr *descr, int64_t rows, int64_t cols, int64_t nnz, void *coo_row_ind, void *coo_col_ind, void *coo_val, rocsparse_indextype idx_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse COO matrix descriptor.

  `rocsparse_create_coo_descr` creates a sparse COO matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Parameters:

    - descr – [out] the pointer to the sparse COO matrix descriptor.

    - rows – [in] number of rows in the COO matrix.

    - cols – [in] number of columns in the COO matrix

    - nnz – [in] number of non-zeros in the COO matrix.

    - coo_row_ind – [in] row indices of the COO matrix (must be array of length `nnz` ).

    - coo_col_ind – [in] column indices of the COO matrix (must be array of length `nnz` ).

    - coo_val – [in] values of the COO matrix (must be array of length `nnz` ).

    - idx_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `coo_row_ind` or `coo_col_ind` or `coo_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_coo_aos_descr

rocsparse_status rocsparse_create_coo_aos_descr(rocsparse_spmat_descr *descr, int64_t rows, int64_t cols, int64_t nnz, void *coo_ind, void *coo_val, rocsparse_indextype idx_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse COO AoS matrix descriptor.

  `rocsparse_create_coo_aos_descr` creates a sparse COO AoS matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Parameters:

    - descr – [out] the pointer to the sparse COO AoS matrix descriptor.

    - rows – [in] number of rows in the COO AoS matrix.

    - cols – [in] number of columns in the COO AoS matrix

    - nnz – [in] number of non-zeros in the COO AoS matrix.

    - coo_ind – [in] <row, column> indices of the COO AoS matrix (must be array of length `nnz` ).

    - coo_val – [in] values of the COO AoS matrix (must be array of length `nnz` ).

    - idx_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `coo_ind` or `coo_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_csr_descr

rocsparse_status rocsparse_create_csr_descr(rocsparse_spmat_descr *descr, int64_t rows, int64_t cols, int64_t nnz, void *csr_row_ptr, void *csr_col_ind, void *csr_val, rocsparse_indextype row_ptr_type, rocsparse_indextype col_ind_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse CSR matrix descriptor.

  `rocsparse_create_csr_descr` creates a sparse CSR matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Parameters:

    - descr – [out] the pointer to the sparse CSR matrix descriptor.

    - rows – [in] number of rows in the CSR matrix.

    - cols – [in] number of columns in the CSR matrix

    - nnz – [in] number of non-zeros in the CSR matrix.

    - csr_row_ptr – [in] row offsets of the CSR matrix (must be array of length `rows+1` ).

    - csr_col_ind – [in] column indices of the CSR matrix (must be array of length `nnz` ).

    - csr_val – [in] values of the CSR matrix (must be array of length `nnz` ).

    - row_ptr_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - col_ind_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `csr_row_ptr` or `csr_col_ind` or `csr_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `row_ptr_type` or `col_ind_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_csc_descr

rocsparse_status rocsparse_create_csc_descr(rocsparse_spmat_descr *descr, int64_t rows, int64_t cols, int64_t nnz, void *csc_col_ptr, void *csc_row_ind, void *csc_val, rocsparse_indextype col_ptr_type, rocsparse_indextype row_ind_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse CSC matrix descriptor.

  `rocsparse_create_csc_descr` creates a sparse CSC matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Parameters:

    - descr – [out] the pointer to the sparse CSC matrix descriptor.

    - rows – [in] number of rows in the CSC matrix.

    - cols – [in] number of columns in the CSC matrix

    - nnz – [in] number of non-zeros in the CSC matrix.

    - csc_col_ptr – [in] column offsets of the CSC matrix (must be array of length `cols+1` ).

    - csc_row_ind – [in] row indices of the CSC matrix (must be array of length `nnz` ).

    - csc_val – [in] values of the CSC matrix (must be array of length `nnz` ).

    - col_ptr_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - row_ind_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `csc_col_ptr` or `csc_row_ind` or `csc_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `col_ptr_type` or `row_ind_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_bsr_descr

rocsparse_status rocsparse_create_bsr_descr(rocsparse_spmat_descr *descr, int64_t mb, int64_t nb, int64_t nnzb, rocsparse_direction block_dir, int64_t block_dim, void *bsr_row_ptr, void *bsr_col_ind, void *bsr_val, rocsparse_indextype row_ptr_type, rocsparse_indextype col_ind_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse BSR matrix descriptor.

  `rocsparse_create_bsr_descr` creates a sparse BSR matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Parameters:

    - descr – [out] the pointer to the sparse BSR matrix descriptor.

    - mb – [in] number of rows in the BSR matrix.

    - nb – [in] number of columns in the BSR matrix

    - nnzb – [in] number of non-zeros in the BSR matrix.

    - block_dir – [in] direction of the internal block storage.

    - block_dim – [in] dimension of the blocks.

    - bsr_row_ptr – [in] row offsets of the BSR matrix (must be array of length `mb+1` ).

    - bsr_col_ind – [in] column indices of the BSR matrix (must be array of length `nnzb` ).

    - bsr_val – [in] values of the BSR matrix (must be array of length `nnzb` * `block_dim` * `block_dim` ).

    - row_ptr_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - col_ind_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `bsr_row_ptr` or `bsr_col_ind` or `bsr_val` is invalid.

    - rocsparse_status_invalid_size – if `mb` or `nb` or `nnzb` `block_dim` is invalid.

    - rocsparse_status_invalid_value – if `row_ptr_type` or `col_ind_type` or `idx_base` or `data_type` or `block_dir` is invalid.

## rocsparse_create_ell_descr

rocsparse_status rocsparse_create_ell_descr(rocsparse_spmat_descr *descr, int64_t rows, int64_t cols, void *ell_col_ind, void *ell_val, int64_t ell_width, rocsparse_indextype idx_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse ELL matrix descriptor.

  `rocsparse_create_ell_descr` creates a sparse ELL matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Parameters:

    - descr – [out] the pointer to the sparse ELL matrix descriptor.

    - rows – [in] number of rows in the ELL matrix.

    - cols – [in] number of columns in the ELL matrix

    - ell_col_ind – [in] column indices of the ELL matrix (must be array of length `rows*ell_width` ).

    - ell_val – [in] values of the ELL matrix (must be array of length `rows*ell_width` ).

    - ell_width – [in] width of the ELL matrix.

    - idx_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `ell_col_ind` or `ell_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `ell_width` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_bell_descr

rocsparse_status rocsparse_create_bell_descr(rocsparse_spmat_descr *descr, int64_t rows, int64_t cols, rocsparse_direction ell_block_dir, int64_t ell_block_dim, int64_t ell_cols, void *ell_col_ind, void *ell_val, rocsparse_indextype idx_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse blocked ELL matrix descriptor.

  `rocsparse_create_bell_descr` creates a sparse blocked ELL matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Currently the only routine that supports the Blocked ELL format is rocsparse_spmm.

  Parameters:

    - descr – [out] the pointer to the sparse blocked ELL matrix descriptor.

    - rows – [in] number of rows in the blocked ELL matrix.

    - cols – [in] number of columns in the blocked ELL matrix

    - ell_block_dir – [in] rocsparse_direction_row or rocsparse_direction_column.

    - ell_block_dim – [in] block dimension of the sparse blocked ELL matrix.

    - ell_cols – [in] column indices of the blocked ELL matrix (must be array of length `rows*ell_width` ).

    - ell_col_ind – [in] column indices of the blocked ELL matrix (must be array of length `rows*ell_width` ).

    - ell_val – [in] values of the blocked ELL matrix (must be array of length `rows*ell_width` ).

    - idx_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `ell_cols` or `ell_col_ind` or `ell_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_sell_descr

rocsparse_status rocsparse_create_sell_descr(rocsparse_spmat_descr *descr, int64_t rows, int64_t cols, int64_t nnz, int64_t sell_slice_size, int64_t sell_colval_size, void *sell_slice_offsets, void *sell_col_ind, void *sell_val, rocsparse_indextype sell_slice_offsets_type, rocsparse_indextype sell_col_ind_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse sliced ELL matrix descriptor.

  `rocsparse_create_sell_descr` creates a sparse slice ELL matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Currently the only routine that supports the sliced ELL format is rocsparse_spmv.

  Parameters:

    - descr – [out] the pointer to the sparse sliced ELL matrix descriptor.

    - rows – [in] number of rows in the sliced ELL matrix.

    - cols – [in] number of columns in the sliced ELL matrix

    - nnz – [in] number of non-zeros in the sliced ELL matrix.

    - sell_slice_size – [in] slice size in the sliced ELL matrix.

    - sell_colval_size – [in] size of the column and value arrays in the sliced ELL matrix.

    - sell_slice_offsets – [in] slice offsets into column and value arrays (must be array of length `nslices+1` where `nslice=m/sell_slice_size` ).

    - sell_col_ind – [in] column indices of the sliced ELL matrix (must be array of length `sell_colval_size` ).

    - sell_val – [in] values of the sliced ELL matrix (must be array of length `sell_colval_size` ).

    - sell_slice_offsets_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - sell_col_ind_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `sell_slice_offsets` or `sell_col_ind` or `sell_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` pr `sell_slice_size` or `sell_colval_size` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_const_coo_descr

rocsparse_status rocsparse_create_const_coo_descr(rocsparse_const_spmat_descr *descr, int64_t rows, int64_t cols, int64_t nnz, const void *coo_row_ind, const void *coo_col_ind, const void *coo_val, rocsparse_indextype idx_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse COO matrix descriptor.

  `rocsparse_create_coo_descr` creates a sparse COO matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Parameters:

    - descr – [out] the pointer to the sparse COO matrix descriptor.

    - rows – [in] number of rows in the COO matrix.

    - cols – [in] number of columns in the COO matrix

    - nnz – [in] number of non-zeros in the COO matrix.

    - coo_row_ind – [in] row indices of the COO matrix (must be array of length `nnz` ).

    - coo_col_ind – [in] column indices of the COO matrix (must be array of length `nnz` ).

    - coo_val – [in] values of the COO matrix (must be array of length `nnz` ).

    - idx_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `coo_row_ind` or `coo_col_ind` or `coo_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_const_csr_descr

rocsparse_status rocsparse_create_const_csr_descr(rocsparse_const_spmat_descr *descr, int64_t rows, int64_t cols, int64_t nnz, const void *csr_row_ptr, const void *csr_col_ind, const void *csr_val, rocsparse_indextype row_ptr_type, rocsparse_indextype col_ind_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse CSR matrix descriptor.

  `rocsparse_create_csr_descr` creates a sparse CSR matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Parameters:

    - descr – [out] the pointer to the sparse CSR matrix descriptor.

    - rows – [in] number of rows in the CSR matrix.

    - cols – [in] number of columns in the CSR matrix

    - nnz – [in] number of non-zeros in the CSR matrix.

    - csr_row_ptr – [in] row offsets of the CSR matrix (must be array of length `rows+1` ).

    - csr_col_ind – [in] column indices of the CSR matrix (must be array of length `nnz` ).

    - csr_val – [in] values of the CSR matrix (must be array of length `nnz` ).

    - row_ptr_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - col_ind_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `csr_row_ptr` or `csr_col_ind` or `csr_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `row_ptr_type` or `col_ind_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_const_csc_descr

rocsparse_status rocsparse_create_const_csc_descr(rocsparse_const_spmat_descr *descr, int64_t rows, int64_t cols, int64_t nnz, const void *csc_col_ptr, const void *csc_row_ind, const void *csc_val, rocsparse_indextype col_ptr_type, rocsparse_indextype row_ind_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse CSC matrix descriptor.

  `rocsparse_create_csc_descr` creates a sparse CSC matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Parameters:

    - descr – [out] the pointer to the sparse CSC matrix descriptor.

    - rows – [in] number of rows in the CSC matrix.

    - cols – [in] number of columns in the CSC matrix

    - nnz – [in] number of non-zeros in the CSC matrix.

    - csc_col_ptr – [in] column offsets of the CSC matrix (must be array of length `cols+1` ).

    - csc_row_ind – [in] row indices of the CSC matrix (must be array of length `nnz` ).

    - csc_val – [in] values of the CSC matrix (must be array of length `nnz` ).

    - col_ptr_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - row_ind_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `csc_col_ptr` or `csc_row_ind` or `csc_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `col_ptr_type` or `row_ind_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_const_bell_descr

rocsparse_status rocsparse_create_const_bell_descr(rocsparse_const_spmat_descr *descr, int64_t rows, int64_t cols, rocsparse_direction ell_block_dir, int64_t ell_block_dim, int64_t ell_cols, const void *ell_col_ind, const void *ell_val, rocsparse_indextype idx_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse blocked ELL matrix descriptor.

  `rocsparse_create_bell_descr` creates a sparse blocked ELL matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Currently the only routine that supports the Blocked ELL format is rocsparse_spmm.

  Parameters:

    - descr – [out] the pointer to the sparse blocked ELL matrix descriptor.

    - rows – [in] number of rows in the blocked ELL matrix.

    - cols – [in] number of columns in the blocked ELL matrix

    - ell_block_dir – [in] rocsparse_direction_row or rocsparse_direction_column.

    - ell_block_dim – [in] block dimension of the sparse blocked ELL matrix.

    - ell_cols – [in] column indices of the blocked ELL matrix (must be array of length `rows*ell_width` ).

    - ell_col_ind – [in] column indices of the blocked ELL matrix (must be array of length `rows*ell_width` ).

    - ell_val – [in] values of the blocked ELL matrix (must be array of length `rows*ell_width` ).

    - idx_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `ell_cols` or `ell_col_ind` or `ell_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_create_const_sell_descr

rocsparse_status rocsparse_create_const_sell_descr(rocsparse_const_spmat_descr *descr, int64_t rows, int64_t cols, int64_t nnz, int64_t sell_slice_size, int64_t sell_colval_size, const void *sell_slice_offsets, const void *sell_col_ind, const void *sell_val, rocsparse_indextype sell_slice_offsets_type, rocsparse_indextype sell_col_ind_type, rocsparse_index_base idx_base, rocsparse_datatype data_type)

  Create a sparse sliced ELL matrix descriptor.

  `rocsparse_create_sell_descr` creates a sparse slice ELL matrix descriptor. It should be destroyed at the end using `rocsparse_destroy_spmat_descr`.

  Currently the only routine that supports the sliced ELL format is rocsparse_spmv.

  Parameters:

    - descr – [out] the pointer to the sparse sliced ELL matrix descriptor.

    - rows – [in] number of rows in the sliced ELL matrix.

    - cols – [in] number of columns in the sliced ELL matrix

    - nnz – [in] number of non-zeros in the sliced ELL matrix.

    - sell_slice_size – [in] slice size in the sliced ELL matrix.

    - sell_colval_size – [in] size of the column and value arrays in the sliced ELL matrix.

    - sell_slice_offsets – [in] slice offsets into column and value arrays (must be array of length `nslices+1` where `nslice=m/sell_slice_size` ).

    - sell_col_ind – [in] column indices of the sliced ELL matrix (must be array of length `sell_colval_size` ).

    - sell_val – [in] values of the sliced ELL matrix (must be array of length `sell_colval_size` ).

    - sell_slice_offsets_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - sell_col_ind_type – [in] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [in] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `sell_slice_offsets` or `sell_col_ind` or `sell_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` pr `sell_slice_size` or `sell_colval_size` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_destroy_spmat_descr

rocsparse_status rocsparse_destroy_spmat_descr(rocsparse_const_spmat_descr descr)

  Destroy a sparse matrix descriptor.

  `rocsparse_destroy_spmat_descr` destroys a sparse matrix descriptor and releases all resources used by the descriptor.

  Currently the only routine that supports the Blocked ELL format is rocsparse_spmm.

  Parameters:

    descr – [in] the matrix descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` is invalid.

## rocsparse_create_sparse_to_sparse_descr

rocsparse_status rocsparse_create_sparse_to_sparse_descr(rocsparse_sparse_to_sparse_descr *descr, rocsparse_const_spmat_descr source, rocsparse_spmat_descr target, rocsparse_sparse_to_sparse_alg alg)

  Sparse matrix to sparse matrix conversion.

  `rocsparse_create_sparse_to_sparse_descr` creates the descriptor of the sparse_to_sparse algorithm.

  Parameters:

    - descr – [out] pointer to the descriptor of the sparse_to_sparse algorithm.

    - source – [in] source sparse matrix descriptor.

    - target – [in] target sparse matrix descriptor.

    - alg – [in] algorithm for the sparse_to_sparse computation.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_value – if any required enumeration is invalid.

    - rocsparse_status_invalid_pointer – `descr`, `source`, or `target` pointer is invalid.

## rocsparse_destroy_sparse_to_sparse_descr

rocsparse_status rocsparse_destroy_sparse_to_sparse_descr(rocsparse_sparse_to_sparse_descr descr)

  Sparse matrix to sparse matrix conversion.

  `rocsparse_destroy_sparse_to_sparse_descr` destroys the descriptor of the sparse_to_sparse algorithm.

  Parameters:

    descr – [in] descriptor of the sparse_to_sparse algorithm.

  Return values:

    rocsparse_status_success – the operation completed successfully.

## rocsparse_sparse_to_sparse_permissive

rocsparse_status rocsparse_sparse_to_sparse_permissive(rocsparse_sparse_to_sparse_descr descr)

  Sparse matrix to sparse matrix conversion.

  `rocsparse_sparse_to_sparse_permissive` allows the routine to allocate an intermediate sparse matrix in order to perform the conversion. By default, the routine is not permissive.

  Parameters:

    descr – [in] descriptor of the sparse_to_sparse algorithm.

  Return values:

    rocsparse_status_success – the operation completed successfully.

## rocsparse_create_extract_descr

rocsparse_status rocsparse_create_extract_descr(rocsparse_extract_descr *descr, rocsparse_const_spmat_descr source, rocsparse_spmat_descr target, rocsparse_extract_alg alg)

  Sparse matrix extraction.

  `rocsparse_create_extract_descr` creates the descriptor of the extract algorithm.

  Parameters:

    - descr – [out] pointer to the descriptor of the extract algorithm.

    - source – [in] source sparse matrix descriptor.

    - target – [in] target sparse matrix descriptor.

    - alg – [in] algorithm for the extract computation.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_value – if any required enumeration is invalid.

    - rocsparse_status_invalid_pointer – `descr`, `source`, or `target` pointer is invalid.

## rocsparse_destroy_extract_descr

rocsparse_status rocsparse_destroy_extract_descr(rocsparse_extract_descr descr)

  Sparse matrix extraction.

  `rocsparse_destroy_extract_descr` destroys the descriptor of the rocsparse_extract routine.

  Parameters:

    descr – [in] descriptor of the extract routine.

  Return values:

    rocsparse_status_success – the operation completed successfully.

## rocsparse_create_spgeam_descr

rocsparse_status rocsparse_create_spgeam_descr(rocsparse_spgeam_descr *descr)

  Sparse matrix spgeam.

  `rocsparse_create_spgeam_descr` creates the descriptor of the rocsparse_spgeam_buffer_size and rocsparse_spgeam routines.

  Parameters:

    descr – [out] pointer to the descriptor of the SpGEAM routine.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` pointer is invalid.

## rocsparse_destroy_spgeam_descr

rocsparse_status rocsparse_destroy_spgeam_descr(rocsparse_spgeam_descr descr)

  Sparse matrix spgeam.

  `rocsparse_destroy_spgeam_descr` destroys the descriptor of the rocsparse_spgeam_buffer_size and rocsparse_spgeam routines.

  Parameters:

    descr – [in] descriptor of the spgeam routine.

  Return values:

    rocsparse_status_success – the operation completed successfully.

## rocsparse_spgeam_set_input

rocsparse_status rocsparse_spgeam_set_input(rocsparse_handle handle, rocsparse_spgeam_descr descr, rocsparse_spgeam_input input, const void *data, size_t data_size_in_bytes, rocsparse_error *p_error)

  Set the requested rocsparse_spgeam_input data in the SpGEAM descriptor.

  Parameters:

    - handle – [in] the pointer to the handle to the rocSPARSE library context.

    - descr – [inout] the pointer to the SpGEAM descriptor.

    - input – [in] one of the values from rocsparse_spgeam_input

    - data – [in] input data

    - data_size_in_bytes – [in] input data size.

    - p_error – [out] error descriptor created if the returned status is not rocsparse_status_success. A null pointer can be passed if the user is not interested in obtaining an error descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `data` is invalid.

    - rocsparse_status_invalid_value – if `input` is invalid.

    - rocsparse_status_invalid_size – if `data_size_in_bytes` is invalid.

## rocsparse_spgeam_get_output

rocsparse_status rocsparse_spgeam_get_output(rocsparse_handle handle, rocsparse_spgeam_descr descr, rocsparse_spgeam_output output, void *data, size_t data_size_in_bytes, rocsparse_error *error)

  Get the requested rocsparse_spgeam_output data from the SpGEAM descriptor.

  Parameters:

    - handle – [in] the pointer to the handle to the rocSPARSE library context.

    - descr – [inout] the pointer to the SpGEAM descriptor.

    - output – [in] rocsparse_spgeam_output_nnz

    - data – [in] output data

    - data_size_in_bytes – [in] output data size.

    - error – [out] error descriptor created if the returned status is not rocsparse_status_success. A null pointer can be passed if the user is not interested in obtaining an error descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `data` is invalid.

    - rocsparse_status_invalid_value – if `output` is invalid.

    - rocsparse_status_invalid_size – if `data_size_in_bytes` is invalid.

## rocsparse_create_spmv_descr

rocsparse_status rocsparse_create_spmv_descr(rocsparse_spmv_descr *descr)

  Sparse matrix spmv.

  `rocsparse_create_spmv_descr` creates the descriptor of the rocsparse_v2_spmv_buffer_size and rocsparse_v2_spmv routines.

  Parameters:

    descr – [out] pointer to the descriptor of the SpMV routine.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` pointer is invalid.

## rocsparse_destroy_spmv_descr

rocsparse_status rocsparse_destroy_spmv_descr(rocsparse_spmv_descr descr)

  Sparse matrix spmv.

  `rocsparse_destroy_spmv_descr` destroys the descriptor of the rocsparse_v2_spmv_buffer_size and rocsparse_v2_spmv routines.

  Parameters:

    descr – [in] descriptor of the v2_spmv routine.

  Return values:

    rocsparse_status_success – the operation completed successfully.

## rocsparse_spmv_set_input

rocsparse_status rocsparse_spmv_set_input(rocsparse_handle handle, rocsparse_spmv_descr descr, rocsparse_spmv_input input, const void *in, size_t size_in_bytes, rocsparse_error *error)

  Set the requested rocsparse_spmv_input data in the SpMV descriptor.

  Parameters:

    - handle – [in] the pointer to the handle to the rocSPARSE library context.

    - descr – [inout] the pointer to the SpMV descriptor.

    - input – [in] one possible value of rocsparse_spmv_input

    - in – [in] input value

    - size_in_bytes – [in] input value size in bytes.

    - error – [out] error descriptor created if the returned status is not rocsparse_status_success. A null pointer can be passed if the user is not interested in obtaining an error descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `in` is invalid.

    - rocsparse_status_invalid_value – if `input` is invalid.

    - rocsparse_status_invalid_size – if `size_in_bytes` is zero.

## rocsparse_coo_get

rocsparse_status rocsparse_coo_get(const rocsparse_spmat_descr descr, int64_t *rows, int64_t *cols, int64_t *nnz, void **coo_row_ind, void **coo_col_ind, void **coo_val, rocsparse_indextype *idx_type, rocsparse_index_base *idx_base, rocsparse_datatype *data_type)

  Get the fields of the sparse COO matrix descriptor.

  `rocsparse_coo_get` gets the fields of the sparse COO matrix descriptor

  Parameters:

    - descr – [in] the pointer to the sparse COO matrix descriptor.

    - rows – [out] number of rows in the sparse COO matrix.

    - cols – [out] number of columns in the sparse COO matrix.

    - nnz – [out] number of non-zeros in sparse COO matrix.

    - coo_row_ind – [out] row indices of the COO matrix (must be array of length `nnz` ).

    - coo_col_ind – [out] column indices of the COO matrix (must be array of length `nnz` ).

    - coo_val – [out] values of the COO matrix (must be array of length `nnz` ).

    - idx_type – [out] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [out] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [out] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `coo_row_ind` or `coo_col_ind` or `coo_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_coo_aos_get

rocsparse_status rocsparse_coo_aos_get(const rocsparse_spmat_descr descr, int64_t *rows, int64_t *cols, int64_t *nnz, void **coo_ind, void **coo_val, rocsparse_indextype *idx_type, rocsparse_index_base *idx_base, rocsparse_datatype *data_type)

  Get the fields of the sparse COO AoS matrix descriptor.

  `rocsparse_coo_aos_get` gets the fields of the sparse COO AoS matrix descriptor

  Parameters:

    - descr – [in] the pointer to the sparse COO AoS matrix descriptor.

    - rows – [out] number of rows in the sparse COO AoS matrix.

    - cols – [out] number of columns in the sparse COO AoS matrix.

    - nnz – [out] number of non-zeros in sparse COO AoS matrix.

    - coo_ind – [out] <row, columns> indices of the COO AoS matrix (must be array of length `nnz` ).

    - coo_val – [out] values of the COO AoS matrix (must be array of length `nnz` ).

    - idx_type – [out] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [out] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [out] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `coo_ind` or `coo_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_csr_get

rocsparse_status rocsparse_csr_get(const rocsparse_spmat_descr descr, int64_t *rows, int64_t *cols, int64_t *nnz, void **csr_row_ptr, void **csr_col_ind, void **csr_val, rocsparse_indextype *row_ptr_type, rocsparse_indextype *col_ind_type, rocsparse_index_base *idx_base, rocsparse_datatype *data_type)

  Get the fields of the sparse CSR matrix descriptor.

  `rocsparse_csr_get` gets the fields of the sparse CSR matrix descriptor

  Parameters:

    - descr – [in] the pointer to the sparse CSR matrix descriptor.

    - rows – [out] number of rows in the CSR matrix.

    - cols – [out] number of columns in the CSR matrix

    - nnz – [out] number of non-zeros in the CSR matrix.

    - csr_row_ptr – [out] row offsets of the CSR matrix (must be array of length `rows+1` ).

    - csr_col_ind – [out] column indices of the CSR matrix (must be array of length `nnz` ).

    - csr_val – [out] values of the CSR matrix (must be array of length `nnz` ).

    - row_ptr_type – [out] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - col_ind_type – [out] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [out] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [out] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `csr_row_ptr` or `csr_col_ind` or `csr_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

    - rocsparse_status_invalid_value – if `row_ptr_type` or `col_ind_type` or `idx_base` or `data_type` is invalid.

## rocsparse_ell_get

rocsparse_status rocsparse_ell_get(const rocsparse_spmat_descr descr, int64_t *rows, int64_t *cols, void **ell_col_ind, void **ell_val, int64_t *ell_width, rocsparse_indextype *idx_type, rocsparse_index_base *idx_base, rocsparse_datatype *data_type)

  Get the fields of the sparse ELL matrix descriptor.

  `rocsparse_ell_get` gets the fields of the sparse ELL matrix descriptor

  Parameters:

    - descr – [in] the pointer to the sparse ELL matrix descriptor.

    - rows – [out] number of rows in the ELL matrix.

    - cols – [out] number of columns in the ELL matrix

    - ell_col_ind – [out] column indices of the ELL matrix (must be array of length `rows*ell_width` ).

    - ell_val – [out] values of the ELL matrix (must be array of length `rows*ell_width` ).

    - ell_width – [out] width of the ELL matrix.

    - idx_type – [out] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [out] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [out] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `ell_col_ind` or `ell_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `ell_width` is invalid.

    - rocsparse_status_invalid_value – if `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_bell_get

rocsparse_status rocsparse_bell_get(const rocsparse_spmat_descr descr, int64_t *rows, int64_t *cols, rocsparse_direction *ell_block_dir, int64_t *ell_block_dim, int64_t *ell_cols, void **ell_col_ind, void **ell_val, rocsparse_indextype *idx_type, rocsparse_index_base *idx_base, rocsparse_datatype *data_type)

  Get the fields of the sparse blocked ELL matrix descriptor.

  `rocsparse_bell_get` gets the fields of the sparse blocked ELL matrix descriptor

  Parameters:

    - descr – [in] the pointer to the sparse blocked ELL matrix descriptor.

    - rows – [out] number of rows in the blocked ELL matrix.

    - cols – [out] number of columns in the blocked ELL matrix

    - ell_block_dir – [out] rocsparse_direction_row or rocsparse_direction_column.

    - ell_block_dim – [out] block dimension of the sparse blocked ELL matrix.

    - ell_cols – [out] column indices of the blocked ELL matrix (must be array of length `rows*ell_width` ).

    - ell_col_ind – [out] column indices of the blocked ELL matrix (must be array of length `rows*ell_width` ).

    - ell_val – [out] values of the blocked ELL matrix (must be array of length `rows*ell_width` ).

    - idx_type – [out] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [out] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [out] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `ell_cols` or `ell_col_ind` or `ell_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `ell_block_dim` is invalid.

    - rocsparse_status_invalid_value – if `ell_block_dir` or `idx_type` or `idx_base` or `data_type` is invalid.

## rocsparse_sell_get

rocsparse_status rocsparse_sell_get(const rocsparse_spmat_descr descr, int64_t *rows, int64_t *cols, int64_t *nnz, int64_t *sell_slice_size, int64_t *sell_colval_size, void **sell_slice_offsets, void **sell_col_ind, void **sell_val, rocsparse_indextype *sell_slice_offsets_type, rocsparse_indextype *sell_col_ind_type, rocsparse_index_base *idx_base, rocsparse_datatype *data_type)

  Get the fields of the sparse sliced ELL matrix descriptor.

  `rocsparse_sell_get` gets the fields of the sparse sliced ELL matrix descriptor

  Parameters:

    - descr – [in] the pointer to the sparse sliced ELL matrix descriptor.

    - rows – [out] number of rows in the sliced ELL matrix.

    - cols – [out] number of columns in the sliced ELL matrix

    - nnz – [out] number of non-zeros in the sliced ELL matix.

    - sell_slice_size – [out] slice size in the sliced ELL matrix.

    - sell_colval_size – [out] actual number of elements stored in the sliced ELL matrix.

    - sell_slice_offsets – [out] slice offsets array in the sliced ELL matrix (must be array of length `nslices` + 1 where `nslices=`(rows-1)/sell_slice_size+1 ).

    - sell_col_ind – [out] column indices of the sliced ELL matrix (must be array of length `sell_colval_size` ).

    - sell_val – [out] values of the sliced ELL matrix (must be array of length `sell_colval_size` ).

    - sell_slice_offsets_type – [out] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - sell_col_ind_type – [out] rocsparse_indextype_i32 or rocsparse_indextype_i64.

    - idx_base – [out] rocsparse_index_base_zero or rocsparse_index_base_one.

    - data_type – [out] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `sell_slice_offsets` or `sell_col_ind` or `sell_val` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` or `sell_colval_size` or `sell_slice_size` is invalid.

    - rocsparse_status_invalid_value – if `sell_slice_offsets_type` or `sell_col_ind_type` or `idx_base` or `data_type` is invalid.

## rocsparse_coo_set_pointers

rocsparse_status rocsparse_coo_set_pointers(rocsparse_spmat_descr descr, void *coo_row_ind, void *coo_col_ind, void *coo_val)

  Set the row indices, column indices and values array in the sparse COO matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse vector descriptor.

    - coo_row_ind – [in] row indices of the COO matrix (must be array of length `nnz` ).

    - coo_col_ind – [in] column indices of the COO matrix (must be array of length `nnz` ).

    - coo_val – [in] values of the COO matrix (must be array of length `nnz` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `coo_row_ind` or `coo_col_ind` or `coo_val` is invalid.

## rocsparse_coo_aos_set_pointers

rocsparse_status rocsparse_coo_aos_set_pointers(rocsparse_spmat_descr descr, void *coo_ind, void *coo_val)

  Set the <row, column> indices and values array in the sparse COO AoS matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse vector descriptor.

    - coo_ind – [in] <row, column> indices of the COO matrix (must be array of length `nnz` ).

    - coo_val – [in] values of the COO matrix (must be array of length `nnz` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `coo_ind` or `coo_val` is invalid.

## rocsparse_csr_set_pointers

rocsparse_status rocsparse_csr_set_pointers(rocsparse_spmat_descr descr, void *csr_row_ptr, void *csr_col_ind, void *csr_val)

  Set the row offsets, column indices and values array in the sparse CSR matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse vector descriptor.

    - csr_row_ptr – [in] row offsets of the CSR matrix (must be array of length `rows+1` ).

    - csr_col_ind – [in] column indices of the CSR matrix (must be array of length `nnz` ).

    - csr_val – [in] values of the CSR matrix (must be array of length `nnz` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `coo_ind` or `coo_val` is invalid.

## rocsparse_csc_set_pointers

rocsparse_status rocsparse_csc_set_pointers(rocsparse_spmat_descr descr, void *csc_col_ptr, void *csc_row_ind, void *csc_val)

  Set the column offsets, row indices and values array in the sparse CSC matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse vector descriptor.

    - csc_col_ptr – [in] column offsets of the CSC matrix (must be array of length `cols+1` ).

    - csc_row_ind – [in] row indices of the CSC matrix (must be array of length `nnz` ).

    - csc_val – [in] values of the CSC matrix (must be array of length `nnz` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `csc_col_ptr` or `csc_row_ind` or `csc_val` is invalid.

## rocsparse_ell_set_pointers

rocsparse_status rocsparse_ell_set_pointers(rocsparse_spmat_descr descr, void *ell_col_ind, void *ell_val)

  Set the column indices and values array in the sparse ELL matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse vector descriptor.

    - ell_col_ind – [in] column indices of the ELL matrix (must be array of length `rows*ell_width` ).

    - ell_val – [in] values of the ELL matrix (must be array of length `rows*ell_width` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `ell_col_ind` or `ell_val` is invalid.

## rocsparse_bsr_set_pointers

rocsparse_status rocsparse_bsr_set_pointers(rocsparse_spmat_descr descr, void *bsr_row_ptr, void *bsr_col_ind, void *bsr_val)

  Set the row offsets, column indices and values array in the sparse BSR matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse vector descriptor.

    - bsr_row_ptr – [in] row offsets of the BSR matrix (must be array of length `rows+1` ).

    - bsr_col_ind – [in] column indices of the BSR matrix (must be array of length `nnzb` ).

    - bsr_val – [in] values of the BSR matrix (must be array of length `nnzb*block_dim*block_dim` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `bsr_row_ptr` or `bsr_col_ind` or `bsr_val` is invalid.

## rocsparse_spmat_get_size

rocsparse_status rocsparse_spmat_get_size(rocsparse_const_spmat_descr descr, int64_t *rows, int64_t *cols, int64_t *nnz)

  Get the number of rows, columns and non-zeros from the sparse matrix descriptor.

  Parameters:

    - descr – [in] the pointer to the sparse matrix descriptor.

    - rows – [out] number of rows in the sparse matrix.

    - cols – [out] number of columns in the sparse matrix.

    - nnz – [out] number of non-zeros in sparse matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `nnz` is invalid.

## rocsparse_spmat_get_nnz

rocsparse_status rocsparse_spmat_get_nnz(rocsparse_const_spmat_descr descr, int64_t *nnz)

  Get the number of non-zeros from the sparse matrix descriptor.

  Note

  The returned number of non-zeros is the number of elements of the array of values of the sparse matrix.

  Parameters:

    - descr – [in] the pointer to the sparse matrix descriptor.

    - nnz – [out] the number of non-zeros of the sparse matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `nnz` is invalid.

## rocsparse_spmat_get_format

rocsparse_status rocsparse_spmat_get_format(rocsparse_const_spmat_descr descr, rocsparse_format *format)

  Get the sparse matrix format from the sparse matrix descriptor.

  Parameters:

    - descr – [in] the pointer to the sparse matrix descriptor.

    - format – [out] rocsparse_format_coo or rocsparse_format_coo_aos or rocsparse_format_csr or rocsparse_format_csc or rocsparse_format_ell

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_value – if `format` is invalid.

## rocsparse_spmat_get_index_base

rocsparse_status rocsparse_spmat_get_index_base(rocsparse_const_spmat_descr descr, rocsparse_index_base *idx_base)

  Get the sparse matrix index base from the sparse matrix descriptor.

  Parameters:

    - descr – [in] the pointer to the sparse matrix descriptor.

    - idx_base – [out] rocsparse_index_base_zero or rocsparse_index_base_one

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_value – if `idx_base` is invalid.

## rocsparse_spmat_get_values

rocsparse_status rocsparse_spmat_get_values(rocsparse_spmat_descr descr, void **values)

  Get the values array from the sparse matrix descriptor.

  Parameters:

    - descr – [in] the pointer to the sparse matrix descriptor.

    - values – [out] values array of the sparse matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

## rocsparse_spmat_set_values

rocsparse_status rocsparse_spmat_set_values(rocsparse_spmat_descr descr, void *values)

  Set the values array in the sparse matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse matrix descriptor.

    - values – [in] values array of the sparse matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

## rocsparse_spmat_get_strided_batch

rocsparse_status rocsparse_spmat_get_strided_batch(rocsparse_const_spmat_descr descr, rocsparse_int *batch_count)

  Get the strided batch count from the sparse matrix descriptor.

  Parameters:

    - descr – [in] the pointer to the sparse matrix descriptor.

    - batch_count – [out] batch_count of the sparse matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_size – if `batch_count` is invalid.

## rocsparse_spmat_set_strided_batch

rocsparse_status rocsparse_spmat_set_strided_batch(rocsparse_spmat_descr descr, rocsparse_int batch_count)

  Set the strided batch count in the sparse matrix descriptor.

  Parameters:

    - descr – [in] the pointer to the sparse matrix descriptor.

    - batch_count – [in] batch_count of the sparse matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_size – if `batch_count` is invalid.

## rocsparse_coo_set_strided_batch

rocsparse_status rocsparse_coo_set_strided_batch(rocsparse_spmat_descr descr, rocsparse_int batch_count, int64_t batch_stride)

  Set the batch count and batch stride in the sparse COO matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse COO matrix descriptor.

    - batch_count – [in] batch_count of the sparse COO matrix.

    - batch_stride – [in] batch stride of the sparse COO matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_size – if `batch_count` or `batch_stride` is invalid.

## rocsparse_csr_set_strided_batch

rocsparse_status rocsparse_csr_set_strided_batch(rocsparse_spmat_descr descr, rocsparse_int batch_count, int64_t offsets_batch_stride, int64_t columns_values_batch_stride)

  Set the batch count, row offset batch stride and the column indices batch stride in the sparse CSR matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse CSR matrix descriptor.

    - batch_count – [in] batch_count of the sparse CSR matrix.

    - offsets_batch_stride – [in] row offset batch stride of the sparse CSR matrix.

    - columns_values_batch_stride – [in] column indices batch stride of the sparse CSR matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_size – if `batch_count` or `offsets_batch_stride` or `columns_values_batch_stride` is invalid.

## rocsparse_csc_set_strided_batch

rocsparse_status rocsparse_csc_set_strided_batch(rocsparse_spmat_descr descr, rocsparse_int batch_count, int64_t offsets_batch_stride, int64_t rows_values_batch_stride)

  Set the batch count, column offset batch stride and the row indices batch stride in the sparse CSC matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse CSC matrix descriptor.

    - batch_count – [in] batch_count of the sparse CSC matrix.

    - offsets_batch_stride – [in] column offset batch stride of the sparse CSC matrix.

    - rows_values_batch_stride – [in] row indices batch stride of the sparse CSC matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_size – if `batch_count` or `offsets_batch_stride` or `rows_values_batch_stride` is invalid.

## rocsparse_spmat_get_attribute

rocsparse_status rocsparse_spmat_get_attribute(rocsparse_const_spmat_descr descr, rocsparse_spmat_attribute attribute, void *data, size_t data_size)

  Get the requested attribute data from the sparse matrix descriptor.

  Parameters:

    - descr – [in] the pointer to the sparse matrix descriptor.

    - attribute – [in] rocsparse_spmat_fill_mode or rocsparse_spmat_diag_type or rocsparse_spmat_matrix_type or rocsparse_spmat_storage_mode

    - data – [out] attribute data

    - data_size – [in] attribute data size.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `data` is invalid.

    - rocsparse_status_invalid_value – if `attribute` is invalid.

    - rocsparse_status_invalid_size – if `data_size` is invalid.

## rocsparse_spmat_set_attribute

rocsparse_status rocsparse_spmat_set_attribute(rocsparse_spmat_descr descr, rocsparse_spmat_attribute attribute, const void *data, size_t data_size)

  Set the requested attribute data in the sparse matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the sparse matrix descriptor.

    - attribute – [in] rocsparse_spmat_fill_mode or rocsparse_spmat_diag_type or rocsparse_spmat_matrix_type or rocsparse_spmat_storage_mode

    - data – [in] attribute data

    - data_size – [in] attribute data size.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `data` is invalid.

    - rocsparse_status_invalid_value – if `attribute` is invalid.

    - rocsparse_status_invalid_size – if `data_size` is invalid.

## rocsparse_create_dnvec_descr

rocsparse_status rocsparse_create_dnvec_descr(rocsparse_dnvec_descr *descr, int64_t size, void *values, rocsparse_datatype data_type)

  Create a dense vector descriptor.

  `rocsparse_create_dnvec_descr` creates a dense vector descriptor. It should be destroyed at the end using rocsparse_destroy_dnvec_descr().

  Parameters:

    - descr – [out] the pointer to the dense vector descriptor.

    - size – [in] size of the dense vector.

    - values – [in] non-zero values in the dense vector (must be array of length `size` ).

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

    - rocsparse_status_invalid_size – if `size` is invalid.

    - rocsparse_status_invalid_value – if `data_type` is invalid.

## rocsparse_create_const_dnvec_descr

rocsparse_status rocsparse_create_const_dnvec_descr(rocsparse_const_dnvec_descr *descr, int64_t size, const void *values, rocsparse_datatype data_type)

  Create a dense vector descriptor.

  `rocsparse_create_dnvec_descr` creates a dense vector descriptor. It should be destroyed at the end using rocsparse_destroy_dnvec_descr().

  Parameters:

    - descr – [out] the pointer to the dense vector descriptor.

    - size – [in] size of the dense vector.

    - values – [in] non-zero values in the dense vector (must be array of length `size` ).

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

    - rocsparse_status_invalid_size – if `size` is invalid.

    - rocsparse_status_invalid_value – if `data_type` is invalid.

## rocsparse_destroy_dnvec_descr

rocsparse_status rocsparse_destroy_dnvec_descr(rocsparse_const_dnvec_descr descr)

  Destroy a dense vector descriptor.

  `rocsparse_destroy_dnvec_descr` destroys a dense vector descriptor and releases all resources used by the descriptor.

  Parameters:

    descr – [in] the matrix descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` is invalid.

## rocsparse_dnvec_get

rocsparse_status rocsparse_dnvec_get(const rocsparse_dnvec_descr descr, int64_t *size, void **values, rocsparse_datatype *data_type)

  Get the fields of the dense vector descriptor.

  `rocsparse_dnvec_get` gets the fields of the dense vector descriptor

  Parameters:

    - descr – [in] the pointer to the dense vector descriptor.

    - size – [out] size of the dense vector.

    - values – [out] non-zero values in the dense vector (must be array of length `size` ).

    - data_type – [out] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

    - rocsparse_status_invalid_size – if `size` is invalid.

    - rocsparse_status_invalid_value – if `data_type` is invalid.

## rocsparse_dnvec_get_values

rocsparse_status rocsparse_dnvec_get_values(const rocsparse_dnvec_descr descr, void **values)

  Get the values array from a dense vector descriptor.

  Parameters:

    - descr – [in] the matrix descriptor.

    - values – [out] non-zero values in the dense vector (must be array of length `size` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` or `values` is invalid.

## rocsparse_dnvec_set_values

rocsparse_status rocsparse_dnvec_set_values(rocsparse_dnvec_descr descr, void *values)

  Set the values array in a dense vector descriptor.

  Parameters:

    - descr – [inout] the matrix descriptor.

    - values – [in] non-zero values in the dense vector (must be array of length `size` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` or `values` is invalid.

## rocsparse_create_dnmat_descr

rocsparse_status rocsparse_create_dnmat_descr(rocsparse_dnmat_descr *descr, int64_t rows, int64_t cols, int64_t ld, void *values, rocsparse_datatype data_type, rocsparse_order order)

  Create a dense matrix descriptor.

  `rocsparse_create_dnmat_descr` creates a dense matrix descriptor. It should be destroyed at the end using rocsparse_destroy_dnmat_descr().

  Parameters:

    - descr – [out] the pointer to the dense matrix descriptor.

    - rows – [in] number of rows in the dense matrix.

    - cols – [in] number of columns in the dense matrix.

    - ld – [in] leading dimension of the dense matrix.

    - values – [in] non-zero values in the dense vector (must be array of length `ld*rows` if `order=rocsparse_order_column` or `ld*cols` if `order=rocsparse_order_row` ).

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

    - order – [in] rocsparse_order_row or rocsparse_order_column.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `ld` is invalid.

    - rocsparse_status_invalid_value – if `data_type` or `order` is invalid.

## rocsparse_create_const_dnmat_descr

rocsparse_status rocsparse_create_const_dnmat_descr(rocsparse_const_dnmat_descr *descr, int64_t rows, int64_t cols, int64_t ld, const void *values, rocsparse_datatype data_type, rocsparse_order order)

  Create a dense matrix descriptor.

  `rocsparse_create_dnmat_descr` creates a dense matrix descriptor. It should be destroyed at the end using rocsparse_destroy_dnmat_descr().

  Parameters:

    - descr – [out] the pointer to the dense matrix descriptor.

    - rows – [in] number of rows in the dense matrix.

    - cols – [in] number of columns in the dense matrix.

    - ld – [in] leading dimension of the dense matrix.

    - values – [in] non-zero values in the dense vector (must be array of length `ld*rows` if `order=rocsparse_order_column` or `ld*cols` if `order=rocsparse_order_row` ).

    - data_type – [in] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

    - order – [in] rocsparse_order_row or rocsparse_order_column.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `ld` is invalid.

    - rocsparse_status_invalid_value – if `data_type` or `order` is invalid.

## rocsparse_destroy_dnmat_descr

rocsparse_status rocsparse_destroy_dnmat_descr(rocsparse_const_dnmat_descr descr)

  Destroy a dense matrix descriptor.

  `rocsparse_destroy_dnmat_descr` destroys a dense matrix descriptor and releases all resources used by the descriptor.

  Parameters:

    descr – [in] the matrix descriptor.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` is invalid.

## rocsparse_dnmat_get

rocsparse_status rocsparse_dnmat_get(const rocsparse_dnmat_descr descr, int64_t *rows, int64_t *cols, int64_t *ld, void **values, rocsparse_datatype *data_type, rocsparse_order *order)

  Get the fields of the dense matrix descriptor.

  Parameters:

    - descr – [in] the pointer to the dense matrix descriptor.

    - rows – [out] number of rows in the dense matrix.

    - cols – [out] number of columns in the dense matrix.

    - ld – [out] leading dimension of the dense matrix.

    - values – [out] non-zero values in the dense matrix (must be array of length `ld*rows` if `order=rocsparse_order_column` or `ld*cols` if `order=rocsparse_order_row` ).

    - data_type – [out] rocsparse_datatype_f32_r, rocsparse_datatype_f64_r, rocsparse_datatype_f32_c or rocsparse_datatype_f64_c.

    - order – [out] rocsparse_order_row or rocsparse_order_column.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

    - rocsparse_status_invalid_size – if `rows` or `cols` or `ld` is invalid.

    - rocsparse_status_invalid_value – if `data_type` or `order` is invalid.

## rocsparse_dnmat_get_values

rocsparse_status rocsparse_dnmat_get_values(const rocsparse_dnmat_descr descr, void **values)

  Get the values array from the dense matrix descriptor.

  Parameters:

    - descr – [in] the pointer to the dense matrix descriptor.

    - values – [out] non-zero values in the dense matrix (must be array of length `ld*rows` if `order=rocsparse_order_column` or `ld*cols` if `order=rocsparse_order_row` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` or `values` is invalid.

## rocsparse_dnmat_set_values

rocsparse_status rocsparse_dnmat_set_values(rocsparse_dnmat_descr descr, void *values)

  Set the values array in a dense matrix descriptor.

  Parameters:

    - descr – [inout] the matrix descriptor.

    - values – [in] non-zero values in the dense matrix (must be array of length `ld*rows` if `order=rocsparse_order_column` or `ld*cols` if `order=rocsparse_order_row` ).

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – `descr` or `values` is invalid.

## rocsparse_dnmat_get_strided_batch

rocsparse_status rocsparse_dnmat_get_strided_batch(rocsparse_const_dnmat_descr descr, rocsparse_int *batch_count, int64_t *batch_stride)

  Get the batch count and batch stride from the dense matrix descriptor.

  Parameters:

    - descr – [in] the pointer to the dense matrix descriptor.

    - batch_count – [out] the batch count in the dense matrix.

    - batch_stride – [out] the batch stride in the dense matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_size – if `batch_count` or `batch_stride` is invalid.

## rocsparse_dnmat_set_strided_batch

rocsparse_status rocsparse_dnmat_set_strided_batch(rocsparse_dnmat_descr descr, rocsparse_int batch_count, int64_t batch_stride)

  Set the batch count and batch stride in the dense matrix descriptor.

  Parameters:

    - descr – [inout] the pointer to the dense matrix descriptor.

    - batch_count – [in] the batch count in the dense matrix.

    - batch_stride – [in] the batch stride in the dense matrix.

  Return values:

    - rocsparse_status_success – the operation completed successfully.

    - rocsparse_status_invalid_pointer – if `descr` is invalid.

    - rocsparse_status_invalid_size – if `batch_count` or `batch_stride` is invalid.