Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

mkl_?csrcoo -- description of parameter nnz

Roman_F_
Beginner
362 Views

Hello,

is the description of parameter nnz in function mkl_?csrcoo correct?

The manual states that nnz is an output parameter specifying the number of non-zero elements in matrix A. However, I feel like nnz is an input parameter.

A minimal example (conversion of a unit matrix of size 10 from COO to CSR format in C++) only works if I define nnz = 10 before calling the function. If I set, say, nnz = 5, then only the first 5 elements are set in the CSR arrays.

Could someone check or disprove that?

 

0 Kudos
3 Replies
Ying_H_Intel
Employee
362 Views

Hi Roman, 

Thanks for the question. I can see the same result (nnz) as you mentioned. There are some typo in the mkl manual

like 

job(5)   --> job[4]

job[4]=nzmax- maximum number of the non-zero elements allowed if job[0]=0.

job[4]=nnz- sets number of the non-zero elements of the matrix A if job[0]=1  

and it seems there are two parameters to control the nnz parameters, so some design issue here. 

We will check with our developer and get back soon. 

Thanks

Ying 

0 Kudos
Ying_H_Intel
Employee
362 Views

Hi Roman, 

We confirmed there is old issue that we use internally both job[4] and nnz to set number of nonzero elements. we will consider what solution will be the best and remove one of the parameter from input list. Current recommendation to set nnz=job[4] = number of nonzero elements in coordinate format. 

Thanks
Ying 

0 Kudos
Ying_H_Intel
Employee
362 Views

Dear All,

Just update the thread,  we fix the related issue in later version. for example,  the latest version MKL 2017 update 1 have below description:

job

Array, contains the following conversion parameters:

job[0]

If job[0]=0, the matrix in the CSR format is converted to the coordinate format;

if job[0]=1, the matrix in the coordinate format is converted to the CSR format.

if job[0]=2, the matrix in the coordinate format is converted to the CSR format, and the column indices in CSR representation are sorted in the increasing order within each row.

 

 

nnz

Specifies the number of non-zero elements of the matrix A for job[0]0.

Refer to nnz description in Coordinate Format for more details.

 

Output Parameters

nnz

Returns the number of converted elements of the matrix A for job[0]=0.

 

Best Regards

Ying

0 Kudos
Reply