/* Steven Andrews, 5/99	*/
/* See documentation called Cn doc */
/* Copyright 2003 by Steven Andrews.  Permission is granted
   for non-commercial use of and modifications to the code. */

#ifndef __Cn_h
#define __Cn_h

#include <math.h>
#define CMPXmag(a,b) (sqrt((a)*(a)+(b)*(b)))
#define CMPXang(a,b) ((b)?((a)?atan((b)/(a)):((b)>0?1.57079632679:4.71238898037)):((a)<0?3.14159265358:0))

typedef struct {float r;float i;} complex;

float *makecmplx(float *ar,float *ai,float *c,int n);
float *real(float *a,float *cr,int n);
float *imag(float *a,float *ci,int n);
float *magnitude(float *a,float *cr,int n);
float *cmplxphase(float *a,float *cr,int n);
float *CompConj(float *a,float *c,int n);
float *rotateCV(float *a,float *c,int n,int p);
float *rotate2CV(float *a,float *c,int n,float phi);
float *multeikx(float *xr,float *a,float *c,int n,float k);
float *multCV(float *a,float *b,float *c,int n);
float *deriv2CV(float *a,float *c,int n,int p);
float *integCV(float *a,float *c,int n);
float FTStartDflt(float *xr,int n);
float *fourier(float *xr,float *a,float *kr,float *c,int nx,int nk,int isign);
float *realcosft(float *xr,float *ar,float *kr,float *cr,int nx,int nk);
float *hankel(float *xr,float *ar,float *kr,float *cr,int nx,int nk,int samp);
float *fft(float *xr,float *a,float *kr,float *c,int nn,int isign);

#endif