Max.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_FUNCTORS_MAX_H_
36 #define _BLAZE_MATH_FUNCTORS_MAX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/math/simd/Max.h>
63 #include <blaze/system/Inline.h>
65 
66 
67 namespace blaze {
68 
69 //=================================================================================================
70 //
71 // CLASS DEFINITION
72 //
73 //=================================================================================================
74 
75 //*************************************************************************************************
79 struct Max
80 {
81  //**********************************************************************************************
84  explicit inline Max()
85  {}
86  //**********************************************************************************************
87 
88  //**********************************************************************************************
95  template< typename T1, typename T2 >
96  BLAZE_ALWAYS_INLINE decltype(auto) operator()( const T1& a, const T2& b ) const
97  {
98  return max( a, b );
99  }
100  //**********************************************************************************************
101 
102  //**********************************************************************************************
107  template< typename T1, typename T2 >
108  static constexpr bool simdEnabled() { return HasSIMDMax_v<T1,T2>; }
109  //**********************************************************************************************
110 
111  //**********************************************************************************************
116  static constexpr bool paddingEnabled() { return true; }
117  //**********************************************************************************************
118 
119  //**********************************************************************************************
126  template< typename T1, typename T2 >
127  BLAZE_ALWAYS_INLINE decltype(auto) load( const T1& a, const T2& b ) const
128  {
131  return max( a, b );
132  }
133  //**********************************************************************************************
134 };
135 //*************************************************************************************************
136 
137 
138 
139 
140 //=================================================================================================
141 //
142 // YIELDSUNIFORM SPECIALIZATIONS
143 //
144 //=================================================================================================
145 
146 //*************************************************************************************************
148 template< typename T1, typename T2 >
149 struct YieldsUniform<Max,T1,T2>
150  : public BoolConstant< IsUniform_v<T1> && IsUniform_v<T2> >
151 {};
153 //*************************************************************************************************
154 
155 
156 
157 
158 //=================================================================================================
159 //
160 // YIELDSSYMMETRIC SPECIALIZATIONS
161 //
162 //=================================================================================================
163 
164 //*************************************************************************************************
166 template< typename MT1, typename MT2 >
167 struct YieldsSymmetric<Max,MT1,MT2>
168  : public BoolConstant< IsSymmetric_v<MT1> && IsSymmetric_v<MT2> >
169 {};
171 //*************************************************************************************************
172 
173 
174 
175 
176 //=================================================================================================
177 //
178 // YIELDSLOWER SPECIALIZATIONS
179 //
180 //=================================================================================================
181 
182 //*************************************************************************************************
184 template< typename MT1, typename MT2 >
185 struct YieldsLower<Max,MT1,MT2>
186  : public BoolConstant< IsLower_v<MT1> && IsLower_v<MT2> >
187 {};
189 //*************************************************************************************************
190 
191 
192 
193 
194 //=================================================================================================
195 //
196 // YIELDSUNILOWER SPECIALIZATIONS
197 //
198 //=================================================================================================
199 
200 //*************************************************************************************************
202 template< typename MT1, typename MT2 >
203 struct YieldsUniLower<Max,MT1,MT2>
204  : public BoolConstant< ( IsUniLower_v<MT1> && ( IsUniLower_v<MT2> || IsStrictlyLower_v<MT2> ) ) ||
205  ( IsUniLower_v<MT2> && ( IsUniLower_v<MT1> || IsStrictlyLower_v<MT1> ) ) >
206 {};
208 //*************************************************************************************************
209 
210 
211 
212 
213 //=================================================================================================
214 //
215 // YIELDSSTRICTLYLOWER SPECIALIZATIONS
216 //
217 //=================================================================================================
218 
219 //*************************************************************************************************
221 template< typename MT1, typename MT2 >
222 struct YieldsStrictlyLower<Max,MT1,MT2>
223  : public BoolConstant< IsStrictlyLower_v<MT1> && IsStrictlyLower_v<MT2> >
224 {};
226 //*************************************************************************************************
227 
228 
229 
230 
231 //=================================================================================================
232 //
233 // YIELDSUPPER SPECIALIZATIONS
234 //
235 //=================================================================================================
236 
237 //*************************************************************************************************
239 template< typename MT1, typename MT2 >
240 struct YieldsUpper<Max,MT1,MT2>
241  : public BoolConstant< IsUpper_v<MT1> && IsUpper_v<MT2> >
242 {};
244 //*************************************************************************************************
245 
246 
247 
248 
249 //=================================================================================================
250 //
251 // YIELDSUNIUPPER SPECIALIZATIONS
252 //
253 //=================================================================================================
254 
255 //*************************************************************************************************
257 template< typename MT1, typename MT2 >
258 struct YieldsUniUpper<Max,MT1,MT2>
259  : public BoolConstant< ( IsUniUpper_v<MT1> && ( IsUniUpper_v<MT2> || IsStrictlyUpper_v<MT2> ) ) ||
260  ( IsUniUpper_v<MT2> && ( IsUniUpper_v<MT1> || IsStrictlyUpper_v<MT1> ) ) >
261 {};
263 //*************************************************************************************************
264 
265 
266 
267 
268 //=================================================================================================
269 //
270 // YIELDSSTRICTLYUPPER SPECIALIZATIONS
271 //
272 //=================================================================================================
273 
274 //*************************************************************************************************
276 template< typename MT1, typename MT2 >
277 struct YieldsStrictlyUpper<Max,MT1,MT2>
278  : public BoolConstant< IsStrictlyUpper_v<MT1> && IsStrictlyUpper_v<MT2> >
279 {};
281 //*************************************************************************************************
282 
283 } // namespace blaze
284 
285 #endif
Header file for the IsUniUpper type trait.
Header file for the YieldsStrictlyLower type trait.
Max()
Default constructor of the Max functor.
Definition: Max.h:84
Header file for the IsUniLower type trait.
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: Max.h:116
#define BLAZE_CONSTRAINT_MUST_BE_SIMD_PACK(T)
Constraint on the data type.In case the given data type T is not a SIMD pack, a compilation error is ...
Definition: SIMDPack.h:60
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data types T1 and T2.
Definition: Max.h:108
Headerfile for the generic max algorithm.
Header file for the IsUniform type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
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 YieldsStrictlyUpper type trait.
Header file for the YieldsUniLower type trait.
Header file for the IsLower type trait.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1179
Header file for the HasSIMDMax type trait.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Header file for the YieldsUniform type trait.
decltype(auto) BLAZE_ALWAYS_INLINE load(const T1 &a, const T2 &b) const
Returns the result of the max() function for the given SIMD vector.
Definition: Max.h:127
Header file for the YieldsSymmetric type trait.
Generic wrapper for the max() function.
Definition: Max.h:79
Header file for the YieldsUpper type trait.
Header file for the YieldsLower type trait.
Header file for the SIMD max functionality.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:101
Header file for the IntegralConstant class template.
Header file for the IsUpper type trait.
Header file for the YieldsUniUpper type trait.
System settings for the inline keywords.