NumCpp  2.10.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
maximum.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #include <cmath>
31 #include <complex>
32 #include <string>
33 
37 #include "NumCpp/NdArray.hpp"
39 
40 namespace nc
41 {
42  //============================================================================
43  // Method Description:
54  template<typename dtype>
55  NdArray<dtype> maximum(const NdArray<dtype>& inArray1, const NdArray<dtype>& inArray2)
56  {
58 
59  const auto comparitor = [](const dtype& lhs, const dtype& rhs) noexcept -> bool { return lhs < rhs; };
60  return broadcast::broadcaster<dtype>(inArray1,
61  inArray2,
62  [&comparitor](const dtype& value1, const dtype& value2)
63  { return std::max(value1, value2, comparitor); });
64  }
65 
66  //============================================================================
67  // Method Description:
78  template<typename dtype>
79  NdArray<dtype> maximum(const NdArray<dtype>& inArray, const dtype& inScalar)
80  {
81  const NdArray<dtype> inArray2 = { inScalar };
82  return maximum(inArray, inArray2);
83  }
84 
85  //============================================================================
86  // Method Description:
97  template<typename dtype>
98  NdArray<dtype> maximum(const dtype& inScalar, const NdArray<dtype>& inArray)
99  {
100  return maximum(inArray, inScalar);
101  }
102 } // namespace nc
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:56
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:138
Definition: Coordinate.hpp:45
NdArray< dtype > maximum(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)
Definition: maximum.hpp:55
NdArray< dtype > max(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: max.hpp:44