/*
   File:        awdut.h
   Author:      Artur Dubrawski
   Created:     July 1999
   Description: header for AWD's general purpose utilities

   Copyright 1999, Schenley Park Research Inc
*/


#ifndef AWDUT_H
#define AWDUT_H

#include <math.h> /* for HUGE_VAL definition */
#include "amut.h"

#define AWD_VERY_UNLIKELY_LIKELIHOOD 1.383896e-87
#define AWD_VERY_UNLIKELY_LOGLIKELIHOOD -200.0

#define AWD_DEFAULT_RANDOM_SAMPLE_SIZE 1000


extern dyv *mk_default_tics_dyv( double xmin, double xmax, int resolution );

/* ------- produces the last digit of an integer --------- */
extern int int_last_digit( int num );

/* ------- makes a two-character suffix for the ordinary number 
   ------- text representation 
   ------- (e.g. if num=2 or num=102 the result would be "nd")
   ------- use free_string() to free the allocated memory after use! */
extern char *mk_int_last_digit_suffix( int num );

/*
  x contains some distribution -> the created dyv is its histogram
 
  nbins determines horizontal (x-wise) resolution of the histogram
  bins stores values for the subsequent bin-center locations along x

  dyv *bins is created inside and must be freed outside!!!

  the result and bins have nbins+2 entries to account for the
  pre- and post- domain range zero-count bins and make the
  drawn histogram look nicer.
  if your purpose is not that of drawing a histogram, then just
  ignore the first and the last components of the generated dyvs
  ---------------------------------------------------
*/
extern dyv *mk_hist_dyv_from_dyv(dyv *x,int nbins,dyv **bins);

/* ------------------
   makes a stripped copy of the source ivec
   the new ivec contains all but the specified entry
   (if it is there in the source) */
extern ivec *mk_stripped_copy_ivec( ivec *src, int remove_me );

#endif
