Blaze 3.9
Join.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_FUNCTORS_JOIN_H_
36#define _BLAZE_MATH_FUNCTORS_JOIN_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
56#include <blaze/system/Inline.h>
57
58
59namespace blaze {
60
61//=================================================================================================
62//
63// CLASS DEFINITION
64//
65//=================================================================================================
66
67//*************************************************************************************************
71template< typename OP > // Type of the operation
72struct Join
73{
74 public:
75 //**********************************************************************************************
80 explicit constexpr Join( const OP& op )
81 : op_( op ) // The wrapped operation.
82 {}
83 //**********************************************************************************************
84
85 //**********************************************************************************************
91 template< typename... Args >
92 BLAZE_ALWAYS_INLINE constexpr decltype(auto) operator()( const Args&... args ) const
93 {
94 return op_( args... );
95 }
96 //**********************************************************************************************
97
98 //**********************************************************************************************
105 template< typename T1, typename T2, typename... Args >
106 BLAZE_ALWAYS_INLINE constexpr decltype(auto) operator()( const std::pair<T1,T2>& p, const Args&... args ) const
107 {
108 return (*this)( p.first, p.second, args... );
109 }
110 //**********************************************************************************************
111
112 //**********************************************************************************************
117 template< typename... Args >
118 static constexpr bool simdEnabled() { return IsSIMDEnabled_v<OP,Args...>; }
119 //**********************************************************************************************
120
121 //**********************************************************************************************
126 static constexpr bool paddingEnabled() { return IsPaddingEnabled_v<OP>; }
127 //**********************************************************************************************
128
129 //**********************************************************************************************
135 template< typename... Args >
136 BLAZE_ALWAYS_INLINE decltype(auto) load( const Args&... args ) const
137 {
138 return op_.load( args... );
139 }
140 //**********************************************************************************************
141
142 //**********************************************************************************************
149 template< typename T1, typename T2, typename... Args >
150 BLAZE_ALWAYS_INLINE decltype(auto) load( const std::pair<T1,T2>& p, const Args&... args ) const
151 {
152 return (*this).load( p.first, p.second, args... );
153 }
154 //**********************************************************************************************
155
156 private:
157 //**Member variables****************************************************************************
158 OP op_;
159 //**********************************************************************************************
160};
161//*************************************************************************************************
162
163
164
165
166//=================================================================================================
167//
168// GLOBAL FUNCTIONS
169//
170//=================================================================================================
171
172//*************************************************************************************************
182template< typename OP > // Type of the operation
183constexpr Join<OP> join( const OP& op )
184{
185 return Join<OP>( op );
186}
187//*************************************************************************************************
188
189
190
191
192//=================================================================================================
193//
194// YIELDSUNIFORM SPECIALIZATIONS
195//
196//=================================================================================================
197
198//*************************************************************************************************
200template< typename OP, typename T, typename... Args >
201struct YieldsUniform<Join<OP>,T,Args...>
202 : public YieldsUniform<OP,T,Args...>
203{};
205//*************************************************************************************************
206
207
208
209
210//=================================================================================================
211//
212// YIELDSSYMMETRIC SPECIALIZATIONS
213//
214//=================================================================================================
215
216//*************************************************************************************************
218template< typename OP, typename MT, typename... MTs >
219struct YieldsSymmetric<Join<OP>,MT,MTs...>
220 : public YieldsSymmetric<OP,MT,MTs...>
221{};
223//*************************************************************************************************
224
225
226
227
228//=================================================================================================
229//
230// YIELDSHERMITIAN SPECIALIZATIONS
231//
232//=================================================================================================
233
234//*************************************************************************************************
236template< typename OP, typename MT, typename... MTs >
237struct YieldsHermitian<Join<OP>,MT,MTs...>
238 : public YieldsHermitian<OP,MT,MTs...>
239{};
241//*************************************************************************************************
242
243
244
245
246//=================================================================================================
247//
248// YIELDSLOWER SPECIALIZATIONS
249//
250//=================================================================================================
251
252//*************************************************************************************************
254template< typename OP, typename MT, typename... MTs >
255struct YieldsLower<Join<OP>,MT,MTs...>
256 : public YieldsLower<OP,MT,MTs...>
257{};
259//*************************************************************************************************
260
261
262
263
264//=================================================================================================
265//
266// YIELDSUNILOWER SPECIALIZATIONS
267//
268//=================================================================================================
269
270//*************************************************************************************************
272template< typename OP, typename MT, typename... MTs >
273struct YieldsUniLower<Join<OP>,MT,MTs...>
274 : public YieldsUniLower<OP,MT,MTs...>
275{};
277//*************************************************************************************************
278
279
280
281
282//=================================================================================================
283//
284// YIELDSSTRICTLYLOWER SPECIALIZATIONS
285//
286//=================================================================================================
287
288//*************************************************************************************************
290template< typename OP, typename MT, typename... MTs >
291struct YieldsStrictlyLower<Join<OP>,MT,MTs...>
292 : public YieldsStrictlyLower<OP,MT,MTs...>
293{};
295//*************************************************************************************************
296
297
298
299
300//=================================================================================================
301//
302// YIELDSUPPER SPECIALIZATIONS
303//
304//=================================================================================================
305
306//*************************************************************************************************
308template< typename OP, typename MT, typename... MTs >
309struct YieldsUpper<Join<OP>,MT,MTs...>
310 : public YieldsUpper<OP,MT,MTs...>
311{};
313//*************************************************************************************************
314
315
316
317
318//=================================================================================================
319//
320// YIELDSUNIUPPER SPECIALIZATIONS
321//
322//=================================================================================================
323
324//*************************************************************************************************
326template< typename OP, typename MT, typename... MTs >
327struct YieldsUniUpper<Join<OP>,MT,MTs...>
328 : public YieldsUniUpper<OP,MT,MTs...>
329{};
331//*************************************************************************************************
332
333
334
335
336//=================================================================================================
337//
338// YIELDSSTRICTLYUPPER SPECIALIZATIONS
339//
340//=================================================================================================
341
342//*************************************************************************************************
344template< typename OP, typename MT, typename... MTs >
345struct YieldsStrictlyUpper<Join<OP>,MT,MTs...>
346 : public YieldsStrictlyUpper<OP,MT,MTs...>
347{};
349//*************************************************************************************************
350
351
352
353
354//=================================================================================================
355//
356// YIELDSZERO SPECIALIZATIONS
357//
358//=================================================================================================
359
360//*************************************************************************************************
362template< typename OP, typename T, typename... Args >
363struct YieldsZero<Join<OP>,T,Args...>
364 : public YieldsZero<OP,T,Args...>
365{};
367//*************************************************************************************************
368
369} // namespace blaze
370
371#endif
Header file for the IsPaddingEnabled type trait.
Header file for the IsSIMDEnabled type trait.
Header file for the YieldsHermitian type trait.
Header file for the YieldsLower type trait.
Header file for the YieldsStrictlyLower type trait.
Header file for the YieldsStrictlyUpper type trait.
Header file for the YieldsSymmetric type trait.
Header file for the YieldsUniLower type trait.
Header file for the YieldsUniUpper type trait.
Header file for the YieldsUniform type trait.
Header file for the YieldsUpper type trait.
Header file for the YieldsZero type trait.
constexpr Join< OP > join(const OP &op)
Wraps the given operation to unpack paired arguments.
Definition: Join.h:183
constexpr bool IsSIMDEnabled_v
Auxiliary variable template for the IsSIMDEnabled type trait.
Definition: IsSIMDEnabled.h:129
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Generic wrapper for unpacking paired function arguments.
Definition: Join.h:73
BLAZE_ALWAYS_INLINE decltype(auto) load(const std::pair< T1, T2 > &p, const Args &... args) const
Returns the result of the wrapped operation for the given SIMD vectors.
Definition: Join.h:150
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: Join.h:126
BLAZE_ALWAYS_INLINE decltype(auto) load(const Args &... args) const
Returns the result of the wrapped operation for the given SIMD vectors.
Definition: Join.h:136
OP op_
The wrapped operation.
Definition: Join.h:158
constexpr Join(const OP &op)
Constructor of the Join functor.
Definition: Join.h:80
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data types Args.
Definition: Join.h:118
System settings for the inline keywords.