NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
fmin.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <cmath>
31#include <complex>
32#include <string>
33
37#include "NumCpp/NdArray.hpp"
39
40namespace nc
41{
42 //============================================================================
43 // Method Description:
55 template<typename dtype>
56 dtype fmin(dtype inValue1, dtype inValue2) noexcept
57 {
59
60 return std::min(inValue1,
61 inValue2,
62 [](const dtype value1, const dtype value2) noexcept -> bool { return value1 < value2; });
63 }
64
65 //============================================================================
66 // Method Description:
78 template<typename dtype>
79 NdArray<dtype> fmin(const NdArray<dtype>& inArray1, const NdArray<dtype>& inArray2)
80 {
81 return broadcast::broadcaster<dtype>(inArray1,
82 inArray2,
83 [](dtype inValue1, dtype inValue2) noexcept -> dtype
84 { return fmin(inValue1, inValue2); });
85 }
86
87 //============================================================================
88 // Method Description:
101 template<typename dtype>
102 NdArray<dtype> fmin(const NdArray<dtype>& inArray, const dtype& inScalar)
103 {
104 const NdArray<dtype> inArray2 = { inScalar };
105 return fmin(inArray, inArray2);
106 }
107
108 //============================================================================
109 // Method Description:
122 template<typename dtype>
123 NdArray<dtype> fmin(const dtype& inScalar, const NdArray<dtype>& inArray)
124 {
125 return fmin(inArray, inScalar);
126 }
127} // 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:139
Definition: Cartesian.hpp:40
NdArray< dtype > min(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: min.hpp:44
dtype fmin(dtype inValue1, dtype inValue2) noexcept
Definition: fmin.hpp:56