Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

sparse matrix sparse matrix multiplication

kirankumarm
Beginner
516 Views
Hi All,
I want to multiply sparse matrix with a sparse matrix. Both matrices are stored in CSR format. The suitable function to do this operation is mkl_scsrmultcsr. I wrote a sample code but I'm getting incorrect result. Can you please help me in debugging the program or provide an example to use this function.

I'm having a i7 980x processor and fc13 OS.

The command I used for compiling is

gcc multiplication.c -L/opt/intel/mkl/lib/intel64 -Wl,--start-group -lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -Wl,--end-group -fopenmp -lpthread -lm

The program is here http://pastebin.com/pf3pJwE8

The output matrix should be [4,0;0,9] ( [2,0;0,3] * [2,0;0,3] ) but the output the program is giving is

Result nnz = 1
ic[0] = 1
ic[1] = 1
ic[2] = 1
0.000000 0

Thanks and Regards,
M. Kiran Kumar.


0 Kudos
1 Reply
Alexander_K_Intel2
516 Views
Hi,
It's seems that you use zero-based indexing in arrays ia and ja in one-based functionmkl_scsrmultcsr. I've change arrays ia and ja in your code from
int ja[] = {0,1};
int ia[] = {0,1,2};
to
int ja[] = {1,2};
int ia[] = {1,2,3};
and got output from your example:
4.000000 1
9.000000 2
0.000000 0
With best regards,
Alexander Kalinkin
0 Kudos
Reply