aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::LinearApproximationPolicy< GUM_SCALAR > Class Template Reference

Class implementing linear approximation policy (meaning possible value are split out in interval). More...

#include <linearApproximationPolicy.h>

+ Inheritance diagram for gum::LinearApproximationPolicy< GUM_SCALAR >:
+ Collaboration diagram for gum::LinearApproximationPolicy< GUM_SCALAR >:

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...
 

Detailed Description

template<typename GUM_SCALAR>
class gum::LinearApproximationPolicy< GUM_SCALAR >

Class implementing linear approximation policy (meaning possible value are split out in interval).

Warning
Doxygen does not like spanning command on multiple line, so we could not configure it with the correct include directive. Use the following code snippet to include this file.
Template Parameters
GUM_SCALARThe type used for computations.

Definition at line 54 of file linearApproximationPolicy.h.

Constructor & Destructor Documentation

◆ LinearApproximationPolicy() [1/2]

template<typename GUM_SCALAR >
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.

Parameters
lowThe lower limit.
highThe higher limit.
epsThe epsilon.
Exceptions
OutOfBoundif out of bounds (low<high, eps>0)

Definition at line 37 of file linearApproximationPolicy_tpl.h.

39  :
40  ApproximationPolicy< GUM_SCALAR >(),
41  lowLimit_(low), highLimit_(high), epsilon_(eps) {
42  if (eps <= 0) { GUM_ERROR(OutOfBounds, "Epsilon must be >0") }
43 
45  }
void computeNbInterval_()
Get the number of interval.
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
GUM_SCALAR epsilon_
Approximation factor.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51

◆ LinearApproximationPolicy() [2/2]

template<typename GUM_SCALAR >
gum::LinearApproximationPolicy< GUM_SCALAR >::LinearApproximationPolicy ( const LinearApproximationPolicy< GUM_SCALAR > *  md)

Copy constructor.

Parameters
mdThe gum::LinearApproximationPolicy to copy.

Definition at line 49 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

50  :
51  ApproximationPolicy< GUM_SCALAR >(md),
52  epsilon_(md->epsilon_), nbInterval_(md->nbInterval_) {}
Idx nbInterval_
The number of interval.
GUM_SCALAR epsilon_
Approximation factor.
+ Here is the call graph for this function:

Member Function Documentation

◆ _decode_()

template<typename GUM_SCALAR >
INLINE GUM_SCALAR gum::LinearApproximationPolicy< GUM_SCALAR >::_decode_ ( const GUM_SCALAR &  representation) const
protected

Concretely computes the approximate value from representation.

Parameters
representationThe approximate value to decode.
Returns
The decoded value.

Definition at line 360 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

360  {
361  if (representation == 0) return this->lowLimit_;
362 
363  if (representation == nbInterval_) return this->highLimit_;
364 
365  return (GUM_SCALAR)(((representation * this->epsilon_) - (this->epsilon_ / 2))
366  + this->lowLimit_);
367  }
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
Idx nbInterval_
The number of interval.
GUM_SCALAR epsilon_
Approximation factor.
+ Here is the call graph for this function:

◆ _encode_()

template<typename GUM_SCALAR >
INLINE Idx gum::LinearApproximationPolicy< GUM_SCALAR >::_encode_ ( const GUM_SCALAR &  value) const
protected

Concretely computes the approximate representation.

Warning
We accept value smaller or higher than limits : please
See also
gum::ApproximationPolicy::safeFromExact(const GUM_SCALAR&).
Parameters
valueThe value to encode.
Returns
The encoded value.

Definition at line 349 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

349  {
350  if (value <= this->lowLimit_) return 0;
351 
352  if (value >= this->highLimit_) return nbInterval_;
353 
354  return 1 + Idx(((value - this->lowLimit_) / this->epsilon_));
355  }
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
Idx nbInterval_
The number of interval.
Size Idx
Type for indexes.
Definition: types.h:52
GUM_SCALAR epsilon_
Approximation factor.
+ Here is the call graph for this function:

◆ combineAdd()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::combineAdd ( const ApproximationPolicy< GUM_SCALAR > *  ap)
virtual

Combine using addition with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Implements gum::ApproximationPolicy< GUM_SCALAR >.

