souffle
2.0.2-371-g6315b36
|
#include <EquivalenceRelation.h>
|
class | iterator |
|
struct | operation_hints |
| A collection of operation hints speeding up some of the involved operations by exploiting temporal locality. More...
|
|
|
iterator | anteriorIt (value_type anteriorVal) const |
| Creates an iterator that generates all pairs (A, X) for a given A, and X are elements within A's disjoint set. More...
|
|
iterator | antpostit (value_type anteriorVal, value_type posteriorVal) const |
| Creates an iterator that generates the pair (A, B) for a given A and B. More...
|
|
iterator | begin () const |
| iterator pointing to the beginning of the tuples, with no restrictions More...
|
|
void | clear () |
| Empty the relation. More...
|
|
iterator | closure (value_type rep) const |
| Begin an iterator over all pairs within a single disjoint set - This is used for partition(). More...
|
|
bool | contains (const TupleType &tuple) const |
|
bool | contains (const TupleType &tuple, operation_hints &) const |
| Returns whether there exists given tuple. More...
|
|
bool | contains (value_type x, value_type y) const |
| Returns whether there exists a pair with these two nodes. More...
|
|
bool | empty () const |
| Check emptiness. More...
|
|
void | emptyPartition () const |
|
iterator | end () const |
| iterator pointing to the end of the tuples More...
|
|
| EquivalenceRelation () |
|
void | extend (const EquivalenceRelation< TupleType > &other) |
| Extend this relation with another relation, expanding this equivalence relation The supplied relation is the old knowledge, whilst this relation only contains explicitly new knowledge. More...
|
|
iterator | find (const TupleType &, operation_hints &) const |
|
iterator | find (const TupleType &t) const |
|
template<unsigned levels> |
range< iterator > | getBoundaries (const TupleType &entry) const |
| Obtains a range of elements matching the prefix of the given entry up to levels elements. More...
|
|
template<unsigned levels> |
range< iterator > | getBoundaries (const TupleType &entry, operation_hints &) const |
| Obtains a range of elements matching the prefix of the given entry up to levels elements. More...
|
|
bool | insert (const TupleType &tuple) |
| Insert the tuple symbolically. More...
|
|
bool | insert (value_type x, value_type y) |
| Insert the two values symbolically as a binary relation. More...
|
|
bool | insert (value_type x, value_type y, operation_hints) |
| Insert the two values symbolically as a binary relation. More...
|
|
void | insertAll (const EquivalenceRelation< TupleType > &other) |
| inserts all nodes from the other relation into this one More...
|
|
iterator | lower_bound (const TupleType &entry) const |
|
iterator | lower_bound (const TupleType &entry, operation_hints &) const |
| Act similar to getBoundaries. More...
|
|
std::vector< souffle::range< iterator > > | partition (size_t chunks) const |
| Generate an approximate number of iterators for parallel iteration The iterators returned are not necessarily equal in size, but in practise are approximately similarly sized Depending on the structure of the data, there can be more or less partitions returned than requested. More...
|
|
size_t | size () const |
| Size of relation. More...
|
|
iterator | upper_bound (const TupleType &, operation_hints &) const |
| This function is only here in order to unify interfaces in InterpreterIndex. More...
|
|
iterator | upper_bound (const TupleType &entry) const |
|
| ~EquivalenceRelation () |
|
template<typename TupleType>
class souffle::EquivalenceRelation< TupleType >
Definition at line 50 of file EquivalenceRelation.h.
◆ element_type
template<typename TupleType >
◆ StatesBucket
template<typename TupleType >
◆ StatesList
template<typename TupleType >
◆ StatesMap
template<typename TupleType >
◆ StorePair
template<typename TupleType >
◆ value_type
template<typename TupleType >
◆ EquivalenceRelation()
template<typename TupleType >
◆ ~EquivalenceRelation()
template<typename TupleType >
◆ anteriorIt()
template<typename TupleType >
◆ antpostit()
template<typename TupleType >
Creates an iterator that generates the pair (A, B) for a given A and B.
If A and B don't exist, or aren't in the same set, then the end() iterator is returned.
- Parameters
-
anteriorVal | the A value of the tuple |
posteriorVal | the B value of the tuple |
- Returns
- the iterator representing this
Definition at line 638 of file EquivalenceRelation.h.
645 return iterator(
this, (*found).second);
◆ begin()
template<typename TupleType >
◆ clear()
template<typename TupleType >
◆ closure()
template<typename TupleType >
◆ contains() [1/3]
template<typename TupleType >
◆ contains() [2/3]
template<typename TupleType >
Returns whether there exists given tuple.
- Parameters
-
tuple | The tuple to search for. |
Definition at line 207 of file EquivalenceRelation.h.
◆ contains() [3/3]
template<typename TupleType >
◆ containsElement()
template<typename TupleType >
◆ empty()
template<typename TupleType >
◆ emptyPartition()
template<typename TupleType >
◆ end()
template<typename TupleType >
◆ extend()
template<typename TupleType >
Extend this relation with another relation, expanding this equivalence relation The supplied relation is the old knowledge, whilst this relation only contains explicitly new knowledge.
After this operation the "implicitly new tuples" are now explicitly inserted this relation.
Definition at line 152 of file EquivalenceRelation.h.
155 if (repsCovered.count(rep) == 0) {
156 repsCovered.emplace(rep);
166 auto it = other.sds.sparseToDenseMap.begin();
167 auto end = other.sds.sparseToDenseMap.end();
168 for (; it !=
end; ++it) {
170 rep = other.sds.findNode(el);
171 if (repsCovered.count(rep) != 0) {
191 bool contains(
const TupleType& tuple, operation_hints&)
const {
192 return contains(tuple[0], tuple[1]);
◆ find() [1/2]
template<typename TupleType >
◆ find() [2/2]
template<typename TupleType >
◆ genAllDisjointSetLists()
template<typename TupleType >
◆ getBoundaries() [1/2]
template<typename TupleType >
template<unsigned levels>
Obtains a range of elements matching the prefix of the given entry up to levels elements.
- Template Parameters
-
levels | the length of the requested matching prefix |
- Parameters
-
entry | the entry to be looking for |
- Returns
- the corresponding range of matching elements
Definition at line 502 of file EquivalenceRelation.h.
◆ getBoundaries() [2/2]
template<typename TupleType >
template<unsigned levels>
Obtains a range of elements matching the prefix of the given entry up to levels elements.
A operation context may be provided to exploit temporal locality.
- Template Parameters
-
levels | the length of the requested matching prefix |
- Parameters
-
entry | the entry to be looking for |
ctxt | the operation context to be utilized |
- Returns
- the corresponding range of matching elements
Definition at line 518 of file EquivalenceRelation.h.
◆ insert() [1/3]
template<typename TupleType >
Insert the tuple symbolically.
- Parameters
-
tuple | The tuple to be inserted |
- Returns
- true if the tuple is new to the data structure
Definition at line 104 of file EquivalenceRelation.h.
◆ insert() [2/3]
template<typename TupleType >
◆ insert() [3/3]
template<typename TupleType >
Insert the two values symbolically as a binary relation.
- Parameters
-
x | node to be added/paired |
y | node to be added/paired |
z | the hints to where the pair should be inserted (not applicable atm) |
- Returns
- true if the pair is new to the data structure
Definition at line 116 of file EquivalenceRelation.h.
116 : other.equivalencePartition.getChunks(
MAX_THREADS)) {
120 const size_t ksize = pl.size();
121 for (
size_t i = 0;
i < ksize; ++
i) {
◆ insertAll()
template<typename TupleType >
inserts all nodes from the other relation into this one
- Parameters
-
other | the binary relation from which to add elements from |
Definition at line 128 of file EquivalenceRelation.h.
138 if (other.size() == 0 || this->size() == 0)
return;
141 other.genAllDisjointSetLists();
143 std::set<value_type> repsCovered;
◆ lower_bound() [1/2]
template<typename TupleType >
◆ lower_bound() [2/2]
template<typename TupleType >
Act similar to getBoundaries.
But non-static. This function should be used ONLY by interpreter, and its behavior is tightly coupling with InterpreterIndex. Do Not rely on this interface outside the interpreter.
- Parameters
-
entry | the entry to be looking for |
- Returns
- the corresponding range of matching elements
Definition at line 557 of file EquivalenceRelation.h.
568 iterator
lower_bound(
const TupleType& entry)
const {
569 operation_hints hints;
581 iterator
upper_bound(
const TupleType&, operation_hints&)
const {
◆ partition()
template<typename TupleType >
Generate an approximate number of iterators for parallel iteration The iterators returned are not necessarily equal in size, but in practise are approximately similarly sized Depending on the structure of the data, there can be more or less partitions returned than requested.
- Parameters
-
chunks | the number of requested partitions |
- Returns
- a list of the iterators as ranges
Definition at line 672 of file EquivalenceRelation.h.
678 const size_t s = itp.second->
size();
679 if (s * s > perchunk) {
680 for (
const auto&
i : *itp.second) {
691 iterator
find(
const TupleType&, operation_hints&)
const {
692 throw std::runtime_error(
"error: find() is not compatible with equivalence relations");
696 iterator
find(
const TupleType& t)
const {
697 operation_hints context;
698 return find(t, context);
◆ size()
template<typename TupleType >
◆ upper_bound() [1/2]
template<typename TupleType >
◆ upper_bound() [2/2]
template<typename TupleType >
◆ equivalencePartition
template<typename TupleType >
◆ sds
template<typename TupleType >
◆ statesLock
template<typename TupleType >
◆ statesMapStale
template<typename TupleType >
The documentation for this class was generated from the following file:
bool sameSet(SparseDomain x, SparseDomain y)
std::shared_mutex statesLock
std::set< const Atom * > ignore
std::pair< value_type, StatesBucket > StorePair
iterator find(const TupleType &, operation_hints &) const
bool contains(value_type x, value_type y) const
Returns whether there exists a pair with these two nodes.
std::atomic< bool > statesMapStale
l j a showGridBackground &&c b raw series this eventEmitter e
iterator lower_bound(const TupleType &entry, operation_hints &) const
Act similar to getBoundaries.
void unionNodes(SparseDomain x, SparseDomain y)
void genAllDisjointSetLists() const
Generate a cache of the sets such that they can be iterated over efficiently.
iterator end() const
iterator pointing to the end of the tuples
Functor::result_type insert(Key &k, const Functor &f)
Inserts the given key into this tree.
size_t size() const
Size of relation.
souffle::PiggyList< value_type > StatesList
bool contains(SparseDomain v1, SparseDomain v2)
iterator anteriorIt(value_type anteriorVal) const
Creates an iterator that generates all pairs (A, X) for a given A, and X are elements within A's disj...
SparseDomain findNode(SparseDomain x)
range< Iter > make_range(const Iter &a, const Iter &b)
A utility function enabling the construction of ranges without explicitly specifying the iterator typ...
bool containsElement(value_type e) const
constexpr RamSigned MIN_RAM_SIGNED
lower and upper boundaries for the ram types
bool insert(value_type x, value_type y)
Insert the two values symbolically as a binary relation.
iterator find(const Key &k) const
Locates the given key within this tree and returns an iterator referencing its position.
iterator upper_bound(const TupleType &, operation_hints &) const
This function is only here in order to unify interfaces in InterpreterIndex.
bool nodeExists(const SparseDomain val) const
iterator closure(value_type rep) const
Begin an iterator over all pairs within a single disjoint set - This is used for partition().
souffle::SparseDisjointSet< value_type > sds
StatesMap equivalencePartition
typename TupleType::value_type value_type
iterator begin() const
iterator pointing to the beginning of the tuples, with no restrictions
iterator antpostit(value_type anteriorVal, value_type posteriorVal) const
Creates an iterator that generates the pair (A, B) for a given A and B.
a horizontalBars(j=m=void 0===a.axisX.type?new c.AutoScaleAxis(c.Axis.units.x, b.normalized.series, o, c.extend({}, a.axisX,{highLow:d, referenceValue:0})):a.axisX.type.call(c, c.Axis.units.x, b.normalized.series, o, c.extend({}, a.axisX,{highLow:d, referenceValue:0})), l=n=void 0===a.axisY.type?new c.StepAxis(c.Axis.units.y, b.normalized.series, o,{ticks:k}):a.axisY.type.call(c, c.Axis.units.y, b.normalized.series, o, a.axisY)) var p