source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/lightspeed/xones.c @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 680 bytes
Line 
1/* Simple test of using initialized vs. uninitialized arrays.
2 * The uninitialized version runs nearly twice as fast.
3 */
4/*
5mex.bat -c mexutil.c
6mex.bat xones.c mexutil.obj
7*/
8
9#include "mexutil.h"
10
11void mexFunction(int nlhs, mxArray *plhs[],
12                 int nrhs, const mxArray *prhs[])
13{
14  int m,n,i,sz;
15  double *p;
16  if(nrhs != 2) mexErrMsgTxt("xones(m,n)");
17  m = (int)*mxGetPr(prhs[0]);
18  n = (int)*mxGetPr(prhs[1]);
19  sz = m*n;
20#if 0
21  plhs[0] = mxCreateDoubleMatrix(m,n,mxREAL);
22  p = (double*)mxGetPr(plhs[0]);
23#else
24  plhs[0] = mxCreateDoubleMatrixE(m,n,mxREAL);
25  p = (double*)mxGetPr(plhs[0]);
26#endif
27  for(i=0;i<sz;i++) *p++ = 1;
28}
Note: See TracBrowser for help on using the repository browser.