Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Use mkl_sparse_d_svd for complex matrix

toddwz
Beginner
221 Views

Hi,

 

I'm trying to use mkl_sparse_d_svd for a complex matrix. The code is as below, and gives sig segv. Am I missing anything? I'm using MKL 2023.1. Thanks.

 

MKL_INT N = 1;
MKL_INT ia[] = {0,1};
MKL_INT ja[] = {0};
MKL_Complex16 a; a.real = 2.0; a.imag = 1.0;

char whichE = 'S';
char whichV = 'L';
MKL_INT pm[128];
MKL_INT k0 = 1;
MKL_INT k;
double E[1], XL[1*1], XR[1*1];
double res[1];
struct matrix_descr descr;
descr.type = SPARSE_MATRIX_TYPE_GENERAL;
descr.diag = SPARSE_DIAG_NON_UNIT;
descr.mode = SPARSE_FILL_MODE_FULL;
sparse_matrix_t A = NULL;
sparse_status_t info = mkl_sparse_z_create_csr(&A, SPARSE_INDEX_BASE_ZERO, N, N, ia, ia+1, ja, &a);

/* Call mkl_sparse_ee_init to define default input values */
info = mkl_sparse_ee_init(pm);
/* Call mkl_sparse_d_svd to obtain k0 singular values and singular vectors */
info = mkl_sparse_d_svd(&whichE, &whichV, pm, A, descr, k0, &k, E, XL, XR, res);

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
175 Views


mkl_sparse_[?]_svd supports single and double precision data types only.


see the sneepshot from header file:

sparse_status_t mkl_sparse_d_svd(char *whichE, char *whichV, MKL_INT *pm, sparse_matrix_t A, struct matrix_descr descrA, MKL_INT k0, MKL_INT* k, double *E, double *XL, double *XR, double *res);

sparse_status_t mkl_sparse_s_svd(char *whichE, char *whichV, MKL_INT *pm, sparse_matrix_t A, struct matrix_descr descrA, MKL_INT k0, MKL_INT* k, float *E, float *XL, float *XR, float *res);


You created descriptor for Complex but sent it for double precision of mkl_sparse_d_svd routines. It caused the seq fault.


--Gennady


View solution in original post

0 Kudos
1 Reply
Gennady_F_Intel
Moderator
176 Views


mkl_sparse_[?]_svd supports single and double precision data types only.


see the sneepshot from header file:

sparse_status_t mkl_sparse_d_svd(char *whichE, char *whichV, MKL_INT *pm, sparse_matrix_t A, struct matrix_descr descrA, MKL_INT k0, MKL_INT* k, double *E, double *XL, double *XR, double *res);

sparse_status_t mkl_sparse_s_svd(char *whichE, char *whichV, MKL_INT *pm, sparse_matrix_t A, struct matrix_descr descrA, MKL_INT k0, MKL_INT* k, float *E, float *XL, float *XR, float *res);


You created descriptor for Complex but sent it for double precision of mkl_sparse_d_svd routines. It caused the seq fault.


--Gennady


0 Kudos
Reply