barry: Your go-to motif accountant  0.0-1
Full enumeration of sample space and fast count of sufficient statistics for binary arrays
barraycell-meat.hpp
Go to the documentation of this file.
1 // #include "barraycell-bones.hpp"
2 
3 #ifndef BARRY_BARRAYCELL_MEAT_HPP
4 #define BARRY_BARRAYCELL_MEAT_HPP 1
5 
6 template<typename Cell_Type,typename Data_Type>
7 inline void BArrayCell<Cell_Type,Data_Type>::operator=(const Cell_Type & val) {
8 
9  if (Array->is_empty(i, j, false)) {
10  Array->insert_cell(i, j, val, false, false);
11  } else {
12  Array->el_ij.at(i).at(j).value = val;
13  }
14 
15 }
16 
17 template<typename Cell_Type,typename Data_Type>
18 inline void BArrayCell<Cell_Type,Data_Type>::operator+=(const Cell_Type & val) {
19 
20  if (Array->is_empty(i, j, false)) {
21  Array->insert_cell(i, j, val, false, false);
22  } else {
23  Array->el_ij.at(i).at(j).value += val;
24  }
25 
26 }
27 
28 template<typename Cell_Type,typename Data_Type>
29 inline void BArrayCell<Cell_Type,Data_Type>::operator-=(const Cell_Type & val) {
30 
31  if (Array->is_empty(i, j, false)) {
32  Array->insert_cell(i, j, -val, false, false);
33  } else {
34  Array->el_ij.at(i).at(j).value -= val;
35  }
36 
37 }
38 
39 template<typename Cell_Type,typename Data_Type>
40 inline void BArrayCell<Cell_Type,Data_Type>::operator*=(const Cell_Type & val) {
41 
42  if (!Array->is_empty(i, j, false)) {
43  Array->el_ij.at(i).at(j).value *= val;
44  }
45 
46 }
47 
48 template<typename Cell_Type,typename Data_Type>
49 inline void BArrayCell<Cell_Type,Data_Type>::operator/=(const Cell_Type & val) {
50 
51  if (!Array->is_empty(i, j, false)) {
52  Array->el_ij.at(i).at(j).value /= val;
53  }
54 
55 }
56 
57 template<typename Cell_Type,typename Data_Type>
59  return Array->get_cell(i, j, false);
60 }
61 
62 template<typename Cell_Type,typename Data_Type>
63 inline bool BArrayCell<Cell_Type,Data_Type>::operator==(const Cell_Type & val) const {
64  return Array->get_cell(i, j, false) == static_cast<Cell_Type>(val);
65 }
66 
67 template<typename Cell_Type,typename Data_Type>
69  return Array->get_cell(i, j, false);
70 }
71 
72 template<typename Cell_Type,typename Data_Type>
73 inline bool BArrayCell_const<Cell_Type,Data_Type>::operator==(const Cell_Type & val) const {
74  return Array->get_cell(i, j, false) == static_cast<Cell_Type>(val);
75 }
76 
77 template<typename Cell_Type,typename Data_Type>
78 inline bool BArrayCell_const<Cell_Type,Data_Type>::operator!=(const Cell_Type & val) const {
79  return !(this->operator==(val));
80 }
81 
82 template<typename Cell_Type,typename Data_Type>
83 inline bool BArrayCell_const<Cell_Type,Data_Type>::operator<(const Cell_Type & val) const {
84  return Array->get_cell(i, j, false) < static_cast<Cell_Type>(val);
85 }
86 
87 template<typename Cell_Type,typename Data_Type>
88 inline bool BArrayCell_const<Cell_Type,Data_Type>::operator>(const Cell_Type & val) const {
89  return Array->get_cell(i, j, false) > static_cast<Cell_Type>(val);
90 }
91 
92 template<typename Cell_Type,typename Data_Type>
93 inline bool BArrayCell_const<Cell_Type,Data_Type>::operator<=(const Cell_Type & val) const {
94  return Array->get_cell(i, j, false) <= static_cast<Cell_Type>(val);
95 }
96 
97 template<typename Cell_Type,typename Data_Type>
98 inline bool BArrayCell_const<Cell_Type,Data_Type>::operator>=(const Cell_Type & val) const {
99  return Array->get_cell(i, j, false) >= static_cast<Cell_Type>(val);
100 }
101 
102 #endif
bool operator==(const Cell_Type &val) const
bool operator>(const Cell_Type &val) const
bool operator<=(const Cell_Type &val) const
bool operator<(const Cell_Type &val) const
bool operator!=(const Cell_Type &val) const
bool operator>=(const Cell_Type &val) const
void operator+=(const Cell_Type &val)
void operator-=(const Cell_Type &val)
bool operator==(const Cell_Type &val) const
void operator/=(const Cell_Type &val)
void operator*=(const Cell_Type &val)
void operator=(const Cell_Type &val)
size_t size_t j
size_t i