MOAB  4.9.3pre
Complex.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2010 Gael Guennebaud <[email protected]>
00005 //
00006 // This Source Code Form is subject to the terms of the Mozilla
00007 // Public License v. 2.0. If a copy of the MPL was not distributed
00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009 
00010 #ifndef EIGEN_COMPLEX_NEON_H
00011 #define EIGEN_COMPLEX_NEON_H
00012 
00013 namespace Eigen {
00014 
00015 namespace internal {
00016 
00017 static uint32x4_t p4ui_CONJ_XOR = EIGEN_INIT_NEON_PACKET4(0x00000000, 0x80000000, 0x00000000, 0x80000000);
00018 static uint32x2_t p2ui_CONJ_XOR = EIGEN_INIT_NEON_PACKET2(0x00000000, 0x80000000);
00019 
00020 //---------- float ----------
00021 struct Packet2cf
00022 {
00023   EIGEN_STRONG_INLINE Packet2cf() {}
00024   EIGEN_STRONG_INLINE explicit Packet2cf(const Packet4f& a) : v(a) {}
00025   Packet4f  v;
00026 };
00027 
00028 template<> struct packet_traits<std::complex<float> >  : default_packet_traits
00029 {
00030   typedef Packet2cf type;
00031   typedef Packet2cf half;
00032   enum {
00033     Vectorizable = 1,
00034     AlignedOnScalar = 1,
00035     size = 2,
00036     HasHalfPacket = 0,
00037 
00038     HasAdd    = 1,
00039     HasSub    = 1,
00040     HasMul    = 1,
00041     HasDiv    = 1,
00042     HasNegate = 1,
00043     HasAbs    = 0,
00044     HasAbs2   = 0,
00045     HasMin    = 0,
00046     HasMax    = 0,
00047     HasSetLinear = 0
00048   };
00049 };
00050 
00051 template<> struct unpacket_traits<Packet2cf> { typedef std::complex<float> type; enum {size=2, alignment=Aligned16}; typedef Packet2cf half; };
00052 
00053 template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>&  from)
00054 {
00055   float32x2_t r64;
00056   r64 = vld1_f32((float *)&from);
00057 
00058   return Packet2cf(vcombine_f32(r64, r64));
00059 }
00060 
00061 template<> EIGEN_STRONG_INLINE Packet2cf padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(padd<Packet4f>(a.v,b.v)); }
00062 template<> EIGEN_STRONG_INLINE Packet2cf psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(psub<Packet4f>(a.v,b.v)); }
00063 template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a) { return Packet2cf(pnegate<Packet4f>(a.v)); }
00064 template<> EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf& a)
00065 {
00066   Packet4ui b = vreinterpretq_u32_f32(a.v);
00067   return Packet2cf(vreinterpretq_f32_u32(veorq_u32(b, p4ui_CONJ_XOR)));
00068 }
00069 
00070 template<> EIGEN_STRONG_INLINE Packet2cf pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
00071 {
00072   Packet4f v1, v2;
00073 
00074   // Get the real values of a | a1_re | a1_re | a2_re | a2_re |
00075   v1 = vcombine_f32(vdup_lane_f32(vget_low_f32(a.v), 0), vdup_lane_f32(vget_high_f32(a.v), 0));
00076   // Get the imag values of a | a1_im | a1_im | a2_im | a2_im |
00077   v2 = vcombine_f32(vdup_lane_f32(vget_low_f32(a.v), 1), vdup_lane_f32(vget_high_f32(a.v), 1));
00078   // Multiply the real a with b
00079   v1 = vmulq_f32(v1, b.v);
00080   // Multiply the imag a with b
00081   v2 = vmulq_f32(v2, b.v);
00082   // Conjugate v2 
00083   v2 = vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(v2), p4ui_CONJ_XOR));
00084   // Swap real/imag elements in v2.
00085   v2 = vrev64q_f32(v2);
00086   // Add and return the result
00087   return Packet2cf(vaddq_f32(v1, v2));
00088 }
00089 
00090 template<> EIGEN_STRONG_INLINE Packet2cf pand   <Packet2cf>(const Packet2cf& a, const Packet2cf& b)
00091 {
00092   return Packet2cf(vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
00093 }
00094 template<> EIGEN_STRONG_INLINE Packet2cf por    <Packet2cf>(const Packet2cf& a, const Packet2cf& b)
00095 {
00096   return Packet2cf(vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
00097 }
00098 template<> EIGEN_STRONG_INLINE Packet2cf pxor   <Packet2cf>(const Packet2cf& a, const Packet2cf& b)
00099 {
00100   return Packet2cf(vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
00101 }
00102 template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
00103 {
00104   return Packet2cf(vreinterpretq_f32_u32(vbicq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
00105 }
00106 
00107 template<> EIGEN_STRONG_INLINE Packet2cf pload<Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>((const float*)from)); }
00108 template<> EIGEN_STRONG_INLINE Packet2cf ploadu<Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu<Packet4f>((const float*)from)); }
00109 
00110 template<> EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>* from) { return pset1<Packet2cf>(*from); }
00111 
00112 template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> *   to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); }
00113 template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> *   to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); }
00114 
00115 template<> EIGEN_DEVICE_FUNC inline Packet2cf pgather<std::complex<float>, Packet2cf>(const std::complex<float>* from, Index stride)
00116 {
00117   Packet4f res = pset1<Packet4f>(0.f);
00118   res = vsetq_lane_f32(std::real(from[0*stride]), res, 0);
00119   res = vsetq_lane_f32(std::imag(from[0*stride]), res, 1);
00120   res = vsetq_lane_f32(std::real(from[1*stride]), res, 2);
00121   res = vsetq_lane_f32(std::imag(from[1*stride]), res, 3);
00122   return Packet2cf(res);
00123 }
00124 
00125 template<> EIGEN_DEVICE_FUNC inline void pscatter<std::complex<float>, Packet2cf>(std::complex<float>* to, const Packet2cf& from, Index stride)
00126 {
00127   to[stride*0] = std::complex<float>(vgetq_lane_f32(from.v, 0), vgetq_lane_f32(from.v, 1));
00128   to[stride*1] = std::complex<float>(vgetq_lane_f32(from.v, 2), vgetq_lane_f32(from.v, 3));
00129 }
00130 
00131 template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> *   addr) { EIGEN_ARM_PREFETCH((float *)addr); }
00132 
00133 template<> EIGEN_STRONG_INLINE std::complex<float>  pfirst<Packet2cf>(const Packet2cf& a)
00134 {
00135   std::complex<float> EIGEN_ALIGN16 x[2];
00136   vst1q_f32((float *)x, a.v);
00137   return x[0];
00138 }
00139 
00140 template<> EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf& a)
00141 {
00142   float32x2_t a_lo, a_hi;
00143   Packet4f a_r128;
00144 
00145   a_lo = vget_low_f32(a.v);
00146   a_hi = vget_high_f32(a.v);
00147   a_r128 = vcombine_f32(a_hi, a_lo);
00148 
00149   return Packet2cf(a_r128);
00150 }
00151 
00152 template<> EIGEN_STRONG_INLINE Packet2cf pcplxflip<Packet2cf>(const Packet2cf& a)
00153 {
00154   return Packet2cf(vrev64q_f32(a.v));
00155 }
00156 
00157 template<> EIGEN_STRONG_INLINE std::complex<float> predux<Packet2cf>(const Packet2cf& a)
00158 {
00159   float32x2_t a1, a2;
00160   std::complex<float> s;
00161 
00162   a1 = vget_low_f32(a.v);
00163   a2 = vget_high_f32(a.v);
00164   a2 = vadd_f32(a1, a2);
00165   vst1_f32((float *)&s, a2);
00166 
00167   return s;
00168 }
00169 
00170 template<> EIGEN_STRONG_INLINE Packet2cf preduxp<Packet2cf>(const Packet2cf* vecs)
00171 {
00172   Packet4f sum1, sum2, sum;
00173 
00174   // Add the first two 64-bit float32x2_t of vecs[0]
00175   sum1 = vcombine_f32(vget_low_f32(vecs[0].v), vget_low_f32(vecs[1].v));
00176   sum2 = vcombine_f32(vget_high_f32(vecs[0].v), vget_high_f32(vecs[1].v));
00177   sum = vaddq_f32(sum1, sum2);
00178 
00179   return Packet2cf(sum);
00180 }
00181 
00182 template<> EIGEN_STRONG_INLINE std::complex<float> predux_mul<Packet2cf>(const Packet2cf& a)
00183 {
00184   float32x2_t a1, a2, v1, v2, prod;
00185   std::complex<float> s;
00186 
00187   a1 = vget_low_f32(a.v);
00188   a2 = vget_high_f32(a.v);
00189    // Get the real values of a | a1_re | a1_re | a2_re | a2_re |
00190   v1 = vdup_lane_f32(a1, 0);
00191   // Get the real values of a | a1_im | a1_im | a2_im | a2_im |
00192   v2 = vdup_lane_f32(a1, 1);
00193   // Multiply the real a with b
00194   v1 = vmul_f32(v1, a2);
00195   // Multiply the imag a with b
00196   v2 = vmul_f32(v2, a2);
00197   // Conjugate v2 
00198   v2 = vreinterpret_f32_u32(veor_u32(vreinterpret_u32_f32(v2), p2ui_CONJ_XOR));
00199   // Swap real/imag elements in v2.
00200   v2 = vrev64_f32(v2);
00201   // Add v1, v2
00202   prod = vadd_f32(v1, v2);
00203 
00204   vst1_f32((float *)&s, prod);
00205 
00206   return s;
00207 }
00208 
00209 template<int Offset>
00210 struct palign_impl<Offset,Packet2cf>
00211 {
00212   EIGEN_STRONG_INLINE static void run(Packet2cf& first, const Packet2cf& second)
00213   {
00214     if (Offset==1)
00215     {
00216       first.v = vextq_f32(first.v, second.v, 2);
00217     }
00218   }
00219 };
00220 
00221 template<> struct conj_helper<Packet2cf, Packet2cf, false,true>
00222 {
00223   EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
00224   { return padd(pmul(x,y),c); }
00225 
00226   EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
00227   {
00228     return internal::pmul(a, pconj(b));
00229   }
00230 };
00231 
00232 template<> struct conj_helper<Packet2cf, Packet2cf, true,false>
00233 {
00234   EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
00235   { return padd(pmul(x,y),c); }
00236 
00237   EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
00238   {
00239     return internal::pmul(pconj(a), b);
00240   }
00241 };
00242 
00243 template<> struct conj_helper<Packet2cf, Packet2cf, true,true>
00244 {
00245   EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
00246   { return padd(pmul(x,y),c); }
00247 
00248   EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
00249   {
00250     return pconj(internal::pmul(a, b));
00251   }
00252 };
00253 
00254 template<> EIGEN_STRONG_INLINE Packet2cf pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
00255 {
00256   // TODO optimize it for NEON
00257   Packet2cf res = conj_helper<Packet2cf,Packet2cf,false,true>().pmul(a,b);
00258   Packet4f s, rev_s;
00259 
00260   // this computes the norm
00261   s = vmulq_f32(b.v, b.v);
00262   rev_s = vrev64q_f32(s);
00263 
00264   return Packet2cf(pdiv(res.v, vaddq_f32(s,rev_s)));
00265 }
00266 
00267 EIGEN_DEVICE_FUNC inline void
00268 ptranspose(PacketBlock<Packet2cf,2>& kernel) {
00269   Packet4f tmp = vcombine_f32(vget_high_f32(kernel.packet[0].v), vget_high_f32(kernel.packet[1].v));
00270   kernel.packet[0].v = vcombine_f32(vget_low_f32(kernel.packet[0].v), vget_low_f32(kernel.packet[1].v));
00271   kernel.packet[1].v = tmp;
00272 }
00273 
00274 //---------- double ----------
00275 #if EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG
00276 
00277 static uint64x2_t p2ul_CONJ_XOR = EIGEN_INIT_NEON_PACKET2(0x0, 0x8000000000000000);
00278 
00279 struct Packet1cd
00280 {
00281   EIGEN_STRONG_INLINE Packet1cd() {}
00282   EIGEN_STRONG_INLINE explicit Packet1cd(const Packet2d& a) : v(a) {}
00283   Packet2d v;
00284 };
00285 
00286 template<> struct packet_traits<std::complex<double> >  : default_packet_traits
00287 {
00288   typedef Packet1cd type;
00289   typedef Packet1cd half;
00290   enum {
00291     Vectorizable = 1,
00292     AlignedOnScalar = 0,
00293     size = 1,
00294     HasHalfPacket = 0,
00295 
00296     HasAdd    = 1,
00297     HasSub    = 1,
00298     HasMul    = 1,
00299     HasDiv    = 1,
00300     HasNegate = 1,
00301     HasAbs    = 0,
00302     HasAbs2   = 0,
00303     HasMin    = 0,
00304     HasMax    = 0,
00305     HasSetLinear = 0
00306   };
00307 };
00308 
00309 template<> struct unpacket_traits<Packet1cd> { typedef std::complex<double> type; enum {size=1, alignment=Aligned16}; typedef Packet1cd half; };
00310 
00311 template<> EIGEN_STRONG_INLINE Packet1cd pload<Packet1cd>(const std::complex<double>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet1cd(pload<Packet2d>((const double*)from)); }
00312 template<> EIGEN_STRONG_INLINE Packet1cd ploadu<Packet1cd>(const std::complex<double>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet1cd(ploadu<Packet2d>((const double*)from)); }
00313 
00314 template<> EIGEN_STRONG_INLINE Packet1cd pset1<Packet1cd>(const std::complex<double>&  from)
00315 { /* here we really have to use unaligned loads :( */ return ploadu<Packet1cd>(&from); }
00316 
00317 template<> EIGEN_STRONG_INLINE Packet1cd padd<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(padd<Packet2d>(a.v,b.v)); }
00318 template<> EIGEN_STRONG_INLINE Packet1cd psub<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(psub<Packet2d>(a.v,b.v)); }
00319 template<> EIGEN_STRONG_INLINE Packet1cd pnegate(const Packet1cd& a) { return Packet1cd(pnegate<Packet2d>(a.v)); }
00320 template<> EIGEN_STRONG_INLINE Packet1cd pconj(const Packet1cd& a) { return Packet1cd(vreinterpretq_f64_u64(veorq_u64(vreinterpretq_u64_f64(a.v), p2ul_CONJ_XOR))); }
00321 
00322 template<> EIGEN_STRONG_INLINE Packet1cd pmul<Packet1cd>(const Packet1cd& a, const Packet1cd& b)
00323 {
00324   Packet2d v1, v2;
00325 
00326   // Get the real values of a 
00327   v1 = vdupq_lane_f64(vget_low_f64(a.v), 0);
00328   // Get the imag values of a
00329   v2 = vdupq_lane_f64(vget_high_f64(a.v), 0);
00330   // Multiply the real a with b
00331   v1 = vmulq_f64(v1, b.v);
00332   // Multiply the imag a with b
00333   v2 = vmulq_f64(v2, b.v);
00334   // Conjugate v2 
00335   v2 = vreinterpretq_f64_u64(veorq_u64(vreinterpretq_u64_f64(v2), p2ul_CONJ_XOR));
00336   // Swap real/imag elements in v2.
00337   v2 = preverse<Packet2d>(v2);
00338   // Add and return the result
00339   return Packet1cd(vaddq_f64(v1, v2));
00340 }
00341 
00342 template<> EIGEN_STRONG_INLINE Packet1cd pand   <Packet1cd>(const Packet1cd& a, const Packet1cd& b)
00343 {
00344   return Packet1cd(vreinterpretq_f64_u64(vandq_u64(vreinterpretq_u64_f64(a.v),vreinterpretq_u64_f64(b.v))));
00345 }
00346 template<> EIGEN_STRONG_INLINE Packet1cd por    <Packet1cd>(const Packet1cd& a, const Packet1cd& b)
00347 {
00348   return Packet1cd(vreinterpretq_f64_u64(vorrq_u64(vreinterpretq_u64_f64(a.v),vreinterpretq_u64_f64(b.v))));
00349 }
00350 template<> EIGEN_STRONG_INLINE Packet1cd pxor   <Packet1cd>(const Packet1cd& a, const Packet1cd& b)
00351 {
00352   return Packet1cd(vreinterpretq_f64_u64(veorq_u64(vreinterpretq_u64_f64(a.v),vreinterpretq_u64_f64(b.v))));
00353 }
00354 template<> EIGEN_STRONG_INLINE Packet1cd pandnot<Packet1cd>(const Packet1cd& a, const Packet1cd& b)
00355 {
00356   return Packet1cd(vreinterpretq_f64_u64(vbicq_u64(vreinterpretq_u64_f64(a.v),vreinterpretq_u64_f64(b.v))));
00357 }
00358 
00359 template<> EIGEN_STRONG_INLINE Packet1cd ploaddup<Packet1cd>(const std::complex<double>* from) { return pset1<Packet1cd>(*from); }
00360 
00361 template<> EIGEN_STRONG_INLINE void pstore <std::complex<double> >(std::complex<double> *   to, const Packet1cd& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((double*)to, from.v); }
00362 template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double> *   to, const Packet1cd& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, from.v); }
00363 
00364 template<> EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double> *   addr) { EIGEN_ARM_PREFETCH((double *)addr); }
00365 
00366 template<> EIGEN_DEVICE_FUNC inline Packet1cd pgather<std::complex<double>, Packet1cd>(const std::complex<double>* from, Index stride)
00367 {
00368   Packet2d res = pset1<Packet2d>(0.0);
00369   res = vsetq_lane_f64(std::real(from[0*stride]), res, 0);
00370   res = vsetq_lane_f64(std::imag(from[0*stride]), res, 1);
00371   return Packet1cd(res);
00372 }
00373 
00374 template<> EIGEN_DEVICE_FUNC inline void pscatter<std::complex<double>, Packet1cd>(std::complex<double>* to, const Packet1cd& from, Index stride)
00375 {
00376   to[stride*0] = std::complex<double>(vgetq_lane_f64(from.v, 0), vgetq_lane_f64(from.v, 1));
00377 }
00378 
00379 
00380 template<> EIGEN_STRONG_INLINE std::complex<double>  pfirst<Packet1cd>(const Packet1cd& a)
00381 {
00382   std::complex<double> EIGEN_ALIGN16 res;
00383   pstore<std::complex<double> >(&res, a);
00384 
00385   return res;
00386 }
00387 
00388 template<> EIGEN_STRONG_INLINE Packet1cd preverse(const Packet1cd& a) { return a; }
00389 
00390 template<> EIGEN_STRONG_INLINE std::complex<double> predux<Packet1cd>(const Packet1cd& a) { return pfirst(a); }
00391 
00392 template<> EIGEN_STRONG_INLINE Packet1cd preduxp<Packet1cd>(const Packet1cd* vecs) { return vecs[0]; }
00393 
00394 template<> EIGEN_STRONG_INLINE std::complex<double> predux_mul<Packet1cd>(const Packet1cd& a) { return pfirst(a); }
00395 
00396 template<int Offset>
00397 struct palign_impl<Offset,Packet1cd>
00398 {
00399   static EIGEN_STRONG_INLINE void run(Packet1cd& /*first*/, const Packet1cd& /*second*/)
00400   {
00401     // FIXME is it sure we never have to align a Packet1cd?
00402     // Even though a std::complex<double> has 16 bytes, it is not necessarily aligned on a 16 bytes boundary...
00403   }
00404 };
00405 
00406 template<> struct conj_helper<Packet1cd, Packet1cd, false,true>
00407 {
00408   EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const
00409   { return padd(pmul(x,y),c); }
00410 
00411   EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const
00412   {
00413     return internal::pmul(a, pconj(b));
00414   }
00415 };
00416 
00417 template<> struct conj_helper<Packet1cd, Packet1cd, true,false>
00418 {
00419   EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const
00420   { return padd(pmul(x,y),c); }
00421 
00422   EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const
00423   {
00424     return internal::pmul(pconj(a), b);
00425   }
00426 };
00427 
00428 template<> struct conj_helper<Packet1cd, Packet1cd, true,true>
00429 {
00430   EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const
00431   { return padd(pmul(x,y),c); }
00432 
00433   EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const
00434   {
00435     return pconj(internal::pmul(a, b));
00436   }
00437 };
00438 
00439 template<> EIGEN_STRONG_INLINE Packet1cd pdiv<Packet1cd>(const Packet1cd& a, const Packet1cd& b)
00440 {
00441   // TODO optimize it for NEON
00442   Packet1cd res = conj_helper<Packet1cd,Packet1cd,false,true>().pmul(a,b);
00443   Packet2d s = pmul<Packet2d>(b.v, b.v);
00444   Packet2d rev_s = preverse<Packet2d>(s);
00445 
00446   return Packet1cd(pdiv(res.v, padd<Packet2d>(s,rev_s)));
00447 }
00448 
00449 EIGEN_STRONG_INLINE Packet1cd pcplxflip/*<Packet1cd>*/(const Packet1cd& x)
00450 {
00451   return Packet1cd(preverse(Packet2d(x.v)));
00452 }
00453 
00454 EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet1cd,2>& kernel)
00455 {
00456   Packet2d tmp = vcombine_f64(vget_high_f64(kernel.packet[0].v), vget_high_f64(kernel.packet[1].v));
00457   kernel.packet[0].v = vcombine_f64(vget_low_f64(kernel.packet[0].v), vget_low_f64(kernel.packet[1].v));
00458   kernel.packet[1].v = tmp;
00459 }
00460 #endif // EIGEN_ARCH_ARM64
00461 
00462 } // end namespace internal
00463 
00464 } // end namespace Eigen
00465 
00466 #endif // EIGEN_COMPLEX_NEON_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines