 |
NumCpp
2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
|
Go to the documentation of this file.
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);
value_type item() const
Definition: NdArrayCore.hpp:2975
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
NdArray< dtype > max(Axis inAxis=Axis::NONE) const
Definition: NdArrayCore.hpp:2996
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:71
std::uint32_t uint32
Definition: Types.hpp:40
size_type size() const noexcept
Definition: NdArrayCore.hpp:4370
NdArray< dtype > linspace(dtype inStart, dtype inStop, uint32 inNum=50, bool endPoint=true)
Definition: linspace.hpp:62
Definition: Coordinate.hpp:44
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:36
NdArray< uint32 > histogram(const NdArray< dtype > &inArray, const NdArray< double > &inBinEdges)
Definition: histogram.hpp:58
NdArray< dtype > sort(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: sort.hpp:47
NdArray< dtype > min(Axis inAxis=Axis::NONE) const
Definition: NdArrayCore.hpp:3053