Definition at line 64 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

65  {
66  try {
67  const LinearApproximationPolicy< GUM_SCALAR >* lap
68  = dynamic_cast< const LinearApproximationPolicy< GUM_SCALAR >* >(ap);
69 
70  GUM_SCALAR newHighLimit = lowLimit_ + lap->lowLimit();
71  GUM_SCALAR newLowLimit = lowLimit_ + lap->lowLimit();
72 
73  GUM_SCALAR newVal = lowLimit_ + lap->highLimit();
74 
75  if (newHighLimit < newVal) newHighLimit = newVal;
76 
77  if (newLowLimit > newVal) newLowLimit = newVal;
78 
79  newVal = highLimit_ + lap->lowLimit();
80 
81  if (newHighLimit < newVal) newHighLimit = newVal;
82 
83  if (newLowLimit > newVal) newLowLimit = newVal;
84 
85  newVal = highLimit_ + lap->highLimit();
86 
87  if (newHighLimit < newVal) newHighLimit = newVal;
88 
89  if (newLowLimit > newVal) newLowLimit = newVal;
90  } catch (const std::bad_cast&) {}
91  }
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
+ Here is the call graph for this function:

◆ combineDiv()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::combineDiv ( const ApproximationPolicy< GUM_SCALAR > *  ap)
virtual

Combine using division with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Implements gum::ApproximationPolicy< GUM_SCALAR >.

Definition at line 154 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

155  {
156  try {
157  const LinearApproximationPolicy< GUM_SCALAR >* lap
158  = dynamic_cast< const LinearApproximationPolicy< GUM_SCALAR >* >(ap);
159 
160  GUM_SCALAR newHighLimit = lowLimit_ / lap->lowLimit();
161  GUM_SCALAR newLowLimit = lowLimit_ / lap->lowLimit();
162 
163  GUM_SCALAR newVal = lowLimit_ / lap->highLimit();
164 
165  if (newHighLimit < newVal) newHighLimit = newVal;
166 
167  if (newLowLimit > newVal) newLowLimit = newVal;
168 
169  newVal = highLimit_ / lap->lowLimit();
170 
171  if (newHighLimit < newVal) newHighLimit = newVal;
172 
173  if (newLowLimit > newVal) newLowLimit = newVal;
174 
175  newVal = highLimit_ / lap->highLimit();
176 
177  if (newHighLimit < newVal) newHighLimit = newVal;
178 
179  if (newLowLimit > newVal) newLowLimit = newVal;
180  } catch (const std::bad_cast&) {}
181  }
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
+ Here is the call graph for this function:

◆ combineMax()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::combineMax ( const ApproximationPolicy< GUM_SCALAR > *  ap)
virtual

Combine using max with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Implements gum::ApproximationPolicy< GUM_SCALAR >.

Definition at line 184 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

185  {
186  try {
187  const LinearApproximationPolicy< GUM_SCALAR >* lap
188  = dynamic_cast< const LinearApproximationPolicy< GUM_SCALAR >* >(ap);
189 
190  GUM_SCALAR newHighLimit = lowLimit_ > lap->lowLimit() ? lowLimit_ : lap->lowLimit();
191  GUM_SCALAR newLowLimit = lowLimit_ > lap->lowLimit() ? lowLimit_ : lap->lowLimit();
192 
193  GUM_SCALAR newVal = lowLimit_ > lap->highLimit() ? lowLimit_ : lap->highLimit();
194 
195  if (newHighLimit < newVal) newHighLimit = newVal;
196 
197  if (newLowLimit > newVal) newLowLimit = newVal;
198 
199  newVal = highLimit_ > lap->lowLimit() ? highLimit_ : lap->lowLimit();
200 
201  if (newHighLimit < newVal) newHighLimit = newVal;
202 
203  if (newLowLimit > newVal) newLowLimit = newVal;
204 
205  newVal = highLimit_ > lap->highLimit() ? highLimit_ : lap->highLimit();
206 
207  if (newHighLimit < newVal) newHighLimit = newVal;
208 
209  if (newLowLimit > newVal) newLowLimit = newVal;
210  } catch (const std::bad_cast&) {}
211  }
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
+ Here is the call graph for this function:

