Max.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_ALGORITHMS_MAX_H_
36 #define _BLAZE_UTIL_ALGORITHMS_MAX_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 // MAX 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  max( const T1& a, const T2& b ) noexcept
74 {
75  return ( a < b )?( b ):( a );
76 }
77 //*************************************************************************************************
78 
79 
80 //*************************************************************************************************
92 template< typename T1, typename T2, typename T3 >
93 BLAZE_ALWAYS_INLINE constexpr decltype(auto)
94  max( const T1& a, const T2& b, const T3& c ) noexcept
95 {
96  using blaze::max;
97 
98  return max( max( 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  max( const T1& a, const T2& b, const T3& c, const Ts&... args ) noexcept
119 {
120  using blaze::max;
121 
122  return max( max( max( a, b ), c ), args... );
123 }
124 //*************************************************************************************************
125 
126 } // namespace blaze
127 
128 #endif
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1809
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#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.