![]() |
aGrUM 3.1.1
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_ELEMENT low=(GUM_ELEMENT) 0.0, GUM_ELEMENT high=(GUM_ELEMENT) 1.0, GUM_ELEMENT eps=(GUM_ELEMENT) 0.1) | |
| Default constructor. | |
| LinearApproximationPolicy (const LinearApproximationPolicy< GUM_ELEMENT > *md) | |
| Copy constructor. | |
Accessors/Modifiers | |
| GUM_ELEMENT | fromExact (const GUM_ELEMENT &value) const override |
| Convert value to his approximation. | |
| void | combineAdd (const ApproximationPolicy< GUM_ELEMENT > *ap) override |
| Combine using addition with the given gum::ApproximationPolicy. | |
| void | combineSub (const ApproximationPolicy< GUM_ELEMENT > *ap) override |
| Combine using subtraction with the given gum::ApproximationPolicy. | |
| void | combineMult (const ApproximationPolicy< GUM_ELEMENT > *ap) override |
| Combine using multiplication with the given gum::ApproximationPolicy. | |
| void | combineDiv (const ApproximationPolicy< GUM_ELEMENT > *ap) override |
| Combine using division with the given gum::ApproximationPolicy. | |
| void | combineMax (const ApproximationPolicy< GUM_ELEMENT > *ap) override |
| Combine using max with the given gum::ApproximationPolicy. | |
| void | combineMin (const ApproximationPolicy< GUM_ELEMENT > *ap) override |
| Combine using min with the given gum::ApproximationPolicy. | |
| GUM_ELEMENT | safeFromExact (const GUM_ELEMENT &value) |
| Convert value to his approximation. | |
| Idx | encode (const GUM_ELEMENT &value) const |
| Encode a given value into its approximation representation. | |
| GUM_ELEMENT | decode (Idx representation) const |
| Convert approximation representation to value. | |
| virtual void | setEpsilon (const GUM_ELEMENT &e) |
| Sets approximation factor. | |
| virtual void | setLimits (const GUM_ELEMENT &newLowLimit, const GUM_ELEMENT &newHighLimit) |
| Set bounds in a whole. | |
| virtual void | setLowLimit (const GUM_ELEMENT &newLowLimit) |
| Sets lowest possible value. | |
| const GUM_ELEMENT & | lowLimit () const |
| Gets lowest possible value. | |
| virtual void | setHighLimit (const GUM_ELEMENT &newHighLimit) |
| Sets Highest possible value. | |
| const GUM_ELEMENT & | highLimit () const |
| Gets Highest possible value. | |
Accessors / Modifiers | |
| virtual GUM_SCALAR | fromExact (const GUM_SCALAR &value) const=0 |
| Convert value to his approximation. | |
| virtual void | combineAdd (const ApproximationPolicy< GUM_SCALAR > *ap)=0 |
| Combine using addition with the given gum::ApproximationPolicy. | |
| virtual void | combineSub (const ApproximationPolicy< GUM_SCALAR > *ap)=0 |
| Combine using subtraction with the given gum::ApproximationPolicy. | |
| virtual void | combineMult (const ApproximationPolicy< GUM_SCALAR > *ap)=0 |
| Combine using multiplication with the given gum::ApproximationPolicy. | |
| virtual void | combineDiv (const ApproximationPolicy< GUM_SCALAR > *ap)=0 |
| Combine using division with the given gum::ApproximationPolicy. | |
| virtual void | combineMax (const ApproximationPolicy< GUM_SCALAR > *ap)=0 |
| Combine using max with the given gum::ApproximationPolicy. | |
| virtual void | combineMin (const ApproximationPolicy< GUM_SCALAR > *ap)=0 |
| Combine using min with the given gum::ApproximationPolicy. | |
Protected Member Functions | |
| Idx | _encode_ (const GUM_ELEMENT &value) const |
| Concretely computes the approximate representation. | |
| GUM_ELEMENT | _decode_ (const GUM_ELEMENT &representation) const |
| Concretely computes the approximate value from representation. | |
| void | computeNbInterval_ () |
| Get the number of interval. | |
Protected Attributes | |
| GUM_ELEMENT | lowLimit_ |
| Lowest value possible. | |
| GUM_ELEMENT | highLimit_ |
| Highest value possible. | |
| GUM_ELEMENT | epsilon_ |
| Approximation factor. | |
| Idx | nbInterval_ |
| The number of interval. | |
Class implementing linear approximation policy (meaning possible value are split out in interval).
| GUM_ELEMENT | The type used for computations. |
Definition at line 76 of file linearApproximationPolicy.h.
| gum::LinearApproximationPolicy< GUM_ELEMENT >::LinearApproximationPolicy | ( | GUM_ELEMENT | low = (GUM_ELEMENT)0.0, |
| GUM_ELEMENT | high = (GUM_ELEMENT)1.0, | ||
| GUM_ELEMENT | eps = (GUM_ELEMENT)0.1 ) |
Default constructor.
| low | The lower limit. |
| high | The higher limit. |
| eps | The epsilon. |
| OutOfBounds | if out of bounds (low<high, eps>0) |
Definition at line 59 of file linearApproximationPolicy_tpl.h.
References gum::ApproximationPolicy< GUM_ELEMENT >::ApproximationPolicy(), computeNbInterval_(), epsilon_, GUM_ERROR, highLimit_, and lowLimit_.
Referenced by LinearApproximationPolicy(), combineAdd(), combineDiv(), combineMax(), combineMin(), combineMult(), and combineSub().
| gum::LinearApproximationPolicy< GUM_ELEMENT >::LinearApproximationPolicy | ( | const LinearApproximationPolicy< GUM_ELEMENT > * | md | ) |
Copy constructor.
| md | The gum::LinearApproximationPolicy to copy. |
Definition at line 70 of file linearApproximationPolicy_tpl.h.
References gum::ApproximationPolicy< GUM_ELEMENT >::ApproximationPolicy(), LinearApproximationPolicy(), epsilon_, and nbInterval_.
|
protected |
Concretely computes the approximate value from representation.
| representation | The approximate value to decode. |
Definition at line 400 of file linearApproximationPolicy_tpl.h.
References epsilon_, highLimit_, lowLimit_, and nbInterval_.
Referenced by decode(), and fromExact().
|
protected |
Concretely computes the approximate representation.
| value | The value to encode. |
Definition at line 389 of file linearApproximationPolicy_tpl.h.
References epsilon_, highLimit_, lowLimit_, and nbInterval_.
Referenced by encode().
|
pure virtualinherited |
Combine using addition with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
|
override |
Combine using addition with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Definition at line 83 of file linearApproximationPolicy_tpl.h.
References LinearApproximationPolicy(), computeNbInterval_(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
pure virtualinherited |
Combine using division with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
|
override |
Combine using division with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Definition at line 185 of file linearApproximationPolicy_tpl.h.
References LinearApproximationPolicy(), computeNbInterval_(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
pure virtualinherited |
Combine using max with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
|
override |
Combine using max with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Definition at line 219 of file linearApproximationPolicy_tpl.h.
References LinearApproximationPolicy(), computeNbInterval_(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
pure virtualinherited |
Combine using min with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
|
override |
Combine using min with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Definition at line 253 of file linearApproximationPolicy_tpl.h.
References LinearApproximationPolicy(), computeNbInterval_(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
pure virtualinherited |
Combine using multiplication with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
|
override |
Combine using multiplication with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Definition at line 151 of file linearApproximationPolicy_tpl.h.
References LinearApproximationPolicy(), computeNbInterval_(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
pure virtualinherited |
Combine using subtraction with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
|
override |
Combine using subtraction with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Definition at line 117 of file linearApproximationPolicy_tpl.h.
References LinearApproximationPolicy(), computeNbInterval_(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
protected |
Get the number of interval.
Definition at line 411 of file linearApproximationPolicy_tpl.h.
References epsilon_, highLimit_, lowLimit_, and nbInterval_.
Referenced by LinearApproximationPolicy(), combineAdd(), combineDiv(), combineMax(), combineMin(), combineMult(), combineSub(), setEpsilon(), setHighLimit(), setLimits(), and setLowLimit().
| GUM_ELEMENT gum::LinearApproximationPolicy< GUM_ELEMENT >::decode | ( | Idx | representation | ) | const |
Convert approximation representation to value.
| representation | The approximation representation to decode. |
Definition at line 322 of file linearApproximationPolicy_tpl.h.
References _decode_(), GUM_ERROR, and nbInterval_.
| Idx gum::LinearApproximationPolicy< GUM_ELEMENT >::encode | ( | const GUM_ELEMENT & | value | ) | const |
Encode a given value into its approximation representation.
| value | The to encode. |
| OutOfBounds | Raised if value is out of bounds. |
| OutOfBounds | Raised if value is out of bounds. |
Definition at line 301 of file linearApproximationPolicy_tpl.h.
References _encode_(), GUM_ERROR, highLimit_, and lowLimit_.
Referenced by fromExact().
|
pure virtualinherited |
Convert value to his approximation.
This method, at least in release mode, should not verify the limits
| value | The converted value. |
|
override |
Convert value to his approximation.
| value | The converted value. |
Definition at line 77 of file linearApproximationPolicy_tpl.h.
References _decode_(), and encode().
Referenced by safeFromExact().
| const GUM_ELEMENT & gum::LinearApproximationPolicy< GUM_ELEMENT >::highLimit | ( | ) | const |
Gets Highest possible value.
Definition at line 383 of file linearApproximationPolicy_tpl.h.
References highLimit_.
Referenced by combineAdd(), combineDiv(), combineMax(), combineMin(), combineMult(), and combineSub().
| const GUM_ELEMENT & gum::LinearApproximationPolicy< GUM_ELEMENT >::lowLimit | ( | ) | const |
Gets lowest possible value.
Definition at line 365 of file linearApproximationPolicy_tpl.h.
References lowLimit_.
Referenced by combineAdd(), combineDiv(), combineMax(), combineMin(), combineMult(), and combineSub().
| GUM_ELEMENT gum::LinearApproximationPolicy< GUM_ELEMENT >::safeFromExact | ( | const GUM_ELEMENT & | value | ) |
Convert value to his approximation.
This method is slower than fromExact since it verifies the bounds.
| OutOfBounds | Raised if value is out of bounds. |
| OutOfBounds | Raised if value is out of bounds. |
Definition at line 289 of file linearApproximationPolicy_tpl.h.
References fromExact(), GUM_ERROR, highLimit_, and lowLimit_.
|
virtual |
Sets approximation factor.
| e | The new epsilon value. |
Definition at line 332 of file linearApproximationPolicy_tpl.h.
References computeNbInterval_(), epsilon_, and GUM_ERROR.
|
virtual |
Sets Highest possible value.
| newHighLimit | New higher bound. |
| OutOfBounds | Raised if out of bound. |
Definition at line 371 of file linearApproximationPolicy_tpl.h.
References computeNbInterval_(), GUM_ERROR, highLimit_, and lowLimit_.
|
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 340 of file linearApproximationPolicy_tpl.h.
References computeNbInterval_(), GUM_ERROR, highLimit_, and lowLimit_.
|
virtual |
Sets lowest possible value.
| newLowLimit | New lower bound. |
| OutOfBounds | Raised if out of bound. |
Definition at line 353 of file linearApproximationPolicy_tpl.h.
References computeNbInterval_(), GUM_ERROR, highLimit_, and lowLimit_.
|
protected |
Approximation factor.
Definition at line 230 of file linearApproximationPolicy.h.
Referenced by LinearApproximationPolicy(), LinearApproximationPolicy(), _decode_(), _encode_(), computeNbInterval_(), and setEpsilon().
|
protected |
Highest value possible.
Definition at line 227 of file linearApproximationPolicy.h.
Referenced by LinearApproximationPolicy(), _decode_(), _encode_(), combineAdd(), combineDiv(), combineMax(), combineMin(), combineMult(), combineSub(), computeNbInterval_(), encode(), highLimit(), safeFromExact(), setHighLimit(), setLimits(), and setLowLimit().
|
protected |
Lowest value possible.
Definition at line 224 of file linearApproximationPolicy.h.
Referenced by LinearApproximationPolicy(), _decode_(), _encode_(), combineAdd(), combineDiv(), combineMax(), combineMin(), combineMult(), combineSub(), computeNbInterval_(), encode(), lowLimit(), safeFromExact(), setHighLimit(), setLimits(), and setLowLimit().
|
protected |
The number of interval.
Definition at line 256 of file linearApproximationPolicy.h.
Referenced by LinearApproximationPolicy(), _decode_(), _encode_(), computeNbInterval_(), and decode().