![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Class implementing linear approximation policy (meaning possible value are split out in interval). More...
#include <linearApproximationPolicy.h>
Public Member Functions | |
Constructors / Destructors | |
LinearApproximationPolicy (GUM_SCALAR low=(GUM_SCALAR) 0.0, GUM_SCALAR high=(GUM_SCALAR) 1.0, GUM_SCALAR eps=(GUM_SCALAR) 0.1) | |
Default constructor. More... | |
LinearApproximationPolicy (const LinearApproximationPolicy< GUM_SCALAR > *md) | |
Copy constructor. More... | |
Accessors/Modifiers | |
GUM_SCALAR | fromExact (const GUM_SCALAR &value) const |
Convert value to his approximation. More... | |
void | combineAdd (const ApproximationPolicy< GUM_SCALAR > *ap) |
Combine using addition with the given gum::ApproximationPolicy. More... | |
void | combineSub (const ApproximationPolicy< GUM_SCALAR > *ap) |
Combine using substraction with the given gum::ApproximationPolicy. More... | |
void | combineMult (const ApproximationPolicy< GUM_SCALAR > *ap) |
Combine using multiplication with the given gum::ApproximationPolicy. More... | |
void | combineDiv (const ApproximationPolicy< GUM_SCALAR > *ap) |
Combine using division with the given gum::ApproximationPolicy. More... | |
void | combineMax (const ApproximationPolicy< GUM_SCALAR > *ap) |
Combine using max with the given gum::ApproximationPolicy. More... | |
void | combineMin (const ApproximationPolicy< GUM_SCALAR > *ap) |
Combine using min with the given gum::ApproximationPolicy. More... | |
GUM_SCALAR | safeFromExact (const GUM_SCALAR &value) |
Convert value to his approximation. More... | |
Idx | encode (const GUM_SCALAR &value) const |
Encode a given value into its approximation representation. More... | |
GUM_SCALAR | decode (Idx representation) const |
Convert approximation representation to value. More... | |
virtual void | setEpsilon (const GUM_SCALAR &e) |
Sets approximation factor. More... | |
virtual void | setLimits (const GUM_SCALAR &newLowLimit, const GUM_SCALAR &newHighLimit) |
Set bounds in a whole. More... | |
virtual void | setLowLimit (const GUM_SCALAR &newLowLimit) |
Sets lowest possible value. More... | |
const GUM_SCALAR & | lowLimit () const |
Gets lowest possible value. More... | |
virtual void | setHighLimit (const GUM_SCALAR &newHighLimit) |
Sets Highest possible value. More... | |
const GUM_SCALAR & | highLimit () const |
Gets Highest possible value. More... | |
Protected Attributes | |
GUM_SCALAR | lowLimit_ |
Lowest value possible. More... | |
GUM_SCALAR | highLimit_ |
Highest value possible. More... | |
GUM_SCALAR | epsilon_ |
Approximation factor. More... | |
Idx | nbInterval_ |
The number of interval. More... | |
Protected Member Functions | |
Idx | _encode_ (const GUM_SCALAR &value) const |
Concretely computes the approximate representation. More... | |
GUM_SCALAR | _decode_ (const GUM_SCALAR &representation) const |
Concretely computes the approximate value from representation. More... | |
void | computeNbInterval_ () |
Get the number of interval. More... | |
Class implementing linear approximation policy (meaning possible value are split out in interval).
GUM_SCALAR | The type used for computations. |
Definition at line 54 of file linearApproximationPolicy.h.
gum::LinearApproximationPolicy< GUM_SCALAR >::LinearApproximationPolicy | ( | GUM_SCALAR | low = (GUM_SCALAR)0.0 , |
GUM_SCALAR | high = (GUM_SCALAR)1.0 , |
||
GUM_SCALAR | eps = (GUM_SCALAR)0.1 |
||
) |
Default constructor.
low | The lower limit. |
high | The higher limit. |
eps | The epsilon. |
OutOfBound | if out of bounds (low<high, eps>0) |
Definition at line 37 of file linearApproximationPolicy_tpl.h.
gum::LinearApproximationPolicy< GUM_SCALAR >::LinearApproximationPolicy | ( | const LinearApproximationPolicy< GUM_SCALAR > * | md | ) |
Copy constructor.
md | The gum::LinearApproximationPolicy to copy. |
Definition at line 49 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protected |
Concretely computes the approximate value from representation.
representation | The approximate value to decode. |
Definition at line 360 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protected |
Concretely computes the approximate representation.
value | The value to encode. |
Definition at line 349 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Combine using addition with the given gum::ApproximationPolicy.
ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 64 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Combine using division with the given gum::ApproximationPolicy.
ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 154 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Combine using max with the given gum::ApproximationPolicy.
ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 184 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Combine using min with the given gum::ApproximationPolicy.
ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 214 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Combine using multiplication with the given gum::ApproximationPolicy.
ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 124 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Combine using substraction with the given gum::ApproximationPolicy.
ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 94 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protected |
Get the number of interval.
Definition at line 371 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE GUM_SCALAR gum::LinearApproximationPolicy< GUM_SCALAR >::decode | ( | Idx | representation | ) | const |
Convert approximation representation to value.
representation | The approximation representation to decode. |
Definition at line 282 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE Idx gum::LinearApproximationPolicy< GUM_SCALAR >::encode | ( | const GUM_SCALAR & | value | ) | const |
Encode a given value into its approximation representation.
value | The to encode. |
OutOfLowerBound | Raised if value is out of bounds. |
OutOfUpperBound | Raised if value is out of bounds. |
Definition at line 261 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Convert value to his approximation.
value | The converted value. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 58 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE const GUM_SCALAR & gum::LinearApproximationPolicy< GUM_SCALAR >::highLimit | ( | ) | const |
Gets Highest possible value.
Definition at line 343 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE const GUM_SCALAR & gum::LinearApproximationPolicy< GUM_SCALAR >::lowLimit | ( | ) | const |
Gets lowest possible value.
Definition at line 324 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE GUM_SCALAR gum::LinearApproximationPolicy< GUM_SCALAR >::safeFromExact | ( | const GUM_SCALAR & | value | ) |
Convert value to his approximation.
This method is slower than fromExact since it verifies the bounds.
OutOfLowerBound | Raised if value is out of bounds. |
OutOfUpperBound | Raised if value is out of bounds. |
Definition at line 247 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Sets approximation factor.
e | The new epsilon value. |
Definition at line 292 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Sets Highest possible value.
newHighLimit | New higher bound. |
OutOfLowerBound | Raised if out of bound. |
Definition at line 331 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Set bounds in a whole.
newLowLimit | New lower bound. |
newHighLimit | New higher bound. |
OutOfBounds | Raised if new bounds are not legit. |
Definition at line 299 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Sets lowest possible value.
newLowLimit | New lower bound. |
OutOfUpperBound | Raised if out of bound. |
Definition at line 312 of file linearApproximationPolicy_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protected |
Approximation factor.
Definition at line 208 of file linearApproximationPolicy.h.
|
protected |
Highest value possible.
Definition at line 205 of file linearApproximationPolicy.h.
|
protected |
Lowest value possible.
Definition at line 202 of file linearApproximationPolicy.h.
|
protected |
The number of interval.
Definition at line 234 of file linearApproximationPolicy.h.