#ifndef AVG_H
# define AVG_H
struct v_wt	{ double v, wt;};		/* A value and a weight. */
struct a_w	{double avg, width, wt;};

struct a_w avg_robust(const struct v_wt *z, int n, double chop = 0.15);
struct a_w avg_robust(const float *z, int n);
struct a_w avg_linear(C struct v_wt *in, int n);

double avg_sky(const float *sa, int n);
double var_extrapolate(C float *sa, int n);

struct mode_out	{double low, high, best;};
struct mode_out mode(C double *data, int n, int stop = 0);
struct mode_out mode(C float *data, int n, int stop = 0);
struct mode_out mode(C int *data, int n, int stop = 0);
#endif