◆ combineMin()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::combineMin ( const ApproximationPolicy< GUM_SCALAR > *  ap)
virtual

Combine using min with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Implements gum::ApproximationPolicy< GUM_SCALAR >.

Definition at line 214 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

215  {
216  try {
217  const LinearApproximationPolicy< GUM_SCALAR >* lap
218  = dynamic_cast< const LinearApproximationPolicy< GUM_SCALAR >* >(ap);
219 
220  GUM_SCALAR newHighLimit = lowLimit_ < lap->lowLimit() ? lowLimit_ : lap->lowLimit();
221  GUM_SCALAR newLowLimit = lowLimit_ < lap->lowLimit() ? lowLimit_ : lap->lowLimit();
222 
223  GUM_SCALAR newVal = lowLimit_ < lap->highLimit() ? lowLimit_ : lap->highLimit();
224 
225  if (newHighLimit < newVal) newHighLimit = newVal;
226 
227  if (newLowLimit > newVal) newLowLimit = newVal;
228 
229  newVal = highLimit_ < lap->lowLimit() ? highLimit_ : lap->lowLimit();
230 
231  if (newHighLimit < newVal) newHighLimit = newVal;
232 
233  if (newLowLimit > newVal) newLowLimit = newVal;
234 
235  newVal = highLimit_ < lap->highLimit() ? highLimit_ : lap->highLimit();
236 
237  if (newHighLimit < newVal) newHighLimit = newVal;
238 
239  if (newLowLimit > newVal) newLowLimit = newVal;
240  } catch (const std::bad_cast&) {}
241  }
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
+ Here is the call graph for this function:

◆ combineMult()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::combineMult ( const ApproximationPolicy< GUM_SCALAR > *  ap)
virtual

Combine using multiplication with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Implements gum::ApproximationPolicy< GUM_SCALAR >.

Definition at line 124 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

125  {
126  try {
127  const LinearApproximationPolicy< GUM_SCALAR >* lap
128  = dynamic_cast< const LinearApproximationPolicy< GUM_SCALAR >* >(ap);
129 
130  GUM_SCALAR newHighLimit = lowLimit_ * lap->lowLimit();
131  GUM_SCALAR newLowLimit = lowLimit_ * lap->lowLimit();
132 
133  GUM_SCALAR newVal = lowLimit_ * lap->highLimit();
134 
135  if (newHighLimit < newVal) newHighLimit = newVal;
136 
137  if (newLowLimit > newVal) newLowLimit = newVal;
138 
139  newVal = highLimit_ * lap->lowLimit();
140 
141  if (newHighLimit < newVal) newHighLimit = newVal;
142 
143  if (newLowLimit > newVal) newLowLimit = newVal;
144 
145  newVal = highLimit_ * lap->highLimit();
146 
147  if (newHighLimit < newVal) newHighLimit = newVal;
148 
149  if (newLowLimit > newVal) newLowLimit = newVal;
150  } catch (const std::bad_cast&) {}
151  }
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
+ Here is the call graph for this function:

◆ combineSub()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::combineSub ( const ApproximationPolicy< GUM_SCALAR > *  ap)
virtual

Combine using substraction with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Implements gum::ApproximationPolicy< GUM_SCALAR >.

Definition at line 94 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

95  {
96  try {
97  const LinearApproximationPolicy< GUM_SCALAR >* lap
98  = dynamic_cast< const LinearApproximationPolicy< GUM_SCALAR >* >(ap);
99 
100  GUM_SCALAR newHighLimit = lowLimit_ - lap->lowLimit();
101  GUM_SCALAR newLowLimit = lowLimit_ - lap->lowLimit();
102 
103  GUM_SCALAR newVal = lowLimit_ - lap->highLimit();
104 
105  if (newHighLimit < newVal) newHighLimit = newVal;
106 
107  if (newLowLimit > newVal) newLowLimit = newVal;
108 
109  newVal = highLimit_ - lap->lowLimit();
110 
111  if (newHighLimit < newVal) newHighLimit = newVal;
112 
113  if (newLowLimit > newVal) newLowLimit = newVal;
114 
115  newVal = highLimit_ - lap->highLimit();
116 
117  if (newHighLimit < newVal) newHighLimit = newVal;
118 
119  if (newLowLimit > newVal) newLowLimit = newVal;
120  } catch (const std::bad_cast&) {}
121  }
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
+ Here is the call graph for this function:

