NumCpp  2.12.1
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 <limits>
31
32#include "NumCpp/Core/Types.hpp"
33#include "NumCpp/NdArray.hpp"
34
35namespace 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:139
size_type size() const noexcept
Definition: NdArrayCore.hpp:4524
NdArray< size_type > flatnonzero() const
Definition: NdArrayCore.hpp:2821
A Class for slicing into NdArrays.
Definition: Slice.hpp:45
Definition: Cartesian.hpp:40
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
NdArray< dtype > max(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: max.hpp:44