Min.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_ALGORITHMS_MIN_H_
36 #define _BLAZE_UTIL_ALGORITHMS_MIN_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/system/Inline.h>
44 #include <blaze/util/EnableIf.h>
45 #include <blaze/util/mpl/Or.h>
49 
50 
51 namespace blaze {
52 
53 //=================================================================================================
54 //
55 // MIN ALGORITHMS
56 //
57 //=================================================================================================
58 
59 //*************************************************************************************************
70 template< typename T1, typename T2
71  , typename = EnableIf_< Or< All<IsSigned,T1,T2>, All<IsUnsigned,T1,T2> > > >
72 BLAZE_ALWAYS_INLINE constexpr auto
73  min( const T1& a, const T2& b ) noexcept
74 {
75  return ( a < b )?( a ):( b );
76 }
77 //*************************************************************************************************
78 
79 
80 //*************************************************************************************************
92 template< typename T1, typename T2, typename T3 >
93 BLAZE_ALWAYS_INLINE constexpr decltype(auto)
94  min( const T1& a, const T2& b, const T3& c ) noexcept
95 {
96  using blaze::min;
97 
98  return min( min( a, b ), c );
99 }
100 //*************************************************************************************************
101 
102 
103 //*************************************************************************************************
116 template< typename T1, typename T2, typename T3, typename... Ts >
117 BLAZE_ALWAYS_INLINE constexpr decltype(auto)
118  min( const T1& a, const T2& b, const T3& c, const Ts&... args ) noexcept
119 {
120  using blaze::min;
121 
122  return min( min( min( a, b ), c ), args... );
123 }
124 //*************************************************************************************************
125 
126 } // namespace blaze
127 
128 #endif
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the Or class template.
Header file for the EnableIf class template.
Header file for the IsSigned type trait.
Header file for the IsUnsigned type trait.
Header file for the All type trait.
System settings for the inline keywords.