1 // Bayes update scheme
2 #ifndef _BAYESUPDATE_
3 #define _BAYESUPDATE_
4 /*
5 send questions concerning this software to:
6 Peter Beerli
7 beerli@fsu.edu
8 
9 Copyright 1997-2002 Peter Beerli and Joseph Felsenstein
10 Copyright 2003-2008 Peter Beerli
11 Copyright 2009-2012 Peter Beerli and Michal Palczewski
12 
13 Permission is hereby granted, free of charge, to any person obtaining a copy
14 of this software and associated documentation files (the "Software"), to deal
15 in the Software without restriction, including without limitation the rights
16 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17 of the Software, and to permit persons to whom the Software is furnished to do
18 so, subject to the following conditions:
19 
20 The above copyright notice and this permission notice shall be included in all copies
21 or substantial portions of the Software.
22 
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
24 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
25 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 
30 $Id: bayes.h 2093 2012-09-06 23:41:30Z beerli $
31 started in 2000
32 */
33 #include "migration.h"
34 extern boolean acceptBayes (MYREAL newval, MYREAL oldval);
35 extern long bayes_update (world_fmt *world);
36 extern void bayes_free(world_fmt *world);
37 extern void bayes_fill(world_fmt *world, option_fmt *options);
38 extern void bayes_init(bayes_fmt *bayes, world_fmt *world, option_fmt *options);
39 extern void bayes_save(world_fmt *world, long step);
40 extern void bayes_stat(world_fmt *world);
41 extern long setup_bayes_map(longpair *map, char *custm2, long numpop, long numpop2, long size);
42 extern void bayes_init_histogram(world_fmt * world, option_fmt * options);
43 extern void adjust_bayes_bins(world_fmt * world, long locus);
44 extern void calculate_credibility_interval(world_fmt * world, long locus);
45 extern void bayes_reset(world_fmt * world);
46 extern void bayes_check_and_fix_param(world_fmt *world, option_fmt *options);
47 #ifdef ZNZ
48 extern void print_bayes_mdimfileheader(znzFile file, long interval, world_fmt *world, data_fmt *data);
49 #else
50 extern void print_bayes_mdimfileheader(FILE *file, long interval, world_fmt *world, data_fmt *data);
51 #endif
52 extern void bayes_print_accept(FILE * outfile, world_fmt * world);
53 extern MYREAL probg_treetimes(world_fmt *world);
54 extern void recalc_timelist (world_fmt * world, MYREAL new_ratio, MYREAL old_ratio);
55 extern void bayes_smooth(float *x, long xelem, long el, boolean lastfirst);
56 extern void bayes_set_param(MYREAL *param, MYREAL newparam, long which, char *custm2, long numpop);
57 extern MYREAL log_prior_ratio_uni(MYREAL newparam,
58 			   MYREAL oldparam,
59 			   bayes_fmt * bayes,
60 				  long which);
61 extern MYREAL log_prior_ratio_all(world_fmt *world, MYREAL *newvals);
62 extern MYREAL calculate_prior(world_fmt *world);
63 extern void calc_hpd_credibility(bayes_fmt *bayes,long locus, long numpop2, long numparam);
64 #endif
65