55 template<
typename dtype>
60 if (inBinEdges.
size() < 2)
66 const auto binEdges =
sort(inBinEdges);
69 for (
const auto value : inArray)
71 if (value < binEdges.front() || value > binEdges.back())
77 constexpr bool keepSearching =
true;
79 uint32 highIdx = binEdges.size() - 1;
82 const uint32 idx = (lowIdx + highIdx) / 2;
83 if (lowIdx == highIdx || lowIdx == highIdx - 1)
90 if (value > binEdges[idx])
94 else if (value < binEdges[idx])
122 template<
typename dtype>
133 static_cast<double>(inArray.
max().
item()),
137 const auto histo =
histogram(inArray, binEdges);
138 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:135
self_type max(Axis inAxis=Axis::NONE) const
Definition NdArrayCore.hpp:3117
size_type size() const noexcept
Definition NdArrayCore.hpp:4600
value_type item() const
Definition NdArrayCore.hpp:3098
self_type min(Axis inAxis=Axis::NONE) const
Definition NdArrayCore.hpp:3161
Definition Cartesian.hpp:39
NdArray< dtype > sort(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition sort.hpp:45
NdArray< dtype > linspace(dtype inStart, dtype inStop, uint32 inNum=50, EndPoint endPoint=EndPoint::YES)
Definition linspace.hpp:59
NdArray< dtype > zeros(uint32 inSquareSize)
Definition zeros.hpp:48
NdArray< uint32 > histogram(const NdArray< dtype > &inArray, const NdArray< double > &inBinEdges)
Definition histogram.hpp:56
std::uint32_t uint32
Definition Types.hpp:40
@ YES
Definition Enums.hpp:75