Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

Error in mkl_sparse_z_set_value

$
0
0

Hello,

I am struggling to change a single value of a matrix in internal Intel Sparse BLAS format using the mkl_sparse_z_set_value function. Most of the time  this function returns a value of 3. However, it does work some times! I have checked the status of memory allocation and also mkl_sparse_z_create_csr and there is no problem with them. Any idea why this issue is happening? Here is the code:

// Matrix size is Mat_Size x Mat_Size
// This matrix is going to be a diagonal matrix so the maximum number of non-zeros will be equal to Mat_Size

int Mat_Size = 10;

sparse_matrix_t  Ysh_CSR = NULL;
MKL_Complex16 *Ysh_val = NULL;
MKL_INT *Ysh_col = NULL;
MKL_INT *Ysh_row = NULL;

Ysh_val = (MKL_Complex16 *)mkl_malloc(Mat_Size * sizeof(MKL_Complex16), 64);
Ysh_col = (MKL_INT *)mkl_malloc(Mat_Size * sizeof(MKL_INT), 64);
Ysh_row = (MKL_INT *)mkl_malloc((Mat_Size + 1) * sizeof(MKL_INT), 64); // +1 is because we are using 3-aaray variation

mkl_sparse_z_create_csr(&Ysh_CSR, SPARSE_INDEX_BASE_ZERO, Mat_Size, Mat_Size, Ysh_row, Ysh_row + 1, Ysh_col, Ysh_val);

MKL_Complex16 temp;
temp.real = 2 ;
temp.imag = 3 ;

int info = mkl_sparse_z_set_value(Ysh_CSR, 1, 1, temp); // set the value of Ysh_CSR[1][1] to temp

printf("info is %i", info);


Viewing all articles
Browse latest Browse all 3005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>