DDD
1.9.0.20240826145154
|
#include <MLHom.h>
Public Member Functions | |
MLHom () | |
Default public constructor. More... | |
MLHom (const GHom &h) | |
MLHom (const GHom &up, const MLHom &down) | |
MLHom (const _MLHom &) | |
MLHom (_MLHom *) | |
MLHom (const _MLHom *) | |
MLHom (int var, int val, const MLHom &h=MLHom::id) | |
Create variable/value pair and left concatenate to a homomorphism. More... | |
virtual | ~MLHom () |
bool | operator< (const MLHom &h) const |
bool | operator== (const MLHom &h) const |
size_t | hash () const |
Hash key computation. More... | |
HomNodeMap | eval (const GDDD &d) const |
The computation function responsible for evaluation over a node. More... | |
HomNodeMap | operator() (const GDDD &) const |
cache calls to eval More... | |
Static Public Member Functions | |
static void | garbage () |
Collects and destroys unused homomorphisms. More... | |
Static Public Attributes | |
static const MLHom | id |
Elementary homomorphism Identity, defined as a constant. More... | |
Private Attributes | |
const _MLHom * | concret |
The real implementation class. More... | |
Friends | |
MLHom | operator+ (const MLHom &, const MLHom &) |
By definition, as homomorphism are linear, (h+g) (d) = h(d) + g(d) ;. More... | |
|
inline |
MLHom::MLHom | ( | const GHom & | h | ) |
MLHom::MLHom | ( | const _MLHom & | h | ) |
MLHom::MLHom | ( | _MLHom * | ) |
MLHom::MLHom | ( | const _MLHom * | h | ) |
Create variable/value pair and left concatenate to a homomorphism.
h(var,val,g) (d) = DDD(var,val) ^ g(d). In other words : var – val -> g
var | the variable index |
val | the value associated to the variable |
h | the homomorphism to apply on successor node. Default is identity, so is equivalent to a left concatenation of a DDD(var,val). |
|
virtual |
HomNodeMap MLHom::eval | ( | const GDDD & | d | ) | const |
The computation function responsible for evaluation over a node.
Users should not directly use this. Normal behavior is to use operator() that encapsulates this call with operation caching.
References concret, and _MLHom::eval().
|
static |
Collects and destroys unused homomorphisms.
Do not call this directly but through MemoryManager::garbage() as order of calls (among GSDD::garbage(), GShom::garbage(), SDED::garbage()) is important.
References canonical, MLCache< MLHomType, NodeType, HomNodeMapType >::clear(), _MLHom::marking, and nsMLHom::mlcache.
Referenced by MemoryManager::garbage().
|
inline |
Hash key computation.
It is essential for good hash table operation that the spread of the keys be as good as possible. Also, fast hash key computation is a good design goal. Note that bad hash functions will yield more collisions, thus equality comparisons which may be quite costly.
References concret, and ddd::knuth32_hash().
Referenced by MLHomAdapter::hash(), nsMLHom::ConstantUp::hash(), and nsMLHom::LeftConcat::hash().
HomNodeMap MLHom::operator() | ( | const GDDD & | d | ) | const |
cache calls to eval
References MLCache< MLHomType, NodeType, HomNodeMapType >::insert(), and nsMLHom::mlcache.
By definition, as homomorphism are linear, (h+g) (d) = h(d) + g(d) ;.
Where g,h are homomorphisms and d is a DDD.
This commutative operation computes a homomorphism that evaluates as the sum of two homomorphism.
Semantics : (h1 + h2) (d) = h1(d) + h2(d).
|
private |
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 eval(), hash(), operator<(), and operator==().
|
static |
Elementary homomorphism Identity, defined as a constant.
id(d) = <id, d>