38 typedef struct dcomplex {
47 __declspec( target(mic) )
void getpartialinv_mp_zgetpartialinv_(
int *sizeA,
int *nonzerosA,
comp *a,
int *ia,
int *ja,
int *sizeInv,
double *real_invA,
double *imag_invA,
int *error);
60 int nrhs,
const mxArray *prhs[])
67 int sizeAn_fort, nonzerosA_fort, sizeInv_fort;
70 int *ia_fort, *ja_fort;
79 mexErrMsgIdAndTxt (
"EQuUs:zgetPartialInv:nInput",
"Two inputs required.");
82 mexErrMsgIdAndTxt (
"EQuUs:zgetPartialInv:nOutput",
"Too many output arguments.");
88 if ((mxIsDouble(prhs[0]) == 0)) {
89 mexErrMsgIdAndTxt (
"EQuUs:zgetPartialInv:NonDouble",
"Input must be a double.");
93 if ((mxIsComplex(prhs[0]) == 0) ) {
94 mexErrMsgIdAndTxt (
"EQuUs:zgetPartialInv:NonComplex",
"Inputs must be complex.");
98 nonzerosA = mxGetNzmax(prhs[0]);
99 sizeAm = mxGetM(prhs[0]);
100 sizeAn = mxGetN(prhs[0]);
102 ia = mxGetJc(prhs[0]);
103 ja = mxGetIr(prhs[0]);
104 real = mxGetPr(prhs[0]);
105 imag = mxGetPi(prhs[0]);
107 ia_fort = (
int*)mxMalloc( (sizeAm+1)*
sizeof(int) );
108 ja_fort = (
int*)mxMalloc( nonzerosA*
sizeof(
int) );
110 a = (
comp*)mxMalloc( nonzerosA*
sizeof(
comp) );
116 for( idx=1; idx<=sizeAm+1; idx++ ) {
117 ia_fort[idx-1] = (int)ia[idx-1] + 1;
120 for( idx=1; idx<=nonzerosA; idx++ ) {
121 ja_fort[idx-1] = (int)ja[idx-1] + 1;
123 a[idx-1].
real = real[idx-1];
124 a[idx-1].
imag = imag[idx-1];
129 sizeInv = *mxGetPr(prhs[1]);
132 plhs[0] = mxCreateDoubleMatrix(sizeInv, sizeInv, mxCOMPLEX);
134 real = mxGetPr(plhs[0]);
135 imag = mxGetPi(plhs[0]);
137 sizeAn_fort = (int)sizeAn;
138 nonzerosA_fort = (int)nonzerosA;
139 sizeInv_fort = (int)sizeInv;
142 #pragma offload target(mic) \ 143 in(sizeAn_fort, nonzerosA_fort, sizeInv_fort) \ 144 in(a:length(nonzerosA)) \ 145 in(ia_fort:length(sizeAn+1)) \ 146 in(ja_fort:length(nonzerosA)) \ 147 out(real:length(sizeInv_fort*sizeInv_fort)) \ 148 out(imag:length(sizeInv_fort*sizeInv_fort)) \ 153 #ifdef __INTEL_COMPILER 156 __getpartialinv_MOD_zgetpartialinv(&sizeAn_fort, &nonzerosA_fort, a, ia_fort, ja_fort, &sizeInv_fort, real, imag, &error);
170 sprintf(output,
"PARDISO solver ended with error flag: %i\n", error);
171 mexErrMsgIdAndTxt (
"EQuUs:zgetPartialInv:PardisoError", output);
175 mexPrintf(
"Pardiso calculations finished for complex matrix\n");
double real
The real part of the complex number.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Gateway routine to call the zgetpartialinv subroutine from the mkl_EQuUs package.
Fortran compatible complex type.
void getpartialinv_mp_zgetpartialinv_(int *sizeA, int *nonzerosA, comp *a, int *ia, int *ja, int *sizeInv, double *real_invA, double *imag_invA, int *error)
For specification see getpartialinv::zgetpartialinv.
double imag
The imaginary part of the complex number.