Blaze  3.6
Conj.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_SIMD_CONJ_H_
36 #define _BLAZE_MATH_SIMD_CONJ_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/system/Inline.h>
46 
47 
48 namespace blaze {
49 
50 //=================================================================================================
51 //
52 // 8-BIT INTEGRAL SIMD TYPES
53 //
54 //=================================================================================================
55 
56 //*************************************************************************************************
63 template< typename T > // Type of the operand
64 BLAZE_ALWAYS_INLINE const T conj( const SIMDi8<T>& a ) noexcept
65 {
66  return a;
67 }
68 //*************************************************************************************************
69 
70 
71 
72 
73 //=================================================================================================
74 //
75 // 16-BIT INTEGRAL SIMD TYPES
76 //
77 //=================================================================================================
78 
79 //*************************************************************************************************
86 template< typename T > // Type of the operand
87 BLAZE_ALWAYS_INLINE const T conj( const SIMDi16<T>& a ) noexcept
88 {
89  return a;
90 }
91 //*************************************************************************************************
92 
93 
94 //*************************************************************************************************
103 BLAZE_ALWAYS_INLINE const SIMDcint16 conj( const SIMDcint16& a ) noexcept
104 #if BLAZE_AVX512BW_MODE
105 {
106  return _mm512_mask_sub_epi16( a.value, 0XAAAAAAAA, _mm512_setzero_si512(), a.value );
107 }
108 #elif BLAZE_AVX2_MODE
109 {
110  return _mm256_mullo_epi16( a.value, _mm256_set_epi16( -1, 1, -1, 1, -1, 1, -1, 1,
111  -1, 1, -1, 1, -1, 1, -1, 1 ) );
112 }
113 #elif BLAZE_SSE2_MODE
114 {
115  return _mm_mullo_epi16( a.value, _mm_set_epi16( -1, 1, -1, 1, -1, 1, -1, 1 ) );
116 }
117 #else
118 = delete;
119 #endif
120 //*************************************************************************************************
121 
122 
123 
124 
125 //=================================================================================================
126 //
127 // 32-BIT INTEGRAL SIMD TYPES
128 //
129 //=================================================================================================
130 
131 //*************************************************************************************************
138 template< typename T > // Type of the operand
139 BLAZE_ALWAYS_INLINE const T conj( const SIMDi32<T>& a ) noexcept
140 {
141  return a;
142 }
143 //*************************************************************************************************
144 
145 //*************************************************************************************************
154 BLAZE_ALWAYS_INLINE const SIMDcint32 conj( const SIMDcint32& a ) noexcept
155 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
156 {
157  return _mm512_mullo_epi32( a.value, _mm512_set_epi32( -1, 1, -1, 1, -1, 1, -1, 1,
158  -1, 1, -1, 1, -1, 1, -1, 1 ) );
159 }
160 #elif BLAZE_AVX2_MODE
161 {
162  return _mm256_mullo_epi32( a.value, _mm256_set_epi32( -1, 1, -1, 1, -1, 1, -1, 1 ) );
163 }
164 #elif BLAZE_SSE4_MODE
165 {
166  return _mm_mullo_epi32( a.value, _mm_set_epi32( -1, 1, -1, 1 ) );
167 }
168 #else
169 = delete;
170 #endif
171 //*************************************************************************************************
172 
173 
174 
175 
176 //=================================================================================================
177 //
178 // 64-BIT INTEGRAL SIMD TYPES
179 //
180 //=================================================================================================
181 
182 //*************************************************************************************************
189 template< typename T > // Type of the operand
190 BLAZE_ALWAYS_INLINE const T conj( const SIMDi64<T>& a ) noexcept
191 {
192  return a;
193 }
194 //*************************************************************************************************
195 
196 
197 //*************************************************************************************************
206 BLAZE_ALWAYS_INLINE const SIMDcint64 conj( const SIMDcint64& a ) noexcept
207 #if BLAZE_AVX512F_MODE
208 {
209  return _mm512_mask_sub_epi64( a.value, 0XAA, _mm512_setzero_si512(), a.value );
210 }
211 #else
212 = delete;
213 #endif
214 //*************************************************************************************************
215 
216 
217 
218 
219 //=================================================================================================
220 //
221 // 32-BIT FLOATING POINT SIMD TYPES
222 //
223 //=================================================================================================
224 
225 //*************************************************************************************************
232 template< typename T > // Type of the operand
233 BLAZE_ALWAYS_INLINE const T conj( const SIMDf32<T>& a ) noexcept
234 {
235  return (~a);
236 }
237 //*************************************************************************************************
238 
239 
240 //*************************************************************************************************
249 BLAZE_ALWAYS_INLINE const SIMDcfloat conj( const SIMDcfloat& a ) noexcept
250 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
251 {
252  return _mm512_mask_sub_ps( a.value, 0XAAAA, _mm512_setzero_ps(), a.value );
253 }
254 #elif BLAZE_AVX_MODE
255 {
256  return _mm256_mul_ps( a.value, _mm256_set_ps( -1.0F, 1.0F, -1.0F, 1.0F, -1.0F, 1.0F, -1.0F, 1.0F ) );
257 }
258 #elif BLAZE_SSE2_MODE
259 {
260  return _mm_mul_ps( a.value, _mm_set_ps( -1.0F, 1.0F, -1.0F, 1.0F ) );
261 }
262 #else
263 = delete;
264 #endif
265 //*************************************************************************************************
266 
267 
268 
269 
270 //=================================================================================================
271 //
272 // 64-BIT FLOATING POINT SIMD TYPES
273 //
274 //=================================================================================================
275 
276 //*************************************************************************************************
283 template< typename T > // Type of the operand
284 BLAZE_ALWAYS_INLINE const T conj( const SIMDf64<T>& a ) noexcept
285 {
286  return (~a);
287 }
288 //*************************************************************************************************
289 
290 
291 //*************************************************************************************************
300 BLAZE_ALWAYS_INLINE const SIMDcdouble conj( const SIMDcdouble& a ) noexcept
301 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
302 {
303  return _mm512_mask_sub_pd( a.value, 0XAA, _mm512_setzero_pd(), a.value );
304 }
305 #elif BLAZE_AVX_MODE
306 {
307  return _mm256_mul_pd( a.value, _mm256_set_pd( -1.0, 1.0, -1.0, 1.0 ) );
308 }
309 #elif BLAZE_SSE2_MODE
310 {
311  return _mm_mul_pd( a.value, _mm_set_pd( -1.0, 1.0 ) );
312 }
313 #else
314 = delete;
315 #endif
316 //*************************************************************************************************
317 
318 } // namespace blaze
319 
320 #endif
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 basic SIMD types.
System settings for the SSE mode.
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1324
System settings for the inline keywords.