1 #ifndef BARRY_POWERSET_MEAT_HPP
2 #define BARRY_POWERSET_MEAT_HPP 1
4 template <
typename Array_Type,
typename Data_Rule_Type>
6 const Array_Type & array
8 rules(new
Rules<Array_Type,Data_Rule_Type>()), N(array.nrow()), M(array.ncol()) {
12 template <
typename Array_Type,
typename Data_Rule_Type>
14 if (!this->rules_deleted)
18 template <
typename Array_Type,
typename Data_Rule_Type>
23 coordinates_free.clear();
24 coordinates_locked.clear();
25 rules->get_seq(
EmptyArray, &coordinates_free, &coordinates_locked);
27 n_free = coordinates_free.size() / 2u;
28 n_locked = coordinates_locked.size() / 2u;
37 for (
size_t i = 0u;
i < n_free; ++
i)
39 coordinates_free[
i * 2u],
40 coordinates_free[
i * 2u + 1u]
47 for (
size_t i = 0u;
i < n_free; ++
i)
49 coordinates_free[
i * 2u],
50 coordinates_free[
i * 2u + 1u],
64 data.reserve(pow(2.0, n_free));
72 template <
typename Array_Type,
typename Data_Rule_Type>
83 calc_backend_sparse(pos + 1u);
87 coordinates_free[pos * 2u],
88 coordinates_free[pos * 2u + 1u],
95 #ifdef BARRY_USER_INTERRUPT
96 if (
data.size() % 1000u == 0u)
104 calc_backend_sparse(pos + 1u);
108 coordinates_free[pos * 2u],
109 coordinates_free[pos * 2u + 1u],
117 template <
typename Array_Type,
typename Data_Rule_Type>
128 calc_backend_dense(pos + 1u);
131 EmptyArray(coordinates_free[pos * 2u], coordinates_free[pos * 2u + 1u]) = 1;
137 calc_backend_dense(pos + 1u);
140 EmptyArray(coordinates_free[pos * 2u], coordinates_free[pos * 2u + 1u]) = 0;
150 template <
typename Array_Type,
typename Data_Rule_Type>
154 this->init_support();
158 calc_backend_dense(0u);
160 calc_backend_sparse(0u);
166 template <
typename Array_Type,
typename Data_Rule_Type>
179 template <
typename Array_Type,
typename Data_Rule_Type>
184 rules->add_rule(rule);
188 template <
typename Array_Type,
typename Data_Rule_Type>
Powerset of a binary array.
void add_rule(Rule< Array_Type, Data_Rule_Type > rule)
void reset(size_t N_, size_t M_)
Rule for determining if a cell should be included in a sequence.
Vector of objects of class Rule.
Data_Type &&counter_ data(std::move(counter_.data))
Data_Type Counter_fun_type< Array_Type, Data_Type > Hasher_fun_type< Array_Type, Data_Type > Data_Type data_
std::function< bool(const Array_Type &, size_t, size_t, Data_Type &)> Rule_fun_type