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?
Thanks for the question. I can see the same result (nnz) as you mentioned. There are some typo in the mkl manual
job(5) --> job
job=nzmax- maximum number of the non-zero elements allowed if job=0.
job=nnz- sets number of the non-zero elements of the matrix A if job=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.
We confirmed there is old issue that we use internally both job 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 = number of nonzero elements in coordinate format.
Just update the thread, we fix the related issue in later version. for example, the latest version MKL 2017 update 1 have below description:
Array, contains the following conversion parameters:
If job=0, the matrix in the CSR format is converted to the coordinate format;
if job=1, the matrix in the coordinate format is converted to the CSR format.
if job=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.
Specifies the number of non-zero elements of the matrix A for job≠0.
Refer to nnz description in Coordinate Format for more details.
Returns the number of converted elements of the matrix A for job=0.