Blaze  3.6
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>
64 #include <blaze/system/Inline.h>
66 
67 
68 namespace blaze {
69 
70 //=================================================================================================
71 //
72 // CLASS DEFINITION
73 //
74 //=================================================================================================
75 
76 //*************************************************************************************************
80 struct Max
81 {
82  //**********************************************************************************************
89  template< typename T1, typename T2 >
90  BLAZE_ALWAYS_INLINE BLAZE_DEVICE_CALLABLE decltype(auto) operator()( const T1& a, const T2& b ) const
91  {
92  return max( a, b );
93  }
94  //**********************************************************************************************
95 
96  //**********************************************************************************************
101  template< typename T1, typename T2 >
102  static constexpr bool simdEnabled() { return HasSIMDMax_v<T1,T2>; }
103  //**********************************************************************************************
104 
105  //**********************************************************************************************
110  static constexpr bool paddingEnabled() { return true; }
111  //**********************************************************************************************
112 
113  //**********************************************************************************************
120  template< typename T1, typename T2 >
121  BLAZE_ALWAYS_INLINE decltype(auto) load( const T1& a, const T2& b ) const
122  {
125  return max( a, b );
126  }
127  //**********************************************************************************************
128 };
129 //*************************************************************************************************
130 
131 
132 
133 
134 //=================================================================================================
135 //
136 // YIELDSUNIFORM SPECIALIZATIONS
137 //
138 //=================================================================================================
139 
140 //*************************************************************************************************
142 template< typename T1, typename T2 >
143 struct YieldsUniform<Max,T1,T2>
144  : public BoolConstant< IsUniform_v<T1> && IsUniform_v<T2> >
145 {};
147 //*************************************************************************************************
148 
149 
150 
151 
152 //=================================================================================================
153 //
154 // YIELDSSYMMETRIC SPECIALIZATIONS
155 //
156 //=================================================================================================
157 
158 //*************************************************************************************************
160 template< typename MT1, typename MT2 >
161 struct YieldsSymmetric<Max,MT1,MT2>
162  : public BoolConstant< IsSymmetric_v<MT1> && IsSymmetric_v<MT2> >
163 {};
165 //*************************************************************************************************
166 
167 
168 
169 
170 //=================================================================================================
171 //
172 // YIELDSLOWER SPECIALIZATIONS
173 //
174 //=================================================================================================
175 
176 //*************************************************************************************************
178 template< typename MT1, typename MT2 >
179 struct YieldsLower<Max,MT1,MT2>
180  : public BoolConstant< IsLower_v<MT1> && IsLower_v<MT2> >
181 {};
183 //*************************************************************************************************
184 
185 
186 
187 
188 //=================================================================================================
189 //
190 // YIELDSUNILOWER SPECIALIZATIONS
191 //
192 //=================================================================================================
193 
194 //*************************************************************************************************
196 template< typename MT1, typename MT2 >
197 struct YieldsUniLower<Max,MT1,MT2>
198  : public BoolConstant< ( IsUniLower_v<MT1> && ( IsUniLower_v<MT2> || IsStrictlyLower_v<MT2> ) ) ||
199  ( IsUniLower_v<MT2> && ( IsUniLower_v<MT1> || IsStrictlyLower_v<MT1> ) ) >
200 {};
202 //*************************************************************************************************
203 
204 
205 
206 
207 //=================================================================================================
208 //
209 // YIELDSSTRICTLYLOWER SPECIALIZATIONS
210 //
211 //=================================================================================================
212 
213 //*************************************************************************************************
215 template< typename MT1, typename MT2 >
216 struct YieldsStrictlyLower<Max,MT1,MT2>
217  : public BoolConstant< IsStrictlyLower_v<MT1> && IsStrictlyLower_v<MT2> >
218 {};
220 //*************************************************************************************************
221 
222 
223 
224 
225 //=================================================================================================
226 //
227 // YIELDSUPPER SPECIALIZATIONS
228 //
229 //=================================================================================================
230 
231 //*************************************************************************************************
233 template< typename MT1, typename MT2 >
234 struct YieldsUpper<Max,MT1,MT2>
235  : public BoolConstant< IsUpper_v<MT1> && IsUpper_v<MT2> >
236 {};
238 //*************************************************************************************************
239 
240 
241 
242 
243 //=================================================================================================
244 //
245 // YIELDSUNIUPPER SPECIALIZATIONS
246 //
247 //=================================================================================================
248 
249 //*************************************************************************************************
251 template< typename MT1, typename MT2 >
252 struct YieldsUniUpper<Max,MT1,MT2>
253  : public BoolConstant< ( IsUniUpper_v<MT1> && ( IsUniUpper_v<MT2> || IsStrictlyUpper_v<MT2> ) ) ||
254  ( IsUniUpper_v<MT2> && ( IsUniUpper_v<MT1> || IsStrictlyUpper_v<MT1> ) ) >
255 {};
257 //*************************************************************************************************
258 
259 
260 
261 
262 //=================================================================================================
263 //
264 // YIELDSSTRICTLYUPPER SPECIALIZATIONS
265 //
266 //=================================================================================================
267 
268 //*************************************************************************************************
270 template< typename MT1, typename MT2 >
271 struct YieldsStrictlyUpper<Max,MT1,MT2>
272  : public BoolConstant< IsStrictlyUpper_v<MT1> && IsStrictlyUpper_v<MT2> >
273 {};
275 //*************************************************************************************************
276 
277 } // namespace blaze
278 
279 #endif
Header file for the IsUniUpper type trait.
Header file for the YieldsStrictlyLower type trait.
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:110
#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:102
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:1198
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:121
Header file for the YieldsSymmetric type trait.
Generic wrapper for the max() function.
Definition: Max.h:80
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 alias template represents ...
Definition: IntegralConstant.h:110
Macro for CUDA compatibility.
Header file for the IntegralConstant class template.
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
Header file for the IsUpper type trait.
Header file for the YieldsUniUpper type trait.
System settings for the inline keywords.