Skip to content

Commit

Permalink
fixed Mwrap MEX interface to remove chkbnds; fixed mat/oct tests; tur…
Browse files Browse the repository at this point in the history
…ned attempted opts.chkbnds change from default into stderr warning only (no nonzero ier return value), since that is more graceful
  • Loading branch information
ahbarnett committed May 15, 2024
1 parent 4cf52e7 commit b166283
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 227 deletions.
1 change: 0 additions & 1 deletion include/finufft_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@
#define FINUFFT_ERR_BINSIZE_NOTVALID 18
#define FINUFFT_ERR_INSUFFICIENT_SHMEM 19
#define FINUFFT_ERR_NUM_NU_PTS_INVALID 20
#define FINUFFT_WARN_CHKBND_NOT_DEFAULT 21
#endif
125 changes: 61 additions & 64 deletions matlab/finufft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* Automatically generated by mwrap */
/* --------------------------------------------------- */

/* Code generated by mwrap 1.0 */
/* Code generated by mwrap 1.1 */
/*
Copyright statement for mwrap:
Expand Down Expand Up @@ -1001,9 +1001,6 @@ typedef std::complex<float> fcomplex;
else if (strcmp(fname[ifield],"spread_kerpad") == 0) {
oc->spread_kerpad = (int)round(*mxGetPr(mxGetFieldByNumber(om,idx,ifield)));
}
else if (strcmp(fname[ifield],"chkbnds") == 0) {
oc->chkbnds = (int)round(*mxGetPr(mxGetFieldByNumber(om,idx,ifield)));
}
else if (strcmp(fname[ifield],"fftw") == 0) {
oc->fftw = (int)round(*mxGetPr(mxGetFieldByNumber(om,idx,ifield)));
}
Expand Down Expand Up @@ -1134,7 +1131,7 @@ mxWrapCopyZDef_single (mxWrapCopy_single_dcomplex, dcomplex,
mxWrapReturnZDef_single (mxWrapReturn_single_dcomplex, dcomplex,
real_dcomplex, imag_dcomplex)

/* ---- finufft.mw: 169 ----
/* ---- finufft.mw: 166 ----
* finufft_mex_setup();
*/
static const char* stubids1_ = "finufft_mex_setup()";
Expand All @@ -1152,7 +1149,7 @@ void mexStub1(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 170 ----
/* ---- finufft.mw: 167 ----
* finufft_opts* o = new();
*/
static const char* stubids2_ = "o finufft_opts* = new()";
Expand All @@ -1173,7 +1170,7 @@ void mexStub2(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 172 ----
/* ---- finufft.mw: 169 ----
* finufft_plan* p = new();
*/
static const char* stubids3_ = "o finufft_plan* = new()";
Expand All @@ -1194,7 +1191,7 @@ void mexStub3(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 173 ----
/* ---- finufft.mw: 170 ----
* finufft_default_opts(finufft_opts* o);
*/
static const char* stubids4_ = "finufft_default_opts(i finufft_opts*)";
Expand All @@ -1217,7 +1214,7 @@ void mexStub4(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 175 ----
/* ---- finufft.mw: 172 ----
* finufftf_plan* p = new();
*/
static const char* stubids5_ = "o finufftf_plan* = new()";
Expand All @@ -1238,7 +1235,7 @@ void mexStub5(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 176 ----
/* ---- finufft.mw: 173 ----
* finufftf_default_opts(finufft_opts* o);
*/
static const char* stubids6_ = "finufftf_default_opts(i finufft_opts*)";
Expand All @@ -1261,7 +1258,7 @@ void mexStub6(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 187 ----
/* ---- finufft.mw: 184 ----
* copy_finufft_opts(mxArray opts, finufft_opts* o);
*/
static const char* stubids7_ = "copy_finufft_opts(i mxArray, i finufft_opts*)";
Expand All @@ -1286,7 +1283,7 @@ void mexStub7(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 190 ----
/* ---- finufft.mw: 187 ----
* int ier = finufft_makeplan(int type, int dim, int64_t[3] n_modes, int iflag, int n_trans, double tol, finufft_plan* plan, finufft_opts* o);
*/
static const char* stubids8_ = "o int = finufft_makeplan(i int, i int, i int64_t[x], i int, i int, i double, i finufft_plan*, i finufft_opts*)";
Expand Down Expand Up @@ -1371,7 +1368,7 @@ void mexStub8(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 193 ----
/* ---- finufft.mw: 190 ----
* int ier = finufftf_makeplan(int type, int dim, int64_t[3] n_modes, int iflag, int n_trans, float tol, finufftf_plan* plan, finufft_opts* o);
*/
static const char* stubids9_ = "o int = finufftf_makeplan(i int, i int, i int64_t[x], i int, i int, i float, i finufftf_plan*, i finufft_opts*)";
Expand Down Expand Up @@ -1456,7 +1453,7 @@ void mexStub9(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 195 ----
/* ---- finufft.mw: 192 ----
* delete(finufft_opts* o);
*/
static const char* stubids10_ = "delete(i finufft_opts*)";
Expand All @@ -1479,7 +1476,7 @@ void mexStub10(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 225 ----
/* ---- finufft.mw: 222 ----
* int ier = finufft_setpts(finufft_plan plan, int64_t nj, double[] xj, double[] yj, double[] zj, int64_t nk, double[] s, double[] t, double[] u);
*/
static const char* stubids11_ = "o int = finufft_setpts(i finufft_plan, i int64_t, i double[], i double[], i double[], i int64_t, i double[], i double[], i double[])";
Expand Down Expand Up @@ -1600,7 +1597,7 @@ void mexStub11(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 227 ----
/* ---- finufft.mw: 224 ----
* int ier = finufftf_setpts(finufftf_plan plan, int64_t nj, float[] xj, float[] yj, float[] zj, int64_t nk, float[] s, float[] t, float[] u);
*/
static const char* stubids12_ = "o int = finufftf_setpts(i finufftf_plan, i int64_t, i float[], i float[], i float[], i int64_t, i float[], i float[], i float[])";
Expand Down Expand Up @@ -1721,7 +1718,7 @@ void mexStub12(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 254 ----
/* ---- finufft.mw: 251 ----
* int ier = finufft_execute(finufft_plan plan, dcomplex[] data_in, output dcomplex[ncoeffs] result);
*/
static const char* stubids13_ = "o int = finufft_execute(i finufft_plan, i dcomplex[], o dcomplex[x])";
Expand Down Expand Up @@ -1775,7 +1772,7 @@ void mexStub13(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 256 ----
/* ---- finufft.mw: 253 ----
* int ier = finufftf_execute(finufftf_plan plan, fcomplex[] data_in, output fcomplex[ncoeffs] result);
*/
static const char* stubids14_ = "o int = finufftf_execute(i finufftf_plan, i fcomplex[], o fcomplex[x])";
Expand Down Expand Up @@ -1829,7 +1826,7 @@ void mexStub14(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 262 ----
/* ---- finufft.mw: 259 ----
* int ier = finufft_execute(finufft_plan plan, output dcomplex[nj, n_trans] result, dcomplex[] data_in);
*/
static const char* stubids15_ = "o int = finufft_execute(i finufft_plan, o dcomplex[xx], i dcomplex[])";
Expand Down Expand Up @@ -1885,7 +1882,7 @@ void mexStub15(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 264 ----
/* ---- finufft.mw: 261 ----
* int ier = finufftf_execute(finufftf_plan plan, output fcomplex[nj, n_trans] result, fcomplex[] data_in);
*/
static const char* stubids16_ = "o int = finufftf_execute(i finufftf_plan, o fcomplex[xx], i fcomplex[])";
Expand Down Expand Up @@ -1941,7 +1938,7 @@ void mexStub16(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 268 ----
/* ---- finufft.mw: 265 ----
* int ier = finufft_execute(finufft_plan plan, dcomplex[] data_in, output dcomplex[nk, n_trans] result);
*/
static const char* stubids17_ = "o int = finufft_execute(i finufft_plan, i dcomplex[], o dcomplex[xx])";
Expand Down Expand Up @@ -1997,7 +1994,7 @@ void mexStub17(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 270 ----
/* ---- finufft.mw: 267 ----
* int ier = finufftf_execute(finufftf_plan plan, fcomplex[] data_in, output fcomplex[nk, n_trans] result);
*/
static const char* stubids18_ = "o int = finufftf_execute(i finufftf_plan, i fcomplex[], o fcomplex[xx])";
Expand Down Expand Up @@ -2053,7 +2050,7 @@ void mexStub18(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 282 ----
/* ---- finufft.mw: 279 ----
* finufft_destroy(finufft_plan plan);
*/
static const char* stubids19_ = "finufft_destroy(i finufft_plan)";
Expand All @@ -2080,7 +2077,7 @@ void mexStub19(int nlhs, mxArray* plhs[],
mexErrMsgTxt(mw_err_txt_);
}

/* ---- finufft.mw: 284 ----
/* ---- finufft.mw: 281 ----
* finufftf_destroy(finufftf_plan plan);
*/
static const char* stubids20_ = "finufftf_destroy(i finufftf_plan)";
Expand Down Expand Up @@ -2175,26 +2172,26 @@ void mexFunction(int nlhs, mxArray* plhs[],
} else if (strcmp(id, "*profile report*") == 0) {
if (!mexprofrecord_)
mexPrintf("Profiler inactive\n");
mexPrintf("%d calls to finufft.mw:169\n", mexprofrecord_[1]);
mexPrintf("%d calls to finufft.mw:170\n", mexprofrecord_[2]);
mexPrintf("%d calls to finufft.mw:172\n", mexprofrecord_[3]);
mexPrintf("%d calls to finufft.mw:173\n", mexprofrecord_[4]);
mexPrintf("%d calls to finufft.mw:175\n", mexprofrecord_[5]);
mexPrintf("%d calls to finufft.mw:176\n", mexprofrecord_[6]);
mexPrintf("%d calls to finufft.mw:187\n", mexprofrecord_[7]);
mexPrintf("%d calls to finufft.mw:190\n", mexprofrecord_[8]);
mexPrintf("%d calls to finufft.mw:193\n", mexprofrecord_[9]);
mexPrintf("%d calls to finufft.mw:195\n", mexprofrecord_[10]);
mexPrintf("%d calls to finufft.mw:225\n", mexprofrecord_[11]);
mexPrintf("%d calls to finufft.mw:227\n", mexprofrecord_[12]);
mexPrintf("%d calls to finufft.mw:254\n", mexprofrecord_[13]);
mexPrintf("%d calls to finufft.mw:256\n", mexprofrecord_[14]);
mexPrintf("%d calls to finufft.mw:262\n", mexprofrecord_[15]);
mexPrintf("%d calls to finufft.mw:264\n", mexprofrecord_[16]);
mexPrintf("%d calls to finufft.mw:268\n", mexprofrecord_[17]);
mexPrintf("%d calls to finufft.mw:270\n", mexprofrecord_[18]);
mexPrintf("%d calls to finufft.mw:282\n", mexprofrecord_[19]);
mexPrintf("%d calls to finufft.mw:284\n", mexprofrecord_[20]);
mexPrintf("%d calls to finufft.mw:166\n", mexprofrecord_[1]);
mexPrintf("%d calls to finufft.mw:167\n", mexprofrecord_[2]);
mexPrintf("%d calls to finufft.mw:169\n", mexprofrecord_[3]);
mexPrintf("%d calls to finufft.mw:170\n", mexprofrecord_[4]);
mexPrintf("%d calls to finufft.mw:172\n", mexprofrecord_[5]);
mexPrintf("%d calls to finufft.mw:173\n", mexprofrecord_[6]);
mexPrintf("%d calls to finufft.mw:184\n", mexprofrecord_[7]);
mexPrintf("%d calls to finufft.mw:187\n", mexprofrecord_[8]);
mexPrintf("%d calls to finufft.mw:190\n", mexprofrecord_[9]);
mexPrintf("%d calls to finufft.mw:192\n", mexprofrecord_[10]);
mexPrintf("%d calls to finufft.mw:222\n", mexprofrecord_[11]);
mexPrintf("%d calls to finufft.mw:224\n", mexprofrecord_[12]);
mexPrintf("%d calls to finufft.mw:251\n", mexprofrecord_[13]);
mexPrintf("%d calls to finufft.mw:253\n", mexprofrecord_[14]);
mexPrintf("%d calls to finufft.mw:259\n", mexprofrecord_[15]);
mexPrintf("%d calls to finufft.mw:261\n", mexprofrecord_[16]);
mexPrintf("%d calls to finufft.mw:265\n", mexprofrecord_[17]);
mexPrintf("%d calls to finufft.mw:267\n", mexprofrecord_[18]);
mexPrintf("%d calls to finufft.mw:279\n", mexprofrecord_[19]);
mexPrintf("%d calls to finufft.mw:281\n", mexprofrecord_[20]);
} else if (strcmp(id, "*profile log*") == 0) {
FILE* logfp;
if (nrhs != 2 || mxGetString(prhs[1], id, sizeof(id)) != 0)
Expand All @@ -2204,26 +2201,26 @@ void mexFunction(int nlhs, mxArray* plhs[],
mexErrMsgTxt("Cannot open log for output");
if (!mexprofrecord_)
fprintf(logfp, "Profiler inactive\n");
fprintf(logfp, "%d calls to finufft.mw:169\n", mexprofrecord_[1]);
fprintf(logfp, "%d calls to finufft.mw:170\n", mexprofrecord_[2]);
fprintf(logfp, "%d calls to finufft.mw:172\n", mexprofrecord_[3]);
fprintf(logfp, "%d calls to finufft.mw:173\n", mexprofrecord_[4]);
fprintf(logfp, "%d calls to finufft.mw:175\n", mexprofrecord_[5]);
fprintf(logfp, "%d calls to finufft.mw:176\n", mexprofrecord_[6]);
fprintf(logfp, "%d calls to finufft.mw:187\n", mexprofrecord_[7]);
fprintf(logfp, "%d calls to finufft.mw:190\n", mexprofrecord_[8]);
fprintf(logfp, "%d calls to finufft.mw:193\n", mexprofrecord_[9]);
fprintf(logfp, "%d calls to finufft.mw:195\n", mexprofrecord_[10]);
fprintf(logfp, "%d calls to finufft.mw:225\n", mexprofrecord_[11]);
fprintf(logfp, "%d calls to finufft.mw:227\n", mexprofrecord_[12]);
fprintf(logfp, "%d calls to finufft.mw:254\n", mexprofrecord_[13]);
fprintf(logfp, "%d calls to finufft.mw:256\n", mexprofrecord_[14]);
fprintf(logfp, "%d calls to finufft.mw:262\n", mexprofrecord_[15]);
fprintf(logfp, "%d calls to finufft.mw:264\n", mexprofrecord_[16]);
fprintf(logfp, "%d calls to finufft.mw:268\n", mexprofrecord_[17]);
fprintf(logfp, "%d calls to finufft.mw:270\n", mexprofrecord_[18]);
fprintf(logfp, "%d calls to finufft.mw:282\n", mexprofrecord_[19]);
fprintf(logfp, "%d calls to finufft.mw:284\n", mexprofrecord_[20]);
fprintf(logfp, "%d calls to finufft.mw:166\n", mexprofrecord_[1]);
fprintf(logfp, "%d calls to finufft.mw:167\n", mexprofrecord_[2]);
fprintf(logfp, "%d calls to finufft.mw:169\n", mexprofrecord_[3]);
fprintf(logfp, "%d calls to finufft.mw:170\n", mexprofrecord_[4]);
fprintf(logfp, "%d calls to finufft.mw:172\n", mexprofrecord_[5]);
fprintf(logfp, "%d calls to finufft.mw:173\n", mexprofrecord_[6]);
fprintf(logfp, "%d calls to finufft.mw:184\n", mexprofrecord_[7]);
fprintf(logfp, "%d calls to finufft.mw:187\n", mexprofrecord_[8]);
fprintf(logfp, "%d calls to finufft.mw:190\n", mexprofrecord_[9]);
fprintf(logfp, "%d calls to finufft.mw:192\n", mexprofrecord_[10]);
fprintf(logfp, "%d calls to finufft.mw:222\n", mexprofrecord_[11]);
fprintf(logfp, "%d calls to finufft.mw:224\n", mexprofrecord_[12]);
fprintf(logfp, "%d calls to finufft.mw:251\n", mexprofrecord_[13]);
fprintf(logfp, "%d calls to finufft.mw:253\n", mexprofrecord_[14]);
fprintf(logfp, "%d calls to finufft.mw:259\n", mexprofrecord_[15]);
fprintf(logfp, "%d calls to finufft.mw:261\n", mexprofrecord_[16]);
fprintf(logfp, "%d calls to finufft.mw:265\n", mexprofrecord_[17]);
fprintf(logfp, "%d calls to finufft.mw:267\n", mexprofrecord_[18]);
fprintf(logfp, "%d calls to finufft.mw:279\n", mexprofrecord_[19]);
fprintf(logfp, "%d calls to finufft.mw:281\n", mexprofrecord_[20]);
fclose(logfp);
} else
mexErrMsgTxt("Unknown identifier");
Expand Down
3 changes: 0 additions & 3 deletions matlab/finufft.mw
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ $ }
$ else if (strcmp(fname[ifield],"spread_kerpad") == 0) {
$ oc->spread_kerpad = (int)round(*mxGetPr(mxGetFieldByNumber(om,idx,ifield)));
$ }
$ else if (strcmp(fname[ifield],"chkbnds") == 0) {
$ oc->chkbnds = (int)round(*mxGetPr(mxGetFieldByNumber(om,idx,ifield)));
$ }
$ else if (strcmp(fname[ifield],"fftw") == 0) {
$ oc->fftw = (int)round(*mxGetPr(mxGetFieldByNumber(om,idx,ifield)));
$ }
Expand Down
Loading

0 comments on commit b166283

Please sign in to comment.