NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
maximum.hpp
Go to the documentation of this file.
1
28#pragma once
29
31#include "NumCpp/NdArray.hpp"
33
34namespace nc
35{
36 //============================================================================
37 // Method Description:
48 template<typename dtype>
49 NdArray<dtype> maximum(const NdArray<dtype>& inArray1, const NdArray<dtype>& inArray2)
50 {
52
53 const auto comparitor = [](const dtype& lhs, const dtype& rhs) noexcept -> bool { return lhs < rhs; };
54 return broadcast::broadcaster<dtype>(inArray1,
55 inArray2,
56 [&comparitor](const dtype& value1, const dtype& value2)
57 { return std::max(value1, value2, comparitor); });
58 }
59
60 //============================================================================
61 // Method Description:
72 template<typename dtype>
73 NdArray<dtype> maximum(const NdArray<dtype>& inArray, const dtype& inScalar)
74 {
75 const NdArray<dtype> inArray2 = { inScalar };
76 return maximum(inArray, inArray2);
77 }
78
79 //============================================================================
80 // Method Description:
91 template<typename dtype>
92 NdArray<dtype> maximum(const dtype& inScalar, const NdArray<dtype>& inArray)
93 {
94 return maximum(inArray, inScalar);
95 }
96} // 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:135
NdArray< dtypeIn1 > & broadcaster(NdArray< dtypeIn1 > &inArray1, const NdArray< dtypeIn2 > &inArray2, const Function &function, const AdditionalFunctionArgs &&... additionalFunctionArgs)
Definition NdArrayBroadcast.hpp:51
Definition Cartesian.hpp:39
NdArray< dtype > maximum(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)
Definition maximum.hpp:49