Daniel@0: /* divide_by_table.c ../potential/tables */ Daniel@0: Daniel@0: Daniel@0: /******************************************/ Daniel@0: /* 6 input & 1 output */ Daniel@0: /* Big table [0] */ Daniel@0: /* Big domain [1] */ Daniel@0: /* big sizes [2] */ Daniel@0: /* Small table [3] */ Daniel@0: /* small domain [4] */ Daniel@0: /* small sizes [5] */ Daniel@0: /* */ Daniel@0: /* New big table[0] */ Daniel@0: /******************************************/ Daniel@0: Daniel@0: #include "mex.h" Daniel@0: Daniel@0: void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){ Daniel@0: int i, j, count, NB, NS, siz_b, siz_s, ndim, temp; Daniel@0: int *mask, *sx, *sy, *cpsy, *subs, *s, *cpsy2; Daniel@0: double *pbDomain, *psDomain, *sp, *zp, *bs, value; Daniel@0: Daniel@0: plhs[0] = mxDuplicateArray(prhs[0]); Daniel@0: zp = mxGetPr(plhs[0]); Daniel@0: Daniel@0: siz_b = mxGetNumberOfElements(prhs[1]); Daniel@0: siz_s = mxGetNumberOfElements(prhs[4]); Daniel@0: pbDomain = mxGetPr(prhs[1]); Daniel@0: psDomain = mxGetPr(prhs[4]); Daniel@0: Daniel@0: NB = mxGetNumberOfElements(prhs[0]); Daniel@0: NS = mxGetNumberOfElements(prhs[3]); Daniel@0: sp = mxGetPr(prhs[3]); Daniel@0: Daniel@0: bs = mxGetPr(prhs[2]); Daniel@0: Daniel@0: if(NS == 1){ Daniel@0: value = *sp; Daniel@0: if(value == 0) value = 1; Daniel@0: for(i=0; i