#include "mex.h"
#include <fftw3.h>

void FFT1DInterleaved(int N, double *X, double *Y, int Sign)
{
    fftw_plan Plan;
    if(!(Plan = fftw_plan_dft_1d(N, (fftw_complex *)X, (fftw_complex *)Y, Sign, FFTW_ESTIMATE)))
    mexErrMsgTxt("FFTW3 failed to create plan.");
    fftw_execute(Plan);
    fftw_destroy_plan(Plan);
}




void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
/* Macros for the ouput and input arguments */
#define B_OUT plhs[0]
#define A_IN prhs[0]
#define P_IN prhs[1]
double *B, p, colnorm,*Ar,*Ai ;
int M, N, m, n;


p = mxGetScalar(P_IN); /* Get p */
M = mxGetM(A_IN); /* Get the dimensions of A */
N = mxGetN(A_IN);
Ar = mxGetPr(A_IN); /* Real data*/
Ai = mxGetPi(A_IN); /* Imaginary data */

B_OUT = mxCreateDoubleMatrix(M, N, mxCOMPLEX); /* Create the output matrix */
B = mxGetPr(B_OUT); /* Get the pointer to the data of B */


return;
}




