NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
fmin.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:
49 template<typename dtype>
50 dtype fmin(dtype inValue1, dtype inValue2) noexcept
51 {
53
54 return std::min(inValue1,
55 inValue2,
56 [](const dtype value1, const dtype value2) noexcept -> bool { return value1 < value2; });
57 }
58
59 //============================================================================
60 // Method Description:
72 template<typename dtype>
73 NdArray<dtype> fmin(const NdArray<dtype>& inArray1, const NdArray<dtype>& inArray2)
74 {
75 return broadcast::broadcaster<dtype>(inArray1,
76 inArray2,
77 [](dtype inValue1, dtype inValue2) noexcept -> dtype
78 { return fmin(inValue1, inValue2); });
79 }
80
81 //============================================================================
82 // Method Description:
95 template<typename dtype>
96 NdArray<dtype> fmin(const NdArray<dtype>& inArray, const dtype& inScalar)
97 {
98 const NdArray<dtype> inArray2 = { inScalar };
99 return fmin(inArray, inArray2);
100 }
101
102 //============================================================================
103 // Method Description:
116 template<typename dtype>
117 NdArray<dtype> fmin(const dtype& inScalar, const NdArray<dtype>& inArray)
118 {
119 return fmin(inArray, inScalar);
120 }
121} // 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 fmin(dtype inValue1, dtype inValue2) noexcept
Definition fmin.hpp:50