46 template <
typename Key =
double,
typename Value = Key>
156 return data_(0, 0) * (1. + pos_0) * (1. + pos_1);
161 if (lower_1 >= size_1 - 1)
163 if (lower_1 != size_1 - 1)
169 return data_(0, lower_1) * (1. + pos_0) * (size_1 - pos_1);
177 data_(0, lower_1 + 1) * factor_1 +
178 data_(0, lower_1) * factor_1_complement
184 if (lower_0 >= size_0 - 1)
186 if (lower_0 != size_0 - 1)
200 return data_(lower_0, 0) * (size_0 - pos_0) * (1. + pos_1);
205 if (lower_1 >= size_1 - 1)
207 if (lower_1 != size_1 - 1)
213 return data_(lower_0, lower_1) * (size_0 - pos_0) * (size_1 - pos_1);
221 data_(lower_0, lower_1 + 1) * factor_1 +
222 data_(lower_0, lower_1) * factor_1_complement
243 data_(lower_0 + 1, 0) * factor_0
245 data_(lower_0, 0) * factor_0_complement
252 if (lower_1 >= size_1 - 1)
254 if (lower_1 != size_1 - 1)
261 data_(lower_0 + 1, lower_1) * factor_0
263 data_(lower_0, lower_1) * factor_0_complement
273 data_(lower_0 + 1, lower_1 + 1) * factor_0
275 data_(lower_0, lower_1 + 1) * factor_0_complement
280 data_(lower_0 + 1, lower_1) * factor_0
282 data_(lower_0, lower_1) * factor_0_complement
284 * factor_1_complement;
294 typedef typename std::ptrdiff_t DiffType;
299 KeyType const frac_0 = std::modf(pos_0, &lower_0_key);
300 DiffType
const lower_0 = DiffType(lower_0_key);
313 KeyType const frac_1 = std::modf(pos_1, &lower_1_key);
314 DiffType
const lower_1 = DiffType(lower_1_key);
325 data_(0, 0) += arg_value * (1 + frac_0) * (1 + frac_1);
331 DiffType
const back_1 =
data_.
cols() - 1;
333 if (lower_1 >= back_1)
335 if (lower_1 != back_1)
341 data_(0, lower_1) += arg_value * (1 + frac_0) * (1 - frac_1);
349 data_(0, lower_1 + 1) += tmp_prod * frac_1;
350 data_(0, lower_1) += tmp_prod * (1. - frac_1);
358 DiffType
const back_0 =
data_.
rows() - 1;
359 if (lower_0 >= back_0)
361 if (lower_0 != back_0)
373 KeyType const frac_1 = std::modf(pos_1, &lower_1_key);
374 DiffType
const lower_1 = DiffType(lower_1_key);
385 data_(lower_0, 0) += tmp_prod * (1 + frac_1);
391 DiffType
const back_1 =
data_.
cols() - 1;
393 if (lower_1 >= back_1)
395 if (lower_1 != back_1)
401 data_(lower_0, lower_1) += tmp_prod * (1 - frac_1);
408 data_(lower_0, lower_1 + 1) += tmp_prod * frac_1;
409 data_(lower_0, lower_1) += tmp_prod * (1 - frac_1);
423 KeyType const frac_1 = std::modf(pos_1, &lower_1_key);
424 DiffType
const lower_1 = DiffType(lower_1_key);
436 data_(lower_0 + 1, 0) += tmp_prod * frac_0;
437 data_(lower_0, 0) += tmp_prod * (1 - frac_0);
443 DiffType
const back_1 =
data_.
cols() - 1;
445 if (lower_1 >= back_1)
447 if (lower_1 != back_1)
454 data_(lower_0 + 1, lower_1) += tmp_prod * frac_0;
455 data_(lower_0, lower_1) += tmp_prod * (1 - frac_0);
465 data_(lower_0 + 1, lower_1 + 1) += tmp_prod * frac_1;
466 data_(lower_0 + 1, lower_1) += tmp_prod * (1 - frac_1);
467 tmp_prod =
KeyType(arg_value * (1 - frac_0));
468 data_(lower_0, lower_1 + 1) += tmp_prod * frac_1;
469 data_(lower_0, lower_1) += tmp_prod * (1 - frac_1);
501 template <
typename SourceContainer>
650 offset_0_ = outside_low - scale * inside_low;
663 if (inside_high != inside_low)
665 setMapping_0((outside_high - outside_low) / (inside_high - inside_low),
666 inside_low, outside_low);
693 offset_1_ = outside_low - scale * inside_low;
706 if (inside_high != inside_low)
708 setMapping_1((outside_high - outside_low) / (inside_high - inside_low),
709 inside_low, outside_low);
Provides access to bilinearly interpolated values (and derivatives) from discrete data points....
Definition BilinearInterpolation.h:48
Value value_type
Definition BilinearInterpolation.h:54
KeyType supportMin_1() const
Lower boundary of the support, in "outside" coordinates.
Definition BilinearInterpolation.h:749
ValueType value(KeyType arg_pos_0, KeyType arg_pos_1) const
Returns the interpolated value ("backward resampling")
Definition BilinearInterpolation.h:126
KeyType const & getInsideReferencePoint_1() const
Accessor. See setMapping().
Definition BilinearInterpolation.h:725
KeyType const & getOffset_1() const
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,...
Definition BilinearInterpolation.h:605
Key key_type
Definition BilinearInterpolation.h:56
Matrix< value_type > container_type
Definition BilinearInterpolation.h:57
ContainerType data_
Definition BilinearInterpolation.h:780
container_type ContainerType
Definition BilinearInterpolation.h:61
void setData(SourceContainer const &data)
Assigns data to the internal random access container storing the data.
Definition BilinearInterpolation.h:502
KeyType outside_0_
Definition BilinearInterpolation.h:777
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:703
KeyType supportMax_1() const
Upper boundary of the support, in "outside" coordinates.
Definition BilinearInterpolation.h:761
KeyType inside_1_
Definition BilinearInterpolation.h:778
BilinearInterpolation(BilinearInterpolation const &arg)
Copy constructor.
Definition BilinearInterpolation.h:84
ContainerType & getData()
Returns the internal random access container storing the data.
Definition BilinearInterpolation.h:485
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:688
bool empty() const
Returns true if getData() is empty.
Definition BilinearInterpolation.h:508
KeyType supportMax_0() const
Upper boundary of the support, in "outside" coordinates.
Definition BilinearInterpolation.h:755
KeyType const & getScale_1() const
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Definition BilinearInterpolation.h:573
KeyType const & getInsideReferencePoint_0() const
Accessor. See setMapping().
Definition BilinearInterpolation.h:719
void setOffset_1(KeyType const &offset)
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,...
Definition BilinearInterpolation.h:627
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:645
value_type ValueType
Definition BilinearInterpolation.h:59
KeyType scale_1_
Definition BilinearInterpolation.h:774
BilinearInterpolation()
Constructors and destructor.
Definition BilinearInterpolation.h:71
KeyType index2key_0(KeyType pos) const
The transformation from "inside" to "outside" coordinates.
Definition BilinearInterpolation.h:536
KeyType offset_0_
Definition BilinearInterpolation.h:773
KeyType scale_0_
Data members.
Definition BilinearInterpolation.h:772
KeyType inside_0_
Definition BilinearInterpolation.h:776
BilinearInterpolation & operator=(BilinearInterpolation const &arg)
Assignment operator.
Definition BilinearInterpolation.h:97
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:660
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:291
KeyType const & getScale_0() const
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Definition BilinearInterpolation.h:567
key_type KeyType
Definition BilinearInterpolation.h:60
KeyType offset_1_
Definition BilinearInterpolation.h:775
KeyType const & getOutsideReferencePoint_1() const
Accessor. See setMapping().
Definition BilinearInterpolation.h:737
KeyType const & getOffset_0() const
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,...
Definition BilinearInterpolation.h:599
~BilinearInterpolation()
Destructor.
Definition BilinearInterpolation.h:115
KeyType outside_1_
Definition BilinearInterpolation.h:779
void setScale_1(KeyType const &scale)
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Definition BilinearInterpolation.h:593
ContainerType const & getData() const
Returns the internal random access container storing the data.
Definition BilinearInterpolation.h:491
KeyType const & getOutsideReferencePoint_0() const
Accessor. See setMapping().
Definition BilinearInterpolation.h:731
KeyType key2index_1(KeyType pos) const
The transformation from "outside" to "inside" coordinates.
Definition BilinearInterpolation.h:544
void setOffset_0(KeyType const &offset)
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,...
Definition BilinearInterpolation.h:616
KeyType index2key_1(KeyType pos) const
The transformation from "inside" to "outside" coordinates.
Definition BilinearInterpolation.h:559
KeyType supportMin_0() const
Lower boundary of the support, in "outside" coordinates.
Definition BilinearInterpolation.h:743
KeyType key2index_0(KeyType pos) const
The transformation from "outside" to "inside" coordinates.
Definition BilinearInterpolation.h:521
void setScale_0(KeyType const &scale)
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Definition BilinearInterpolation.h:583
A 2D matrix class with efficient buffer access for NumPy interoperability.
Definition Matrix.h:35
Size cols() const
Number of columns.
Definition Matrix.h:84
bool empty() const
Check if matrix is empty.
Definition Matrix.h:90
Size rows() const
Number of rows.
Definition Matrix.h:81
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition Types.h:104
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19