NumCpp  2.7.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
find.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #include "NumCpp/Core/Types.hpp"
31 #include "NumCpp/NdArray.hpp"
32 
33 #include <limits>
34 
35 namespace nc
36 {
37  //============================================================================
38  // Method Description:
47  {
48  NdArray<uint32> indices = mask.flatnonzero();
49 
50  if (indices.size() <= n)
51  {
52  return indices;
53  }
54 
55  return indices[Slice(0, n)];
56  }
57 } // namespace nc
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:4296
NdArray< uint32 > flatnonzero() const
Definition: NdArrayCore.hpp:2733
A Class for slicing into NdArrays.
Definition: Slice.hpp:44
Definition: Coordinate.hpp:45
NdArray< dtype > max(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: max.hpp:44
NdArray< uint32 > find(const NdArray< bool > &mask, uint32 n=std::numeric_limits< uint32 >::max())
Definition: find.hpp:46
std::uint32_t uint32
Definition: Types.hpp:40