From f618466c25d43f3bae9e40920273bf77de1e1149 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Mon, 19 Oct 2020 23:09:30 -0400 Subject: initial sd-vbs initial sd-vbs add sd-vbs sd-vbs --- .../src/matlabPyrTools/MEX/range2.c | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/range2.c (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/range2.c') diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/range2.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/range2.c new file mode 100755 index 0000000..b84f4e1 --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/range2.c @@ -0,0 +1,56 @@ +/* +[MIN, MAX] = range2(MTX) + >>> See range2.m for documentation <<< + EPS, 3/97. +*/ + +#define V4_COMPAT +#include /* Matlab matrices */ +#include + +#include /* NULL */ + +#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it)) + +void mexFunction(int nlhs, /* Num return vals on lhs */ + mxArray *plhs[], /* Matrices on lhs */ + int nrhs, /* Num args on rhs */ + const mxArray *prhs[] /* Matrices on rhs */ + ) + { + register double temp, mn, mx; + register double *mtx; + register int i, size; + mxArray *arg; + + if (nrhs != 1) mexErrMsgTxt("requires 1 argument."); + + /* ARG 1: MATRIX */ + arg = prhs[0]; + if notDblMtx(arg) mexErrMsgTxt("MTX arg must be a real non-sparse matrix."); + mtx = mxGetPr(arg); + size = (int) mxGetM(arg) * mxGetN(arg); + + /* FIND min, max values of MTX */ + mn = *mtx; mx = *mtx; + for (i=1; i mx) + mx = temp; + } + + plhs[0] = (mxArray *) mxCreateDoubleMatrix(1,1,mxREAL); + if (plhs[0] == NULL) mexErrMsgTxt("Error allocating result matrix"); + plhs[1] = (mxArray *) mxCreateDoubleMatrix(1,1,mxREAL); + if (plhs[1] == NULL) mexErrMsgTxt("Error allocating result matrix"); + mtx = mxGetPr(plhs[0]); + mtx[0] = mn; + mtx = mxGetPr(plhs[1]); + mtx[0] = mx; + + return; + } + -- cgit v1.2.2