HMSBEAGLE  1.0.0
fourtaxon.h
1 #include <vector>
2 #include <string>
3 #include "libhmsbeagle/beagle.h"
4 
5 typedef std::vector<int> CodedSequence;
6 typedef std::vector<double> PartialVector;
7 
8 /*-----------------------------------------------------------------------------
9 | FourTaxonExample reads in DNA sequence data for four taxa and simply
10 | recomputes the likelihood of the following unrooted tree numerous times:
11 |
12 | (1:0.01, 2:0.02, (3:0.03, 4:0.04):0.05)
13 |
14 | Future improvements:
15 | - estimate something
16 */
18  {
19  public:
21  void interpretCommandLineParameters(int argc, char* argv[]);
22  void run();
23 
24  private:
25  void helpMessage();
26  void abort(std::string msg);
27  void initBeagleLib();
28  void readData();
29  void writeData();
30  void updateBrlen(unsigned brlen_index);
31  void defineOperations();
32  double calcLnL(int return_value);
33 
34  private:
35  bool quiet;
36  unsigned niters;
37  unsigned like_root_node;
38  unsigned like_parent_index;
39  unsigned like_child_index;
40  unsigned transmat_index;
41  std::string data_file_name;
42  bool scaling;
43  bool single;
44  bool require_double;
45  const unsigned ntaxa;
46  unsigned nsites;
47  unsigned nrates;
48  double delta;
49  double mu;
50  unsigned seed;
51  std::vector<std::string> taxon_name;
52  std::vector<CodedSequence> data;
53  std::vector<PartialVector> partial;
54  std::vector<int> transition_matrix_index;
55  std::vector<double> brlens;
56  std::vector<int> operations;
57  std::vector<int> scaleIndices;
58  int instance_handle;
59  int rsrc_number;
60  bool use_tip_partials;
61  bool accumulate_on_the_fly;
62  bool dynamic_scaling;
63  bool do_rescaling;
64  bool auto_scaling;
65  int calculate_derivatives;
66  bool empirical_derivatives;
67  bool sse_vectorization;
68  };