#ifndef MK_Remez_hpp_

#include <cmath>
using namespace std;
#include "MK_Array.hpp"

typedef Vector<double> VectorD;
typedef Vector<int>    VectorI;

const int BANDPASS     = 0;
const int DIFFERENTIAL = 1;
const int HILBERT      = 2;

const int GRIDDNS      = 32;
const int MAX_ITERAT   = 50;
const int MAX_ORDER    = 512;
const int MAX_TAPS     = MAX_ORDER + 1;
const int MAX_BANDS    = 5;

extern VectorD hk;

bool Remez(int ntaps, int nbands, VectorD &bands, const VectorD &dg,
           const VectorD &weight, VectorD &deviat, int type, double fs);
void SetGrid(int r, int ntaps, int nbands, const VectorD &bands, const VectorD &dg,
			 const VectorD &weight, int &g_size, VectorD &grid,
			 VectorD &desired, VectorD &wght, bool symmetry);
void dw(double (*sin_cos)(double), int g_size, double pi, const VectorD &grid,
				VectorD &desired, VectorD &wght);
bool CalcParms(int r, const VectorI &ext, const VectorD &grid,
			   const VectorD &desired, const VectorD &wght, VectorD &bk,
			   VectorD &cwk, VectorD &ck);
double CalcResp(double freq, int r, const VectorD &bk, const VectorD &cwk,
				const VectorD &ck);
void SearchExtrms(int r, VectorI &ext, int g_size, const VectorD &w_er);
void ToCoefs(int ntaps, const VectorD &taps, bool symmetry);
bool IsConverged(int r, const VectorI &ext, const VectorD &w_er, double &deviation);

#define MK_Remez_hpp_
#endif
