56 template<
typename dtype>
61 if (inBinEdges.
size() < 2)
67 const auto binEdges =
sort(inBinEdges);
70 for (
const auto value : inArray)
72 if (value < binEdges.front() || value > binEdges.back())
78 constexpr bool keepSearching =
true;
80 uint32 highIdx = binEdges.size() - 1;
83 const uint32 idx = (lowIdx + highIdx) / 2;
84 if (lowIdx == highIdx || lowIdx == highIdx - 1)
91 if (value > binEdges[idx])
95 else if (value < binEdges[idx])
123 template<
typename dtype>
134 static_cast<double>(inArray.
max().
item()),
138 const auto histo =
histogram(inArray, binEdges);
139 return std::make_pair(histo, binEdges);
#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
self_type max(Axis inAxis=Axis::NONE) const
Definition: NdArrayCore.hpp:3041
size_type size() const noexcept
Definition: NdArrayCore.hpp:4524
value_type item() const
Definition: NdArrayCore.hpp:3022
self_type min(Axis inAxis=Axis::NONE) const
Definition: NdArrayCore.hpp:3085
Definition: Cartesian.hpp:40
NdArray< dtype > sort(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: sort.hpp:46
NdArray< dtype > linspace(dtype inStart, dtype inStop, uint32 inNum=50, EndPoint endPoint=EndPoint::YES)
Definition: linspace.hpp:61
NdArray< uint32 > histogram(const NdArray< dtype > &inArray, const NdArray< double > &inBinEdges)
Definition: histogram.hpp:57
std::uint32_t uint32
Definition: Types.hpp:40