Blaze 3.9
Bind3rd.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_FUNCTORS_BIND3RD_H_
36#define _BLAZE_MATH_FUNCTORS_BIND3RD_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
44#include <blaze/math/simd/Set.h>
48#include <blaze/system/Inline.h>
49
50
51namespace blaze {
52
53//=================================================================================================
54//
55// CLASS DEFINITION
56//
57//=================================================================================================
58
59//*************************************************************************************************
63template< typename OP // Type of the operation
64 , typename A3 > // Type of the bound argument
65struct Bind3rd
66{
67 public:
68 //**********************************************************************************************
74 constexpr Bind3rd( const OP& op, const A3& a3 )
75 : op_( op ) // The wrapped operation.
76 , a3_( a3 ) // The 3rd argument
77 {}
78 //**********************************************************************************************
79
80 //**********************************************************************************************
88 template< typename A1, typename A2, typename... Args >
89 BLAZE_ALWAYS_INLINE constexpr decltype(auto) operator()( A1&& a1, A2&& a2, Args&&... args ) const
90 {
91 return op_( std::forward<A1>( a1 ), std::forward<A2>( a2 ), a3_, std::forward<Args>( args )... );
92 }
93 //**********************************************************************************************
94
95 //**********************************************************************************************
100 template< typename A1, typename A2, typename... Args >
101 static constexpr bool simdEnabled() { return IsSIMDEnabled_v<OP,A1,A2,A3,Args...>; }
102 //**********************************************************************************************
103
104 //**********************************************************************************************
109 static constexpr bool paddingEnabled() { return false; }
110 //**********************************************************************************************
111
112 //**********************************************************************************************
120 template< typename A1, typename A2, typename... Args >
121 BLAZE_ALWAYS_INLINE decltype(auto) load( A1&& a1, A2&& a2, Args&&... args ) const
122 {
123 return op_.load( std::forward<A1>( a1 ), std::forward<A2>( a2 ), set( a3_ ), std::forward<Args>( args )... );
124 }
125 //**********************************************************************************************
126
127 private:
128 //**Member variables****************************************************************************
129 OP op_;
130 A3 a3_;
131 //**********************************************************************************************
132};
133//*************************************************************************************************
134
135
136
137
138//=================================================================================================
139//
140// GLOBAL FUNCTIONS
141//
142//=================================================================================================
143
144//*************************************************************************************************
155template< typename OP // Type of the operation
156 , typename A3 > // Type of the bound argument
157constexpr Bind3rd<OP,A3> bind3rd( const OP& op, const A3& a3 )
158{
159 return Bind3rd<OP,A3>( op, a3 );
160}
161//*************************************************************************************************
162
163
164
165
166//=================================================================================================
167//
168// YIELDSUNIFORM SPECIALIZATIONS
169//
170//=================================================================================================
171
172//*************************************************************************************************
174template< typename OP, typename A3, typename T >
175struct YieldsUniform<Bind3rd<OP,A3>,T>
176 : public YieldsUniform<OP,T>
177{};
179//*************************************************************************************************
180
181
182
183
184//=================================================================================================
185//
186// YIELDSSYMMETRIC SPECIALIZATIONS
187//
188//=================================================================================================
189
190//*************************************************************************************************
192template< typename OP, typename A3, typename MT >
193struct YieldsSymmetric<Bind3rd<OP,A3>,MT>
194 : public YieldsSymmetric<OP,MT>
195{};
197//*************************************************************************************************
198
199} // namespace blaze
200
201#endif
Header file for the IsSIMDEnabled type trait.
Header file for the SIMD set functionality.
Header file for the YieldsSymmetric type trait.
Header file for the YieldsUniform type trait.
constexpr Bind3rd< OP, A3 > bind3rd(const OP &op, const A3 &a3)
Binds the given object/value to the 3rd parameter of the given operation.
Definition: Bind3rd.h:157
constexpr bool IsSIMDEnabled_v
Auxiliary variable template for the IsSIMDEnabled type trait.
Definition: IsSIMDEnabled.h:129
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Generic wrapper for an operation with fixed 3rd argument.
Definition: Bind3rd.h:66
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: Bind3rd.h:109
OP op_
The wrapped operation.
Definition: Bind3rd.h:129
A3 a3_
The 3rd argument.
Definition: Bind3rd.h:130
BLAZE_ALWAYS_INLINE decltype(auto) load(A1 &&a1, A2 &&a2, Args &&... args) const
Returns the result of the wrapped operation for the given SIMD vectors.
Definition: Bind3rd.h:121
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data types Ts.
Definition: Bind3rd.h:101
constexpr Bind3rd(const OP &op, const A3 &a3)
Constructor of the Bind3rd functor.
Definition: Bind3rd.h:74
System settings for the inline keywords.