Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
15 Views

Conversion from COO to CSR error

I'm trying to convert a COO matrix to CSR representation. My test code is as follows:

[fortran]integer :: job(8) = (/1, 1, 1, 0, 8, 0, 0, 0/)
integer :: n = 4
double precision :: va(8)
integer :: ja(8)
integer :: ia(5)
integer :: nnz
double precision :: s(8) = (/5, 8, 9, 2, 3, 6, 1, 4/)
integer :: i(8) = (/1, 1, 2, 2, 3, 3, 4, 4/)
integer :: j(8) = (/1, 2, 1, 2, 3, 4, 3, 4/)
integer :: info[/fortran]
[fortran]call mkl_dcsrcoo(job, n, va, ja, ia, nnz, s, i, j, info)[/fortran]
This is the example data included with MKL 10.2. Unfortunately, the data returned in va, ja, and ia makes no sense. The arrays va and ja are both full of zeros and ia is full of ones.
I am compiling the code onLinuxwith:
[bash]ifort test.f90 -L$MKLROOT -Wl,--start-group -lmkl_intel -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp -lpthread -o TEST[/bash]
Am I missing an obvious error?
0 Kudos
1 Reply
Highlighted
Beginner
15 Views

I found my own answer. I should have searched morethoroughly. It seems that there is an error in the mkl_?csrcoo documentation. This problem was also documented here:
The argument nnz seems to need to be an input parameter and set to the number of elements in the matrix. As soon as I changed this everything started to work correctly.
0 Kudos