12#ifndef EIGENRAND_RAND_UTILS_NEON_H
13#define EIGENRAND_RAND_UTILS_NEON_H
21 template<
typename Rng,
typename RngResult>
22 struct RawbitsMaker<Packet4i, Rng, RngResult, Rand::RandomEngineType::scalar_fullbit>
24 EIGEN_STRONG_INLINE Packet4i rawbits(Rng& rng)
26 if (
sizeof(RngResult) == 8)
31 return vld1q_s32((int32_t*)v);
40 return vld1q_s32((int32_t*)v);
44 EIGEN_STRONG_INLINE Packet4i rawbits_34(Rng& rng)
46 if (
sizeof(RngResult) == 8)
51 return vld1q_s32((int32_t*)v);
60 return vld1q_s32((int32_t*)v);
64 EIGEN_STRONG_INLINE Packet4i rawbits_half(Rng& rng)
66 if (
sizeof(
decltype(rng())) == 8)
71 return vld1q_s32((int32_t*)v);
80 return vld1q_s32((int32_t*)v);
85 template<
typename Rng>
86 struct RawbitsMaker<Packet4i, Rng, Packet4i, Rand::RandomEngineType::packet>
88 EIGEN_STRONG_INLINE Packet4i rawbits(Rng& rng)
93 EIGEN_STRONG_INLINE Packet4i rawbits_34(Rng& rng)
98 EIGEN_STRONG_INLINE Packet4i rawbits_half(Rng& rng)
104 template<
typename Rng>
105 struct UniformRealUtils<Packet4f, Rng> :
public RawbitsMaker<Packet4i, Rng>
107 EIGEN_STRONG_INLINE Packet4f zero_to_one(Rng& rng)
109 return pdiv((Packet4f)vcvtq_f32_s32(pand(this->rawbits(rng), pset1<Packet4i>(0x7FFFFFFF))),
110 pset1<Packet4f>(0x7FFFFFFF));
113 EIGEN_STRONG_INLINE Packet4f uniform_real(Rng& rng)
115 return bit_to_ur_float(this->rawbits_34(rng));
119#if EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG
120 template<
typename Rng>
121 struct UniformRealUtils<Packet2d, Rng> :
public RawbitsMaker<Packet4i, Rng>
123 EIGEN_STRONG_INLINE Packet2d zero_to_one(Rng& rng)
125 return pdiv((Packet2d)vcvtq_f64_s64(vreinterpretq_s64_s32(pand(this->rawbits(rng), vreinterpretq_s32_s64(vdupq_n_s64(0x7FFFFFFF))))),
126 pset1<Packet2d>(0x7FFFFFFF));
129 EIGEN_STRONG_INLINE Packet2d uniform_real(Rng& rng)
131 return bit_to_ur_double(this->rawbits(rng));
136 template<
typename Gen,
typename Urng,
bool _mutable>
137 struct functor_traits<scalar_rng_adaptor<Gen, double, Urng, _mutable> >
139 enum { Cost = HugeCost, PacketAccess = 0, IsRepeatable =
false };