Blaze 3.9
Bind1st.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_FUNCTORS_BIND1ST_H_
36#define _BLAZE_MATH_FUNCTORS_BIND1ST_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 A1 > // Type of the bound argument
65struct Bind1st
66{
67 public:
68 //**********************************************************************************************
74 constexpr Bind1st( const OP& op, const A1& a1 )
75 : op_( op ) // The wrapped operation.
76 , a1_( a1 ) // The 1st argument
77 {}
78 //**********************************************************************************************
79
80 //**********************************************************************************************
86 template< typename... Args >
87 BLAZE_ALWAYS_INLINE constexpr decltype(auto) operator()( Args&&... args ) const
88 {
89 return op_( a1_, std::forward<Args>( args )... );
90 }
91 //**********************************************************************************************
92
93 //**********************************************************************************************
98 template< typename... Args >
99 static constexpr bool simdEnabled() { return IsSIMDEnabled_v<OP,A1,Args...>; }
100 //**********************************************************************************************
101
102 //**********************************************************************************************
107 static constexpr bool paddingEnabled() { return false; }
108 //**********************************************************************************************
109
110 //**********************************************************************************************
116 template< typename... Args >
117 BLAZE_ALWAYS_INLINE decltype(auto) load( Args&&... args ) const
118 {
119 return op_.load( set( a1_ ), std::forward<Args>( args )... );
120 }
121 //**********************************************************************************************
122
123 private:
124 //**Member variables****************************************************************************
125 OP op_;
126 A1 a1_;
127 //**********************************************************************************************
128};
129//*************************************************************************************************
130
131
132
133
134//=================================================================================================
135//
136// GLOBAL FUNCTIONS
137//
138//=================================================================================================
139
140//*************************************************************************************************
151template< typename OP // Type of the operation
152 , typename A1 > // Type of the bound argument
153constexpr Bind1st<OP,A1> bind1st( const OP& op, const A1& a1 )
154{
155 return Bind1st<OP,A1>( op, a1 );
156}
157//*************************************************************************************************
158
159
160
161
162//=================================================================================================
163//
164// YIELDSUNIFORM SPECIALIZATIONS
165//
166//=================================================================================================
167
168//*************************************************************************************************
170template< typename OP, typename A1, typename T >
171struct YieldsUniform<Bind1st<OP,A1>,T>
172 : public YieldsUniform<OP,T>
173{};
175//*************************************************************************************************
176
177
178
179
180//=================================================================================================
181//
182// YIELDSSYMMETRIC SPECIALIZATIONS
183//
184//=================================================================================================
185
186//*************************************************************************************************
188template< typename OP, typename A1, typename MT >
189struct YieldsSymmetric<Bind1st<OP,A1>,MT>
190 : public YieldsSymmetric<OP,MT>
191{};
193//*************************************************************************************************
194
195} // namespace blaze
196
197#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 Bind1st< OP, A1 > bind1st(const OP &op, const A1 &a1)
Binds the given object/value to the 1st parameter of the given operation.
Definition: Bind1st.h:153
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 1st argument.
Definition: Bind1st.h:66
A1 a1_
The 1st argument.
Definition: Bind1st.h:126
BLAZE_ALWAYS_INLINE decltype(auto) load(Args &&... args) const
Returns the result of the wrapped operation for the given SIMD vectors.
Definition: Bind1st.h:117
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: Bind1st.h:107
constexpr Bind1st(const OP &op, const A1 &a1)
Constructor of the Bind1st functor.
Definition: Bind1st.h:74
OP op_
The wrapped operation.
Definition: Bind1st.h:125
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data types Args.
Definition: Bind1st.h:99
System settings for the inline keywords.