NumCpp  2.6.2
A Templatized Header Only C++ Implementation of the Python NumPy Library
find.hpp
Go to the documentation of this file.
1 
28 #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:
48  {
49  NdArray<uint32> indices = mask.flatnonzero();
50 
51  if (indices.size() <= n)
52  {
53  return indices;
54  }
55 
56  return indices[Slice(0, n)];
57  }
58 } // 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:4497
NdArray< uint32 > flatnonzero() const
Definition: NdArrayCore.hpp:2892
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:45
NdArray< uint32 > find(const NdArray< bool > &mask, uint32 n=std::numeric_limits< uint32 >::max())
Definition: find.hpp:47
std::uint32_t uint32
Definition: Types.hpp:40