65 template<
typename dtype>
73 if (inPercentile < 0. || inPercentile > 100.)
107 static_cast<uint32>(std::floor(
static_cast<double>(inArray.
size() - 1) * inPercentile / 100.));
110 switch (inInterpMethod)
114 const double percentI =
115 static_cast<double>(indexLower) /
static_cast<double>(inArray.
size() - 1);
116 const double fraction =
117 (inPercentile / 100. - percentI) /
118 (
static_cast<double>(indexLower + 1) /
static_cast<double>(inArray.
size() - 1) - percentI);
121 arrayCopy[indexLower] + (arrayCopy[indexLower + 1] - arrayCopy[indexLower]) * fraction
137 const double percent = inPercentile / 100.;
138 const double percent1 =
139 static_cast<double>(indexLower) /
static_cast<double>(inArray.
size() - 1);
140 const double percent2 =
141 static_cast<double>(indexLower + 1) /
static_cast<double>(inArray.
size() - 1);
142 const double diff1 = percent - percent1;
143 const double diff2 = percent2 - percent;
163 NdArray<double> returnArray = { (arrayCopy[indexLower] + arrayCopy[indexLower + 1]) / 2. };
178 for (
uint32 row = 0; row < inShape.
rows; ++row)
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
size_type size() const noexcept
Definition NdArrayCore.hpp:4604
iterator end() noexcept
Definition NdArrayCore.hpp:1623
typename AllocTraits::pointer pointer
Definition NdArrayCore.hpp:152
self_type transpose() const
Definition NdArrayCore.hpp:4963
bool isempty() const noexcept
Definition NdArrayCore.hpp:3012
const Shape & shape() const noexcept
Definition NdArrayCore.hpp:4591
const_reference back() const noexcept
Definition NdArrayCore.hpp:2363
const_reference front() const noexcept
Definition NdArrayCore.hpp:2940
iterator begin() noexcept
Definition NdArrayCore.hpp:1315
bool isscalar() const noexcept
Definition NdArrayCore.hpp:3036
value_type item() const
Definition NdArrayCore.hpp:3102
A Shape Class for NdArrays.
Definition Core/shape.hpp:41
uint32 rows
Definition Core/shape.hpp:44
uint32 cols
Definition Core/shape.hpp:45
void sort(RandomIt first, RandomIt last) noexcept
Definition StlAlgorithms.hpp:697
bool essentiallyEqual(dtype inValue1, dtype inValue2) noexcept
Definition essentiallyEqual.hpp:49
Definition Cartesian.hpp:40
InterpolationMethod
Definition Enums.hpp:139
@ HIGHER
Definition Enums.hpp:142
@ LOWER
Definition Enums.hpp:141
@ LINEAR
Definition Enums.hpp:140
@ NEAREST
Definition Enums.hpp:143
@ MIDPOINT
Definition Enums.hpp:144
dtype clip(dtype inValue, dtype inMinValue, dtype inMaxValue)
Definition clip.hpp:50
Axis
Enum To describe an axis.
Definition Enums.hpp:36
@ ROW
Definition Enums.hpp:38
@ COL
Definition Enums.hpp:39
@ NONE
Definition Enums.hpp:37
NdArray< double > percentile(const NdArray< dtype > &inArray, double inPercentile, Axis inAxis=Axis::NONE, InterpolationMethod inInterpMethod=InterpolationMethod::LINEAR)
Definition percentile.hpp:66
NdArray< uint32 > argmin(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition argmin.hpp:46
@ SHELL
Definition Enums.hpp:58
NdArray< dtypeOut > astype(const NdArray< dtype > inArray)
Definition astype.hpp:45
std::uint32_t uint32
Definition Types.hpp:40