NumCpp  2.8.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
nanmax.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #include <cmath>
31 
35 #include "NumCpp/Core/Types.hpp"
36 #include "NumCpp/Functions/max.hpp"
37 #include "NumCpp/NdArray.hpp"
38 
39 namespace nc
40 {
41  //============================================================================
42  // Method Description:
52  template<typename dtype>
54  {
55  STATIC_ASSERT_FLOAT(dtype);
56 
57  NdArray<dtype> arrayCopy(inArray);
58  stl_algorithms::for_each(arrayCopy.begin(),
59  arrayCopy.end(),
60  [](dtype& value) noexcept -> void
61  {
62  if (std::isnan(value))
63  {
64  value = DtypeInfo<dtype>::min();
65  };
66  });
67 
68  return max(arrayCopy, inAxis);
69  }
70 } // namespace nc
#define STATIC_ASSERT_FLOAT(dtype)
Definition: StaticAsserts.hpp:45
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
iterator end() noexcept
Definition: NdArrayCore.hpp:1479
iterator begin() noexcept
Definition: NdArrayCore.hpp:1171
void for_each(InputIt first, InputIt last, UnaryFunction f)
Definition: StlAlgorithms.hpp:227
Definition: Coordinate.hpp:45
NdArray< dtype > nanmax(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: nanmax.hpp:53
NdArray< dtype > max(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: max.hpp:44
Axis
Enum To describe an axis.
Definition: Types.hpp:47