71 template <
typename Key =
double,
typename Value = Key>
181 return data_(0, 0) * (1. + pos_0) * (1. + pos_1);
186 if (lower_1 >= size_1 - 1)
188 if (lower_1 != size_1 - 1)
194 return data_(0, lower_1) * (1. + pos_0) * (size_1 - pos_1);
202 data_(0, lower_1 + 1) * factor_1 +
203 data_(0, lower_1) * factor_1_complement
209 if (lower_0 >= size_0 - 1)
211 if (lower_0 != size_0 - 1)
225 return data_(lower_0, 0) * (size_0 - pos_0) * (1. + pos_1);
230 if (lower_1 >= size_1 - 1)
232 if (lower_1 != size_1 - 1)
238 return data_(lower_0, lower_1) * (size_0 - pos_0) * (size_1 - pos_1);
246 data_(lower_0, lower_1 + 1) * factor_1 +
247 data_(lower_0, lower_1) * factor_1_complement
268 data_(lower_0 + 1, 0) * factor_0
270 data_(lower_0, 0) * factor_0_complement
277 if (lower_1 >= size_1 - 1)
279 if (lower_1 != size_1 - 1)
286 data_(lower_0 + 1, lower_1) * factor_0
288 data_(lower_0, lower_1) * factor_0_complement
298 data_(lower_0 + 1, lower_1 + 1) * factor_0
300 data_(lower_0, lower_1 + 1) * factor_0_complement
305 data_(lower_0 + 1, lower_1) * factor_0
307 data_(lower_0, lower_1) * factor_0_complement
309 * factor_1_complement;
324 KeyType const frac_0 = std::modf(pos_0, &lower_0_key);
325 DiffType
const lower_0 = DiffType(lower_0_key);
338 KeyType const frac_1 = std::modf(pos_1, &lower_1_key);
339 DiffType
const lower_1 = DiffType(lower_1_key);
350 data_(0, 0) += arg_value * (1 + frac_0) * (1 + frac_1);
356 DiffType
const back_1 =
data_.
cols() - 1;
358 if (lower_1 >= back_1)
360 if (lower_1 != back_1)
366 data_(0, lower_1) += arg_value * (1 + frac_0) * (1 - frac_1);
374 data_(0, lower_1 + 1) += tmp_prod * frac_1;
375 data_(0, lower_1) += tmp_prod * (1. - frac_1);
383 DiffType
const back_0 =
data_.
rows() - 1;
384 if (lower_0 >= back_0)
386 if (lower_0 != back_0)
398 KeyType const frac_1 = std::modf(pos_1, &lower_1_key);
399 DiffType
const lower_1 = DiffType(lower_1_key);
410 data_(lower_0, 0) += tmp_prod * (1 + frac_1);
416 DiffType
const back_1 =
data_.
cols() - 1;
418 if (lower_1 >= back_1)
420 if (lower_1 != back_1)
426 data_(lower_0, lower_1) += tmp_prod * (1 - frac_1);
433 data_(lower_0, lower_1 + 1) += tmp_prod * frac_1;
434 data_(lower_0, lower_1) += tmp_prod * (1 - frac_1);
448 KeyType const frac_1 = std::modf(pos_1, &lower_1_key);
449 DiffType
const lower_1 = DiffType(lower_1_key);
461 data_(lower_0 + 1, 0) += tmp_prod * frac_0;
462 data_(lower_0, 0) += tmp_prod * (1 - frac_0);
468 DiffType
const back_1 =
data_.
cols() - 1;
470 if (lower_1 >= back_1)
472 if (lower_1 != back_1)
479 data_(lower_0 + 1, lower_1) += tmp_prod * frac_0;
480 data_(lower_0, lower_1) += tmp_prod * (1 - frac_0);
490 data_(lower_0 + 1, lower_1 + 1) += tmp_prod * frac_1;
491 data_(lower_0 + 1, lower_1) += tmp_prod * (1 - frac_1);
492 tmp_prod =
KeyType(arg_value * (1 - frac_0));
493 data_(lower_0, lower_1 + 1) += tmp_prod * frac_1;
494 data_(lower_0, lower_1) += tmp_prod * (1 - frac_1);
526 template <
typename SourceContainer>
535 return data_.empty();
675 offset_0_ = outside_low - scale * inside_low;
688 if (inside_high != inside_low)
690 setMapping_0((outside_high - outside_low) / (inside_high - inside_low),
691 inside_low, outside_low);
718 offset_1_ = outside_low - scale * inside_low;
731 if (inside_high != inside_low)
733 setMapping_1((outside_high - outside_low) / (inside_high - inside_low),
734 inside_low, outside_low);
container_type ContainerType
Definition: BilinearInterpolation.h:86
KeyType scale_1_
Definition: BilinearInterpolation.h:799
ContainerType data_
Definition: BilinearInterpolation.h:805
void setMapping_1(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: BilinearInterpolation.h:728
KeyType offset_0_
Definition: BilinearInterpolation.h:798
KeyType offset_1_
Definition: BilinearInterpolation.h:800
void setData(SourceContainer const &data)
Assigns data to the internal random access container storing the data.
Definition: BilinearInterpolation.h:527
KeyType supportMin_1() const
Lower boundary of the support, in "outside" coordinates.
Definition: BilinearInterpolation.h:774
void setMapping_1(KeyType const &scale, KeyType const &inside_low, KeyType const &outside_low)
Specifies the mapping from "outside" to "inside" coordinates by the following data: ...
Definition: BilinearInterpolation.h:713
void setOffset_0(KeyType const &offset)
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)".
Definition: BilinearInterpolation.h:641
KeyType supportMin_0() const
Lower boundary of the support, in "outside" coordinates.
Definition: BilinearInterpolation.h:768
key_type KeyType
Definition: BilinearInterpolation.h:85
ContainerType const & getData() const
Returns the internal random access container storing the data.
Definition: BilinearInterpolation.h:516
KeyType index2key_0(KeyType pos) const
The transformation from "inside" to "outside" coordinates.
Definition: BilinearInterpolation.h:561
KeyType const & getInsideReferencePoint_1() const
Accessor. See setMapping().
Definition: BilinearInterpolation.h:750
void setScale_0(KeyType const &scale)
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data"...
Definition: BilinearInterpolation.h:608
Base::difference_type difference_type
Definition: Matrix.h:87
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:134
KeyType inside_1_
Definition: BilinearInterpolation.h:803
KeyType const & getOffset_1() const
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)".
Definition: BilinearInterpolation.h:630
KeyType outside_1_
Definition: BilinearInterpolation.h:804
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
void setMapping_0(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: BilinearInterpolation.h:685
BilinearInterpolation()
Constructors and destructor.
Definition: BilinearInterpolation.h:96
void setScale_1(KeyType const &scale)
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data"...
Definition: BilinearInterpolation.h:618
void setOffset_1(KeyType const &offset)
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)".
Definition: BilinearInterpolation.h:652
Provides access to bilinearly interpolated values (and derivatives) from discrete data points...
Definition: BilinearInterpolation.h:72
KeyType const & getOutsideReferencePoint_1() const
Accessor. See setMapping().
Definition: BilinearInterpolation.h:762
BilinearInterpolation(BilinearInterpolation const &arg)
Copy constructor.
Definition: BilinearInterpolation.h:109
BilinearInterpolation & operator=(BilinearInterpolation const &arg)
Assignment operator.
Definition: BilinearInterpolation.h:122
KeyType supportMax_0() const
Upper boundary of the support, in "outside" coordinates.
Definition: BilinearInterpolation.h:780
KeyType const & getScale_0() const
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data"...
Definition: BilinearInterpolation.h:592
Matrix< value_type > container_type
Definition: BilinearInterpolation.h:82
KeyType index2key_1(KeyType pos) const
The transformation from "inside" to "outside" coordinates.
Definition: BilinearInterpolation.h:584
KeyType outside_0_
Definition: BilinearInterpolation.h:802
ContainerType & getData()
Returns the internal random access container storing the data.
Definition: BilinearInterpolation.h:510
KeyType const & getOffset_0() const
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)".
Definition: BilinearInterpolation.h:624
KeyType const & getOutsideReferencePoint_0() const
Accessor. See setMapping().
Definition: BilinearInterpolation.h:756
KeyType scale_0_
Data members.
Definition: BilinearInterpolation.h:797
void addValue(KeyType arg_pos_0, KeyType arg_pos_1, ValueType arg_value)
Performs bilinear resampling. The arg_value is split up and added to the data points around arg_pos...
Definition: BilinearInterpolation.h:316
KeyType key2index_1(KeyType pos) const
The transformation from "outside" to "inside" coordinates.
Definition: BilinearInterpolation.h:569
KeyType key2index_0(KeyType pos) const
The transformation from "outside" to "inside" coordinates.
Definition: BilinearInterpolation.h:546
ValueType value(KeyType arg_pos_0, KeyType arg_pos_1) const
Returns the interpolated value ("backward resampling")
Definition: BilinearInterpolation.h:151
SizeType cols() const
Number of columns.
Definition: Matrix.h:264
Value value_type
Definition: BilinearInterpolation.h:79
KeyType const & getScale_1() const
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data"...
Definition: BilinearInterpolation.h:598
Key key_type
Definition: BilinearInterpolation.h:81
KeyType supportMax_1() const
Upper boundary of the support, in "outside" coordinates.
Definition: BilinearInterpolation.h:786
value_type ValueType
Definition: BilinearInterpolation.h:84
bool empty() const
Returns true if getData() is empty.
Definition: BilinearInterpolation.h:533
void setMapping_0(KeyType const &scale, KeyType const &inside_low, KeyType const &outside_low)
Specifies the mapping from "outside" to "inside" coordinates by the following data: ...
Definition: BilinearInterpolation.h:670
SizeType rows() const
Number of rows.
Definition: Matrix.h:258
KeyType const & getInsideReferencePoint_0() const
Accessor. See setMapping().
Definition: BilinearInterpolation.h:744
KeyType inside_0_
Definition: BilinearInterpolation.h:801
~BilinearInterpolation()
Destructor.
Definition: BilinearInterpolation.h:140
A two-dimensional matrix. Similar to std::vector, but uses a binary operator(,) for element access...
Definition: IsobaricQuantitationMethod.h:49