DDD
1.9.0.20240826145154
|
This is the user interface class to manipulate homomorphisms. More...
#include <Hom.h>
Public Types | |
typedef GDDD | NodeType |
Public Member Functions | |
Public Constructors. | |
Default constructor builds identity homomorphism. | |
Hom (const GHom &h=GHom::id) | |
Build an Hom from a GHom. More... | |
Hom (const Hom &h) | |
Copy constructor. Maintains reference count. More... | |
Hom (const GDDD &d) | |
Constructs a constant homomorphism. More... | |
Hom (int var, int val, const GHom &h=GHom::id) | |
Left concatenation of a single arc DDD. More... | |
~Hom () | |
Destructor maintains reference counting. More... | |
Assignment operators. | |
Hom & | operator= (const GHom &) |
Overloaded behavior for assignment operator, maintains reference counting. More... | |
Hom & | operator= (const Hom &) |
Overloaded behavior for assignment operator, maintains reference counting. More... | |
Static Public Attributes | |
Public Constructors | |
static const GHom | id |
Elementary homomorphism Identity, defined as a constant. More... | |
Private Attributes | |
const _GHom * | concret |
The real implementation class. More... | |
Comparisons for hash and map storage | |
bool | operator== (const GHom &h) const |
Comparison between Homomorphisms. More... | |
bool | operator!= (const GHom &h) const |
Comparison between Homomorphisms. More... | |
bool | operator< (const GHom &h) const |
Total ordering function between Hom. More... | |
bool | is_selector () const |
This predicate is true if the homomorphism global behavior is only to prune some paths. More... | |
const range_t | get_range () const |
Returns the range for this homomorphism, i.e. the dual of skip_variable. More... | |
GHom | invert (const GDDD &pot) const |
returns the predescessor homomorphism, using pot to determine variable domains More... | |
GDDD | has_image (const GDDD &d) const |
returns true if and only if h(d) != SDD::null More... | |
GHom | negate () const |
returns a negation of a selector homomorphism h, such that h.negate() (d) = d - h(d) More... | |
GDDD | operator() (const GDDD &d) const |
Evaluation operator. More... | |
GDDD | eval (const GDDD &d) const |
Evaluation function : users should use operator() instead of this. More... | |
bool | skip_variable (int var) const |
GHom | compose (const GHom &r) const |
int | refCounter () const |
Accessor to visualize the reference count of the concret instance. More... | |
typedef d3::set< int >::type | range_t |
typedef range_t::const_iterator | range_it |
static const range_t | full_range = GHom::range_t() |
The full_range : that targets everyone. More... | |
static GHom | add (const d3::set< GHom >::type &set) |
A constructor for a union of several homomorphisms. More... | |
static GHom | ccompose (const d3::set< GHom >::type &set) |
A constructor for a commutative composition of several homomorphisms. More... | |
Memory Management | |
void | mark () const |
For garbage collection internals. Marks a GHom as in use in garbage collection phase. More... | |
size_t | hash () const |
For storage in a hash table. More... | |
static unsigned int | statistics () |
Returns unicity table current size. Gives the number of different _GHom created and not yet destroyed. More... | |
static void | pstats (bool reinit=true) |
Prints some statistics to std::cout. More... | |
static void | garbage () |
For garbage collection. More... | |
This is the user interface class to manipulate homomorphisms.
The only difference with Hom is that it implements reference counting so that instances of Hom are not collected upon MemoryManager::garbage().
|
inherited |
|
inherited |
|
inherited |
References GHom::concret, and _GHom::refCounter.
Hom::Hom | ( | const Hom & | h | ) |
Copy constructor. Maintains reference count.
References GHom::concret, and _GHom::refCounter.
Hom::Hom | ( | const GDDD & | d | ) |
Constructs a constant homomorphism.
References GHom::concret, and _GHom::refCounter.
Left concatenation of a single arc DDD.
This is provided as a convenience and to avoid the inefficiency if we build a node pointing to GSDD::one and then concatenate something to it. Applied to a SDD d, this homomorphism will return var–val->h(d).
var | the variable labeling the node to left concat |
val | the set of values labeling the arc |
h | the homomorphism to apply on the argument d. This defaults to GSHom::id. |
References GHom::concret, and _GHom::refCounter.
Hom::~Hom | ( | ) |
Destructor maintains reference counting.
Note that the destructor does not truly reclaim memory, MemoryManager::garbage() does that.
References GHom::concret, and _GHom::refCounter.
A constructor for a union of several homomorphisms.
Note that for canonisation and optimization reasons, union is an n-ary and commutative composition operator. Use of this constructor may be slightly more efficient than using operator+ multiple times. H({h1,h2, ..hn}) (d) = sum_i h_i (d).
set | the set of homomorphisms to put in the union. |
References canonical, GHom::GHom(), and GDDD::null.
Referenced by Add::invert(), _setVarConst::invert(), And::negate(), and Add::skip_variable().
A constructor for a commutative composition of several homomorphisms.
It's up to user to ensure pairwise commutatitivity off all arguments in the set
set | the set of homomorphisms to put in the composition. |
References canonical, and GHom::id.
Referenced by Add::negate().
References _GHom::compose(), and GHom::concret.
Referenced by nsMLHom::ConstantUp::eval().
Evaluation function : users should use operator() instead of this.
This evaluation function does not use the cache, it is called in case of cache miss in the call to operator().
d | the argument DDD |
References GHom::concret, and _GHom::eval_skip().
Referenced by _DED_Hom::eval().
|
staticinherited |
For garbage collection.
WARNING Do not use this function directly !! Use MemoryManager::garbage() to ensure proper reference counting and cache cleanup. Garbage collection algorithm is a simple two phase mark and sweep : in phase mark, all nodes with positive reference counts are marked, as well as their descendants, recursively. In phase sweep, all nodes which are unmarked are destroyed. This avoids maintaining reference counts during operation : only external references made through the DDD class are counted, and no recursive reference counting is needed.
References cache, canonical, Cache< FuncType, ParamType, ResType, EvalFunc >::clear(), imgcache, and _GHom::marking.
Referenced by MemoryManager::garbage().
|
inherited |
Returns the range for this homomorphism, i.e. the dual of skip_variable.
References GHom::concret, and _GHom::get_range().
Referenced by commutative(), NotCond::get_range(), Compose::get_range(), Fixpoint::get_range(), and notInRange().
returns true if and only if h(d) != SDD::null
References imgcache, Cache< FuncType, ParamType, ResType, EvalFunc >::insert(), and GDDD::null.
Referenced by Inter::has_image(), NotCond::has_image(), Add::has_image(), LeftConcat::has_image(), RightConcat::has_image(), Fixpoint::has_image(), sns::LocalApply::has_image(), and _GHom::has_image_skip().
|
inlineinherited |
For storage in a hash table.
References GHom::concret, and ddd::knuth32_hash().
Referenced by _DED_Hom::hash(), Mult::hash(), Inter::hash(), NotCond::hash(), Compose::hash(), LeftConcat::hash(), RightConcat::hash(), Minus::hash(), Fixpoint::hash(), nsMLHom::GHomAdapter::hash(), nsMLHom::ConstantUp::hash(), and sns::LocalApply::hash().
returns the predescessor homomorphism, using pot to determine variable domains
References GHom::concret, and _GHom::invert().
Referenced by Mult::invert(), Inter::invert(), Compose::invert(), Minus::invert(), Fixpoint::invert(), and sns::LocalApply::invert().
|
inherited |
This predicate is true if the homomorphism global behavior is only to prune some paths.
References GHom::concret, and _GHom::is_selector().
Referenced by commutative(), Mult::is_selector(), Inter::is_selector(), Compose::is_selector(), Minus::is_selector(), Fixpoint::is_selector(), sns::LocalApply::is_selector(), ITE(), and operator*().
|
inherited |
For garbage collection internals. Marks a GHom as in use in garbage collection phase.
References GHom::concret, _GHom::mark(), and _GHom::marking.
Referenced by Fixpoint::eval(), Mult::mark(), Inter::mark(), NotCond::mark(), Compose::mark(), LeftConcat::mark(), RightConcat::mark(), Minus::mark(), Fixpoint::mark(), sns::LocalApply::mark(), and MemoryManager::mark().
|
inherited |
returns a negation of a selector homomorphism h, such that h.negate() (d) = d - h(d)
References GHom::concret, and _GHom::negate().
Referenced by NotCond::has_image(), and Inter::negate().
|
inlineinherited |
Comparison between Homomorphisms.
Note that comparison is based on "concret" address in unicity table.
h | the hom to compare to |
References GHom::concret.
Evaluation operator.
Homomorphisms overload operator(), so they can be directly applied to DDD nodes. Note that evaluation through this operator uses and updates a cache.
d | the DDD to apply this h to. |
References cache, GHom::concret, _GHom::eval(), _GHom::immediat, Cache< FuncType, ParamType, ResType, EvalFunc >::insert(), and GDDD::null.
|
inherited |
Total ordering function between Hom.
Note that comparison is based on chronological ordering of creation, and delegated to "concret". Unlike comparison on addresses in unicity table, this ensures reproductible results. This ordering is necessary for hash and map storage of GHom.
h | the node to compare to |
References GHom::concret.
Overloaded behavior for assignment operator, maintains reference counting.
References GHom::concret, and _GHom::refCounter.
Overloaded behavior for assignment operator, maintains reference counting.
References GHom::concret, and _GHom::refCounter.
|
inlineinherited |
Comparison between Homomorphisms.
Note that comparison is based on "concret" address in unicity table.
h | the hom to compare to |
|
staticinherited |
Prints some statistics to std::cout.
Mostly used in debug and development phase.
References GHom::_GHom, cache, and canonical.
Referenced by MemoryManager::pstats().
|
inherited |
Accessor to visualize the reference count of the concret instance.
See _GHom::refCounter for details.
References GHom::concret, and _GHom::refCounter.
|
inherited |
References GHom::concret, and _GHom::skip_variable().
Referenced by nsMLHom::GHomAdapter::skip_variable().
|
staticinherited |
Returns unicity table current size. Gives the number of different _GHom created and not yet destroyed.
References canonical.
Referenced by Statistic::load(), and MemoryManager::nbHom().
|
privateinherited |
The real implementation class.
All true operations are delagated on this pointer. Construction/destruction take care of ensuring concret is only instantiated once in memory.
Referenced by GHom::compose(), GHom::eval(), _GHom::get_concret(), GHom::get_range(), GHom::hash(), Hom(), GHom::invert(), GHom::is_selector(), GHom::mark(), GHom::negate(), GHom::operator!=(), GHom::operator()(), GHom::operator<(), operator=(), GHom::refCounter(), GHom::skip_variable(), and ~Hom().
|
staticinherited |
The full_range : that targets everyone.
Referenced by _GHom::get_range().
|
staticinherited |
Elementary homomorphism Identity, defined as a constant.
id(d) = d
Referenced by buildUnionParameters(), GHom::ccompose(), _GHom::compose(), StrongMLHom::eval(), And::eval(), nsMLHom::Identity::eval(), nsMLHom::GHomAdapter::eval(), _GHom::eval_skip(), Add::get_have_id(), Fixpoint::has_image(), sns::Fixpoint::has_image(), _GHom::has_image_skip(), Mult::invert(), And::invert(), Minus::invert(), Fixpoint::invert(), Constant::negate(), operator*(), _VarCompState::phi(), _setVarConst::phi(), varEqVar(), varGeqVar(), and varLeqVar().