40 typedef struct dcomplex {
49 __declspec( target(mic) )
void getdiaginv_mp_zgetdiaginv_(
int *sizeA,
int *nonzerosA,
comp *a,
int *ia,
int *ja,
double *real_invA,
double *imag_invA,
int *error);
63 int nrhs,
const mxArray *prhs[])
69 int sizeAn_fort, nonzerosA_fort;
72 int *ia_fort, *ja_fort;
81 mexErrMsgIdAndTxt (
"EQuUs:zgetdiaginv:nInput",
"One input required.");
84 mexErrMsgIdAndTxt (
"EQuUs:zgetdiaginv:nOutput",
"Too many output arguments.");
90 if ((mxIsDouble(prhs[0]) == 0)) {
91 mexErrMsgIdAndTxt (
"EQuUs:zgetdiaginv:NonDouble",
"Input must be a double.");
95 if ((mxIsComplex(prhs[0]) == 0) ) {
96 mexErrMsgIdAndTxt (
"EQuUs:zgetdiaginv:NonComplex",
"Inputs must be complex.");
100 nonzerosA = mxGetNzmax(prhs[0]);
101 sizeAm = mxGetM(prhs[0]);
102 sizeAn = mxGetN(prhs[0]);
104 ia = mxGetJc(prhs[0]);
105 ja = mxGetIr(prhs[0]);
106 real = mxGetPr(prhs[0]);
107 imag = mxGetPi(prhs[0]);
109 ia_fort = (
int*)mxMalloc( (sizeAm+1)*
sizeof(int) );
110 ja_fort = (
int*)mxMalloc( nonzerosA*
sizeof(
int) );
112 a = (
comp*)mxMalloc( nonzerosA*
sizeof(
comp) );
118 for( idx=1; idx<=sizeAm+1; idx++ ) {
119 ia_fort[idx-1] = (int)ia[idx-1] + 1;
122 for( idx=1; idx<=nonzerosA; idx++ ) {
123 ja_fort[idx-1] = (int)ja[idx-1] + 1;
125 a[idx-1].
real = real[idx-1];
126 a[idx-1].
imag = imag[idx-1];
131 plhs[0] = mxCreateDoubleMatrix(sizeAn, 1, mxCOMPLEX);
133 real = mxGetPr(plhs[0]);
134 imag = mxGetPi(plhs[0]);
136 sizeAn_fort = (int)sizeAn;
137 nonzerosA_fort = (int)nonzerosA;
140 #pragma offload target(mic) \ 141 in(sizeAn_fort, nonzerosA_fort) \ 142 in(a:length(nonzerosA)) \ 143 in(ia_fort:length(sizeAn+1)) \ 144 in(ja_fort:length(nonzerosA)) \ 145 out(real:length(sizeAn_fort)) \ 146 out(imag:length(sizeAn_fort)) \ 151 #ifdef __INTEL_COMPILER 154 __getdiaginv_MOD_zgetdiaginv(&sizeAn_fort, &nonzerosA_fort, a, ia_fort, ja_fort, real, imag, &error);
167 sprintf(output,
"PARDISO solver ended with error flag: %i\n", error);
168 mexErrMsgIdAndTxt (
"EQuUs:zgetdiaginv:PardisoError", output);
172 mexPrintf(
"Pardiso calculations finished for real matrix\n");
double real
The real part of the complex number.
Fortran compatible complex type.
void getdiaginv_mp_zgetdiaginv_(int *sizeA, int *nonzerosA, comp *a, int *ia, int *ja, double *real_invA, double *imag_invA, int *error)
For specification see getdiaginv::zgetdiaginv.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Gateway routine to call the zgetdiaginv subroutine from the mkl_EQuUs package.
double imag
The imaginary part of the complex number.