#ifndef fast_pmf_cycle_header
#define fast_pmf_cycle_header

////////////////////////////////////////////////////////////////////////////////
//
// fast_pmf_cycle.h
//
////////////////////////////////////////////////////////////////////////////////

////////////////////
// structs
////////////////////
typedef struct {
  int num_mod;
  int width;
  int wander_dist;
  double std_factor;
  double prior_model;
  double prior_bg;

  double **motif_mean;
  double **motif_std;
  double **region;
  double *bg_mean;
  double *bg_std;
  double *mean_of_stds;
} Data;
Data *d;

typedef struct {
  int return_pol;
  int return_loc;
  int DEBUG;

  double **weights_motif_pos;
  double **weights_motif_neg;
  double **weights_bg_pos;
  double **weights_bg_neg;

  double *votes_pos;
  double *votes_neg;
} Scratch;
Scratch *s;

extern double NONE_VAL;
extern double ABS_Z_SCORE_MAX;
extern double MIN_LOG_RATIO;

////////////////////
// accessors
////////////////////
double get_motif_mean(int mod, int pos);
void set_motif_mean(int mod, int pos, double val);

double get_motif_std(int mod, int pos);
void set_motif_std(int mod, int pos, double val);

double get_bg_mean(int mod);
void set_bg_mean(int mod, double val);

double get_bg_std(int mod);
void set_bg_std(int mod, double val);

double get_region(int mod, int pos);
void set_region(int mod, int pos, double val);

int get_return_pol();
int get_return_loc();

int get_DEBUG();
void set_DEBUG(int DEBUG);

////////////////////
// init
////////////////////
void init(int num_mod, int width, int wander_dist, double prior_model,
	  double prior_bg, double std_factor);

////////////////////
// workload
////////////////////
void set_motif_mean_of_std();
void compute_pmf();
int get_votes();
void tally_votes();

#endif
