Dense Matrix APIs#
The NVPL Sparse helper functions for dense matrix descriptor are described in this section.
See the Dense Matrix Format section for the detailed description of the storage format.
nvpl_sparse_create_dn_mat()#
nvpl_sparse_status_t
nvpl_sparse_create_dn_mat(nvpl_sparse_dn_mat_descr_t* dn_mat_descr,
int64_t rows,
int64_t cols,
int64_t ld,
void* values,
nvpl_sparse_data_type_t value_type,
nvpl_sparse_order_t order)
nvpl_sparse_status_t
nvpl_sparse_create_const_dn_mat(nvpl_sparse_const_dn_mat_descr_t* dn_mat_descr,
int64_t rows,
int64_t cols,
int64_t ld,
const void* values,
nvpl_sparse_data_type_t value_type,
nvpl_sparse_order_t order);
The function initializes the dense matrix descriptor dn_mat_descr.
Note
This function does not copy the data.
The caller is responsible for ensuring that the data is valid and accessible until the descriptor is destroyed. While the data is not copied, certain metadata can be computed and stored in the descriptor. As a result, modifying the provided buffer after the descriptor is created might result in undefined behavior.
Param. |
In/out |
Meaning |
|---|---|---|
|
OUT |
Dense matrix descriptor |
|
IN |
Number of rows of the dense matrix |
|
IN |
Number of columns of the dense matrix |
|
IN |
Leading dimension of the dense matrix |
|
IN |
Values of the dense matrix. |
|
IN |
Enumerator specifying the datatype of |
|
IN |
Enumerator specifying the memory layout of the dense matrix |
nvpl_sparse_create_dn_mat() has the following constraints:
valuesmust be aligned to the size of the datatype specified byvalue_type. See nvpl_sparse_data_type_t for the description of the datatypes.
See nvpl_sparse_status_t for the description of the return status.
nvpl_sparse_destroy_dn_mat()#
nvpl_sparse_status_t
nvpl_sparse_destroy_dn_mat(nvpl_sparse_const_dn_mat_descr_t dn_mat_descr)
This function releases the host memory allocated for the dense matrix descriptor dn_mat_descr.
Param. |
In/out |
Meaning |
|---|---|---|
|
IN |
Dense matrix descriptor |
See nvpl_sparse_status_t for the description of the return status.
nvpl_sparse_dn_mat_get()#
nvpl_sparse_status_t
nvpl_sparse_dn_mat_get(nvpl_sparse_dn_mat_descr_t dn_mat_descr,
int64_t* rows,
int64_t* cols,
int64_t* ld,
void** values,
nvpl_sparse_data_type_t* type,
nvpl_sparse_order_t* order)
nvpl_sparse_status_t
nvpl_sparse_const_dn_mat_get(nvpl_sparse_const_dn_mat_descr_t dn_mat_descr,
int64_t* rows,
int64_t* cols,
int64_t* ld,
const void** values,
nvpl_sparse_data_type_t* type,
nvpl_sparse_order_t* order)
This function returns the fields of the dense matrix descriptor dn_mat_descr.
Param. |
In/out |
Meaning |
|---|---|---|
|
IN |
Dense matrix descriptor |
|
OUT |
Number of rows of the dense matrix |
|
OUT |
Number of columns of the dense matrix |
|
OUT |
Leading dimension of the dense matrix |
|
OUT |
Values of the dense matrix. |
|
OUT |
Enumerator specifying the datatype of |
|
OUT |
Enumerator specifying the memory layout of the dense matrix |
See nvpl_sparse_status_t for the description of the return status.
nvpl_sparse_dn_mat_get_values()#
nvpl_sparse_status_t
nvpl_sparse_dn_mat_get_values(nvpl_sparse_dn_mat_descr_t dn_mat_descr,
void** values)
nvpl_sparse_status_t
nvpl_sparse_const_dn_mat_get_values(nvpl_sparse_const_dn_mat_descr_t dn_mat_descr,
const void** values)
This function returns the values field of the dense matrix descriptor dn_mat_descr.
Param. |
In/out |
Meaning |
|---|---|---|
|
IN |
Dense matrix descriptor |
|
OUT |
Values of the dense matrix. Array with |
See nvpl_sparse_status_t for the description of the return status.
nvpl_sparse_dn_mat_set_values()#
nvpl_sparse_status_t
nvpl_sparse_dn_mat_set_values(nvpl_sparse_dn_mat_descr_t dn_mat_descr,
void* values)
This function sets the values field of the dense matrix descriptor dn_mat_descr.
Param. |
In/out |
Meaning |
|---|---|---|
|
IN |
Dense matrix descriptor |
|
IN |
Values of the dense matrix. Array with |
nvpl_sparse_dn_mat_set_values() has the following constraints:
valuesmust be aligned to the size of the datatype specified indn_mat_descr. See nvpl_sparse_data_type_t for the description of the datatypes.
See nvpl_sparse_status_t for the description of the return status.