73 template <
typename Key =
double,
typename Value = Key>
144 typedef typename container_type::difference_type DiffType;
149 KeyType frac = std::modf(pos, &left_key);
150 DiffType
const left = DiffType(left_key);
161 return data_[0] * (1 + frac);
167 DiffType
const back =
data_.size() - 1;
176 return data_[left] * (1 - frac);
182 return data_[left + 1] * frac +
data_[left] * (1 - frac);
193 typedef typename container_type::difference_type DiffType;
198 KeyType const frac = std::modf(pos, &left_key);
199 DiffType
const left = DiffType(left_key);
210 data_[0] += (1 + frac) * arg_value;
217 DiffType
const back =
data_.size() - 1;
226 data_[left] += (1 - frac) * arg_value;
233 data_[left + 1] += frac * arg_value;
234 data_[left] += (1 - frac) * arg_value;
267 return (
data_[0]) * (pos + 1.5);
282 if (left < size_ - 1)
285 return (
data_[left] -
data_[left - 1]) * factor + (
data_[left + 1] -
data_[left]) * (1. - factor);
290 if (left == size_ - 1)
292 return (
data_[left] -
data_[left - 1]) * factor + (-
data_[left]) * (1. - factor);
302 return (-
data_[left - 1]) * factor;
329 template <
typename SourceContainer>
338 return data_.empty();
422 offset_ = outside - scale * inside;
434 if (inside_high != inside_low)
436 setMapping((outside_high - outside_low) / (inside_high - inside_low),
437 inside_low, outside_low);
void addValue(KeyType arg_pos, ValueType arg_value)
Performs linear resampling. The arg_value is split up and added to the data points around arg_pos...
Definition: LinearInterpolation.h:190
bool empty() const
Returns true if getData() is empty.
Definition: LinearInterpolation.h:336
KeyType index2key(KeyType pos) const
The transformation from "inside" to "outside" coordinates.
Definition: LinearInterpolation.h:364
std::vector< value_type > container_type
Definition: LinearInterpolation.h:84
void setScale(KeyType const &scale)
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data"...
Definition: LinearInterpolation.h:382
KeyType const & getScale() const
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data"...
Definition: LinearInterpolation.h:372
container_type ContainerType
Definition: LinearInterpolation.h:88
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:134
KeyType supportMax() const
Upper boundary of the support, in "outside" coordinates.
Definition: LinearInterpolation.h:465
~LinearInterpolation()
Destructor.
Definition: LinearInterpolation.h:133
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
KeyType const & getOffset() const
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data[0]".
Definition: LinearInterpolation.h:388
KeyType offset_
Definition: LinearInterpolation.h:475
KeyType outside_
Definition: LinearInterpolation.h:477
LinearInterpolation & operator=(LinearInterpolation const &arg)
Assignment operator.
Definition: LinearInterpolation.h:118
Provides access to linearly interpolated values (and derivatives) from discrete data points...
Definition: LinearInterpolation.h:74
ContainerType & getData()
Returns the internal random access container from which interpolated values are being sampled...
Definition: LinearInterpolation.h:313
ValueType value(KeyType arg_pos) const
Returns the interpolated value.
Definition: LinearInterpolation.h:141
ContainerType data_
Definition: LinearInterpolation.h:479
LinearInterpolation(LinearInterpolation const &arg)
Copy constructor.
Definition: LinearInterpolation.h:109
value_type ValueType
Definition: LinearInterpolation.h:86
KeyType const & getInsideReferencePoint() const
Accessor. See setMapping().
Definition: LinearInterpolation.h:447
Key key_type
Definition: LinearInterpolation.h:83
Value value_type
Definition: LinearInterpolation.h:81
ContainerType const & getData() const
Returns the internal random access container from which interpolated values are being sampled...
Definition: LinearInterpolation.h:319
KeyType inside_
Definition: LinearInterpolation.h:476
KeyType supportMin() const
Lower boundary of the support, in "outside" coordinates.
Definition: LinearInterpolation.h:459
LinearInterpolation(KeyType scale=1., KeyType offset=0.)
Constructors and destructor.
Definition: LinearInterpolation.h:100
key_type KeyType
Definition: LinearInterpolation.h:87
KeyType const & getOutsideReferencePoint() const
Accessor. See setMapping().
Definition: LinearInterpolation.h:453
void setMapping(KeyType const &inside_low, KeyType const &outside_low, KeyType const &inside_high, KeyType const &outside_high)
Specifies the mapping from "outside" to "inside" coordinates by the following data: ...
Definition: LinearInterpolation.h:431
ValueType derivative(KeyType arg_pos) const
Returns the interpolated derivative.
Definition: LinearInterpolation.h:244
void setData(SourceContainer const &data)
Assigns data to the internal random access container from which interpolated values are being sampled...
Definition: LinearInterpolation.h:330
void setMapping(KeyType const &scale, KeyType const &inside, KeyType const &outside)
Specifies the mapping from "outside" to "inside" coordinates by the following data: ...
Definition: LinearInterpolation.h:417
KeyType scale_
Definition: LinearInterpolation.h:474
KeyType key2index(KeyType pos) const
The transformation from "outside" to "inside" coordinates.
Definition: LinearInterpolation.h:349
void setOffset(KeyType const &offset)
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data[0]".
Definition: LinearInterpolation.h:399