Dense Vector APIs#
The NVPL Sparse helper functions for dense vector descriptor are described in this section.
See the Dense Vector Format section for the detailed description of the storage format.
nvpl_sparse_create_dn_vec()#
nvpl_sparse_status_t
nvpl_sparse_create_dn_vec(nvpl_sparse_dn_vec_descr_t* dn_vec_descr,
int64_t size,
void* values,
nvpl_sparse_data_type_t value_type)
nvpl_sparse_status_t
nvpl_sparse_create_const_dn_vec(nvpl_sparse_const_dn_vec_descr_t* dn_vec_descr,
int64_t size,
const void* values,
nvpl_sparse_data_type_t value_type)
This function initializes the dense vector descriptor dn_vec_descr
.
Param. |
In/out |
Meaning |
---|---|---|
|
OUT |
Dense vector descriptor |
|
IN |
Size of the dense vector |
|
IN |
Values of the dense vector. Array with |
|
IN |
Enumerator specifying the datatype of |
nvpl_sparse_create_dn_vec()
has the following constraints:
values
must 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_vec()#
nvpl_sparse_status_t
nvpl_sparse_destroy_dn_vec(nvpl_sparse_const_dn_vec_descr_t dn_vec_descr) // non-const descriptor supported
This function releases the host memory allocated for the dense vector descriptor dn_vec_descr
.
Param. |
In/out |
Meaning |
---|---|---|
|
IN |
Dense vector descriptor |
See nvpl_sparse_status_t for the description of the return status.
nvpl_sparse_dn_vec_get()#
nvpl_sparse_status_t
nvpl_sparse_dn_vec_get(nvpl_sparse_dn_vec_descr_t dn_vec_descr,
int64_t* size,
void** values,
nvpl_sparse_data_type* value_type)
nvpl_sparse_status_t
nvpl_sparse_const_dn_vec_get(nvpl_sparse_const_dn_vec_descr_t dn_vec_descr,
int64_t* size,
const void** values,
nvpl_sparse_data_type* value_type)
This function returns the fields of the dense vector descriptor dn_vec_descr
.
Param. |
In/out |
Meaning |
---|---|---|
|
IN |
Dense vector descriptor |
|
OUT |
Size of the dense vector |
|
OUT |
Values of the dense vector. Array with |
|
OUT |
Enumerator specifying the datatype of |
See nvpl_sparse_status_t for the description of the return status.
nvpl_sparse_dn_vec_get_values()#
nvpl_sparse_status_t
nvpl_sparse_dn_vec_get_values(nvpl_sparse_dn_vec_descr_t dn_vec_descr,
void** values)
nvpl_sparse_status_t
nvpl_sparse_const_dn_vec_get_values(nvpl_sparse_const_dn_vec_descr_t dn_vec_descr,
const void** values)
This function returns the values
field of the dense vector descriptor dn_vec_descr
.
Param. |
In/out |
Meaning |
---|---|---|
|
IN |
Dense vector descriptor |
|
OUT |
Values of the dense vector |
See nvpl_sparse_status_t for the description of the return status.
nvpl_sparse_dn_vec_set_values()#
nvpl_sparse_status_t
nvpl_sparse_dn_vec_set_values(nvpl_sparse_dn_vec_descr_t dn_vec_descr,
void* values)
This function set the values
field of the dense vector descriptor dn_vec_descr
.
Param. |
In/out |
Meaning |
---|---|---|
|
IN |
Dense vector descriptor |
|
IN |
Values of the dense vector. Array with |
nvpl_sparse_dn_vec_set_values()
has the following constraints:
values
must be aligned to the size of the datatype specified indn_vec_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.