void evalNode(BigNumber &n, int i, DdValues<BigNumber, ARITY> const &values) { assert(size_t(i) <= pools.size()); if (BDD) { int w = tmp1.store(0); for (int b = 0; b < ARITY; ++b) { tmp2.store(values.get(b)); tmp2.shiftLeft(i - values.getLevel(b) - 1); w = tmp1.add(tmp2); } n.setArray(pools[i].template allocate<uint64_t>(w)); n.store(tmp1); } else { int w; if (ARITY <= 0) { w = tmp1.store(0); } else { w = tmp1.store(values.get(0)); for (int b = 1; b < ARITY; ++b) { w = tmp1.add(values.get(b)); } } n.setArray(pools[i].template allocate<uint64_t>(w)); n.store(tmp1); } }
void initialize(int level) { topLevel = level; pools.resize(topLevel + 1); size_t max = topLevel / 63 + 1; tmp1.setArray(pools[topLevel].template allocate<uint64_t>(max)); tmp2.setArray(pools[topLevel].template allocate<uint64_t>(max)); }
void initialize(int level) { topLevel = level; pools.resize(topLevel + 1); int max = ceil(double(topLevel) * log2(double(ARITY)) / 63.0) + 1; tmp1.setArray(pools[topLevel].allocate<uint64_t>(max)); tmp2.setArray(pools[topLevel].allocate<uint64_t>(max)); tmp3.setArray(pools[topLevel].allocate<uint64_t>(max)); }
void evalNode(BigNumber& n, int i, DdValues<BigNumber,ARITY> const& values) { assert(0 <= i && size_t(i) <= pools.size()); if (BDD) { size_t w = tmp1.store(0); for (int b = 0; b < ARITY; ++b) { tmp2.store(values.get(b)); int k = i - values.getLevel(b) - 1; if (ARITY == 2) { tmp2.shiftLeft(k); } else { while (--k >= 0) { tmp3.store(tmp2); for (int b = 1; b < ARITY; ++b) { tmp2.add(tmp3); } } } w = tmp1.add(tmp2); } n.setArray(pools[i].allocate<uint64_t>(w)); n.store(tmp1); } else { size_t w; if (ARITY <= 0) { w = tmp1.store(0); } else { w = tmp1.store(values.get(0)); for (int b = 1; b < ARITY; ++b) { w = tmp1.add(values.get(b)); } } n.setArray(pools[i].allocate<uint64_t>(w)); n.store(tmp1); } }