57 template<
typename dtype>
62 if (inBinEdges.
size() < 2)
68 const auto binEdges =
sort(inBinEdges);
71 for (
const auto value : inArray)
73 if (value < binEdges.front() || value > binEdges.back())
79 constexpr
bool keepSearching =
true;
81 uint32 highIdx = binEdges.size() - 1;
84 const uint32 idx = (lowIdx + highIdx) / 2;
85 if (lowIdx == highIdx || lowIdx == highIdx - 1)
92 if (value > binEdges[idx])
96 else if (value < binEdges[idx])
125 template<
typename dtype>
135 constexpr
bool useEndPoint =
true;
137 static_cast<double>(inArray.
max().item()), inNumBins + 1, useEndPoint);
139 const auto histo =
histogram(inArray, binEdges);
140 return std::make_pair(histo, binEdges);
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:36
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
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:4497
NdArray< dtype > min(Axis inAxis=Axis::NONE) const
Definition: NdArrayCore.hpp:3180
NdArray< dtype > max(Axis inAxis=Axis::NONE) const
Definition: NdArrayCore.hpp:3123
Definition: Coordinate.hpp:45
NdArray< dtype > linspace(dtype inStart, dtype inStop, uint32 inNum=50, bool endPoint=true)
Definition: linspace.hpp:62
NdArray< dtype > sort(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: sort.hpp:47
NdArray< uint32 > histogram(const NdArray< dtype > &inArray, const NdArray< double > &inBinEdges)
Definition: histogram.hpp:58
std::uint32_t uint32
Definition: Types.hpp:40