31#define NUM_INPUT_ARGS ( 2 )
32#define NUM_OUTPUT_ARGS ( 1 )
63 float* dirs_rad = NULL;
65 int order, nSH, nDirs;
68 order = (int)mxGetScalar(prhs[0]);
72 Y =
malloc1d(nSH*nDirs*
sizeof(
float));
76 mexErrMsgIdAndTxt(
"MyToolbox:inputError",
"the second dimension of the second argument should be of size: 2");
#define ORDER2NSH(order)
Converts spherical harmonic order to number of spherical harmonic components i.e: (order+1)^2.
void getSHreal(int order, float *dirs_rad, int nDirs, float *Y)
Computes real-valued spherical harmonics [1] for each given direction on the unit sphere.
void * malloc1d(size_t dim1_data_size)
1-D malloc (same as malloc, but with error checking)
void * realloc1d(void *ptr, size_t dim1_data_size)
1-D realloc (same as realloc, but with error checking)
Main include header for safmex.
void MEXdouble2SAFsingle(const mxArray *in, float **out, int *nDims, int **pDims)
Convert a mex double-precision array into single precision array for SAF.
MEX_DATA_TYPES
Supported SAF/MEX data conversions.
@ SM_INT32
Integer; 1 x 1.
@ SM_DOUBLE_REAL_1D_OR_2D
Real 2-D matrix or 1-D vector; N x M | N x 1.
void SAFsingle2MEXdouble(float *in, int nDims, int *dims, mxArray **out)
Convert a single precision array used by SAF to mex double-precision array.
void checkNumInOutArgs(int nInputs, int nOutputs, int nInputs_expected, int nOutputs_expected)
Helper function to check number of inputs/outputs arguments are as expected.
void checkArgDataTypes(mxArray **hData, MEX_DATA_TYPES *dataTypes, int nArgs)
Helper function to check the format of the input/output arguments are as expected.