void impl(ExtSet& A, IntSet& B, size_t y, CompIntSet* N){ output(A, B); if (y == attributes()) return; queue<Rec> q; CompIntSet* M = N + attributes(); ExtSet C; IntSet D; // note that M[0..y] may point to stale sets which however doesn't matter for (size_t j = y; j < attributes(); j++) { M[j] = N[j]; if (!B.has(j)){ if (N[j].null() || N[j]->subsetOf(B, j)){ // subset of (considering attributes < j) // C empty, D full is a precondition toEmpty(C); toFull(D); if(closeConcept(A, j, C, D) && B.equal(D, j)){ // equal up to <j q.emplace(move(C), move(D), j); //lose both C&D } else { stats.fail_canon++; M[j] = move(D); // lose D } } else stats.fail_fast++; } } while (!q.empty()){ Rec r = move(q.front()); processQueueItem(ExtendedState{move(r.extent), move(r.intent), r.j + 1, M, attributes()}); q.pop(); } }
static bool SlowRekey(IntSet* s) { IntSet tmp; for (auto iter = s->iter(); !iter.done(); iter.next()) { if (NewKeyFunction::shouldBeRemoved(iter.get())) { continue; } uint32_t hi = NewKeyFunction::rekey(iter.get()); if (tmp.has(hi)) { return false; } if (!tmp.putNew(hi)) { return false; } } s->clear(); for (auto iter = tmp.iter(); !iter.done(); iter.next()) { if (!s->putNew(iter.get())) { return false; } } return true; }
static bool SetsAreEqual(IntSet& am, IntSet& bm) { bool equal = true; if (am.count() != bm.count()) { equal = false; fprintf(stderr, "A.count() == %u and B.count() == %u\n", am.count(), bm.count()); } for (auto iter = am.iter(); !iter.done(); iter.next()) { if (!bm.has(iter.get())) { equal = false; fprintf(stderr, "B does not have %x which is in A\n", iter.get()); } } for (auto iter = bm.iter(); !iter.done(); iter.next()) { if (!am.has(iter.get())) { equal = false; fprintf(stderr, "A does not have %x which is in B\n", iter.get()); } } return equal; }
static bool SetsAreEqual(IntSet& am, IntSet& bm) { bool equal = true; if (am.count() != bm.count()) { equal = false; fprintf(stderr, "A.count() == %u and B.count() == %u\n", am.count(), bm.count()); } for (IntSet::Range r = am.all(); !r.empty(); r.popFront()) { if (!bm.has(r.front())) { equal = false; fprintf(stderr, "B does not have %x which is in A\n", r.front()); } } for (IntSet::Range r = bm.all(); !r.empty(); r.popFront()) { if (!am.has(r.front())) { equal = false; fprintf(stderr, "A does not have %x which is in B\n", r.front()); } } return equal; }
static bool SlowRekey(IntSet *s) { IntSet tmp; tmp.init(); for (IntSet::Range r = s->all(); !r.empty(); r.popFront()) { if (NewKeyFunction::shouldBeRemoved(r.front())) continue; uint32_t hi = NewKeyFunction::rekey(r.front()); if (tmp.has(hi)) return false; tmp.putNew(hi); } s->clear(); for (IntSet::Range r = tmp.all(); !r.empty(); r.popFront()) { s->putNew(r.front()); } return true; }