47 template<
typename dtype>
48 constexpr
double interp(dtype inValue1, dtype inValue2,
double inPercent) noexcept
70 template<
typename dtype>
79 if (inX.
min().item() < inXp.
min().item() || inX.
max().item() > inXp.
max().item())
89 for (
auto sortedXpIdx : sortedXpIdxs)
91 sortedXp[counter] = inXp[sortedXpIdx];
92 sortedFp[counter++] = inFp[sortedXpIdx];
102 while (currXidx < inX.
size())
104 const auto sortedXIdx = sortedXIdxs[currXidx];
105 const auto x = inX[sortedXIdx];
106 const auto xPLow = sortedXp[currXpIdx];
107 const auto xPHigh = sortedXp[currXpIdx + 1];
108 const auto fPLow = sortedFp[currXpIdx];
109 const auto fPHigh = sortedFp[currXpIdx + 1];
111 if (xPLow <= x && x <= xPHigh)
113 const double percent =
static_cast<double>(x - xPLow) /
static_cast<double>(xPHigh - xPLow);
114 returnArray[sortedXIdx] =
utils::interp(fPLow, fPHigh, percent);
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:36
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
size_type size() const noexcept
Definition: NdArrayCore.hpp:4289
NdArray< dtype > min(Axis inAxis=Axis::NONE) const
Definition: NdArrayCore.hpp:2993
NdArray< dtype > max(Axis inAxis=Axis::NONE) const
Definition: NdArrayCore.hpp:2940
constexpr double interp(double inValue1, double inValue2, double inPercent) noexcept
Definition: Utils/interp.hpp:43
Definition: Coordinate.hpp:45
constexpr double interp(dtype inValue1, dtype inValue2, double inPercent) noexcept
Definition: Functions/interp.hpp:48
NdArray< uint32 > argsort(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: argsort.hpp:46
std::uint32_t uint32
Definition: Types.hpp:40