barry: Your go-to motif accountant  0.0-1
Full enumeration of sample space and fast count of sufficient statistics for binary arrays
defm-bones.hpp
Go to the documentation of this file.
1 #ifndef DEFM_BONES_HPP
2 #define DEFM_BONES_HPP 1
3 
4 class DEFM : public DEFMModel {
5 private:
6 
11  int * Y = nullptr;
12  int * ID = nullptr;
13  double * X = nullptr;
14  bool column_major = true;
15 
16  // In case we need a copy of the data
17  std::shared_ptr<std::vector< int >> Y_shared;
18  std::shared_ptr<std::vector< int >> ID_shared;
19  std::shared_ptr<std::vector< double >> X_shared;
20 
21  size_t N;
22  size_t ID_length;
23  size_t Y_ncol;
24  size_t Y_length;
25  size_t X_ncol;
26  size_t X_length;
27  size_t M_order;
28 
29  std::vector< std::string > Y_names;
30  std::vector< std::string > X_names;
31  std::vector< size_t > start_end;
32  std::vector< size_t > model_ord;
34 
35 public:
36 
37  DEFM(
38  int * id,
39  int * y,
40  double * x,
41  size_t id_length,
42  size_t y_ncol,
43  size_t x_ncol,
44  size_t m_order,
45  bool copy_data = true,
46  bool column_major = true
47  );
48 
50  return *this;
51  };
52 
53  void init();
54 
55  void simulate(std::vector< double > par, int * y_out);
56 
57  size_t get_n_y() const;
58  size_t get_n_obs() const;
59  size_t get_n_covars() const;
60  size_t get_m_order() const;
61  size_t get_n_rows() const;
62 
63  const int * get_Y() const;
64  const int * get_ID() const;
65  const double * get_X() const;
66 
67  barry::FreqTable<int> motif_census(
68  std::vector< size_t > idx
69  );
70 
71  std::vector< double > logodds(
72  const std::vector< double > & par,
73  size_t i,
74  size_t j
75  );
76 
77  void set_names(
78  std::vector< std::string > Y_names_,
79  std::vector< std::string > X_names_
80  );
81 
82  const std::vector< std::string > & get_Y_names() const;
83  const std::vector< std::string > & get_X_names() const;
84 
85  void print() const;
86 
87  std::vector< bool > is_motif();
88 
89  bool get_column_major() const noexcept;
90 
91 };
92 
93 #endif
94 
std::vector< bool > is_motif()
Definition: defm-meat.hpp:448
size_t get_n_covars() const
Definition: defm-meat.hpp:296
DEFM(int *id, int *y, double *x, size_t id_length, size_t y_ncol, size_t x_ncol, size_t m_order, bool copy_data=true, bool column_major=true)
Definition: defm-meat.hpp:108
const int * get_Y() const
Definition: defm-meat.hpp:311
void init()
Definition: defm-meat.hpp:218
size_t get_m_order() const
Definition: defm-meat.hpp:301
void set_names(std::vector< std::string > Y_names_, std::vector< std::string > X_names_)
Definition: defm-meat.hpp:410
size_t get_n_rows() const
Definition: defm-meat.hpp:306
const int * get_ID() const
Definition: defm-meat.hpp:316
DEFMModel & get_model()
Definition: defm-bones.hpp:49
const double * get_X() const
Definition: defm-meat.hpp:321
bool get_column_major() const noexcept
Definition: defm-meat.hpp:458
std::vector< double > logodds(const std::vector< double > &par, size_t i, size_t j)
Definition: defm-meat.hpp:365
const std::vector< std::string > & get_Y_names() const
Definition: defm-meat.hpp:427
size_t get_n_obs() const
Definition: defm-meat.hpp:291
void print() const
Definition: defm-meat.hpp:435
const std::vector< std::string > & get_X_names() const
Definition: defm-meat.hpp:431
size_t get_n_y() const
Definition: defm-meat.hpp:286
void simulate(std::vector< double > par, int *y_out)
Definition: defm-meat.hpp:39
barry::FreqTable< int > motif_census(std::vector< size_t > idx)
Definition: defm-meat.hpp:327
size_t size_t j
size_t i
Data_Type &&counter_ noexcept
barry::Model< DEFMArray, DEFMCounterData, DEFMRuleData, DEFMRuleDynData > DEFMModel
Definition: defm-types.hpp:190