SqrAbs.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_FUNCTORS_SQRABS_H_
36 #define _BLAZE_MATH_FUNCTORS_SQRABS_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
45 #include <blaze/math/simd/Conj.h>
46 #include <blaze/math/simd/Mult.h>
68 #include <blaze/system/Inline.h>
70 
71 
72 namespace blaze {
73 
74 //=================================================================================================
75 //
76 // CLASS DEFINITION
77 //
78 //=================================================================================================
79 
80 //*************************************************************************************************
84 struct SqrAbs
85 {
86  //**********************************************************************************************
89  explicit inline SqrAbs()
90  {}
91  //**********************************************************************************************
92 
93  //**********************************************************************************************
99  template< typename T >
100  BLAZE_ALWAYS_INLINE decltype(auto) operator()( const T& a ) const
101  {
102  return a * conj( a );
103  }
104  //**********************************************************************************************
105 
106  //**********************************************************************************************
111  template< typename T >
112  static constexpr bool simdEnabled() { return HasSIMDMult_v<T,T> && HasSIMDConj_v<T>; }
113  //**********************************************************************************************
114 
115  //**********************************************************************************************
120  static constexpr bool paddingEnabled() { return true; }
121  //**********************************************************************************************
122 
123  //**********************************************************************************************
129  template< typename T >
130  BLAZE_ALWAYS_INLINE decltype(auto) load( const T& a ) const
131  {
133  return a * conj( a );
134  }
135  //**********************************************************************************************
136 };
137 //*************************************************************************************************
138 
139 
140 
141 
142 //=================================================================================================
143 //
144 // YIELDSUNIFORM SPECIALIZATIONS
145 //
146 //=================================================================================================
147 
148 //*************************************************************************************************
150 template< typename T >
151 struct YieldsUniform<SqrAbs,T>
152  : public IsUniform<T>
153 {};
155 //*************************************************************************************************
156 
157 
158 
159 
160 //=================================================================================================
161 //
162 // YIELDSSYMMETRIC SPECIALIZATIONS
163 //
164 //=================================================================================================
165 
166 //*************************************************************************************************
168 template< typename MT >
169 struct YieldsSymmetric<SqrAbs,MT>
170  : public BoolConstant< IsSymmetric_v<MT> || IsHermitian_v<MT> >
171 {};
173 //*************************************************************************************************
174 
175 
176 
177 
178 //=================================================================================================
179 //
180 // YIELDSLOWER SPECIALIZATIONS
181 //
182 //=================================================================================================
183 
184 //*************************************************************************************************
186 template< typename MT >
187 struct YieldsLower<SqrAbs,MT>
188  : public IsLower<MT>
189 {};
191 //*************************************************************************************************
192 
193 
194 
195 
196 //=================================================================================================
197 //
198 // YIELDSUNILOWER SPECIALIZATIONS
199 //
200 //=================================================================================================
201 
202 //*************************************************************************************************
204 template< typename MT >
205 struct YieldsUniLower<SqrAbs,MT>
206  : public IsUniLower<MT>
207 {};
209 //*************************************************************************************************
210 
211 
212 
213 
214 //=================================================================================================
215 //
216 // YIELDSSTRICTLYLOWER SPECIALIZATIONS
217 //
218 //=================================================================================================
219 
220 //*************************************************************************************************
222 template< typename MT >
223 struct YieldsStrictlyLower<SqrAbs,MT>
224  : public IsStrictlyLower<MT>
225 {};
227 //*************************************************************************************************
228 
229 
230 
231 
232 //=================================================================================================
233 //
234 // YIELDSUPPER SPECIALIZATIONS
235 //
236 //=================================================================================================
237 
238 //*************************************************************************************************
240 template< typename MT >
241 struct YieldsUpper<SqrAbs,MT>
242  : public IsUpper<MT>
243 {};
245 //*************************************************************************************************
246 
247 
248 
249 
250 //=================================================================================================
251 //
252 // YIELDSUNIUPPER SPECIALIZATIONS
253 //
254 //=================================================================================================
255 
256 //*************************************************************************************************
258 template< typename MT >
259 struct YieldsUniUpper<SqrAbs,MT>
260  : public IsUniUpper<MT>
261 {};
263 //*************************************************************************************************
264 
265 
266 
267 
268 //=================================================================================================
269 //
270 // YIELDSSTRICTLYUPPER SPECIALIZATIONS
271 //
272 //=================================================================================================
273 
274 //*************************************************************************************************
276 template< typename MT >
277 struct YieldsStrictlyUpper<SqrAbs,MT>
278  : public IsStrictlyUpper<MT>
279 {};
281 //*************************************************************************************************
282 
283 
284 
285 
286 //=================================================================================================
287 //
288 // YIELDSZERO SPECIALIZATIONS
289 //
290 //=================================================================================================
291 
292 //*************************************************************************************************
294 template< typename T >
295 struct YieldsZero<SqrAbs,T>
296  : public IsZero<T>
297 {};
299 //*************************************************************************************************
300 
301 } // namespace blaze
302 
303 #endif
Generic wrapper for the squared abs() function.
Definition: SqrAbs.h:84
Header file for the IsUniUpper type trait.
Header file for the YieldsStrictlyLower type trait.
Header file for the YieldsZero type trait.
Header file for the HasSIMDConj type trait.
Header file for the SIMD multiplication functionality.
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: SqrAbs.h:120
#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 type T.
Definition: SqrAbs.h:112
Header file for the SIMD conj functionality.
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) BLAZE_ALWAYS_INLINE load(const T &a) const
Returns the result of the squared abs() function for the given SIMD vector.
Definition: SqrAbs.h:130
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Header file for the conjugate shim.
Header file for the HasSIMDMult type trait.
Header file for the YieldsUniform type trait.
Header file for the YieldsSymmetric type trait.
Header file for the YieldsUpper type trait.
Header file for the IsZero type trait.
Header file for the YieldsLower type trait.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:101
Header file for the IntegralConstant class template.
Header file for the IsUpper type trait.
Header file for the YieldsUniUpper type trait.
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1326
Header file for the IsHermitian type trait.
System settings for the inline keywords.
SqrAbs()
Default constructor of the SqrAbs functor.
Definition: SqrAbs.h:89