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_AVX2_MODE
105 {
106  return _mm256_mullo_epi16( a.value, _mm256_set_epi16( -1, 1, -1, 1, -1, 1, -1, 1,
107  -1, 1, -1, 1, -1, 1, -1, 1 ) );
108 }
109 #elif BLAZE_SSE2_MODE
110 {
111  return _mm_mullo_epi16( a.value, _mm_set_epi16( -1, 1, -1, 1, -1, 1, -1, 1 ) );
112 }
113 #else
114 = delete;
115 #endif
116 //*************************************************************************************************
117 
118 
119 
120 
121 //=================================================================================================
122 //
123 // 32-BIT INTEGRAL SIMD TYPES
124 //
125 //=================================================================================================
126 
127 //*************************************************************************************************
134 template< typename T > // Type of the operand
135 BLAZE_ALWAYS_INLINE const T conj( const SIMDi32<T>& a ) noexcept
136 {
137  return a;
138 }
139 //*************************************************************************************************
140 
141 
142 //*************************************************************************************************
151 BLAZE_ALWAYS_INLINE const SIMDcint32 conj( const SIMDcint32& a ) noexcept
152 #if BLAZE_MIC_MODE
153 {
154  return _mm512_mullo_epi32( a.value, _mm512_set_epi32( -1, 1, -1, 1, -1, 1, -1, 1,
155  -1, 1, -1, 1, -1, 1, -1, 1 ) );
156 }
157 #elif BLAZE_AVX2_MODE
158 {
159  return _mm256_mullo_epi32( a.value, _mm256_set_epi32( -1, 1, -1, 1, -1, 1, -1, 1 ) );
160 }
161 #elif BLAZE_SSE4_MODE
162 {
163  return _mm_mullo_epi32( a.value, _mm_set_epi32( -1, 1, -1, 1 ) );
164 }
165 #else
166 = delete;
167 #endif
168 //*************************************************************************************************
169 
170 
171 
172 
173 //=================================================================================================
174 //
175 // 64-BIT INTEGRAL SIMD TYPES
176 //
177 //=================================================================================================
178 
179 //*************************************************************************************************
186 template< typename T > // Type of the operand
187 BLAZE_ALWAYS_INLINE const T conj( const SIMDi64<T>& a ) noexcept
188 {
189  return a;
190 }
191 //*************************************************************************************************
192 
193 
194 
195 
196 //=================================================================================================
197 //
198 // 32-BIT FLOATING POINT SIMD TYPES
199 //
200 //=================================================================================================
201 
202 //*************************************************************************************************
209 template< typename T > // Type of the operand
210 BLAZE_ALWAYS_INLINE const T conj( const SIMDf32<T>& a ) noexcept
211 {
212  return (~a);
213 }
214 //*************************************************************************************************
215 
216 
217 //*************************************************************************************************
226 BLAZE_ALWAYS_INLINE const SIMDcfloat conj( const SIMDcfloat& a ) noexcept
227 #if BLAZE_MIC_MODE
228 {
229  return _mm512_mul_ps( a.value, _mm512_set_ps( -1.0F, 1.0F, -1.0F, 1.0F, -1.0F, 1.0F, -1.0F, 1.0F,
230  -1.0F, 1.0F, -1.0F, 1.0F, -1.0F, 1.0F, -1.0F, 1.0F ) );
231 }
232 #elif BLAZE_AVX_MODE
233 {
234  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 ) );
235 }
236 #elif BLAZE_SSE2_MODE
237 {
238  return _mm_mul_ps( a.value, _mm_set_ps( -1.0F, 1.0F, -1.0F, 1.0F ) );
239 }
240 #else
241 = delete;
242 #endif
243 //*************************************************************************************************
244 
245 
246 
247 
248 //=================================================================================================
249 //
250 // 64-BIT FLOATING POINT SIMD TYPES
251 //
252 //=================================================================================================
253 
254 //*************************************************************************************************
261 template< typename T > // Type of the operand
262 BLAZE_ALWAYS_INLINE const T conj( const SIMDf64<T>& a ) noexcept
263 {
264  return (~a);
265 }
266 //*************************************************************************************************
267 
268 
269 //*************************************************************************************************
278 BLAZE_ALWAYS_INLINE const SIMDcdouble conj( const SIMDcdouble& a ) noexcept
279 #if BLAZE_MIC_MODE
280 {
281  return _mm512_mul_pd( a.value, _mm512_set_pd( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ) );
282 }
283 #elif BLAZE_AVX_MODE
284 {
285  return _mm256_mul_pd( a.value, _mm256_set_pd( -1.0, 1.0, -1.0, 1.0 ) );
286 }
287 #elif BLAZE_SSE2_MODE
288 {
289  return _mm_mul_pd( a.value, _mm_set_pd( -1.0, 1.0 ) );
290 }
291 #else
292 = delete;
293 #endif
294 //*************************************************************************************************
295 
296 } // namespace blaze
297 
298 #endif
const DMatForEachExpr< MT, Conj, SO > conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatForEachExpr.h:1158
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#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.
System settings for the inline keywords.