![]() |
aGrUM 2.3.2
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. | |
| LinearApproximationPolicy (const LinearApproximationPolicy< GUM_SCALAR > *md) | |
| Copy constructor. | |
Accessors/Modifiers | |
| GUM_SCALAR | fromExact (const GUM_SCALAR &value) const |
| Convert value to his approximation. | |
| void | combineAdd (const ApproximationPolicy< GUM_SCALAR > *ap) |
| Combine using addition with the given gum::ApproximationPolicy. | |
| void | combineSub (const ApproximationPolicy< GUM_SCALAR > *ap) |
| Combine using substraction with the given gum::ApproximationPolicy. | |
| void | combineMult (const ApproximationPolicy< GUM_SCALAR > *ap) |
| Combine using multiplication with the given gum::ApproximationPolicy. | |
| void | combineDiv (const ApproximationPolicy< GUM_SCALAR > *ap) |
| Combine using division with the given gum::ApproximationPolicy. | |
| void | combineMax (const ApproximationPolicy< GUM_SCALAR > *ap) |
| Combine using max with the given gum::ApproximationPolicy. | |
| void | combineMin (const ApproximationPolicy< GUM_SCALAR > *ap) |
| Combine using min with the given gum::ApproximationPolicy. | |
| GUM_SCALAR | safeFromExact (const GUM_SCALAR &value) |
| Convert value to his approximation. | |
| Idx | encode (const GUM_SCALAR &value) const |
| Encode a given value into its approximation representation. | |
| GUM_SCALAR | decode (Idx representation) const |
| Convert approximation representation to value. | |
| virtual void | setEpsilon (const GUM_SCALAR &e) |
| Sets approximation factor. | |
| virtual void | setLimits (const GUM_SCALAR &newLowLimit, const GUM_SCALAR &newHighLimit) |
| Set bounds in a whole. | |
| virtual void | setLowLimit (const GUM_SCALAR &newLowLimit) |
| Sets lowest possible value. | |
| const GUM_SCALAR & | lowLimit () const |
| Gets lowest possible value. | |
| virtual void | setHighLimit (const GUM_SCALAR &newHighLimit) |
| Sets Highest possible value. | |
| const GUM_SCALAR & | highLimit () const |
| Gets Highest possible value. | |
Protected Member Functions | |
| Idx | _encode_ (const GUM_SCALAR &value) const |
| Concretely computes the approximate representation. | |
| GUM_SCALAR | _decode_ (const GUM_SCALAR &representation) const |
| Concretely computes the approximate value from representation. | |
| void | computeNbInterval_ () |
| Get the number of interval. | |
Protected Attributes | |
| GUM_SCALAR | lowLimit_ |
| Lowest value possible. | |
| GUM_SCALAR | highLimit_ |
| Highest value possible. | |
| GUM_SCALAR | epsilon_ |
| Approximation factor. | |
| Idx | nbInterval_ |
| The number of interval. | |
Class implementing linear approximation policy (meaning possible value are split out in interval).
| GUM_SCALAR | The type used for computations. |
Definition at line 76 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. |
| OutOfBounds | if out of bounds (low<high, eps>0) |
Definition at line 58 of file linearApproximationPolicy_tpl.h.
References gum::ApproximationPolicy< GUM_SCALAR >::ApproximationPolicy(), computeNbInterval_(), epsilon_, GUM_ERROR, highLimit_, and lowLimit_.
Referenced by LinearApproximationPolicy(), combineAdd(), combineDiv(), combineMax(), combineMin(), combineMult(), and combineSub().
| gum::LinearApproximationPolicy< GUM_SCALAR >::LinearApproximationPolicy | ( | const LinearApproximationPolicy< GUM_SCALAR > * | md | ) |
Copy constructor.
| md | The gum::LinearApproximationPolicy to copy. |
Definition at line 69 of file linearApproximationPolicy_tpl.h.
References gum::ApproximationPolicy< GUM_SCALAR >::ApproximationPolicy(), LinearApproximationPolicy(), epsilon_, and nbInterval_.
|
protected |
Concretely computes the approximate value from representation.
| representation | The approximate value to decode. |
Definition at line 376 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 365 of file linearApproximationPolicy_tpl.h.
References epsilon_, highLimit_, lowLimit_, and nbInterval_.
Referenced by encode().
|
virtual |
Combine using addition with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 82 of file linearApproximationPolicy_tpl.h.
References gum::ApproximationPolicy< GUM_SCALAR >::ApproximationPolicy(), LinearApproximationPolicy(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
virtual |
Combine using division with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 172 of file linearApproximationPolicy_tpl.h.
References gum::ApproximationPolicy< GUM_SCALAR >::ApproximationPolicy(), LinearApproximationPolicy(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
virtual |
Combine using max with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 202 of file linearApproximationPolicy_tpl.h.
References gum::ApproximationPolicy< GUM_SCALAR >::ApproximationPolicy(), LinearApproximationPolicy(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
virtual |
Combine using min with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 232 of file linearApproximationPolicy_tpl.h.
References gum::ApproximationPolicy< GUM_SCALAR >::ApproximationPolicy(), LinearApproximationPolicy(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
virtual |
Combine using multiplication with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 142 of file linearApproximationPolicy_tpl.h.
References gum::ApproximationPolicy< GUM_SCALAR >::ApproximationPolicy(), LinearApproximationPolicy(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
virtual |
Combine using substraction with the given gum::ApproximationPolicy.
| ap | The policy to combine with. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 112 of file linearApproximationPolicy_tpl.h.
References gum::ApproximationPolicy< GUM_SCALAR >::ApproximationPolicy(), LinearApproximationPolicy(), highLimit(), highLimit_, lowLimit(), and lowLimit_.
|
protected |
Get the number of interval.
Definition at line 387 of file linearApproximationPolicy_tpl.h.
References epsilon_, highLimit_, lowLimit_, and nbInterval_.
Referenced by LinearApproximationPolicy(), setEpsilon(), setHighLimit(), setLimits(), and setLowLimit().
| 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 298 of file linearApproximationPolicy_tpl.h.
References _decode_(), GUM_ERROR, and nbInterval_.
| INLINE Idx gum::LinearApproximationPolicy< GUM_SCALAR >::encode | ( | const GUM_SCALAR & | 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 277 of file linearApproximationPolicy_tpl.h.
References _encode_(), GUM_ERROR, highLimit_, and lowLimit_.
Referenced by fromExact().
|
virtual |
Convert value to his approximation.
| value | The converted value. |
Implements gum::ApproximationPolicy< GUM_SCALAR >.
Definition at line 76 of file linearApproximationPolicy_tpl.h.
References _decode_(), and encode().
Referenced by safeFromExact().
| INLINE const GUM_SCALAR & gum::LinearApproximationPolicy< GUM_SCALAR >::highLimit | ( | ) | const |
Gets Highest possible value.
Definition at line 359 of file linearApproximationPolicy_tpl.h.
References highLimit_.
Referenced by combineAdd(), combineDiv(), combineMax(), combineMin(), combineMult(), and combineSub().
| INLINE const GUM_SCALAR & gum::LinearApproximationPolicy< GUM_SCALAR >::lowLimit | ( | ) | const |
Gets lowest possible value.
Definition at line 340 of file linearApproximationPolicy_tpl.h.
References lowLimit_.
Referenced by combineAdd(), combineDiv(), combineMax(), combineMin(), combineMult(), and combineSub().
| 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.
| OutOfBounds | Raised if value is out of bounds. |
| OutOfBounds | Raised if value is out of bounds. |
Definition at line 265 of file linearApproximationPolicy_tpl.h.
References fromExact(), GUM_ERROR, highLimit_, and lowLimit_.
|
virtual |
Sets approximation factor.
| e | The new epsilon value. |
Definition at line 308 of file linearApproximationPolicy_tpl.h.
References computeNbInterval_(), and epsilon_.
|
virtual |
Sets Highest possible value.
| newHighLimit | New higher bound. |
| OutOfBounds | Raised if out of bound. |
Definition at line 347 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 315 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 328 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().