void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { if(mxGetClassID(prhs[0]) != mxDOUBLE_CLASS) mexErrMsgTxt("Error input should be DOUBLE"); const int numDims = mxGetNumberOfDimensions(prhs[0]); const int numElements = mxGetNumberOfElements(prhs[0]); const int* dims = mxGetDimensions(prhs[0]); doublereal* xi = mxGetPr(prhs[0]); doublereal* yi; int i = 0; if(!mxIsComplex(prhs[0])) { yi = mxCalloc(numElements, sizeof(doublereal)); for(i = 0; i<numElements; i++) yi[i] = 0; } else yi = mxGetPi(prhs[0]); logical* flag = mxCalloc(numElements, sizeof(logical)); plhs[0] = mxCreateNumericArray(numDims, dims, mxDOUBLE_CLASS, mxCOMPLEX); double* u = mxGetPr(plhs[0]); double* v = mxGetPi(plhs[0]); for(i = 0; i<numElements; i++) { wofz(&xi[i], &yi[i], &u[i], &v[i], &flag[i]); } mxFree(flag); }
static int voigt (double x, double y, double *u) /*{{{*/ { double v; /* z = x + iy => w(z) = u + iv */ if (-1 == wofz (x, y, u, &v)) { isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "evaluating voigt function for x=%g, y=%g", x, y); return -1; } return 0; }