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

Using pardiso for complex number matrices

worakanok
Beginner
391 Views
Hi,

I am writing a linear solving routing in visual studio (C++) 2008. When I used pardiso to solve real number matrices, it worked just fine. Then I wanted to use it for complex number matrices. I got the errors below.

error LNK2028: unresolved token (0A000037) "int __cdecl PARDISO(void *,int *,int *,int *,int *,int *,struct _doublecomplex *,int *,int *,int *,int *,int *,int *,struct _doublecomplex *,struct _doublecomplex *,int *)" (?PARDISO@@$FYAHPAXPAH1111PAU_doublecomplex@@111111221@Z) referenced in function "public: cli::array^" (?LinearSolver@NewtonComplex@@$FQ$AAMP$01AP$AAVComplex@@XZ)


error LNK2019: unresolved external symbol "int __cdecl PARDISO(void *,int *,int *,int *,int *,int *,struct _doublecomplex *,int *,int *,int *,int *,int *,int *,struct _doublecomplex *,struct _doublecomplex *,int *)" (?PARDISO@@$FYAHPAXPAH1111PAU_doublecomplex@@111111221@Z) referenced in function "public: cli::array^" (?LinearSolver@NewtonComplex@@$FQ$AAMP$01AP$AAVComplex@@XZ)

I used to get the exact same error messages when i forgot to #include"mkl_pardiso.h" in real number cases so I'm thinking maybe I need to include additional header files.

Is there any difference in linking pardiso between complex- and real-number systems? Pls helppp :(
0 Kudos
5 Replies
VipinKumar_E_Intel
391 Views

If you are calling PARDISO from C/C++ program, please take a look at file mkl_dss.h to learn which complex types you can use for complex arrays. For example you can describe the array of non-zeros as follows:

_DOUBLE_COMPLEX_t cValues[your size];

--Vipin
0 Kudos
worakanok
Beginner
391 Views

If you are calling PARDISO from C/C++ program, please take a look at file mkl_dss.h to learn which complex types you can use for complex arrays. For example you can describe the array of non-zeros as follows:

_DOUBLE_COMPLEX_t cValues[your size];

--Vipin

My input array of non-zeros is

doublecomplex* a = new doublecomplex[nonZeros];

I kinda copied the structure from pardiso_unsym_complex_c.c from the example folder.

I'll try changing it to _DOUBLE_COMPLEX_t cValues[your size]; and let me know if it works. Thanks.

0 Kudos
worakanok
Beginner
391 Views

If you are calling PARDISO from C/C++ program, please take a look at file mkl_dss.h to learn which complex types you can use for complex arrays. For example you can describe the array of non-zeros as follows:

_DOUBLE_COMPLEX_t cValues[your size];

--Vipin

T.T i still got the same error messages.

1>NewtonComplex.obj : error LNK2019: unresolved external symbol "int __cdecl PARDISO(void *,int *,int *,int *,int *,int *,struct _DOUBLE_COMPLEX_t *,int *,int *,int *,int *,int *,int *,struct _DOUBLE_COMPLEX_t *,struct _DOUBLE_COMPLEX_t *,int *)" (?PARDISO@@$FYAHPAXPAH1111PAU_DOUBLE_COMPLEX_t@@111111221@Z) referenced in function "public: cli::array^" (?LinearSolver@NewtonComplex@@$FQ$AAMP$01AP$AAVComplex@@XZ)

My code looks like this

#include "stdafx.h"
#include "NewtonComplex.h"
#include "math.h"
#include "stdlib.h"
#include "stdio.h"
#include "mkl_pardiso.h"
#include "mkl_dss.h"

/* PARDISO prototype. */
#if defined(_WIN32) || defined(_WIN64)
#define pardiso_ PARDISO
#else
#define PARDISO pardiso_
#endif
#if defined(MKL_ILP64)
#define MKL_INT long long
#else
#define MKL_INT int
#endif

typedef struct _doublecomplex{
double re;
double i;}
doublecomplex;

extern MKL_INT PARDISO(void *, MKL_INT *, MKL_INT *, MKL_INT *, MKL_INT *, MKL_INT *,DOUBLE_COMPLEX_t *, MKL_INT *, MKL_INT *, MKL_INT *, MKL_INT *, MKL_INT *, MKL_INT *, _DOUBLE_COMPLEX_t *, _DOUBLE_COMPLEX_t *, MKL_INT *);

------Input parameters and matrix data look something like ----->>

_DOUBLE_COMPLEX_t* a = new _DOUBLE_COMPLEX_t[nonZeros];
for (int i = 0; i {
a.r = JArray->real;
a.i = JArray->imag;
}

MKL_INT mtype = 13; /* Complex unsymmetric matrix */
_DOUBLE_COMPLEX_t* b = new _DOUBLE_COMPLEX_t[numVar];
_DOUBLE_COMPLEX_t* x = new _DOUBLE_COMPLEX_t[numVar];

-------Then to call Pardiso ------>>
phase = 11;
PARDISO (pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja, &idum, &nrhs,iparm, &msglvl, &ddum, &ddum, &error);

This is where I got the error. without the PARDISO(.....) line, the code compiled no problem.

Thank you.

0 Kudos
worakanok
Beginner
391 Views
When I tried to run the pardiso_unsym_complex_c.c (from the MKL's examples folder) by copied the whole code into a new class called Test, I got these error messages:

1>test.obj : error LNK2028: unresolved token (0A00003C) "int __cdecl PARDISO(void *,int *,int *,int *,int *,int *,struct doublecomplex *,int *,int *,int *,int *,int *,int *,struct doublecomplex *,struct doublecomplex *,int *)" (?PARDISO@@$FYAHPAXPAH1111PAUdoublecomplex@@111111221@Z) referenced in function "public: __clrcall Test::Test(void)" (??0Test@@$FQ$AAM@XZ)

1>test.obj : error LNK2019: unresolved external symbol "int __cdecl PARDISO(void *,int *,int *,int *,int *,int *,struct doublecomplex *,int *,int *,int *,int *,int *,int *,struct doublecomplex *,struct doublecomplex *,int *)" (?PARDISO@@$FYAHPAXPAH1111PAUdoublecomplex@@111111221@Z) referenced in function "public: __clrcall Test::Test(void)" (??0Test@@$FQ$AAM@XZ)

I hope you can understant when I explained about the problem. I am not really a programmer so I don't know much about programming or tech terms.

0 Kudos
programmer85
Beginner
391 Views
As long as I know and found it in documentation for real matrices:

double precission (type double) and single precission (type float) is available for PARDISO.

but for complex matrices I am able to use only double precission (structure doublecomplex)...and my question is:
is it possible to use single precision for complex matrices in PARDISO ?

(I tried something like structure complex,but it did not work)

Please, help me!

Pogrammer

0 Kudos
Reply