ycpp 0.1.0__cp315-cp315t-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ycpp/__init__.py +110 -0
- ycpp/_array.py +318 -0
- ycpp/_awareness.py +268 -0
- ycpp/_doc.py +718 -0
- ycpp/_event.py +188 -0
- ycpp/_id_map.py +620 -0
- ycpp/_map.py +267 -0
- ycpp/_provider.py +180 -0
- ycpp/_snapshot.py +28 -0
- ycpp/_sticky_index.py +59 -0
- ycpp/_stream.py +91 -0
- ycpp/_sync.py +192 -0
- ycpp/_text.py +239 -0
- ycpp/_transaction.py +287 -0
- ycpp/_typed.py +122 -0
- ycpp/_undo.py +201 -0
- ycpp/_update.py +18 -0
- ycpp/_xml.py +452 -0
- ycpp/_ycpp.cp315t-win_arm64.lib +0 -0
- ycpp/_ycpp.cp315t-win_arm64.pyd +0 -0
- ycpp-0.1.0.data/headers/fast_float/ascii_number.h +766 -0
- ycpp-0.1.0.data/headers/fast_float/bigint.h +638 -0
- ycpp-0.1.0.data/headers/fast_float/constexpr_feature_detect.h +53 -0
- ycpp-0.1.0.data/headers/fast_float/decimal_to_binary.h +212 -0
- ycpp-0.1.0.data/headers/fast_float/digit_comparison.h +455 -0
- ycpp-0.1.0.data/headers/fast_float/fast_float.h +91 -0
- ycpp-0.1.0.data/headers/fast_float/fast_table.h +708 -0
- ycpp-0.1.0.data/headers/fast_float/float_common.h +1432 -0
- ycpp-0.1.0.data/headers/fast_float/parse_number.h +488 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_bit.hpp +230 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_details.hpp +386 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
- ycpp-0.1.0.data/headers/xsimd/arch/utils/shifts.hpp +82 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx.hpp +2111 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx2.hpp +1591 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512bw.hpp +724 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512cd.hpp +28 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512dq.hpp +270 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512er.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512f.hpp +2919 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512pf.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avxvnni.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_common.hpp +26 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_common_fwd.hpp +127 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_constants.hpp +393 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_emulated.hpp +787 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma4.hpp +92 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_isa.hpp +146 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_neon.hpp +3580 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_neon64.hpp +1614 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_rvv.hpp +1515 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_scalar.hpp +1210 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse2.hpp +2333 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse3.hpp +66 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse4_1.hpp +510 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse4_2.hpp +44 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_ssse3.hpp +186 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sve.hpp +1186 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_vsx.hpp +916 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_vxe.hpp +787 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_wasm.hpp +1819 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_arch.hpp +242 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_config.hpp +620 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features.hpp +50 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_x86.hpp +1044 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpuid.hpp +144 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_getauxval.hpp +159 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_macros.hpp +76 -0
- ycpp-0.1.0.data/headers/xsimd/math/xsimd_rem_pio2.hpp +707 -0
- ycpp-0.1.0.data/headers/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
- ycpp-0.1.0.data/headers/xsimd/memory/xsimd_alignment.hpp +102 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_all_registers.hpp +57 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_api.hpp +3106 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx2_register.hpp +44 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512er_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512f_register.hpp +77 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx_register.hpp +64 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_batch.hpp +1665 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_batch_constant.hpp +571 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_batch_fwd.hpp +41 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_common_arch.hpp +49 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_emulated_register.hpp +80 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma4_register.hpp +50 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_neon64_register.hpp +55 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_neon_register.hpp +130 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_register.hpp +96 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_rvv_register.hpp +491 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse2_register.hpp +59 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse3_register.hpp +49 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_ssse3_register.hpp +48 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_sve_register.hpp +216 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_traits.hpp +408 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_utils.hpp +462 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_vsx_register.hpp +77 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_vxe_register.hpp +86 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_wasm_register.hpp +59 -0
- ycpp-0.1.0.data/headers/xsimd/utils/bits.hpp +122 -0
- ycpp-0.1.0.data/headers/xsimd/utils/xsimd_type_traits.hpp +145 -0
- ycpp-0.1.0.data/headers/xsimd/xsimd.hpp +43 -0
- ycpp-0.1.0.dist-info/DELVEWHEEL +2 -0
- ycpp-0.1.0.dist-info/METADATA +15 -0
- ycpp-0.1.0.dist-info/RECORD +142 -0
- ycpp-0.1.0.dist-info/WHEEL +4 -0
- ycpp.libs/msvcp140-9cb625fcbc2fbbd6fca1aee8b24b0ebe.dll +0 -0
- ycpp.libs/msvcp140_1-84ac1bc84e09d193dd6ad98c84c0fd94.dll +0 -0
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
/***************************************************************************
|
|
2
|
+
* Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
|
|
3
|
+
* Martin Renou *
|
|
4
|
+
* Copyright (c) QuantStack *
|
|
5
|
+
* Copyright (c) Serge Guelton *
|
|
6
|
+
* *
|
|
7
|
+
* Distributed under the terms of the BSD 3-Clause License. *
|
|
8
|
+
* *
|
|
9
|
+
* The full license is in the file LICENSE, distributed with this software. *
|
|
10
|
+
****************************************************************************/
|
|
11
|
+
|
|
12
|
+
#ifndef XSIMD_EMULATED_HPP
|
|
13
|
+
#define XSIMD_EMULATED_HPP
|
|
14
|
+
|
|
15
|
+
#include <complex>
|
|
16
|
+
#include <numeric>
|
|
17
|
+
#include <type_traits>
|
|
18
|
+
|
|
19
|
+
#include "../arch/xsimd_scalar.hpp"
|
|
20
|
+
|
|
21
|
+
#include "../types/xsimd_emulated_register.hpp"
|
|
22
|
+
#include "../types/xsimd_utils.hpp"
|
|
23
|
+
|
|
24
|
+
namespace xsimd
|
|
25
|
+
{
|
|
26
|
+
template <typename T, class A, bool... Values>
|
|
27
|
+
struct batch_bool_constant;
|
|
28
|
+
|
|
29
|
+
template <class T_out, class T_in, class A>
|
|
30
|
+
XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& x) noexcept;
|
|
31
|
+
|
|
32
|
+
template <typename T, class A, T... Values>
|
|
33
|
+
struct batch_constant;
|
|
34
|
+
|
|
35
|
+
namespace kernel
|
|
36
|
+
{
|
|
37
|
+
using namespace types;
|
|
38
|
+
|
|
39
|
+
// fwd
|
|
40
|
+
template <class A, class T, size_t I>
|
|
41
|
+
XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I>, requires_arch<common>) noexcept;
|
|
42
|
+
template <class A, typename T, typename ITy, ITy... Indices>
|
|
43
|
+
XSIMD_INLINE batch<T, A> shuffle(batch<T, A> const& x, batch<T, A> const& y, batch_constant<ITy, A, Indices...>, requires_arch<common>) noexcept;
|
|
44
|
+
|
|
45
|
+
namespace detail
|
|
46
|
+
{
|
|
47
|
+
template <size_t I, class F, class... Bs>
|
|
48
|
+
auto emulated_apply(F func, Bs const&... bs)
|
|
49
|
+
{
|
|
50
|
+
return func(bs.data[I]...);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
template <class F, class B, class... Bs, size_t... Is>
|
|
54
|
+
auto emulated_apply(F func, std::index_sequence<Is...>, B const& b, Bs const&... bs) -> std::array<decltype(func(b.data[0], bs.data[0]...)), B::size>
|
|
55
|
+
{
|
|
56
|
+
return { emulated_apply<Is>(func, b, bs...)... };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
template <class B, class F, class... Bs>
|
|
60
|
+
auto emulated_apply(F func, B const& b, Bs const&... bs)
|
|
61
|
+
{
|
|
62
|
+
return emulated_apply(func, std::make_index_sequence<B::size>(), b, bs...);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// abs
|
|
67
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
68
|
+
XSIMD_INLINE batch<T, A> abs(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
69
|
+
{
|
|
70
|
+
return detail::emulated_apply([](T v)
|
|
71
|
+
{ return xsimd::abs(v); },
|
|
72
|
+
self);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// add
|
|
76
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
77
|
+
XSIMD_INLINE batch<T, A> add(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
78
|
+
{
|
|
79
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
80
|
+
{ return xsimd::add(v0, v1); },
|
|
81
|
+
self, other);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// all
|
|
85
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
86
|
+
XSIMD_INLINE bool all(batch_bool<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
87
|
+
{
|
|
88
|
+
return std::all_of(self.data.begin(), self.data.end(), [](T v)
|
|
89
|
+
{ return bool(v); });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// any
|
|
93
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
94
|
+
XSIMD_INLINE bool any(batch_bool<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
95
|
+
{
|
|
96
|
+
return std::any_of(self.data.begin(), self.data.end(), [](T v)
|
|
97
|
+
{ return bool(v); });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// batch_bool_cast
|
|
101
|
+
template <class A, class T_out, class T_in, size_t N = 8 * sizeof(T_in) * batch<T_in, A>::size>
|
|
102
|
+
XSIMD_INLINE batch_bool<T_out, A> batch_bool_cast(batch_bool<T_in, A> const& self, batch_bool<T_out, A> const&, requires_arch<emulated<N>>) noexcept
|
|
103
|
+
{
|
|
104
|
+
return { self.data };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// bitwise_and
|
|
108
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
109
|
+
XSIMD_INLINE batch<T, A> bitwise_and(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
110
|
+
{
|
|
111
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
112
|
+
{ return xsimd::bitwise_and(v0, v1); },
|
|
113
|
+
self, other);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
117
|
+
XSIMD_INLINE batch_bool<T, A> bitwise_and(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
118
|
+
{
|
|
119
|
+
return detail::emulated_apply([](bool v0, bool v1)
|
|
120
|
+
{ return xsimd::bitwise_and(v0, v1); },
|
|
121
|
+
self, other);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// bitwise_andnot
|
|
125
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
126
|
+
XSIMD_INLINE batch<T, A> bitwise_andnot(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
127
|
+
{
|
|
128
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
129
|
+
{ return xsimd::bitwise_andnot(v0, v1); },
|
|
130
|
+
self, other);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
134
|
+
XSIMD_INLINE batch_bool<T, A> bitwise_andnot(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
135
|
+
{
|
|
136
|
+
return detail::emulated_apply([](bool v0, bool v1)
|
|
137
|
+
{ return xsimd::bitwise_andnot(v0, v1); },
|
|
138
|
+
self, other);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// bitwise_lshift
|
|
142
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
143
|
+
XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, int32_t other, requires_arch<emulated<N>>) noexcept
|
|
144
|
+
{
|
|
145
|
+
return detail::emulated_apply([other](T v)
|
|
146
|
+
{ return xsimd::bitwise_lshift(v, other); },
|
|
147
|
+
self);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// bitwise_not
|
|
151
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
152
|
+
XSIMD_INLINE batch<T, A> bitwise_not(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
153
|
+
{
|
|
154
|
+
return detail::emulated_apply([](T v)
|
|
155
|
+
{ return xsimd::bitwise_not(v); },
|
|
156
|
+
self);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
160
|
+
XSIMD_INLINE batch_bool<T, A> bitwise_not(batch_bool<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
161
|
+
{
|
|
162
|
+
return detail::emulated_apply([](bool v)
|
|
163
|
+
{ return xsimd::bitwise_not(v); },
|
|
164
|
+
self);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// bitwise_or
|
|
168
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
169
|
+
XSIMD_INLINE batch<T, A> bitwise_or(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
170
|
+
{
|
|
171
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
172
|
+
{ return xsimd::bitwise_or(v0, v1); },
|
|
173
|
+
self, other);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
177
|
+
XSIMD_INLINE batch_bool<T, A> bitwise_or(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
178
|
+
{
|
|
179
|
+
return detail::emulated_apply([](bool v0, bool v1)
|
|
180
|
+
{ return xsimd::bitwise_or(v0, v1); },
|
|
181
|
+
self, other);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// bitwise_rshift
|
|
185
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
186
|
+
XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, int32_t other, requires_arch<emulated<N>>) noexcept
|
|
187
|
+
{
|
|
188
|
+
return detail::emulated_apply([other](T v)
|
|
189
|
+
{ return xsimd::bitwise_rshift(v, other); },
|
|
190
|
+
self);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// bitwise_xor
|
|
194
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
195
|
+
XSIMD_INLINE batch<T, A> bitwise_xor(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
196
|
+
{
|
|
197
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
198
|
+
{ return xsimd::bitwise_xor(v0, v1); },
|
|
199
|
+
self, other);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
203
|
+
XSIMD_INLINE batch_bool<T, A> bitwise_xor(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
204
|
+
{
|
|
205
|
+
return detail::emulated_apply([](bool v0, bool v1)
|
|
206
|
+
{ return xsimd::bitwise_xor(v0, v1); },
|
|
207
|
+
self, other);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// bitwise_cast
|
|
211
|
+
template <class A, class T_in, class T_out, size_t N = 8 * sizeof(T_in) * batch<T_in, A>::size>
|
|
212
|
+
XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& self, batch<T_out, A> const&, requires_arch<emulated<N>>) noexcept
|
|
213
|
+
{
|
|
214
|
+
constexpr size_t size = batch<T_out, A>::size;
|
|
215
|
+
std::array<T_out, size> result;
|
|
216
|
+
char* raw_data = reinterpret_cast<char*>(result.data());
|
|
217
|
+
const char* raw_input = reinterpret_cast<const char*>(self.data.data());
|
|
218
|
+
memcpy(raw_data, raw_input, size * sizeof(T_out));
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// broadcast
|
|
223
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
224
|
+
batch<T, A> XSIMD_INLINE broadcast(T val, requires_arch<emulated<N>>) noexcept
|
|
225
|
+
{
|
|
226
|
+
constexpr size_t size = batch<T, A>::size;
|
|
227
|
+
std::array<T, size> r;
|
|
228
|
+
std::fill(r.begin(), r.end(), val);
|
|
229
|
+
return r;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// first
|
|
233
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
234
|
+
T XSIMD_INLINE first(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
235
|
+
{
|
|
236
|
+
return self.data[0];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
#if 0
|
|
240
|
+
// count
|
|
241
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
242
|
+
XSIMD_INLINE size_t count(batch_bool<T, A> const& x, requires_arch<emulated<N>>) noexcept
|
|
243
|
+
{
|
|
244
|
+
uint64_t m = x.mask();
|
|
245
|
+
// https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
|
|
246
|
+
m = m - ((m >> 1) & (uint64_t) ~(uint64_t)0 / 3); // temp
|
|
247
|
+
m = (m & (uint64_t) ~(uint64_t)0 / 15 * 3) + ((m >> 2) & (uint64_t) ~(uint64_t)0 / 15 * 3); // temp
|
|
248
|
+
m = (m + (m >> 4)) & (uint64_t) ~(uint64_t)0 / 255 * 15; // temp
|
|
249
|
+
return (m * ((uint64_t) ~(uint64_t)0 / 255)) >> (sizeof(uint64_t) - 1) * CHAR_BIT; // count
|
|
250
|
+
}
|
|
251
|
+
#endif
|
|
252
|
+
|
|
253
|
+
// store_complex
|
|
254
|
+
namespace detail
|
|
255
|
+
{
|
|
256
|
+
// complex_low
|
|
257
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
258
|
+
XSIMD_INLINE batch<T, A> complex_low(batch<std::complex<T>, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
259
|
+
{
|
|
260
|
+
constexpr size_t size = batch<T, A>::size;
|
|
261
|
+
std::array<T, size> result;
|
|
262
|
+
for (size_t i = 0; i < size / 2; ++i)
|
|
263
|
+
{
|
|
264
|
+
result[2 * i] = self.real().data[i];
|
|
265
|
+
result[1 + 2 * i] = self.imag().data[i];
|
|
266
|
+
}
|
|
267
|
+
return result;
|
|
268
|
+
}
|
|
269
|
+
// complex_high
|
|
270
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
271
|
+
XSIMD_INLINE batch<T, A> complex_high(batch<std::complex<T>, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
272
|
+
{
|
|
273
|
+
constexpr size_t size = batch<T, A>::size;
|
|
274
|
+
std::array<T, size> result;
|
|
275
|
+
for (size_t i = 0; i < size / 2; ++i)
|
|
276
|
+
{
|
|
277
|
+
result[2 * i] = self.real().data[i + size / 2];
|
|
278
|
+
result[1 + 2 * i] = self.imag().data[i + size / 2];
|
|
279
|
+
}
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// decr_if
|
|
285
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
286
|
+
XSIMD_INLINE batch<T, A> decr_if(batch<T, A> const& self, batch_bool<T, A> const& mask, requires_arch<emulated<N>>) noexcept
|
|
287
|
+
{
|
|
288
|
+
return self - batch<T, A>(mask.data);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// div
|
|
292
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
293
|
+
XSIMD_INLINE batch<T, A> div(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
294
|
+
{
|
|
295
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
296
|
+
{ return xsimd::div(v0, v1); },
|
|
297
|
+
self, other);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// fast_cast
|
|
301
|
+
namespace detail
|
|
302
|
+
{
|
|
303
|
+
template <class A, size_t N = 8 * sizeof(float) * batch<float, A>::size>
|
|
304
|
+
XSIMD_INLINE batch<float, A> fast_cast(batch<int32_t, A> const& self, batch<float, A> const&, requires_arch<emulated<N>>) noexcept
|
|
305
|
+
{
|
|
306
|
+
return detail::emulated_apply([](int32_t v)
|
|
307
|
+
{ return float(v); },
|
|
308
|
+
self);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
template <class A, size_t N = 8 * sizeof(float) * batch<float, A>::size>
|
|
312
|
+
XSIMD_INLINE batch<float, A> fast_cast(batch<uint32_t, A> const& self, batch<float, A> const&, requires_arch<emulated<N>>) noexcept
|
|
313
|
+
{
|
|
314
|
+
return detail::emulated_apply([](uint32_t v)
|
|
315
|
+
{ return float(v); },
|
|
316
|
+
self);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
template <class A, size_t N = 8 * sizeof(double) * batch<double, A>::size>
|
|
320
|
+
XSIMD_INLINE batch<double, A> fast_cast(batch<int64_t, A> const& self, batch<double, A> const&, requires_arch<emulated<N>>) noexcept
|
|
321
|
+
{
|
|
322
|
+
return detail::emulated_apply([](int64_t v)
|
|
323
|
+
{ return double(v); },
|
|
324
|
+
self);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
template <class A, size_t N = 8 * sizeof(double) * batch<double, A>::size>
|
|
328
|
+
XSIMD_INLINE batch<double, A> fast_cast(batch<uint64_t, A> const& self, batch<double, A> const&, requires_arch<emulated<N>>) noexcept
|
|
329
|
+
{
|
|
330
|
+
return detail::emulated_apply([](uint64_t v)
|
|
331
|
+
{ return double(v); },
|
|
332
|
+
self);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
template <class A, size_t N = 8 * sizeof(int32_t) * batch<int32_t, A>::size>
|
|
336
|
+
XSIMD_INLINE batch<int32_t, A> fast_cast(batch<float, A> const& self, batch<int32_t, A> const&, requires_arch<emulated<N>>) noexcept
|
|
337
|
+
{
|
|
338
|
+
return detail::emulated_apply([](float v)
|
|
339
|
+
{ return int32_t(v); },
|
|
340
|
+
self);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
template <class A, size_t N = 8 * sizeof(double) * batch<double, A>::size>
|
|
344
|
+
XSIMD_INLINE batch<int64_t, A> fast_cast(batch<double, A> const& self, batch<int64_t, A> const&, requires_arch<emulated<N>>) noexcept
|
|
345
|
+
{
|
|
346
|
+
return detail::emulated_apply([](double v)
|
|
347
|
+
{ return int64_t(v); },
|
|
348
|
+
self);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// eq
|
|
353
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
354
|
+
XSIMD_INLINE batch_bool<T, emulated<N>> eq(batch<T, emulated<N>> const& self, batch<T, emulated<N>> const& other, requires_arch<emulated<N>>) noexcept
|
|
355
|
+
{
|
|
356
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
357
|
+
{ return xsimd::eq(v0, v1); },
|
|
358
|
+
self, other);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch_bool<T, A>::size>
|
|
362
|
+
XSIMD_INLINE batch_bool<T, emulated<N>> eq(batch_bool<T, emulated<N>> const& self, batch_bool<T, emulated<N>> const& other, requires_arch<emulated<N>>) noexcept
|
|
363
|
+
{
|
|
364
|
+
return detail::emulated_apply([](bool v0, bool v1)
|
|
365
|
+
{ return xsimd::eq(v0, v1); },
|
|
366
|
+
self, other);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// from_bool
|
|
370
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
371
|
+
XSIMD_INLINE batch<T, A> from_bool(batch_bool<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
372
|
+
{
|
|
373
|
+
return detail::emulated_apply([](bool v)
|
|
374
|
+
{ return T(v); },
|
|
375
|
+
self);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// from_mask
|
|
379
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
380
|
+
XSIMD_INLINE batch_bool<T, A> from_mask(batch_bool<T, A> const&, uint64_t mask, requires_arch<emulated<N>>) noexcept
|
|
381
|
+
{
|
|
382
|
+
constexpr size_t size = batch<T, A>::size;
|
|
383
|
+
std::array<bool, size> vmask;
|
|
384
|
+
for (size_t i = 0; i < size; ++i)
|
|
385
|
+
vmask[i] = (mask >> i) & 1u;
|
|
386
|
+
return vmask;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// ge
|
|
390
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
391
|
+
XSIMD_INLINE batch_bool<T, emulated<N>> ge(batch<T, emulated<N>> const& self, batch<T, emulated<N>> const& other, requires_arch<emulated<N>>) noexcept
|
|
392
|
+
{
|
|
393
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
394
|
+
{ return xsimd::ge(v0, v1); },
|
|
395
|
+
self, other);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// gt
|
|
399
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
400
|
+
XSIMD_INLINE batch_bool<T, emulated<N>> gt(batch<T, emulated<N>> const& self, batch<T, emulated<N>> const& other, requires_arch<emulated<N>>) noexcept
|
|
401
|
+
{
|
|
402
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
403
|
+
{ return xsimd::gt(v0, v1); },
|
|
404
|
+
self, other);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// haddp
|
|
408
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
409
|
+
XSIMD_INLINE batch<T, A> haddp(batch<T, A> const* row, requires_arch<emulated<N>>) noexcept
|
|
410
|
+
{
|
|
411
|
+
constexpr size_t size = batch<T, A>::size;
|
|
412
|
+
std::array<T, size> r;
|
|
413
|
+
for (size_t i = 0; i < size; ++i)
|
|
414
|
+
r[i] = std::accumulate(row[i].data.begin() + 1, row[i].data.end(), row[i].data.front());
|
|
415
|
+
return r;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// incr_if
|
|
419
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
420
|
+
XSIMD_INLINE batch<T, A> incr_if(batch<T, A> const& self, batch_bool<T, A> const& mask, requires_arch<emulated<N>>) noexcept
|
|
421
|
+
{
|
|
422
|
+
return self + batch<T, A>(mask.data);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// insert
|
|
426
|
+
template <class A, class T, size_t I, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
427
|
+
XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I>, requires_arch<emulated<N>>) noexcept
|
|
428
|
+
{
|
|
429
|
+
batch<T, A> other = self;
|
|
430
|
+
other.data[I] = val;
|
|
431
|
+
return other;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// isnan
|
|
435
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
436
|
+
XSIMD_INLINE batch_bool<T, A> isnan(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
437
|
+
{
|
|
438
|
+
return detail::emulated_apply([](T v)
|
|
439
|
+
{ return xsimd::isnan(v); },
|
|
440
|
+
self);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// load_aligned
|
|
444
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
445
|
+
XSIMD_INLINE batch<T, A> load_aligned(T const* mem, convert<T>, requires_arch<emulated<N>>) noexcept
|
|
446
|
+
{
|
|
447
|
+
constexpr size_t size = batch<T, A>::size;
|
|
448
|
+
std::array<T, size> res;
|
|
449
|
+
std::copy(mem, mem + size, res.begin());
|
|
450
|
+
return res;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// load_unaligned
|
|
454
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
455
|
+
XSIMD_INLINE batch<T, A> load_unaligned(T const* mem, convert<T>, requires_arch<emulated<N>>) noexcept
|
|
456
|
+
{
|
|
457
|
+
constexpr size_t size = batch<T, A>::size;
|
|
458
|
+
std::array<T, size> res;
|
|
459
|
+
std::copy(mem, mem + size, res.begin());
|
|
460
|
+
return res;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// load_complex
|
|
464
|
+
namespace detail
|
|
465
|
+
{
|
|
466
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
467
|
+
XSIMD_INLINE batch<std::complex<T>, A> load_complex(batch<T, A> const& hi, batch<T, A> const& lo, requires_arch<emulated<N>>) noexcept
|
|
468
|
+
{
|
|
469
|
+
constexpr size_t size = batch<T, A>::size;
|
|
470
|
+
std::array<T, size> real, imag;
|
|
471
|
+
for (size_t i = 0; i < size / 2; ++i)
|
|
472
|
+
{
|
|
473
|
+
real[i] = hi.data[2 * i];
|
|
474
|
+
imag[i] = hi.data[1 + 2 * i];
|
|
475
|
+
}
|
|
476
|
+
for (size_t i = 0; i < size / 2; ++i)
|
|
477
|
+
{
|
|
478
|
+
real[size / 2 + i] = lo.data[2 * i];
|
|
479
|
+
imag[size / 2 + i] = lo.data[1 + 2 * i];
|
|
480
|
+
}
|
|
481
|
+
return { real, imag };
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// le
|
|
486
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
487
|
+
XSIMD_INLINE batch_bool<T, emulated<N>> le(batch<T, emulated<N>> const& self, batch<T, emulated<N>> const& other, requires_arch<emulated<N>>) noexcept
|
|
488
|
+
{
|
|
489
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
490
|
+
{ return xsimd::le(v0, v1); },
|
|
491
|
+
self, other);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// lt
|
|
495
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
496
|
+
XSIMD_INLINE batch_bool<T, emulated<N>> lt(batch<T, emulated<N>> const& self, batch<T, emulated<N>> const& other, requires_arch<emulated<N>>) noexcept
|
|
497
|
+
{
|
|
498
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
499
|
+
{ return xsimd::lt(v0, v1); },
|
|
500
|
+
self, other);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// mask
|
|
504
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
505
|
+
XSIMD_INLINE uint64_t mask(batch_bool<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
506
|
+
{
|
|
507
|
+
constexpr size_t size = batch<T, A>::size;
|
|
508
|
+
uint64_t res = 0;
|
|
509
|
+
for (size_t i = 0; i < size; ++i)
|
|
510
|
+
res |= (uint64_t)(self.data[i] ? 1u : 0u) << i;
|
|
511
|
+
return res;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// max
|
|
515
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
516
|
+
XSIMD_INLINE batch<T, A> max(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
517
|
+
{
|
|
518
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
519
|
+
{ return xsimd::max(v0, v1); },
|
|
520
|
+
self, other);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// min
|
|
524
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
525
|
+
XSIMD_INLINE batch<T, A> min(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
526
|
+
{
|
|
527
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
528
|
+
{ return xsimd::min(v0, v1); },
|
|
529
|
+
self, other);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// mul
|
|
533
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
534
|
+
XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
535
|
+
{
|
|
536
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
537
|
+
{ return xsimd::mul(v0, v1); },
|
|
538
|
+
self, other);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// nearbyint_as_int
|
|
542
|
+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
543
|
+
XSIMD_INLINE batch<as_integer_t<T>, A> nearbyint_as_int(batch<T, A> const& self,
|
|
544
|
+
requires_arch<emulated<N>>) noexcept
|
|
545
|
+
{
|
|
546
|
+
return detail::emulated_apply([](T v)
|
|
547
|
+
{ return xsimd::nearbyint_as_int(v); },
|
|
548
|
+
self);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// neg
|
|
552
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
553
|
+
XSIMD_INLINE batch<T, A> neg(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
554
|
+
{
|
|
555
|
+
return detail::emulated_apply([](T v)
|
|
556
|
+
{ return xsimd::neg(v); },
|
|
557
|
+
self);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// neq
|
|
561
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
562
|
+
XSIMD_INLINE batch_bool<T, A> neq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
563
|
+
{
|
|
564
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
565
|
+
{ return xsimd::neq(v0, v1); },
|
|
566
|
+
self, other);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
570
|
+
XSIMD_INLINE batch_bool<T, A> neq(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
571
|
+
{
|
|
572
|
+
return detail::emulated_apply([](bool v0, bool v1)
|
|
573
|
+
{ return xsimd::neq(v0, v1); },
|
|
574
|
+
self, other);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// reduce_add
|
|
578
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
579
|
+
XSIMD_INLINE T reduce_add(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
580
|
+
{
|
|
581
|
+
constexpr size_t size = batch<T, A>::size;
|
|
582
|
+
std::array<T, size> buffer;
|
|
583
|
+
self.store_unaligned(buffer.data());
|
|
584
|
+
return std::accumulate(buffer.begin() + 1, buffer.end(), *buffer.begin());
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// reduce_max
|
|
588
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
589
|
+
XSIMD_INLINE T reduce_max(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
590
|
+
{
|
|
591
|
+
return std::accumulate(self.data.begin() + 1, self.data.end(), *self.data.begin(), [](T const& x, T const& y)
|
|
592
|
+
{ return xsimd::max(x, y); });
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// reduce_min
|
|
596
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
597
|
+
XSIMD_INLINE T reduce_min(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
598
|
+
{
|
|
599
|
+
return std::accumulate(self.data.begin() + 1, self.data.end(), *self.data.begin(), [](T const& x, T const& y)
|
|
600
|
+
{ return xsimd::min(x, y); });
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// reduce_mul
|
|
604
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
605
|
+
XSIMD_INLINE T reduce_mul(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
606
|
+
{
|
|
607
|
+
constexpr size_t size = batch<T, A>::size;
|
|
608
|
+
std::array<T, size> buffer;
|
|
609
|
+
self.store_unaligned(buffer.data());
|
|
610
|
+
return std::accumulate(buffer.begin() + 1, buffer.end(), *buffer.begin(), std::multiplies<T>());
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// rsqrt
|
|
614
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
615
|
+
XSIMD_INLINE batch<T, A> rsqrt(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
616
|
+
{
|
|
617
|
+
return detail::emulated_apply([](T v)
|
|
618
|
+
{ return xsimd::rsqrt(v); },
|
|
619
|
+
self);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// select
|
|
623
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
624
|
+
XSIMD_INLINE batch<T, A> select(batch_bool<T, A> const& cond, batch<T, A> const& true_br, batch<T, A> const& false_br, requires_arch<emulated<N>>) noexcept
|
|
625
|
+
{
|
|
626
|
+
return detail::emulated_apply([](bool c, T t, T f)
|
|
627
|
+
{ return xsimd::select(c, t, f); },
|
|
628
|
+
cond, true_br, false_br);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
template <class A, class T, bool... Values>
|
|
632
|
+
XSIMD_INLINE batch<T, A> select(batch_bool_constant<T, A, Values...> const& cond, batch<T, A> const& true_br, batch<T, A> const& false_br, requires_arch<emulated<8 * sizeof(T) * batch<T, A>::size>>) noexcept
|
|
633
|
+
{
|
|
634
|
+
constexpr size_t size = batch<T, A>::size;
|
|
635
|
+
static_assert(sizeof...(Values) == size, "consistent init");
|
|
636
|
+
return select((batch_bool<T, A>)cond, true_br, false_br, emulated<8 * sizeof(T) * size> {});
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
// shuffle
|
|
640
|
+
template <class A, typename T, class ITy, ITy... Is>
|
|
641
|
+
XSIMD_INLINE batch<T, A> shuffle(batch<T, A> const& x, batch<float, A> const& y, batch_constant<ITy, A, Is...> mask, requires_arch<emulated<batch<T, A>::size>>) noexcept
|
|
642
|
+
{
|
|
643
|
+
constexpr size_t size = batch<T, A>::size;
|
|
644
|
+
batch<ITy, A> bmask = mask;
|
|
645
|
+
std::array<T, size> res;
|
|
646
|
+
for (size_t i = 0; i < size; ++i)
|
|
647
|
+
res[i] = bmask.data[i] < size ? x.data[bmask.data[i]] : y.data[bmask.data[i] - size];
|
|
648
|
+
return res;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// sqrt
|
|
652
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
653
|
+
XSIMD_INLINE batch<T, A> sqrt(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
|
|
654
|
+
{
|
|
655
|
+
return detail::emulated_apply([](T v)
|
|
656
|
+
{ return xsimd::sqrt(v); },
|
|
657
|
+
self);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// slide_left
|
|
661
|
+
template <size_t M, class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
662
|
+
XSIMD_INLINE batch<T, A> slide_left(batch<T, A> const& x, requires_arch<emulated<N>>) noexcept
|
|
663
|
+
{
|
|
664
|
+
constexpr size_t size = batch<T, A>::size;
|
|
665
|
+
std::array<T, size> result;
|
|
666
|
+
char* raw_data = reinterpret_cast<char*>(result.data());
|
|
667
|
+
memset(raw_data, 0, M);
|
|
668
|
+
memcpy(raw_data + M, reinterpret_cast<const char*>(x.data.data()), sizeof(T) * result.size() - M);
|
|
669
|
+
return result;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// slide_right
|
|
673
|
+
template <size_t M, class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
674
|
+
XSIMD_INLINE batch<T, A> slide_right(batch<T, A> const& x, requires_arch<emulated<N>>) noexcept
|
|
675
|
+
{
|
|
676
|
+
constexpr size_t size = batch<T, A>::size;
|
|
677
|
+
std::array<T, size> result;
|
|
678
|
+
char* raw_data = reinterpret_cast<char*>(result.data());
|
|
679
|
+
memcpy(raw_data, reinterpret_cast<const char*>(x.data.data()) + M, sizeof(T) * result.size() - M);
|
|
680
|
+
memset(raw_data + sizeof(T) * result.size() - M, 0, M);
|
|
681
|
+
return result;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// sadd
|
|
685
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
686
|
+
XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
687
|
+
{
|
|
688
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
689
|
+
{ return xsimd::sadd(v0, v1); },
|
|
690
|
+
self, other);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// set
|
|
694
|
+
template <class A, class T, size_t N, class... Values>
|
|
695
|
+
XSIMD_INLINE batch<T, emulated<N>> set(batch<T, emulated<N>> const&, requires_arch<emulated<N>>, Values... values) noexcept
|
|
696
|
+
{
|
|
697
|
+
static_assert(sizeof...(Values) == batch<T, emulated<N>>::size, "consistent init");
|
|
698
|
+
return { typename batch<T, emulated<N>>::register_type { static_cast<T>(values)... } };
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
template <class A, class T, size_t N, class... Values>
|
|
702
|
+
XSIMD_INLINE batch_bool<T, emulated<N>> set(batch_bool<T, emulated<N>> const&, requires_arch<emulated<N>>, Values... values) noexcept
|
|
703
|
+
{
|
|
704
|
+
static_assert(sizeof...(Values) == batch<T, emulated<N>>::size, "consistent init");
|
|
705
|
+
return { std::array<bool, sizeof...(Values)> { static_cast<bool>(values)... } };
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// ssub
|
|
709
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
710
|
+
XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
711
|
+
{
|
|
712
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
713
|
+
{ return xsimd::ssub(v0, v1); },
|
|
714
|
+
self, other);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// store_aligned
|
|
718
|
+
template <class A, class T, size_t N>
|
|
719
|
+
XSIMD_INLINE void store_aligned(T* mem, batch<T, emulated<N>> const& self, requires_arch<emulated<N>>) noexcept
|
|
720
|
+
{
|
|
721
|
+
std::copy(self.data.begin(), self.data.end(), mem);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
// store_unaligned
|
|
725
|
+
template <class A, class T, size_t N>
|
|
726
|
+
XSIMD_INLINE void store_unaligned(T* mem, batch<T, emulated<N>> const& self, requires_arch<emulated<N>>) noexcept
|
|
727
|
+
{
|
|
728
|
+
std::copy(self.data.begin(), self.data.end(), mem);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// sub
|
|
732
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
733
|
+
XSIMD_INLINE batch<T, A> sub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
734
|
+
{
|
|
735
|
+
return detail::emulated_apply([](T v0, T v1)
|
|
736
|
+
{ return xsimd::sub(v0, v1); },
|
|
737
|
+
self, other);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// swizzle
|
|
741
|
+
|
|
742
|
+
template <class A, typename T, class ITy, ITy... Is>
|
|
743
|
+
XSIMD_INLINE batch<T, A> swizzle(batch<T, A> const& self, batch_constant<ITy, A, Is...> mask, requires_arch<emulated<8 * sizeof(T) * batch<T, A>::size>>) noexcept
|
|
744
|
+
{
|
|
745
|
+
constexpr size_t size = batch<T, A>::size;
|
|
746
|
+
batch<ITy, A> bmask = mask;
|
|
747
|
+
std::array<T, size> res;
|
|
748
|
+
for (size_t i = 0; i < size; ++i)
|
|
749
|
+
res[i] = self.data[bmask.data[i]];
|
|
750
|
+
return res;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
// zip_hi
|
|
754
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
755
|
+
XSIMD_INLINE batch<T, A> zip_hi(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
756
|
+
{
|
|
757
|
+
constexpr size_t size = batch<T, A>::size;
|
|
758
|
+
// Note: irregular behavior for odd numbers.
|
|
759
|
+
std::array<T, size> res;
|
|
760
|
+
if (size % 2)
|
|
761
|
+
{
|
|
762
|
+
for (size_t i = 0; i < size; ++i)
|
|
763
|
+
res[i] = (i % 2 ? self : other).data[size / 2 + i / 2];
|
|
764
|
+
}
|
|
765
|
+
else
|
|
766
|
+
{
|
|
767
|
+
for (size_t i = 0; i < size; ++i)
|
|
768
|
+
res[i] = (i % 2 ? other : self).data[size / 2 + i / 2];
|
|
769
|
+
}
|
|
770
|
+
return res;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// zip_lo
|
|
774
|
+
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
|
|
775
|
+
XSIMD_INLINE batch<T, A> zip_lo(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
|
|
776
|
+
{
|
|
777
|
+
constexpr size_t size = batch<T, A>::size;
|
|
778
|
+
// Note: irregular behavior for odd numbers.
|
|
779
|
+
std::array<T, size> res;
|
|
780
|
+
for (size_t i = 0; i < size; ++i)
|
|
781
|
+
res[i] = (i % 2 ? other : self).data[i / 2];
|
|
782
|
+
return res;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
#endif
|