◆ computeNbInterval_()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::computeNbInterval_ ( )
protected

Get the number of interval.

Definition at line 371 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

371  {
372  nbInterval_ = 1 + Idx((this->highLimit_ - this->lowLimit_) / this->epsilon_);
373  }
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
Idx nbInterval_
The number of interval.
Size Idx
Type for indexes.
Definition: types.h:52
GUM_SCALAR epsilon_
Approximation factor.
+ Here is the call graph for this function:

◆ decode()

template<typename GUM_SCALAR >
INLINE GUM_SCALAR gum::LinearApproximationPolicy< GUM_SCALAR >::decode ( Idx  representation) const

Convert approximation representation to value.

Parameters
representationThe approximation representation to decode.
Returns
Returns the value decoded from its approximation reprensentation.

Definition at line 282 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

282  {
283  if (representation > nbInterval_) {
284  GUM_ERROR(OutOfUpperBound, "Interval Number asked is higher than total number of interval")
285  }
286 
287  return _decode_(GUM_SCALAR(representation));
288  }
GUM_SCALAR _decode_(const GUM_SCALAR &representation) const
Concretely computes the approximate value from representation.
Idx nbInterval_
The number of interval.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ encode()

template<typename GUM_SCALAR >
INLINE Idx gum::LinearApproximationPolicy< GUM_SCALAR >::encode ( const GUM_SCALAR &  value) const

Encode a given value into its approximation representation.

Parameters
valueThe to encode.
Returns
Returns the encoded value.
Exceptions
OutOfLowerBoundRaised if value is out of bounds.
OutOfUpperBoundRaised if value is out of bounds.

Definition at line 261 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

261  {
262 // we keep the bounds checked in debug mode
263 #ifdef GUM_DEBUG_MODE
264  if (value > this->highLimit_) {
265  GUM_ERROR(OutOfUpperBound,
266  "Value asked is higher than High limit : not in (" << this->lowLimit_ << "-"
267  << this->highLimit_ << ")")
268  }
269 
270  if (value < this->lowLimit_) {
271  GUM_ERROR(OutOfLowerBound,
272  "Value asked is lower than low limit : not in (" << this->lowLimit_ << "-"
273  << this->highLimit_ << ")")
274  }
275 
276 #endif // GUM_DEBUG_MODE
277  return _encode_(value);
278  }
Idx _encode_(const GUM_SCALAR &value) const
Concretely computes the approximate representation.
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ fromExact()

template<typename GUM_SCALAR >
INLINE GUM_SCALAR gum::LinearApproximationPolicy< GUM_SCALAR >::fromExact ( const GUM_SCALAR &  value) const
virtual

Convert value to his approximation.

Parameters
valueThe converted value.
Returns
The value approximation representation.

Implements gum::ApproximationPolicy< GUM_SCALAR >.

Definition at line 58 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

58  {
59  return _decode_(GUM_SCALAR(encode(value)));
60  }
GUM_SCALAR _decode_(const GUM_SCALAR &representation) const
Concretely computes the approximate value from representation.
Idx encode(const GUM_SCALAR &value) const
Encode a given value into its approximation representation.
+ Here is the call graph for this function:

◆ highLimit()

template<typename GUM_SCALAR >
INLINE const GUM_SCALAR & gum::LinearApproximationPolicy< GUM_SCALAR >::highLimit ( ) const

Gets Highest possible value.

Returns
Returns the highest possible value.

Definition at line 343 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

343  {
344  return highLimit_;
345  }
GUM_SCALAR highLimit_
Highest value possible.
+ Here is the call graph for this function:

◆ lowLimit()

template<typename GUM_SCALAR >
INLINE const GUM_SCALAR & gum::LinearApproximationPolicy< GUM_SCALAR >::lowLimit ( ) const

Gets lowest possible value.

Returns
Returns the lowest possible value.

Definition at line 324 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

324  {
325  return lowLimit_;
326  }
GUM_SCALAR lowLimit_
Lowest value possible.
+ Here is the call graph for this function:

◆ safeFromExact()

template<typename GUM_SCALAR >
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.

