47 template <
typename Key =
double,
typename Value = Key>
118 typedef typename container_type::difference_type DiffType;
123 KeyType frac = std::modf(pos, &left_key);
124 DiffType
const left = DiffType(left_key);
135 return data_[0] * (1 + frac);
141 DiffType
const back =
data_.size() - 1;
150 return data_[left] * (1 - frac);
156 return data_[left + 1] * frac +
data_[left] * (1 - frac);
167 typedef typename container_type::difference_type DiffType;
172 KeyType const frac = std::modf(pos, &left_key);
173 DiffType
const left = DiffType(left_key);
184 data_[0] += (1 + frac) * arg_value;
191 DiffType
const back =
data_.size() - 1;
200 data_[left] += (1 - frac) * arg_value;
207 data_[left + 1] += frac * arg_value;
208 data_[left] += (1 - frac) * arg_value;
241 return (
data_[0]) * (pos + 1.5);
256 if (left < size_ - 1)
259 return (
data_[left] -
data_[left - 1]) * factor + (
data_[left + 1] -
data_[left]) * (1. - factor);
264 if (left == size_ - 1)
266 return (
data_[left] -
data_[left - 1]) * factor + (-
data_[left]) * (1. - factor);
276 return (-
data_[left - 1]) * factor;
303 template <
typename SourceContainer>
312 return data_.empty();
396 offset_ = outside - scale * inside;
408 if (inside_high != inside_low)
410 setMapping((outside_high - outside_low) / (inside_high - inside_low),
411 inside_low, outside_low);
Provides access to linearly interpolated values (and derivatives) from discrete data points....
Definition: LinearInterpolation.h:49
ContainerType const & getData() const
Returns the internal random access container from which interpolated values are being sampled.
Definition: LinearInterpolation.h:293
Value value_type
Definition: LinearInterpolation.h:55
KeyType key2index(KeyType pos) const
The transformation from "outside" to "inside" coordinates.
Definition: LinearInterpolation.h:323
KeyType index2key(KeyType pos) const
The transformation from "inside" to "outside" coordinates.
Definition: LinearInterpolation.h:338
KeyType supportMax() const
Upper boundary of the support, in "outside" coordinates.
Definition: LinearInterpolation.h:439
Key key_type
Definition: LinearInterpolation.h:57
ContainerType data_
Definition: LinearInterpolation.h:453
ValueType derivative(KeyType arg_pos) const
Returns the interpolated derivative.
Definition: LinearInterpolation.h:218
container_type ContainerType
Definition: LinearInterpolation.h:62
void setData(SourceContainer const &data)
Assigns data to the internal random access container from which interpolated values are being sampled...
Definition: LinearInterpolation.h:304
KeyType outside_
Definition: LinearInterpolation.h:451
LinearInterpolation & operator=(LinearInterpolation const &arg)
Assignment operator.
Definition: LinearInterpolation.h:92
bool empty() const
Returns true if getData() is empty.
Definition: LinearInterpolation.h:310
KeyType const & getScale() const
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Definition: LinearInterpolation.h:346
value_type ValueType
Definition: LinearInterpolation.h:60
KeyType scale_
Definition: LinearInterpolation.h:448
void setScale(KeyType const &scale)
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Definition: LinearInterpolation.h:356
std::vector< value_type > container_type
Definition: LinearInterpolation.h:58
LinearInterpolation(KeyType scale=1., KeyType offset=0.)
Constructors and destructor.
Definition: LinearInterpolation.h:74
ContainerType & getData()
Returns the internal random access container from which interpolated values are being sampled.
Definition: LinearInterpolation.h:287
KeyType const & getOutsideReferencePoint() const
Accessor. See setMapping().
Definition: LinearInterpolation.h:427
key_type KeyType
Definition: LinearInterpolation.h:61
KeyType offset_
Definition: LinearInterpolation.h:449
LinearInterpolation(LinearInterpolation const &arg)
Copy constructor.
Definition: LinearInterpolation.h:83
KeyType const & getOffset() const
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data[0]".
Definition: LinearInterpolation.h:362
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:405
KeyType inside_
Definition: LinearInterpolation.h:450
void setOffset(KeyType const &offset)
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data[0]".
Definition: LinearInterpolation.h:373
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:391
~LinearInterpolation()=default
Destructor.
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:164
ValueType value(KeyType arg_pos) const
Returns the interpolated value.
Definition: LinearInterpolation.h:115
KeyType supportMin() const
Lower boundary of the support, in "outside" coordinates.
Definition: LinearInterpolation.h:433
KeyType const & getInsideReferencePoint() const
Accessor. See setMapping().
Definition: LinearInterpolation.h:421
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:108
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22