barry: Your go-to motif accountant  0.0-1
Full enumeration of sample space and fast count of sufficient statistics for binary arrays
barraydensecell-bones.hpp
Go to the documentation of this file.
1 // #include "typedefs.hpp"
2 
3 #ifndef BARRY_BARRAYDENSECELL_BONES_HPP
4 #define BARRY_BARRAYDENSECELL_BONES_HPP 1
5 
6 #define POS(a, b) (a) + (b) * N
7 
8 template<typename Cell_Type, typename Data_Type>
9 class BArrayDense;
10 
11 template<typename Cell_Type, typename Data_Type>
12 class BArrayDenseCol;
13 
14 template<typename Cell_Type, typename Data_Type>
16 
17 template <typename Cell_Type = bool, typename Data_Type = bool>
19  friend class BArrayDense<Cell_Type,Data_Type>;
20  friend class BArrayDenseCol<Cell_Type,Data_Type>;
21  friend class BArrayDenseCol_const<Cell_Type,Data_Type>;
22 private:
23 
25  size_t i;
26  size_t j;
27 
28 public:
29 
32  size_t i_,
33  size_t j_,
34  bool check_bounds = true
35  ) :
36  i(i_), j(j_)
37  {
38 
39  if (check_bounds)
40  {
41 
42  if (i >= Array_->nrow())
43  throw std::length_error("Row out of range.");
44  if (j >= Array_->ncol())
45  throw std::length_error("Col out of range.");
46 
47  }
48  dat = Array_;
49 
50  };
51 
54  );
55 
57  void operator=(const Cell_Type & val);
58  void operator+=(const Cell_Type & val);
59  void operator-=(const Cell_Type & val);
60  void operator*=(const Cell_Type & val);
61  void operator/=(const Cell_Type & val);
62 
63  operator Cell_Type() const;
64  bool operator==(const Cell_Type & val) const;
65 
66 };
67 
68 
69 #undef POS
70 
71 #endif
void operator/=(const Cell_Type &val)
void operator+=(const Cell_Type &val)
bool operator==(const Cell_Type &val) const
BArrayDenseCell(BArrayDense< Cell_Type, Data_Type > *Array_, size_t i_, size_t j_, bool check_bounds=true)
BArrayDenseCell< Cell_Type, Data_Type > & operator=(const BArrayDenseCell< Cell_Type, Data_Type > &other)
void operator*=(const Cell_Type &val)
void operator-=(const Cell_Type &val)
Baseline class for binary arrays.
size_t ncol() const noexcept
size_t nrow() const noexcept
size_t size_t j
size_t i