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_matrix_set_csr

Updates a graph matrix with the data in CSR format.

Syntax

mkl_graph_status_t mkl_graph_matrix_set_csr (mkl_graph_matrix_t A, int64_t nrows, int64_t ncols, void *rows_start, mkl_graph_type_t rows_start_type, void *col_indx, mkl_graph_type_t col_indx_type, void *values, mkl_graph_type_t values_type);

Include Files
  • mkl_graph.h

Description

The mkl_graph_matrix_set_csr routine updates CSR data (in the 3-array variation) associated with a graph matrix A. All arguments except the input graph matrix A and the matrix dimensions nrows and ncols are optional and will not be used if they are not set. This means that if NULL is passed for one of the CSR arrays rows_start, col_indx 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.

Refer to Sparse Matrix Storage Formats for further details on the CSR format.

NOTE:

The graph matrix must be created via a call to mkl_graph_matrix_create before calling mkl_graph_matrix_set_csr.

NOTE:

If the matrix already has the specified format on entry to the routine, the existing data is replaced by the new data and existing internal optimized data is deallocated. To create new optimized data after changing the matrix data, call a corresponding mkl_graph_optimize_? routine.

Input Parameters
A

A graph matrix to be modified.

nrows

Number of rows in the matrix.

ncols

Number of columns in the matrix.

rows_start

A pointer to the start of the rows_start array. The array must be of length at least (nrows+1). The array contains row indices such that rows_start[i] is the index of the first non-zero entry in row i in the arrays col_indx and values. Or, in other words, rows_start[i+1] - rows_start[i] is always the number of non-zero elements in row i and the value rows_start[nrows]-rows_start[0] should be the total number of non-zero entries in the matrix. The type of the array elements is derived from the rows_start_type argument.

Ignored if NULL.

Refer to pointerB array description in CSR Format for more details.

rows_start_type

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

col_indx

A pointer to the start of the col_indx array. The array must be of length at least rows_start[nrows]-rows_start[0]. The array contains zero-based column indices for the non-zero entries of the matrix A. The type of the array elements is derived from the col_indx_type argument. Ignored if NULL.

Refer to columns array description in CSR Format for more details.

col_indx_type

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

values

A pointer to the start of the values array. The array must be of length at least rows_start[nrows]-rows_start[0]. The array contains values for the non-zero entries of the matrix A. The type of the array elements is derived from the values_type argument. Ignored if NULL.

Refer to values array description in CSR Format for more details.

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
A

A graph matrix with the updated data in CSR 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