set_coo_matrix_data#
Reset the data of a matrix_handle_t
object with the provided COO data.
Description and Assumptions
The oneapi::mkl::sparse::set_coo_matrix_data
function sets new data to the
matrix_handle_t
object with the provided data.
In the case of buffers, the reference count of the provided buffer is
incremented which extends the lifetime of the underlying buffer until the
smhandle
is destroyed with release_sparse_matrix
or the data is reset
with set_coo_matrix_data
.
In the case of USM, the object does not take ownership of the data.
Also see init_coo_matrix.
set_coo_matrix_data (Buffer version)#
Syntax
namespace oneapi::mkl::sparse {
template <typename dataType, typename indexType>
void set_coo_matrix_data (sycl::queue &queue,
oneapi::mkl::sparse::matrix_handle_t smhandle,
std::int64_t num_rows,
std::int64_t num_cols,
std::int64_t nnz,
index_base index,
sycl::buffer<indexType, 1> row_ind,
sycl::buffer<indexType, 1> col_ind,
sycl::buffer<dataType, 1> val);
}
Template parameters
- dataType
See supported template types. Must be the same type as was used when creating the
matrix_handle_t
.- indexType
See supported template types. Must be the same type as was used when creating the
matrix_handle_t
.
Input parameters
- queue
The SYCL command queue which will be used for SYCL kernels execution.
- smhandle
Handle already initialized with init_coo_matrix.
- num_rows
Number of rows of the provided data
val
. Must be at least 0.- num_cols
Number of columns of the provided data
val
. Must be at least 0.- nnz
The number of explicit entries, also known as Number of Non-Zero elements. Must be at least 0.
- index
Indicates how input arrays are indexed. The possible options are described in index_base enum class.
- row_ind
Buffer of length at least
nnz
containing the row indices inindex
-based numbering. Refer to COO format for detailed description ofrow_ind
.- col_ind
Buffer of length at least
nnz
containing the column indices inindex
-based numbering. Refer to COO format for detailed description ofcol_ind
.- val
Buffer of length at least
nnz
. Contains the data of the input matrix which is not implicitly zero. The remaining input values are implicit zeros. Refer to COO format for detailed description ofval
.
Notes
The parameters
num_rows
,num_cols
andnnz
may be zero if and only ifrow_ind
,col_ind
andval
are zero-sized, otherwise they must be strictly greater than zero.
Throws
This function shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.
set_coo_matrix_data (USM version)#
Syntax
namespace oneapi::mkl::sparse {
template <typename dataType, typename indexType>
void set_coo_matrix_data (sycl::queue &queue,
oneapi::mkl::sparse::matrix_handle_t smhandle,
std::int64_t num_rows,
std::int64_t num_cols,
std::int64_t nnz,
index_base index,
indexType *row_ind,
indexType *col_ind,
dataType *val);
}
Template parameters
- dataType
See supported template types. Must be the same type as was used when creating the
matrix_handle_t
.- indexType
See supported template types. Must be the same type as was used when creating the
matrix_handle_t
.
Input parameters
- queue
The SYCL command queue which will be used for SYCL kernels execution.
- smhandle
Handle already initialized with init_coo_matrix.
- num_rows
Number of rows of the provided data
val
. Must be at least 0.- num_cols
Number of columns of the provided data
val
. Must be at least 0.- nnz
The number of explicit entries, also known as Number of Non-Zero elements. Must be at least 0.
- index
Indicates how input arrays are indexed. The possible options are described in index_base enum class.
- row_ind
USM pointer of length at least
nnz
containing the row indices inindex
-based numbering. Refer to COO format for detailed description ofrow_ind
. The data must be accessible on the device.- col_ind
USM pointer of length at least
nnz
containing the column indices inindex
-based numbering. Refer to COO format for detailed description ofcol_ind
. The data must be accessible on the device.- val
USM pointer of length at least
nnz
. Contains the data of the input matrix which is not implicitly zero. The remaining input values are implicit zeros. Refer to COO format for detailed description ofval
. The data must be accessible on the device. Using a USM pointer with a smaller allocated memory size is undefined behavior.
Notes
The parameters
num_rows
,num_cols
andnnz
may be zero if and only ifrow_ind
,col_ind
andval
are null pointers, otherwise they must be strictly greater than zero.
Throws
This function shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.
Parent topic: Data handles