react-native-executorch 0.10.5 → 0.10.7

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.
Files changed (251) hide show
  1. package/README.md +10 -1
  2. package/android/build.gradle.kts +4 -3
  3. package/ios/RnExecutorch.mm +15 -17
  4. package/lib/module/fetcher/fetcher.js +35 -122
  5. package/lib/module/fetcher/fetcher.js.map +1 -1
  6. package/lib/module/fetcher/telemetry.js +1 -1
  7. package/lib/module/index.js +12 -13
  8. package/lib/module/index.js.map +1 -1
  9. package/lib/module/models.js +4 -2
  10. package/lib/module/models.js.map +1 -1
  11. package/lib/typescript/src/fetcher/fetcher.d.ts +3 -7
  12. package/lib/typescript/src/fetcher/fetcher.d.ts.map +1 -1
  13. package/lib/typescript/src/models.d.ts.map +1 -1
  14. package/package.json +9 -7
  15. package/react-native-executorch.podspec +6 -2
  16. package/src/fetcher/fetcher.ts +38 -131
  17. package/src/fetcher/telemetry.ts +1 -1
  18. package/src/models.ts +6 -1
  19. package/third-party/common/phonemis/CMakeLists.txt +70 -14
  20. package/third-party/common/phonemis/README.md +183 -33
  21. package/third-party/common/phonemis/THIRD_PARTY_NOTICES.md +57 -0
  22. package/third-party/common/phonemis/knowledge/code_style.md +642 -0
  23. package/third-party/common/phonemis/licenses/Unicode-3.0.txt +39 -0
  24. package/third-party/common/phonemis/licenses/misaki-Apache-2.0.txt +201 -0
  25. package/third-party/common/phonemis/licenses/nlohmann-json-MIT.txt +21 -0
  26. package/third-party/common/phonemis/licenses/xsimd-BSD-3-Clause.txt +29 -0
  27. package/third-party/common/phonemis/src/phonemis/base/config.h +6 -0
  28. package/third-party/common/phonemis/src/phonemis/base/ipipeline.cpp +75 -0
  29. package/third-party/common/phonemis/src/phonemis/base/ipipeline.h +21 -0
  30. package/third-party/common/phonemis/src/phonemis/base/phonemizer/constants.h +2 -5
  31. package/third-party/common/phonemis/src/phonemis/base/phonemizer/lexicon_phonemizer.cpp +3 -4
  32. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.cpp +17 -8
  33. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.h +4 -0
  34. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.cpp +21 -6
  35. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.h +13 -4
  36. package/third-party/common/phonemis/src/phonemis/base/pipeline.cpp +8 -0
  37. package/third-party/common/phonemis/src/phonemis/base/pipeline.h +19 -0
  38. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.cpp +37 -0
  39. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.h +45 -0
  40. package/third-party/common/phonemis/src/phonemis/base/processor/common/constants.h +10 -0
  41. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.cpp +105 -0
  42. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.h +49 -0
  43. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.cpp +173 -0
  44. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.h +67 -0
  45. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.cpp +75 -0
  46. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.h +60 -0
  47. package/third-party/common/phonemis/src/phonemis/base/processor/common/types.h +18 -0
  48. package/third-party/common/phonemis/src/phonemis/base/processor/config.h +53 -0
  49. package/third-party/common/phonemis/src/phonemis/base/processor/layer.h +9 -7
  50. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/constants.h +20 -0
  51. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.cpp +89 -0
  52. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.h +35 -0
  53. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/types.h +16 -0
  54. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/kind.h +40 -0
  55. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/layer.h +382 -0
  56. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/notation.h +30 -0
  57. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.cpp +51 -0
  58. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.h +31 -0
  59. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern.h +30 -0
  60. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.cpp +17 -0
  61. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.h +31 -0
  62. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.cpp +811 -0
  63. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.h +285 -0
  64. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.cpp +64 -0
  65. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.h +23 -0
  66. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/types.h +94 -0
  67. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sanitizer/layer.cpp +19 -0
  68. package/third-party/common/phonemis/src/phonemis/base/processor/{sanitizer_layer.h → layers/sanitizer/layer.h} +8 -8
  69. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.cpp +65 -0
  70. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.h +29 -0
  71. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.cpp +170 -0
  72. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.h +40 -0
  73. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/types.h +25 -0
  74. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.cpp +47 -0
  75. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.h +19 -0
  76. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.cpp +60 -0
  77. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.h +45 -0
  78. package/third-party/common/phonemis/src/phonemis/base/processor/processor.cpp +6 -7
  79. package/third-party/common/phonemis/src/phonemis/base/processor/processor.h +14 -10
  80. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.cpp +89 -52
  81. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.h +16 -9
  82. package/third-party/common/phonemis/src/phonemis/base/tokenizer/tokenizer.cpp +13 -12
  83. package/third-party/common/phonemis/src/phonemis/lang/de/constants.h +183 -19
  84. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.cpp +355 -309
  85. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.h +42 -17
  86. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.cpp +56 -0
  87. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.h +15 -0
  88. package/third-party/common/phonemis/src/phonemis/lang/de/pipeline.h +3 -3
  89. package/third-party/common/phonemis/src/phonemis/lang/en/constants.h +181 -30
  90. package/third-party/common/phonemis/src/phonemis/lang/en/hmm_tagger.cpp +5 -7
  91. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.cpp +232 -135
  92. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.h +41 -16
  93. package/third-party/common/phonemis/src/phonemis/lang/en/pipeline.h +3 -10
  94. package/third-party/common/phonemis/src/phonemis/lang/es/constants.h +182 -60
  95. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.cpp +247 -212
  96. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.h +38 -18
  97. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.cpp +50 -0
  98. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.h +15 -0
  99. package/third-party/common/phonemis/src/phonemis/lang/es/pipeline.h +3 -3
  100. package/third-party/common/phonemis/src/phonemis/lang/fr/constants.h +152 -26
  101. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.cpp +252 -179
  102. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.h +38 -15
  103. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.cpp +83 -0
  104. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.h +15 -0
  105. package/third-party/common/phonemis/src/phonemis/lang/fr/pipeline.h +3 -3
  106. package/third-party/common/phonemis/src/phonemis/lang/hi/constants.h +62 -10
  107. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.cpp +74 -123
  108. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.h +27 -16
  109. package/third-party/common/phonemis/src/phonemis/lang/hi/pipeline.h +5 -3
  110. package/third-party/common/phonemis/src/phonemis/lang/it/constants.h +122 -42
  111. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.cpp +200 -207
  112. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.h +30 -18
  113. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.cpp +25 -0
  114. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.h +15 -0
  115. package/third-party/common/phonemis/src/phonemis/lang/it/pipeline.h +3 -3
  116. package/third-party/common/phonemis/src/phonemis/lang/pl/constants.h +346 -77
  117. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.cpp +631 -246
  118. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.h +47 -15
  119. package/third-party/common/phonemis/src/phonemis/lang/pl/pipeline.h +6 -6
  120. package/third-party/common/phonemis/src/phonemis/lang/pt/constants.h +201 -0
  121. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.cpp +365 -0
  122. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.h +53 -0
  123. package/third-party/common/phonemis/src/phonemis/lang/pt/pipeline.h +4 -2
  124. package/third-party/common/phonemis/src/phonemis/main.cpp +42 -11
  125. package/third-party/common/phonemis/src/phonemis/protophone/meta.h +24 -0
  126. package/third-party/common/phonemis/src/phonemis/protophone/numeric.h +26 -0
  127. package/third-party/common/phonemis/src/phonemis/protophone/protophone.cpp +525 -0
  128. package/third-party/common/phonemis/src/phonemis/protophone/protophone.h +80 -0
  129. package/third-party/common/phonemis/src/phonemis/protophone/tensor.h +76 -0
  130. package/third-party/common/phonemis/src/phonemis/protophone/tensor_utils.h +89 -0
  131. package/third-party/common/phonemis/src/phonemis/protophone/tensor_view.h +125 -0
  132. package/third-party/common/phonemis/src/phonemis/protophone/types.h +43 -0
  133. package/third-party/common/phonemis/src/phonemis/utils/strings.h +20 -14
  134. package/third-party/common/phonemis/src/phonemis/utils/unicode.h +15 -1
  135. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
  136. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_bit.hpp +232 -0
  137. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
  138. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
  139. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_details.hpp +386 -0
  140. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
  141. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
  142. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
  143. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
  144. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
  145. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
  146. package/third-party/common/phonemis/src/third-party/xsimd/arch/utils/shifts.hpp +82 -0
  147. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx.hpp +2111 -0
  148. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2.hpp +1591 -0
  149. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2_128.hpp +170 -0
  150. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512bw.hpp +724 -0
  151. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512cd.hpp +28 -0
  152. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512dq.hpp +270 -0
  153. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512er.hpp +17 -0
  154. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512f.hpp +2919 -0
  155. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
  156. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512pf.hpp +17 -0
  157. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
  158. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
  159. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
  160. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
  161. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx_128.hpp +164 -0
  162. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avxvnni.hpp +17 -0
  163. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common.hpp +26 -0
  164. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common_fwd.hpp +127 -0
  165. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_constants.hpp +393 -0
  166. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_emulated.hpp +787 -0
  167. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
  168. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
  169. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
  170. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma4.hpp +92 -0
  171. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
  172. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_isa.hpp +148 -0
  173. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon.hpp +3580 -0
  174. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon64.hpp +1614 -0
  175. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_rvv.hpp +1515 -0
  176. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_scalar.hpp +1210 -0
  177. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse2.hpp +2333 -0
  178. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse3.hpp +66 -0
  179. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_1.hpp +510 -0
  180. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_2.hpp +44 -0
  181. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_ssse3.hpp +186 -0
  182. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sve.hpp +1186 -0
  183. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vsx.hpp +947 -0
  184. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vxe.hpp +787 -0
  185. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_wasm.hpp +1819 -0
  186. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_arch.hpp +242 -0
  187. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_config.hpp +633 -0
  188. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features.hpp +50 -0
  189. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
  190. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
  191. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
  192. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
  193. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_x86.hpp +1121 -0
  194. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpuid.hpp +144 -0
  195. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_getauxval.hpp +159 -0
  196. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_macros.hpp +78 -0
  197. package/third-party/common/phonemis/src/third-party/xsimd/math/xsimd_rem_pio2.hpp +707 -0
  198. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
  199. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_alignment.hpp +102 -0
  200. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_all_registers.hpp +57 -0
  201. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_api.hpp +3106 -0
  202. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx2_register.hpp +57 -0
  203. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
  204. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
  205. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
  206. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512er_register.hpp +51 -0
  207. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512f_register.hpp +77 -0
  208. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
  209. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
  210. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
  211. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
  212. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
  213. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
  214. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx_register.hpp +79 -0
  215. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
  216. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch.hpp +1666 -0
  217. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_constant.hpp +572 -0
  218. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_fwd.hpp +41 -0
  219. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_common_arch.hpp +49 -0
  220. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_emulated_register.hpp +80 -0
  221. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
  222. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
  223. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
  224. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma4_register.hpp +50 -0
  225. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
  226. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon64_register.hpp +55 -0
  227. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon_register.hpp +130 -0
  228. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_register.hpp +96 -0
  229. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_rvv_register.hpp +491 -0
  230. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse2_register.hpp +59 -0
  231. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse3_register.hpp +49 -0
  232. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
  233. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
  234. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_ssse3_register.hpp +48 -0
  235. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sve_register.hpp +216 -0
  236. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_traits.hpp +409 -0
  237. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_utils.hpp +462 -0
  238. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vsx_register.hpp +84 -0
  239. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vxe_register.hpp +86 -0
  240. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_wasm_register.hpp +59 -0
  241. package/third-party/common/phonemis/src/third-party/xsimd/utils/bits.hpp +122 -0
  242. package/third-party/common/phonemis/src/third-party/xsimd/utils/xsimd_type_traits.hpp +145 -0
  243. package/third-party/common/phonemis/src/third-party/xsimd/xsimd.hpp +43 -0
  244. package/third-party/common/phonemis/src/phonemis/base/processor/constants.h +0 -11
  245. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/config.h +0 -16
  246. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.cpp +0 -271
  247. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.h +0 -45
  248. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/types.h +0 -29
  249. package/third-party/common/phonemis/src/phonemis/base/processor/sanitizer_layer.cpp +0 -22
  250. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.cpp +0 -40
  251. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.h +0 -22
@@ -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