49#ifndef GUM_LINEAR_APPROXIMATION_POLICY_H
50#define GUM_LINEAR_APPROXIMATION_POLICY_H
75 template <
typename GUM_ELEMENT >
92 GUM_ELEMENT high = (GUM_ELEMENT)1.0,
93 GUM_ELEMENT eps = (GUM_ELEMENT)0.1);
113 GUM_ELEMENT
fromExact(
const GUM_ELEMENT& value)
const override;
171 Idx encode(
const GUM_ELEMENT& value)
const;
179 GUM_ELEMENT
decode(
Idx representation)
const;
185 virtual void setEpsilon(
const GUM_ELEMENT& e);
193 virtual void setLimits(
const GUM_ELEMENT& newLowLimit,
const GUM_ELEMENT& newHighLimit);
200 virtual void setLowLimit(
const GUM_ELEMENT& newLowLimit);
206 const GUM_ELEMENT&
lowLimit()
const;
213 virtual void setHighLimit(
const GUM_ELEMENT& newHighLimit);
248 GUM_ELEMENT
_decode_(
const GUM_ELEMENT& representation)
const;
261#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Classes used to practice approximation on value.
Class implementing linear approximation policy (meaning possible value are split out in interval).
void combineMin(const ApproximationPolicy< GUM_ELEMENT > *ap) override
Combine using min with the given gum::ApproximationPolicy.
GUM_ELEMENT fromExact(const GUM_ELEMENT &value) const override
Convert value to his approximation.
GUM_ELEMENT _decode_(const GUM_ELEMENT &representation) const
Concretely computes the approximate value from representation.
void combineAdd(const ApproximationPolicy< GUM_ELEMENT > *ap) override
Combine using addition with the given gum::ApproximationPolicy.
void combineMax(const ApproximationPolicy< GUM_ELEMENT > *ap) override
Combine using max with the given gum::ApproximationPolicy.
virtual void setLowLimit(const GUM_ELEMENT &newLowLimit)
Sets lowest possible value.
void combineDiv(const ApproximationPolicy< GUM_ELEMENT > *ap) override
Combine using division 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.
void computeNbInterval_()
Get the number of interval.
virtual void setLimits(const GUM_ELEMENT &newLowLimit, const GUM_ELEMENT &newHighLimit)
Set bounds in a whole.
void combineMult(const ApproximationPolicy< GUM_ELEMENT > *ap) override
Combine using multiplication with the given gum::ApproximationPolicy.
Idx _encode_(const GUM_ELEMENT &value) const
Concretely computes the approximate representation.
virtual void setEpsilon(const GUM_ELEMENT &e)
Sets approximation factor.
LinearApproximationPolicy(GUM_ELEMENT low=(GUM_ELEMENT) 0.0, GUM_ELEMENT high=(GUM_ELEMENT) 1.0, GUM_ELEMENT eps=(GUM_ELEMENT) 0.1)
Default constructor.
GUM_ELEMENT decode(Idx representation) const
Convert approximation representation to value.
const GUM_ELEMENT & highLimit() const
Gets Highest possible value.
GUM_ELEMENT lowLimit_
Lowest value possible.
virtual void setHighLimit(const GUM_ELEMENT &newHighLimit)
Sets Highest possible value.
Idx nbInterval_
The number of interval.
const GUM_ELEMENT & lowLimit() const
Gets lowest possible value.
GUM_ELEMENT epsilon_
Approximation factor.
GUM_ELEMENT highLimit_
Highest value possible.
void combineSub(const ApproximationPolicy< GUM_ELEMENT > *ap) override
Combine using subtraction with the given gum::ApproximationPolicy.
Size Idx
Type for indexes.
Inlined implementation of gum::LienarApproxiationPolicy.
gum is the global namespace for all aGrUM entities