#ifndef __VEGAS__
#define __VEGAS__

extern int simplexOn;

typedef struct vegasGrid
  {

    int ndim,                   /* number of dimensions */
      ndmx;
    double *x_grid;
    double *c_grid;
  }
vegasGrid;

extern vegasGrid *vegas_init
  (int dim,                     /* number of dimensions */
   int ndmx                     /* size of grid */
);

extern void vegas_finish (vegasGrid * vegPtr);

extern int vegas_int (vegasGrid * vegPtr,
                      long ncall0,      /* number of integrand calls */
                      double alph,      /* rate of grid improvement  */
                      double (*fxn) (double *, double),         /* integrand */
                      double *ti,       /* integral estimation */
                      double *tsi       /* standard deviation */
);


extern int vegas_max (
                       vegasGrid * vegPtr,
                       long nCubs,
                       long nPoints,
                       double (*fxn) (double *, double),
                       double milk,
                       double *eff,
                       float *fmax
);


extern int vegas_events (
                          vegasGrid * vegPtr,
                          long nCubs,
                          long nEvents,
                          double gmax,
                          double (*fxn) (double *, double),
                          void (*out) (long, int, char *),
                          float *fmax
);

extern void generateVegasCubs (vegasGrid * vegPtr, long *nCubs);

extern double get_efficiency (void);
extern double get_rmax (void);
extern double get_multiplicity (void);
extern double get_negativity (void);

#endif
