NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
fmax.hpp
Go to the documentation of this file.
1
28#pragma once
29
31#include "NumCpp/NdArray.hpp"
32
33namespace nc
34{
35 //============================================================================
36 // Method Description:
48 template<typename dtype>
49 dtype fmax(dtype inValue1, dtype inValue2) noexcept
50 {
52
53 return std::max(inValue1,
54 inValue2,
55 [](const dtype value1, const dtype value2) noexcept -> bool { return value1 < value2; });
56 }
57
58 //============================================================================
59 // Method Description:
71 template<typename dtype>
72 NdArray<dtype> fmax(const NdArray<dtype>& inArray1, const NdArray<dtype>& inArray2)
73 {
74 return broadcast::broadcaster<dtype>(inArray1,
75 inArray2,
76 [](dtype inValue1, dtype inValue2) noexcept -> dtype
77 { return fmax(inValue1, inValue2); });
78 }
79
80 //============================================================================
81 // Method Description:
94 template<typename dtype>
95 NdArray<dtype> fmax(const NdArray<dtype>& inArray, const dtype& inScalar)
96 {
97 const NdArray<dtype> inArray2 = { inScalar };
98 return fmax(inArray, inArray2);
99 }
100
101 //============================================================================
102 // Method Description:
115 template<typename dtype>
116 NdArray<dtype> fmax(const dtype& inScalar, const NdArray<dtype>& inArray)
117 {
118 return fmax(inArray, inScalar);
119 }
120} // 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
dtype fmax(dtype inValue1, dtype inValue2) noexcept
Definition fmax.hpp:49