1212 *
1313 * Usage:
1414 * f = ...
15- * flag_synthesis_mex(flmn, L, N, nodes, R , reality);
15+ * flag_synthesis_mex(flmn, L, N, nodes, tau , reality, spin );
1616 *
1717 */
1818void mexFunction ( int nlhs , mxArray * plhs [],
1919 int nrhs , const mxArray * prhs [])
2020{
21- int f_is_complex , n , i , L , N , reality , flmn_m , flmn_n , Nnodes ;
21+ int spin , f_is_complex , n , i , L , N , reality , flmn_m , flmn_n , Nnodes ;
2222 double * flmn_real , * flmn_imag , * f_real , * f_imag ;
2323 double * fr = NULL ;
2424 complex double * flmn = NULL , * f = NULL ;
@@ -27,7 +27,7 @@ void mexFunction( int nlhs, mxArray *plhs[],
2727
2828
2929 // Check number of arguments
30- if (nrhs != 6 ) {
30+ if (nrhs != 7 ) {
3131 mexErrMsgIdAndTxt ("flag_synthesis_mex:InvalidInput:nrhs" ,
3232 "Require six inputs." );
3333 }
@@ -92,18 +92,32 @@ void mexFunction( int nlhs, mxArray *plhs[],
9292 ntheta = L ;
9393 nphi = 2 * L - 1 ;
9494
95- // Parse harmonic band-limit R
95+ // Parse radial scale factor tau
9696 iin = 4 ;
9797 if ( !mxIsDouble (prhs [iin ]) ||
9898 mxIsComplex (prhs [iin ]) ||
9999 mxGetNumberOfElements (prhs [iin ])!= 1 ) {
100- mexErrMsgIdAndTxt ("slag_synthesis_mex:InvalidInput:Rlimit " ,
101- "Radial limit R must be positive real." );
100+ mexErrMsgIdAndTxt ("slag_synthesis_mex:InvalidInput:taulimit " ,
101+ "Radial scale factor tau must be positive real." );
102102 }
103- double R = mxGetScalar (prhs [iin ]);
104- if ( R <= 0 )
105- mexErrMsgIdAndTxt ("slag_synthesis_mex:InvalidInput:RLimitNonInt" ,
106- "Radial limit R must be positive real." );
103+ double tau = mxGetScalar (prhs [iin ]);
104+ if ( tau <= 0 )
105+ mexErrMsgIdAndTxt ("slag_synthesis_mex:InvalidInput:tauLimitNonInt" ,
106+ "Radial scale factor tau must be positive real." );
107+
108+
109+ // Parse radial scale factor tau
110+ iin = 6 ;
111+ if ( !mxIsDouble (prhs [iin ]) ||
112+ mxIsComplex (prhs [iin ]) ||
113+ mxGetNumberOfElements (prhs [iin ])!= 1 ) {
114+ mexErrMsgIdAndTxt ("flag_synthesis_mex:InvalidInput:LbandLimit" ,
115+ "spin must be integer." );
116+ }
117+ spin = (int )mxGetScalar (prhs [iin ]);
118+ if (mxGetScalar (prhs [iin ]) > (double )spin || spin < 0 )
119+ mexErrMsgIdAndTxt ("flag_synthesis_mex:InvalidInput:bandLimitNonInt" ,
120+ "spin must be positive integer." );
107121
108122 // Parse nodes
109123 int nodes_m , nodes_n ;
@@ -123,17 +137,17 @@ void mexFunction( int nlhs, mxArray *plhs[],
123137 Nnodes = N ;
124138 nodes = (double * )calloc (Nnodes , sizeof (double ));
125139 weights = (double * )calloc (Nnodes , sizeof (double ));
126- flag_spherlaguerre_sampling (nodes , weights , R , N );
140+ flag_spherlaguerre_sampling (nodes , weights , tau , N );
127141 free (weights );
128142 }
129143
130144
131145 if (reality ) {
132146 flag_core_allocate_f_real (& fr , L , N );
133- flag_core_synthesis_real (fr , flmn , nodes , Nnodes , L , N );
147+ flag_core_synthesis_real (fr , flmn , nodes , Nnodes , L , tau , N );
134148 } else {
135149 flag_core_allocate_f (& f , L , N );;
136- flag_core_synthesis (f , flmn , nodes , Nnodes , L , N );
150+ flag_core_synthesis (f , flmn , nodes , Nnodes , L , tau , N , spin );
137151 }
138152
139153
0 commit comments