Developer Reference for Intel® oneAPI Math Kernel Library for C

ID 766684
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

mkl_graph_vector_set_sparse

Updates a graph vector with the data in a sparse format.

Syntax

mkl_graph_status_t mkl_graph_vector_set_sparse (mkl_graph_vector_t v, int64_t dim, int64_t nnz, void * indices, mkl_graph_type_t indices_type, void *values, mkl_graph_type_t values_type);

Include Files
  • mkl_graph.h

Description

The mkl_graph_vector_set_sparse routine updates sparse data (indices and values of the entries present) associated with a graph vector v. The sparse representation of a vector comprises two arrays, one of the indices and one of the values of the non-zero entries.

All arguments except the input graph vector v, vector’s dimension dim and the number of non-zero elements nnz are optional and will not be used if they are not set. This means that if NULL is passed for one of the array's indices or values, this argument, as well as the corresponding argument of type mkl_graph_type_t, will be ignored.

The library assumes any buffers passed as arguments to mkl_graph_?_set_? routines persist for the life of the input graph object or until the next call to an mkl_graph_?_set_? routine for an existing format. Calling a set routine on an existing format resets the data of the graph object to the new data. After destroying the graph object or resetting its data, you can safely deallocate data used as input to an mkl_graph_?_set_? routine. Intel® oneAPI Math Kernel Library never deallocates user-allocated memory.

NOTE:

The input graph vector must be created via a call to mkl_graph_vector_create before calling mkl_graph_vector_set_sparse.

NOTE:

If the vector already has the specified format on entry to the routine, the existing data is replaced by the new data.

Input Parameters
v

A graph vector to be modified.

dim

Dimension of the vector.

nnz

Number of non-zero entries in the vector.

indices

A pointer to the start of the indices array. The array must be of length at least nnz. The array contains zero-based indices for the non-zero entries in the vector v. The type of the array elements is derived from the indices_type argument. Ignored if NULL.

indices_type

Type of the elements of indices array. Refer to Graph API Glossary for a list of possible options. Ignored if NULL is passed for indices.

values

A pointer to the start of the values array. The array must be of length at least nnz. The array contains values for the non-zero entries in the vector v. The type of the array elements is derived from the values_type argument. Ignored if NULL.

values_type

Type of the elements of the values array. Refer to Graph API Glossary for a list of possible options. Ignored if NULL is passed for values.

Output Parameters
v

A graph vector with the updated data in the sparse format.

Return Values

The function returns a value indicating whether the operation was successful or not and why. Refer to Graph API Glossary for a list of possible options.

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Notice revision #20201201