10#ifndef EIGEN_COMPLEX_AVX_H
11#define EIGEN_COMPLEX_AVX_H
25#ifndef EIGEN_VECTORIZE_AVX512
52 typedef std::complex<float>
type;
72 const __m256 mask = _mm256_castsi256_ps(_mm256_setr_epi32(0x00000000,0x80000000,0x00000000,0x80000000,0x00000000,0x80000000,0x00000000,0x80000000));
78 __m256 tmp1 = _mm256_mul_ps(_mm256_moveldup_ps(a.
v),
b.v);
79 __m256 tmp2 = _mm256_mul_ps(_mm256_movehdup_ps(a.
v), _mm256_permute_ps(
b.v, _MM_SHUFFLE(2,3,0,1)));
80 __m256
result = _mm256_addsub_ps(tmp1, tmp2);
86 __m256 eq = _mm256_cmp_ps(a.
v,
b.v, _CMP_EQ_OQ);
87 return Packet4cf(_mm256_and_ps(eq, _mm256_permute_ps(eq, 0xb1)));
102 return Packet4cf(_mm256_castpd_ps(_mm256_broadcast_sd((
const double*)(
const void*)&
from)));
110 return Packet4cf(_mm256_insertf128_ps(_mm256_castps128_ps256(a.
v),
b.v, 1));
126 __m128 low = _mm256_extractf128_ps(
from.v, 0);
127 to[stride*0] = std::complex<float>(_mm_cvtss_f32(_mm_shuffle_ps(low, low, 0)),
128 _mm_cvtss_f32(_mm_shuffle_ps(low, low, 1)));
129 to[stride*1] = std::complex<float>(_mm_cvtss_f32(_mm_shuffle_ps(low, low, 2)),
130 _mm_cvtss_f32(_mm_shuffle_ps(low, low, 3)));
132 __m128 high = _mm256_extractf128_ps(
from.v, 1);
133 to[stride*2] = std::complex<float>(_mm_cvtss_f32(_mm_shuffle_ps(high, high, 0)),
134 _mm_cvtss_f32(_mm_shuffle_ps(high, high, 1)));
135 to[stride*3] = std::complex<float>(_mm_cvtss_f32(_mm_shuffle_ps(high, high, 2)),
136 _mm_cvtss_f32(_mm_shuffle_ps(high, high, 3)));
146 __m128 low = _mm256_extractf128_ps(a.
v, 0);
147 __m128 high = _mm256_extractf128_ps(a.
v, 1);
148 __m128d lowd = _mm_castps_pd(low);
149 __m128d highd = _mm_castps_pd(high);
150 low = _mm_castpd_ps(_mm_shuffle_pd(lowd,lowd,0x1));
151 high = _mm_castpd_ps(_mm_shuffle_pd(highd,highd,0x1));
152 __m256
result = _mm256_setzero_ps();
175 __m256 tmp = _mm256_mul_ps(
b.v,
b.v);
176 __m256 tmp2 = _mm256_shuffle_ps(tmp,tmp,0xB1);
177 __m256 denom = _mm256_add_ps(tmp, tmp2);
178 return Packet4cf(_mm256_div_ps(num.
v, denom));
183 return Packet4cf(_mm256_shuffle_ps(x.
v, x.
v, _MM_SHUFFLE(2, 3, 0 ,1)));
194#ifndef EIGEN_VECTORIZE_AVX512
221 typedef std::complex<double>
type;
238 const __m256d mask = _mm256_castsi256_pd(_mm256_set_epi32(0x80000000,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0));
244 __m256d tmp1 = _mm256_shuffle_pd(a.
v,a.
v,0x0);
245 __m256d even = _mm256_mul_pd(tmp1,
b.v);
246 __m256d tmp2 = _mm256_shuffle_pd(a.
v,a.
v,0xF);
247 __m256d tmp3 = _mm256_shuffle_pd(
b.v,
b.v,0x5);
248 __m256d odd = _mm256_mul_pd(tmp2, tmp3);
249 return Packet2cd(_mm256_addsub_pd(even, odd));
254 __m256d eq = _mm256_cmp_pd(a.
v,
b.v, _CMP_EQ_OQ);
273 return Packet2cd(_mm256_broadcast_pd((
const __m128d*)(
const void*)&
from));
289 __m128d low = _mm256_extractf128_pd(
from.v, 0);
290 to[stride*0] = std::complex<double>(_mm_cvtsd_f64(low), _mm_cvtsd_f64(_mm_shuffle_pd(low, low, 1)));
291 __m128d high = _mm256_extractf128_pd(
from.v, 1);
292 to[stride*1] = std::complex<double>(_mm_cvtsd_f64(high), _mm_cvtsd_f64(_mm_shuffle_pd(high, high, 1)));
297 __m128d low = _mm256_extractf128_pd(a.
v, 0);
299 _mm_store_pd(res, low);
300 return std::complex<double>(res[0],res[1]);
304 __m256d
result = _mm256_permute2f128_pd(a.
v, a.
v, 1);
325 __m256d tmp = _mm256_mul_pd(
b.v,
b.v);
326 __m256d denom = _mm256_hadd_pd(tmp, tmp);
327 return Packet2cd(_mm256_div_pd(num.
v, denom));
332 return Packet2cd(_mm256_shuffle_pd(x.
v, x.
v, 0x5));
337 __m256d P0 = _mm256_castps_pd(kernel.
packet[0].v);
338 __m256d P1 = _mm256_castps_pd(kernel.
packet[1].v);
339 __m256d P2 = _mm256_castps_pd(kernel.
packet[2].v);
340 __m256d P3 = _mm256_castps_pd(kernel.
packet[3].v);
342 __m256d T0 = _mm256_shuffle_pd(P0, P1, 15);
343 __m256d T1 = _mm256_shuffle_pd(P0, P1, 0);
344 __m256d T2 = _mm256_shuffle_pd(P2, P3, 15);
345 __m256d T3 = _mm256_shuffle_pd(P2, P3, 0);
347 kernel.
packet[1].v = _mm256_castpd_ps(_mm256_permute2f128_pd(T0, T2, 32));
348 kernel.
packet[3].v = _mm256_castpd_ps(_mm256_permute2f128_pd(T0, T2, 49));
349 kernel.
packet[0].v = _mm256_castpd_ps(_mm256_permute2f128_pd(T1, T3, 32));
350 kernel.
packet[2].v = _mm256_castpd_ps(_mm256_permute2f128_pd(T1, T3, 49));
355 __m256d tmp = _mm256_permute2f128_pd(kernel.
packet[0].v, kernel.
packet[1].v, 0+(2<<4));
356 kernel.
packet[1].v = _mm256_permute2f128_pd(kernel.
packet[0].v, kernel.
packet[1].v, 1+(3<<4));
361 return psqrt_complex<Packet2cd>(a);
365 return psqrt_complex<Packet4cf>(a);
EIGEN_DEVICE_FUNC RealReturnType real() const
Definition: CommonCwiseUnaryOps.h:100
EIGEN_DEVICE_FUNC const ImagReturnType imag() const
Definition: CommonCwiseUnaryOps.h:109
#define EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(PACKET_CPLX, PACKET_REAL)
Definition: ConjHelper.h:14
#define EIGEN_DEBUG_ALIGNED_STORE
Definition: GenericPacketMath.h:35
#define EIGEN_DEBUG_ALIGNED_LOAD
Definition: GenericPacketMath.h:27
#define EIGEN_DEBUG_UNALIGNED_STORE
Definition: GenericPacketMath.h:39
#define EIGEN_DEBUG_UNALIGNED_LOAD
Definition: GenericPacketMath.h:31
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define EIGEN_STRONG_INLINE
Definition: Macros.h:927
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable from
Definition: ThirdPartyNotices.txt:128
@ Aligned32
Data pointer is aligned on a 32 bytes boundary.
Definition: Constants.h:236
EIGEN_STRONG_INLINE std::complex< double > predux< Packet2cd >(const Packet2cd &a)
Definition: Complex.h:308
EIGEN_STRONG_INLINE Packet4cf ploadu< Packet4cf >(const std::complex< float > *from)
Definition: Complex.h:97
EIGEN_STRONG_INLINE Packet8f pcmp_eq(const Packet8f &a, const Packet8f &b)
Definition: PacketMath.h:348
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:215
EIGEN_DEVICE_FUNC void ptranspose(PacketBlock< Packet8f, 8 > &kernel)
Definition: PacketMath.h:863
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux(const Packet &a)
Definition: GenericPacketMath.h:875
EIGEN_STRONG_INLINE std::complex< float > predux_mul< Packet4cf >(const Packet4cf &a)
Definition: Complex.h:164
EIGEN_STRONG_INLINE Packet2cd pcplxflip< Packet2cd >(const Packet2cd &x)
Definition: Complex.h:330
EIGEN_STRONG_INLINE Packet4cf psub< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
Definition: Complex.h:65
EIGEN_STRONG_INLINE Packet2cd pset1< Packet2cd >(const std::complex< double > &from)
Definition: Complex.h:269
EIGEN_STRONG_INLINE std::complex< float > pfirst< Packet4cf >(const Packet4cf &a)
Definition: Complex.h:140
EIGEN_STRONG_INLINE Packet2cd ploaddup< Packet2cd >(const std::complex< double > *from)
Definition: Complex.h:276
EIGEN_STRONG_INLINE Packet2cd psqrt< Packet2cd >(const Packet2cd &a)
Definition: Complex.h:360
EIGEN_STRONG_INLINE Packet2cf ploaddup< Packet2cf >(const std::complex< float > *from)
Definition: Complex.h:119
EIGEN_STRONG_INLINE Packet2cd pand< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
Definition: Complex.h:259
EIGEN_STRONG_INLINE Packet4cf pxor< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
Definition: Complex.h:93
EIGEN_DEVICE_FUNC Packet pdiv(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:244
EIGEN_STRONG_INLINE Packet2cd ploadu< Packet2cd >(const std::complex< double > *from)
Definition: Complex.h:266
EIGEN_STRONG_INLINE std::complex< double > predux_mul< Packet2cd >(const Packet2cd &a)
Definition: Complex.h:314
EIGEN_STRONG_INLINE std::complex< double > pfirst< Packet2cd >(const Packet2cd &a)
Definition: Complex.h:295
EIGEN_STRONG_INLINE Packet2cd por< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
Definition: Complex.h:260
EIGEN_STRONG_INLINE Packet2cd ptrue< Packet2cd >(const Packet2cd &a)
Definition: Complex.h:258
EIGEN_STRONG_INLINE Packet4cf ptrue< Packet4cf >(const Packet4cf &a)
Definition: Complex.h:90
EIGEN_STRONG_INLINE Packet4cf pand< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
Definition: Complex.h:91
EIGEN_STRONG_INLINE Packet4cf pset1< Packet4cf >(const std::complex< float > &from)
Definition: Complex.h:100
EIGEN_STRONG_INLINE Packet2cd pload< Packet2cd >(const std::complex< double > *from)
Definition: Complex.h:264
EIGEN_STRONG_INLINE Packet8f ploadu< Packet8f >(const float *from)
Definition: PacketMath.h:581
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_mul(const Packet &a)
Definition: GenericPacketMath.h:882
EIGEN_STRONG_INLINE Packet8f pconj(const Packet8f &a)
Definition: PacketMath.h:295
EIGEN_STRONG_INLINE Packet2cd pandnot< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
Definition: Complex.h:262
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:237
EIGEN_STRONG_INLINE Packet8h ptrue(const Packet8h &a)
Definition: PacketMath.h:978
EIGEN_STRONG_INLINE Packet2cd psub< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
Definition: Complex.h:234
EIGEN_STRONG_INLINE Packet8f pload< Packet8f >(const float *from)
Definition: PacketMath.h:577
EIGEN_STRONG_INLINE Packet4d ploadu< Packet4d >(const double *from)
Definition: PacketMath.h:582
EIGEN_STRONG_INLINE Packet4cf ploaddup< Packet4cf >(const std::complex< float > *from)
Definition: Complex.h:105
EIGEN_STRONG_INLINE Packet4cf pandnot< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
Definition: Complex.h:94
EIGEN_DEVICE_FUNC void pstore(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:696
EIGEN_STRONG_INLINE Packet2cd pxor< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
Definition: Complex.h:261
EIGEN_STRONG_INLINE Packet4cf padd< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
Definition: Complex.h:64
EIGEN_DEVICE_FUNC void pstoreu(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:700
EIGEN_STRONG_INLINE Packet8h pand(const Packet8h &a, const Packet8h &b)
Definition: PacketMath.h:1050
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type pfirst(const Packet &a)
Definition: GenericPacketMath.h:844
EIGEN_STRONG_INLINE Packet2cd pmul< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
Definition: Complex.h:242
EIGEN_STRONG_INLINE Packet4cf pmul< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
Definition: Complex.h:76
EIGEN_STRONG_INLINE Packet4d pload< Packet4d >(const double *from)
Definition: PacketMath.h:578
EIGEN_STRONG_INLINE Packet4cf pcplxflip< Packet4cf >(const Packet4cf &x)
Definition: Complex.h:181
EIGEN_STRONG_INLINE Packet8f preverse(const Packet8f &a)
Definition: PacketMath.h:707
EIGEN_STRONG_INLINE Packet4cf pload< Packet4cf >(const std::complex< float > *from)
Definition: Complex.h:96
__m256 Packet8f
Definition: PacketMath.h:31
EIGEN_STRONG_INLINE std::complex< float > predux< Packet4cf >(const Packet4cf &a)
Definition: Complex.h:158
EIGEN_STRONG_INLINE Packet4cf por< Packet4cf >(const Packet4cf &a, const Packet4cf &b)
Definition: Complex.h:92
EIGEN_STRONG_INLINE Packet2cd padd< Packet2cd >(const Packet2cd &a, const Packet2cd &b)
Definition: Complex.h:233
__m256d Packet4d
Definition: PacketMath.h:33
EIGEN_STRONG_INLINE Packet8f pnegate(const Packet8f &a)
Definition: PacketMath.h:286
EIGEN_STRONG_INLINE Packet4cf psqrt< Packet4cf >(const Packet4cf &a)
Definition: Complex.h:364
EIGEN_DEVICE_FUNC internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar)>::type real_ref(const Scalar &x)
Definition: MathFunctions.h:1237
Namespace containing all symbols from the Eigen library.
Definition: Core:141
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
result
Definition: format.h:2564
Definition: Eigen_Colamd.h:50
Definition: BFloat16.h:88
Definition: Complex.h:187
Definition: Complex.h:188
EIGEN_STRONG_INLINE Packet2cd()
Definition: Complex.h:189
__m256d v
Definition: Complex.h:191
EIGEN_STRONG_INLINE Packet2cd(const __m256d &a)
Definition: Complex.h:190
Packet4f v
Definition: Complex.h:22
EIGEN_STRONG_INLINE Packet4cf(const __m256 &a)
Definition: Complex.h:21
__m256 v
Definition: Complex.h:22
EIGEN_STRONG_INLINE Packet4cf()
Definition: Complex.h:20
Definition: GenericPacketMath.h:1014
Packet packet[N]
Definition: GenericPacketMath.h:1015
Definition: GenericPacketMath.h:43
@ HasSqrt
Definition: GenericPacketMath.h:66
@ HasDiv
Definition: GenericPacketMath.h:65
Packet1cd half
Definition: Complex.h:198
Packet2cd type
Definition: Complex.h:197
Packet2cf half
Definition: Complex.h:29
Packet4cf type
Definition: Complex.h:28
Definition: GenericPacketMath.h:107
@ HasHalfPacket
Definition: GenericPacketMath.h:114
@ size
Definition: GenericPacketMath.h:112
@ AlignedOnScalar
Definition: GenericPacketMath.h:113
@ Vectorizable
Definition: GenericPacketMath.h:111
@ HasSub
Definition: GenericPacketMath.h:118
@ HasMax
Definition: GenericPacketMath.h:124
@ HasNegate
Definition: GenericPacketMath.h:120
@ HasMul
Definition: GenericPacketMath.h:119
@ HasAdd
Definition: GenericPacketMath.h:117
@ HasSetLinear
Definition: GenericPacketMath.h:126
@ HasMin
Definition: GenericPacketMath.h:123
@ HasAbs2
Definition: GenericPacketMath.h:122
@ HasAbs
Definition: GenericPacketMath.h:121
Packet1cd half
Definition: Complex.h:222
Packet4d as_real
Definition: Complex.h:223
std::complex< double > type
Definition: Complex.h:221
std::complex< float > type
Definition: Complex.h:52
Packet2cf half
Definition: Complex.h:53
Packet8f as_real
Definition: Complex.h:54
Definition: GenericPacketMath.h:133
@ masked_load_available
Definition: GenericPacketMath.h:141
@ size
Definition: GenericPacketMath.h:138
@ masked_store_available
Definition: GenericPacketMath.h:142
@ vectorizable
Definition: GenericPacketMath.h:140
@ alignment
Definition: GenericPacketMath.h:139