#ifndef __WAVELET_H__
#define __WAVELET_H__

#include <complex.h>

/******************************************************************************
* WAVELET.H                                                                   *
*                                                                             *
* The header file for WAVELET.C                                               *
* Necessary functions for wavelet analysis.                                   *
*                                                                             *
* James Holliday                                                              *
* University of California - Davis                                            *
*                                                                             *
******************************************************************************/

/* Custom datatypes */
typedef double complex cdouble;

/* Custom Definitions */
#define DEFAULT -1
#define MORLET   0
#define PAUL     1
#define DOG      2

/* Create a mother wavelet at a given scale */
void create_wavelet(cdouble  wavelet[],
		    int      N,
		    int      mother,
		    double   param,
		    double   scale,
		    double   dt,
		    double*  period,
		    double*  folding);

/* Perform the wavelet transform in an input vector */
void wavelet_transform(cdouble input[],
		       int     length,
		       double  dt,
		       int     mother,
		       double  param,
		       int     J,
		       double  s0,
		       double  ds,
		       double  power[],
		       double  phase[],
		       double  spectrum[],
		       double  sap[],
		       double  period[],
		       double  coi[]);

/* Dump an output vector into a GMT-ready file */
int save_data(char*  name,
              double data[],
              int    Nx,
              int    Ny,
	      double Xscale[],
	      double Yscale[]);

#endif
