LookupTable
-
template<fgc4::utils::NumericScalar IndexType, fgc4::utils::NumericScalar StoredType = IndexType>
class LookupTable : public vslib::Component Subclassed by vslib::PeriodicLookupTable< double, double >
Public Functions
-
inline LookupTable(std::string_view name, Component &parent, std::vector<std::pair<IndexType, StoredType>> &&values, const bool equal_binning = false) noexcept
Defines constructor for LookupTable Component.
-
inline StoredType interpolate(const IndexType input_x, const bool random_access = false) noexcept
Provides an interpolated y-axis value from the stored values closest to the provided x-axis input.
- Parameters:
input_x – X-axis input value
random_access – Switch informing if the input_x is coming linearly or randomly, allows for binary search optimisation in the latter case
- Returns:
Y-axis value result of the interpolation
-
inline const StoredType &operator[](const size_t index) const
Provides random-access operator overload to the index-th element of the stored lookup table’s y-axis value.
- Parameters:
index – Index of the element to be returned
- Returns:
Y-axis value of the function at the index
-
inline const auto &getData() const
Provides a const reference to the data table.
- Returns:
Data table of index-value pairs
-
inline LookupTable(std::string_view name, Component &parent, std::vector<std::pair<IndexType, StoredType>> &&values, const bool equal_binning = false) noexcept