Exceptions
OutOfLowerBoundRaised if value is out of bounds.
OutOfUpperBoundRaised if value is out of bounds.

Definition at line 247 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

247  {
248  if (value > this->highLimit_) {
249  GUM_ERROR(OutOfUpperBound, "Value asked is higher than high limit")
250  }
251 
252  if (value < this->lowLimit_) {
253  GUM_ERROR(OutOfLowerBound, "Value asked is lower than low limit")
254  }
255 
256  return fromExact(value);
257  }
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
GUM_SCALAR fromExact(const GUM_SCALAR &value) const
Convert value to his approximation.
+ Here is the call graph for this function:

◆ setEpsilon()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::setEpsilon ( const GUM_SCALAR &  e)
virtual

Sets approximation factor.

Parameters
eThe new epsilon value.

Definition at line 292 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

292  {
293  epsilon_ = e;
295  }
void computeNbInterval_()
Get the number of interval.
GUM_SCALAR epsilon_
Approximation factor.
+ Here is the call graph for this function:

◆ setHighLimit()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::setHighLimit ( const GUM_SCALAR &  newHighLimit)
virtual

Sets Highest possible value.

Parameters
newHighLimitNew higher bound.
Exceptions
OutOfLowerBoundRaised if out of bound.

Definition at line 331 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

331  {
332  if (newHighLimit < this->lowLimit_) {
333  GUM_ERROR(OutOfLowerBound, "Value asked is lower than low limit")
334  }
335 
336  highLimit_ = newHighLimit;
337 
339  }
void computeNbInterval_()
Get the number of interval.
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ setLimits()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::setLimits ( const GUM_SCALAR &  newLowLimit,
const GUM_SCALAR &  newHighLimit 
)
virtual

Set bounds in a whole.

Parameters
newLowLimitNew lower bound.
newHighLimitNew higher bound.
Exceptions
OutOfBoundsRaised if new bounds are not legit.

Definition at line 299 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

300  {
301  if (newLowLimit > newHighLimit) {
302  GUM_ERROR(OutOfBounds, "Asked low value is higher than asked high value")
303  }
304 
305  lowLimit_ = newLowLimit;
306  highLimit_ = newHighLimit;
308  }
void computeNbInterval_()
Get the number of interval.
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ setLowLimit()

template<typename GUM_SCALAR >
INLINE void gum::LinearApproximationPolicy< GUM_SCALAR >::setLowLimit ( const GUM_SCALAR &  newLowLimit)
virtual

Sets lowest possible value.

Parameters
newLowLimitNew lower bound.
Exceptions
OutOfUpperBoundRaised if out of bound.

Definition at line 312 of file linearApproximationPolicy_tpl.h.

References gum::Set< Key, Alloc >::emplace().

312  {
313  if (newLowLimit > this->highLimit_) {
314  GUM_ERROR(OutOfUpperBound, "Value asked is higher than High limit")
315  }
316 
317  lowLimit_ = newLowLimit;
318 
320  }
void computeNbInterval_()
Get the number of interval.
GUM_SCALAR highLimit_
Highest value possible.
GUM_SCALAR lowLimit_
Lowest value possible.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

Member Data Documentation

◆ epsilon_

template<typename GUM_SCALAR >
GUM_SCALAR gum::LinearApproximationPolicy< GUM_SCALAR >::epsilon_
protected

Approximation factor.

Definition at line 208 of file linearApproximationPolicy.h.

◆ highLimit_

template<typename GUM_SCALAR >
GUM_SCALAR gum::LinearApproximationPolicy< GUM_SCALAR >::highLimit_
protected

Highest value possible.

Definition at line 205 of file linearApproximationPolicy.h.

◆ lowLimit_

template<typename GUM_SCALAR >
GUM_SCALAR gum::LinearApproximationPolicy< GUM_SCALAR >::lowLimit_
protected

Lowest value possible.

Definition at line 202 of file linearApproximationPolicy.h.

◆ nbInterval_

template<typename GUM_SCALAR >
Idx gum::LinearApproximationPolicy< GUM_SCALAR >::nbInterval_
protected

The number of interval.

Definition at line 234 of file linearApproximationPolicy.h.


The documentation for this class was generated from the following files: