Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
6427 Discussions

## csrcoo garbles unsorted complex16 matrices

Beginner
90 Views

While using csrcoo to convert an unsorted (rows and colums) complex16 (double precision complex) matrix from COO to CSR using the option to sort the columns in the output, I discovered the array of matrix values gets garbled during the sort. The same operation appears to work if the input is already sorted, or using any other data type.

I'm guessing there's something wrong in how it handles swapping/gathering the data in the value arrray. Can anyone confirm?

4 Replies
Employee
90 Views

Would you please provide a simple test case, including a sparse matrix and a code snippet showing how you call mkl_zcsrcoo?

And I also need information on the version of MKL and your OS.

Thanks.

Beginner
90 Views

A small program demonstrating my problem is attached. I am running Linux and using MKL 11.0.

Black Belt
90 Views
I can confirm that the problem exists also on Windows 7, MKL 10.3.12 and 11.0.2, 32- or 64-bit. The example code below has the values of the "val" array contrived such that they are also in sort order when printed out. [fortran] program tcnv integer,parameter :: n=8,nnz=12 integer :: irow(nnz)=(/ 7, 5, 2, 0, 4, 0, 1, 6, 5, 6, 5, 3 /) integer :: icol(nnz)=(/ 7, 2, 2, 1, 4, 0, 1, 6, 7, 1, 5, 2 /) !order C 7 4 2 6 1 3 B 9 A 8 5 complex*16 :: val(nnz)=(/(12,22),(7,17),(4,14),(2,12),(6,16),(1,11), & (3,13),(11,21),(9,19),(10,20),(8,18),(5,15)/) complex*16 :: acsr(nnz) integer :: job(6)=(/2,0,0,0,nnz,0/) integer :: rowptr(n+1),colind(nnz) character*198 :: vers ! call mkl_get_version_string(vers) write(*,'(A)')vers call mkl_zcsrcoo(job,n,acsr,colind,rowptr,nnz,val,irow,icol,info) do i=1,nnz write(*,'(1x,i3,2x,2F8.1)')i,acsr(i) end do end program tcnv [/fortran] The output is not correct: [bash] 1 12.0 2.0 2 1.0 11.0 3 3.0 13.0 4 4.0 5.0 5 14.0 6.0 6 15.0 16.0 7 7.0 17.0 8 9.0 19.0 9 8.0 18.0 10 11.0 21.0 11 10.0 20.0 12 12.0 22.0 [/bash] Change the array to COMPLEX*8 and mkl_zcsrcoo to mkl_ccsrcoo, and you get [bash] 1 1.0 11.0 2 2.0 12.0 3 3.0 13.0 4 4.0 14.0 5 5.0 15.0 6 6.0 16.0 7 7.0 17.0 8 8.0 18.0 9 9.0 19.0 10 10.0 20.0 11 11.0 21.0 12 12.0 22.0 [/bash]
Employee
90 Views

This does look like a bug. This issue is now escalated to the MKL engineering team. Thanks for catching it!