Blaze 3.9
Loading...
Searching...
No Matches
Mult.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_FUNCTORS_MULT_H_
36#define _BLAZE_MATH_FUNCTORS_MULT_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
65#include <blaze/system/Inline.h>
67
68
69namespace blaze {
70
71//=================================================================================================
72//
73// CLASS DEFINITION
74//
75//=================================================================================================
76
77//*************************************************************************************************
81struct Mult
82{
83 //**********************************************************************************************
90 template< typename T1, typename T2 >
91 BLAZE_ALWAYS_INLINE BLAZE_DEVICE_CALLABLE decltype(auto) operator()( T1&& a, T2&& b ) const
92 {
93 return std::forward<T1>( a ) * std::forward<T2>( b );
94 }
95 //**********************************************************************************************
96
97 //**********************************************************************************************
102 template< typename T1, typename T2 >
103 static constexpr bool simdEnabled() { return HasSIMDMult_v<T1,T2>; }
104 //**********************************************************************************************
105
106 //**********************************************************************************************
111 static constexpr bool paddingEnabled() { return true; }
112 //**********************************************************************************************
113
114 //**********************************************************************************************
121 template< typename T1, typename T2 >
122 BLAZE_ALWAYS_INLINE decltype(auto) load( const T1& a, const T2& b ) const
123 {
126 return a * b;
127 }
128 //**********************************************************************************************
129};
130//*************************************************************************************************
131
132
133
134
135//=================================================================================================
136//
137// YIELDSUNIFORM SPECIALIZATIONS
138//
139//=================================================================================================
140
141//*************************************************************************************************
143template< typename T1, typename T2 >
144struct YieldsUniform<Mult,T1,T2>
145 : public BoolConstant< IsUniform_v<T1> && IsUniform_v<T2> >
146{};
148//*************************************************************************************************
149
150
151
152
153//=================================================================================================
154//
155// YIELDSLOWER SPECIALIZATIONS
156//
157//=================================================================================================
158
159//*************************************************************************************************
161template< typename MT1, typename MT2 >
162struct YieldsLower<Mult,MT1,MT2>
163 : public BoolConstant< IsLower_v<MT1> || IsLower_v<MT2> >
164{};
166//*************************************************************************************************
167
168
169
170
171//=================================================================================================
172//
173// YIELDSUNILOWER SPECIALIZATIONS
174//
175//=================================================================================================
176
177//*************************************************************************************************
179template< typename MT1, typename MT2 >
180struct YieldsUniLower<Mult,MT1,MT2>
181 : public BoolConstant< ( IsUniLower_v<MT1> && IsUniTriangular_v<MT2> ) ||
182 ( IsUniLower_v<MT2> && IsUniTriangular_v<MT1> ) >
183{};
185//*************************************************************************************************
186
187
188
189
190//=================================================================================================
191//
192// YIELDSSTRICTLYLOWER SPECIALIZATIONS
193//
194//=================================================================================================
195
196//*************************************************************************************************
198template< typename MT1, typename MT2 >
199struct YieldsStrictlyLower<Mult,MT1,MT2>
200 : public BoolConstant< IsStrictlyLower_v<MT1> || IsStrictlyLower_v<MT2> >
201{};
203//*************************************************************************************************
204
205
206
207
208//=================================================================================================
209//
210// YIELDSUPPER SPECIALIZATIONS
211//
212//=================================================================================================
213
214//*************************************************************************************************
216template< typename MT1, typename MT2 >
217struct YieldsUpper<Mult,MT1,MT2>
218 : public BoolConstant< IsUpper_v<MT1> || IsUpper_v<MT2> >
219{};
221//*************************************************************************************************
222
223
224
225
226//=================================================================================================
227//
228// YIELDSUNIUPPER SPECIALIZATIONS
229//
230//=================================================================================================
231
232//*************************************************************************************************
234template< typename MT1, typename MT2 >
235struct YieldsUniUpper<Mult,MT1,MT2>
236 : public BoolConstant< ( IsUniUpper_v<MT1> && IsUniTriangular_v<MT2> ) ||
237 ( IsUniUpper_v<MT2> && IsUniTriangular_v<MT1> ) >
238{};
240//*************************************************************************************************
241
242
243
244
245//=================================================================================================
246//
247// YIELDSSTRICTLYUPPER SPECIALIZATIONS
248//
249//=================================================================================================
250
251//*************************************************************************************************
253template< typename MT1, typename MT2 >
254struct YieldsStrictlyUpper<Mult,MT1,MT2>
255 : public BoolConstant< IsStrictlyUpper_v<MT1> || IsStrictlyUpper_v<MT2> >
256{};
258//*************************************************************************************************
259
260
261
262
263//=================================================================================================
264//
265// YIELDSZERO SPECIALIZATIONS
266//
267//=================================================================================================
268
269//*************************************************************************************************
271template< typename T1, typename T2 >
272struct YieldsZero<Mult,T1,T2>
273 : public BoolConstant< IsZero_v<T1> || IsZero_v<T2> >
274{};
276//*************************************************************************************************
277
278} // namespace blaze
279
280#endif
Header file for the HasSIMDMult type trait.
Macro for CUDA compatibility.
Header file for the IntegralConstant class template.
Header file for the IsLower type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsUniLower type trait.
Header file for the IsUniTriangular type trait.
Header file for the IsUniUpper type trait.
Header file for the IsUniform type trait.
Header file for the IsUpper 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 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.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_SIMD_PACK(T)
Constraint on the data type.
Definition SIMDPack.h:60
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.
Definition HasSIMDMult.h:188
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition Inline.h:85
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition HostDevice.h:94
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition IntegralConstant.h:110
Header file for the SIMD multiplication functionality.
Generic wrapper for the multiplication operator.
Definition Mult.h:82
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data types T1 and T2.
Definition Mult.h:103
BLAZE_ALWAYS_INLINE decltype(auto) load(const T1 &a, const T2 &b) const
Returns the result of the multiplication operation for the given SIMD vectors.
Definition Mult.h:122
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition Mult.h:111
Compile time check for operations on matrices.
Definition YieldsLower.h:69
Compile time check for operations on matrices.
Definition YieldsStrictlyLower.h:67
Compile time check for operations on matrices.
Definition YieldsStrictlyUpper.h:67
Compile time check for operations on matrices.
Definition YieldsUniLower.h:67
Compile time check for operations on matrices.
Definition YieldsUniUpper.h:67
Compile time check for operations on matrices.
Definition YieldsUpper.h:69
Compile time check for operations on vectors and matrices.
Definition YieldsZero.h:68
System settings for the inline keywords.
Header file for the IsZero type trait.