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);
                }
            }
Esempio n. 2
0
 void evalNode(T& n, int i, DdValues<T,ARITY> const& values) const {
     if (BDD) {
         n = 0;
         for (int b = 0; b < ARITY; ++b) {
             T tmp = values.get(b);
             int ii = values.getLevel(b);
             while (++ii < i) {
                 tmp *= ARITY;
             }
             n += tmp;
         }
     }
     else {
         n = 0;
         for (int b = 0; b < ARITY; ++b) {
             n += values.get(b);
         }
     }
 }
Esempio n. 3
0
 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);
     }
 }