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!

Issue with mkl_sparse_z_export_csr

Ahmadi__Afshin
230 Views

Hello,

I use mkl_sparse_z_export_csr to export a CSR handle from internal representation. I double checked the exported values and they are all correct. However, when I use the following code to convert "Values" to conjugate of "Values" everything becomes zero (even the real part which I didn't touch)! Any idea what is going wrong? I am using latest version of Intel MKL 2019. Thank you for your help.

 

sparse_matrix_t C_CSR_Handle = NULL

/* First, I use mkl_sparse_spmm() function to multiply two matrices and save the results in C_CSR_Handle */
mkl_sparse_spmm(SPARSE_OPERATION_NON_TRANSPOSE, A_CSR_Handle, B_CSR_Handle, &C_CSR_Handle)

sparse_index_base_t indexing = 0;
MKL_INT rows, cols;
MKL_INT *JA= NULL, *PointerE = NULL, *IA= NULL;
MKL_Complex16 *Values= NULL;

sparse_index_base_t indexing1 = 0;
MKL_INT rows1, cols1; 
MKL_INT *JA1= NULL, *PointerE1 = NULL, *IA1= NULL; 
MKL_Complex16 *Values1= NULL;

mkl_sparse_z_export_csr(C_CSR_Handle, &indexing, &rows, &cols, &JA, &PointerE, &IA, &Values);
mkl_sparse_z_export_csr(C_CSR_Handle, &indexing1, &rows1, &cols1, &JA1, &PointerE1, &IA1, &Values1);

for (i = 0; i < JA[rows]; i++) {
   printf("values(%i) = %f , %f \n", i, Values.real, Values.imag); // print values before making any changes
   Values.imag = Values.imag*(-1); 
   Values1.imag = Values1.imag*(-1); 
   printf("values(%i) = %f , %f \n", i, Values.real, Values.imag); // print values after modification
}

 

0 Kudos
2 Replies
Ahmadi__Afshin
230 Views

It seems that exporting the same CSR handle twice had caused this problem.

Kirill_V_Intel
Employee
230 Views

Hello,

I've notice that the code has been updated. Do you still see the problem?

Best,
Kirill

Reply