react-native-executorch 0.10.6 → 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 (237) hide show
  1. package/lib/module/fetcher/telemetry.js +1 -1
  2. package/package.json +1 -1
  3. package/react-native-executorch.podspec +2 -0
  4. package/src/fetcher/telemetry.ts +1 -1
  5. package/third-party/common/phonemis/CMakeLists.txt +70 -14
  6. package/third-party/common/phonemis/README.md +183 -33
  7. package/third-party/common/phonemis/THIRD_PARTY_NOTICES.md +57 -0
  8. package/third-party/common/phonemis/knowledge/code_style.md +642 -0
  9. package/third-party/common/phonemis/licenses/Unicode-3.0.txt +39 -0
  10. package/third-party/common/phonemis/licenses/misaki-Apache-2.0.txt +201 -0
  11. package/third-party/common/phonemis/licenses/nlohmann-json-MIT.txt +21 -0
  12. package/third-party/common/phonemis/licenses/xsimd-BSD-3-Clause.txt +29 -0
  13. package/third-party/common/phonemis/src/phonemis/base/config.h +6 -0
  14. package/third-party/common/phonemis/src/phonemis/base/ipipeline.cpp +75 -0
  15. package/third-party/common/phonemis/src/phonemis/base/ipipeline.h +21 -0
  16. package/third-party/common/phonemis/src/phonemis/base/phonemizer/constants.h +2 -5
  17. package/third-party/common/phonemis/src/phonemis/base/phonemizer/lexicon_phonemizer.cpp +3 -4
  18. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.cpp +17 -8
  19. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.h +4 -0
  20. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.cpp +21 -6
  21. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.h +13 -4
  22. package/third-party/common/phonemis/src/phonemis/base/pipeline.cpp +8 -0
  23. package/third-party/common/phonemis/src/phonemis/base/pipeline.h +19 -0
  24. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.cpp +37 -0
  25. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.h +45 -0
  26. package/third-party/common/phonemis/src/phonemis/base/processor/common/constants.h +10 -0
  27. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.cpp +105 -0
  28. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.h +49 -0
  29. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.cpp +173 -0
  30. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.h +67 -0
  31. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.cpp +75 -0
  32. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.h +60 -0
  33. package/third-party/common/phonemis/src/phonemis/base/processor/common/types.h +18 -0
  34. package/third-party/common/phonemis/src/phonemis/base/processor/config.h +53 -0
  35. package/third-party/common/phonemis/src/phonemis/base/processor/layer.h +9 -7
  36. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/constants.h +20 -0
  37. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.cpp +89 -0
  38. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.h +35 -0
  39. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/types.h +16 -0
  40. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/kind.h +40 -0
  41. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/layer.h +382 -0
  42. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/notation.h +30 -0
  43. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.cpp +51 -0
  44. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.h +31 -0
  45. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern.h +30 -0
  46. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.cpp +17 -0
  47. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.h +31 -0
  48. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.cpp +811 -0
  49. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.h +285 -0
  50. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.cpp +64 -0
  51. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.h +23 -0
  52. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/types.h +94 -0
  53. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sanitizer/layer.cpp +19 -0
  54. package/third-party/common/phonemis/src/phonemis/base/processor/{sanitizer_layer.h → layers/sanitizer/layer.h} +8 -8
  55. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.cpp +65 -0
  56. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.h +29 -0
  57. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.cpp +170 -0
  58. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.h +40 -0
  59. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/types.h +25 -0
  60. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.cpp +47 -0
  61. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.h +19 -0
  62. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.cpp +60 -0
  63. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.h +45 -0
  64. package/third-party/common/phonemis/src/phonemis/base/processor/processor.cpp +6 -7
  65. package/third-party/common/phonemis/src/phonemis/base/processor/processor.h +14 -10
  66. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.cpp +89 -52
  67. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.h +16 -9
  68. package/third-party/common/phonemis/src/phonemis/base/tokenizer/tokenizer.cpp +13 -12
  69. package/third-party/common/phonemis/src/phonemis/lang/de/constants.h +183 -19
  70. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.cpp +355 -309
  71. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.h +42 -17
  72. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.cpp +56 -0
  73. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.h +15 -0
  74. package/third-party/common/phonemis/src/phonemis/lang/de/pipeline.h +3 -3
  75. package/third-party/common/phonemis/src/phonemis/lang/en/constants.h +181 -30
  76. package/third-party/common/phonemis/src/phonemis/lang/en/hmm_tagger.cpp +5 -7
  77. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.cpp +232 -135
  78. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.h +41 -16
  79. package/third-party/common/phonemis/src/phonemis/lang/en/pipeline.h +3 -10
  80. package/third-party/common/phonemis/src/phonemis/lang/es/constants.h +182 -60
  81. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.cpp +247 -212
  82. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.h +38 -18
  83. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.cpp +50 -0
  84. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.h +15 -0
  85. package/third-party/common/phonemis/src/phonemis/lang/es/pipeline.h +3 -3
  86. package/third-party/common/phonemis/src/phonemis/lang/fr/constants.h +152 -26
  87. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.cpp +252 -179
  88. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.h +38 -15
  89. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.cpp +83 -0
  90. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.h +15 -0
  91. package/third-party/common/phonemis/src/phonemis/lang/fr/pipeline.h +3 -3
  92. package/third-party/common/phonemis/src/phonemis/lang/hi/constants.h +62 -10
  93. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.cpp +74 -123
  94. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.h +27 -16
  95. package/third-party/common/phonemis/src/phonemis/lang/hi/pipeline.h +5 -3
  96. package/third-party/common/phonemis/src/phonemis/lang/it/constants.h +122 -42
  97. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.cpp +200 -207
  98. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.h +30 -18
  99. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.cpp +25 -0
  100. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.h +15 -0
  101. package/third-party/common/phonemis/src/phonemis/lang/it/pipeline.h +3 -3
  102. package/third-party/common/phonemis/src/phonemis/lang/pl/constants.h +346 -77
  103. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.cpp +631 -246
  104. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.h +47 -15
  105. package/third-party/common/phonemis/src/phonemis/lang/pl/pipeline.h +6 -6
  106. package/third-party/common/phonemis/src/phonemis/lang/pt/constants.h +201 -0
  107. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.cpp +365 -0
  108. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.h +53 -0
  109. package/third-party/common/phonemis/src/phonemis/lang/pt/pipeline.h +4 -2
  110. package/third-party/common/phonemis/src/phonemis/main.cpp +42 -11
  111. package/third-party/common/phonemis/src/phonemis/protophone/meta.h +24 -0
  112. package/third-party/common/phonemis/src/phonemis/protophone/numeric.h +26 -0
  113. package/third-party/common/phonemis/src/phonemis/protophone/protophone.cpp +525 -0
  114. package/third-party/common/phonemis/src/phonemis/protophone/protophone.h +80 -0
  115. package/third-party/common/phonemis/src/phonemis/protophone/tensor.h +76 -0
  116. package/third-party/common/phonemis/src/phonemis/protophone/tensor_utils.h +89 -0
  117. package/third-party/common/phonemis/src/phonemis/protophone/tensor_view.h +125 -0
  118. package/third-party/common/phonemis/src/phonemis/protophone/types.h +43 -0
  119. package/third-party/common/phonemis/src/phonemis/utils/strings.h +20 -14
  120. package/third-party/common/phonemis/src/phonemis/utils/unicode.h +15 -1
  121. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
  122. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_bit.hpp +232 -0
  123. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
  124. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
  125. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_details.hpp +386 -0
  126. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
  127. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
  128. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
  129. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
  130. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
  131. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
  132. package/third-party/common/phonemis/src/third-party/xsimd/arch/utils/shifts.hpp +82 -0
  133. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx.hpp +2111 -0
  134. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2.hpp +1591 -0
  135. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2_128.hpp +170 -0
  136. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512bw.hpp +724 -0
  137. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512cd.hpp +28 -0
  138. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512dq.hpp +270 -0
  139. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512er.hpp +17 -0
  140. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512f.hpp +2919 -0
  141. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
  142. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512pf.hpp +17 -0
  143. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
  144. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
  145. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
  146. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
  147. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx_128.hpp +164 -0
  148. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avxvnni.hpp +17 -0
  149. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common.hpp +26 -0
  150. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common_fwd.hpp +127 -0
  151. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_constants.hpp +393 -0
  152. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_emulated.hpp +787 -0
  153. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
  154. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
  155. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
  156. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma4.hpp +92 -0
  157. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
  158. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_isa.hpp +148 -0
  159. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon.hpp +3580 -0
  160. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon64.hpp +1614 -0
  161. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_rvv.hpp +1515 -0
  162. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_scalar.hpp +1210 -0
  163. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse2.hpp +2333 -0
  164. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse3.hpp +66 -0
  165. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_1.hpp +510 -0
  166. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_2.hpp +44 -0
  167. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_ssse3.hpp +186 -0
  168. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sve.hpp +1186 -0
  169. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vsx.hpp +947 -0
  170. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vxe.hpp +787 -0
  171. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_wasm.hpp +1819 -0
  172. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_arch.hpp +242 -0
  173. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_config.hpp +633 -0
  174. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features.hpp +50 -0
  175. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
  176. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
  177. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
  178. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
  179. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_x86.hpp +1121 -0
  180. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpuid.hpp +144 -0
  181. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_getauxval.hpp +159 -0
  182. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_macros.hpp +78 -0
  183. package/third-party/common/phonemis/src/third-party/xsimd/math/xsimd_rem_pio2.hpp +707 -0
  184. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
  185. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_alignment.hpp +102 -0
  186. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_all_registers.hpp +57 -0
  187. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_api.hpp +3106 -0
  188. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx2_register.hpp +57 -0
  189. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
  190. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
  191. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
  192. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512er_register.hpp +51 -0
  193. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512f_register.hpp +77 -0
  194. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
  195. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
  196. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
  197. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
  198. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
  199. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
  200. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx_register.hpp +79 -0
  201. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
  202. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch.hpp +1666 -0
  203. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_constant.hpp +572 -0
  204. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_fwd.hpp +41 -0
  205. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_common_arch.hpp +49 -0
  206. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_emulated_register.hpp +80 -0
  207. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
  208. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
  209. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
  210. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma4_register.hpp +50 -0
  211. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
  212. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon64_register.hpp +55 -0
  213. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon_register.hpp +130 -0
  214. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_register.hpp +96 -0
  215. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_rvv_register.hpp +491 -0
  216. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse2_register.hpp +59 -0
  217. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse3_register.hpp +49 -0
  218. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
  219. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
  220. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_ssse3_register.hpp +48 -0
  221. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sve_register.hpp +216 -0
  222. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_traits.hpp +409 -0
  223. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_utils.hpp +462 -0
  224. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vsx_register.hpp +84 -0
  225. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vxe_register.hpp +86 -0
  226. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_wasm_register.hpp +59 -0
  227. package/third-party/common/phonemis/src/third-party/xsimd/utils/bits.hpp +122 -0
  228. package/third-party/common/phonemis/src/third-party/xsimd/utils/xsimd_type_traits.hpp +145 -0
  229. package/third-party/common/phonemis/src/third-party/xsimd/xsimd.hpp +43 -0
  230. package/third-party/common/phonemis/src/phonemis/base/processor/constants.h +0 -11
  231. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/config.h +0 -16
  232. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.cpp +0 -271
  233. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.h +0 -45
  234. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/types.h +0 -29
  235. package/third-party/common/phonemis/src/phonemis/base/processor/sanitizer_layer.cpp +0 -22
  236. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.cpp +0 -40
  237. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.h +0 -22
@@ -0,0 +1,1210 @@
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_SCALAR_HPP
13
+ #define XSIMD_SCALAR_HPP
14
+
15
+ #include <cassert>
16
+ #include <cmath>
17
+ #include <complex>
18
+ #include <cstdint>
19
+ #include <cstring>
20
+ #include <limits>
21
+ #include <type_traits>
22
+
23
+ #include "xsimd/config/xsimd_macros.hpp"
24
+
25
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
26
+ #include "xtl/xcomplex.hpp"
27
+ #endif
28
+
29
+ #ifdef __APPLE__
30
+ #include <AvailabilityMacros.h>
31
+ #endif
32
+
33
+ namespace xsimd
34
+ {
35
+ using std::abs;
36
+
37
+ using std::acos;
38
+ using std::acosh;
39
+ using std::arg;
40
+ using std::asin;
41
+ using std::asinh;
42
+ using std::atan;
43
+ using std::atan2;
44
+ using std::atanh;
45
+ using std::cbrt;
46
+ using std::ceil;
47
+ using std::conj;
48
+ using std::copysign;
49
+ using std::cos;
50
+ using std::cosh;
51
+ using std::erf;
52
+ using std::erfc;
53
+ using std::exp;
54
+ using std::exp2;
55
+ using std::expm1;
56
+ using std::fabs;
57
+ using std::fdim;
58
+ using std::floor;
59
+ using std::fmax;
60
+ using std::fmin;
61
+ using std::fmod;
62
+ using std::hypot;
63
+ using std::ldexp;
64
+ using std::lgamma;
65
+ using std::log;
66
+ using std::log10;
67
+ using std::log1p;
68
+ using std::log2;
69
+ using std::modf;
70
+ using std::nearbyint;
71
+ using std::nextafter;
72
+ using std::norm;
73
+ using std::polar;
74
+ using std::proj;
75
+ using std::remainder;
76
+ using std::rint;
77
+ using std::round;
78
+ using std::sin;
79
+ using std::sinh;
80
+ using std::sqrt;
81
+ using std::tan;
82
+ using std::tanh;
83
+ using std::tgamma;
84
+ using std::trunc;
85
+
86
+ template <typename T>
87
+ XSIMD_INLINE constexpr std::enable_if_t<std::is_integral<T>::value && std::is_signed<T>::value, T>
88
+ abs(T v) noexcept
89
+ {
90
+ return v < 0 ? -v : v;
91
+ }
92
+
93
+ template <typename T>
94
+ XSIMD_INLINE constexpr std::enable_if_t<std::is_integral<T>::value && std::is_unsigned<T>::value, T>
95
+ abs(T v) noexcept
96
+ {
97
+ return v;
98
+ }
99
+
100
+ #ifndef _WIN32
101
+ using std::isfinite;
102
+ using std::isinf;
103
+ using std::isnan;
104
+ #else
105
+
106
+ // Windows defines catch all templates
107
+ template <class T>
108
+ XSIMD_INLINE std::enable_if_t<std::is_floating_point<T>::value, bool>
109
+ isfinite(T var) noexcept
110
+ {
111
+ return std::isfinite(var);
112
+ }
113
+
114
+ template <class T>
115
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, bool>
116
+ isfinite(T var) noexcept
117
+ {
118
+ return isfinite(double(var));
119
+ }
120
+
121
+ template <class T>
122
+ XSIMD_INLINE std::enable_if_t<std::is_floating_point<T>::value, bool>
123
+ isinf(T var) noexcept
124
+ {
125
+ return std::isinf(var);
126
+ }
127
+
128
+ template <class T>
129
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, bool>
130
+ isinf(T var) noexcept
131
+ {
132
+ return isinf(double(var));
133
+ }
134
+
135
+ template <class T>
136
+ XSIMD_INLINE std::enable_if_t<std::is_floating_point<T>::value, bool>
137
+ isnan(T var) noexcept
138
+ {
139
+ return std::isnan(var);
140
+ }
141
+
142
+ template <class T>
143
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, bool>
144
+ isnan(T var) noexcept
145
+ {
146
+ return isnan(double(var));
147
+ }
148
+ #endif
149
+
150
+ template <class T, class Tp>
151
+ XSIMD_INLINE std::common_type_t<T, Tp> add(T const& x, Tp const& y) noexcept
152
+ {
153
+ return x + y;
154
+ }
155
+
156
+ template <class T, class Tp>
157
+ XSIMD_INLINE std::common_type_t<T, Tp> avg(T const& x, Tp const& y) noexcept
158
+ {
159
+ using common_type = std::common_type_t<T, Tp>;
160
+ if (std::is_floating_point<common_type>::value)
161
+ return (x + y) / 2;
162
+ else if (std::is_unsigned<common_type>::value)
163
+ {
164
+ return (x & y) + ((x ^ y) >> 1);
165
+ }
166
+ else
167
+ {
168
+ // Inspired by
169
+ // https://stackoverflow.com/questions/5697500/take-the-average-of-two-signed-numbers-in-c
170
+ auto t = (x & y) + ((x ^ y) >> 1);
171
+ auto t_u = static_cast<std::make_unsigned_t<common_type>>(t);
172
+ auto avg = t + (static_cast<T>(t_u >> (8 * sizeof(T) - 1)) & (x ^ y));
173
+ return avg;
174
+ }
175
+ }
176
+
177
+ template <class T, class Tp>
178
+ XSIMD_INLINE std::common_type_t<T, Tp> avgr(T const& x, Tp const& y) noexcept
179
+ {
180
+ using common_type = std::common_type_t<T, Tp>;
181
+ if (std::is_floating_point<common_type>::value)
182
+ return avg(x, y);
183
+ else
184
+ {
185
+ return avg(x, y) + ((x ^ y) & 1);
186
+ }
187
+ }
188
+
189
+ template <class T>
190
+ XSIMD_INLINE T incr(T const& x) noexcept
191
+ {
192
+ return x + T(1);
193
+ }
194
+
195
+ template <class T>
196
+ XSIMD_INLINE T incr_if(T const& x, bool mask) noexcept
197
+ {
198
+ return x + T(mask ? 1 : 0);
199
+ }
200
+
201
+ XSIMD_INLINE bool all(bool mask)
202
+ {
203
+ return mask;
204
+ }
205
+
206
+ XSIMD_INLINE bool any(bool mask)
207
+ {
208
+ return mask;
209
+ }
210
+
211
+ XSIMD_INLINE bool none(bool mask)
212
+ {
213
+ return !mask;
214
+ }
215
+
216
+ template <class T>
217
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T>
218
+ bitwise_and(T x, T y) noexcept
219
+ {
220
+ return x & y;
221
+ }
222
+
223
+ template <class T_out, class T_in>
224
+ XSIMD_INLINE T_out bitwise_cast(T_in x) noexcept
225
+ {
226
+ static_assert(sizeof(T_in) == sizeof(T_out), "bitwise_cast between types of the same size");
227
+ T_out r;
228
+ std::memcpy((void*)&r, (void*)&x, sizeof(T_in));
229
+ return r;
230
+ }
231
+
232
+ XSIMD_INLINE float bitwise_and(float x, float y) noexcept
233
+ {
234
+ uint32_t ix, iy;
235
+ std::memcpy((void*)&ix, (void*)&x, sizeof(float));
236
+ std::memcpy((void*)&iy, (void*)&y, sizeof(float));
237
+ uint32_t ir = bitwise_and(ix, iy);
238
+ float r;
239
+ std::memcpy((void*)&r, (void*)&ir, sizeof(float));
240
+ return r;
241
+ }
242
+
243
+ XSIMD_INLINE double bitwise_and(double x, double y) noexcept
244
+ {
245
+ uint64_t ix, iy;
246
+ std::memcpy((void*)&ix, (void*)&x, sizeof(double));
247
+ std::memcpy((void*)&iy, (void*)&y, sizeof(double));
248
+ uint64_t ir = bitwise_and(ix, iy);
249
+ double r;
250
+ std::memcpy((void*)&r, (void*)&ir, sizeof(double));
251
+ return r;
252
+ }
253
+
254
+ template <class T0, class T1>
255
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T0>::value && std::is_integral<T1>::value, T0>
256
+ bitwise_lshift(T0 x, T1 shift) noexcept
257
+ {
258
+ return x << shift;
259
+ }
260
+
261
+ template <size_t shift, class T>
262
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T>
263
+ bitwise_lshift(T x) noexcept
264
+ {
265
+ constexpr auto bits = std::numeric_limits<T>::digits + std::numeric_limits<T>::is_signed;
266
+ static_assert(shift < bits, "Count must be less than the number of bits in T");
267
+ return x << shift;
268
+ }
269
+
270
+ template <class T0, class T1>
271
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T0>::value && std::is_integral<T1>::value, T0>
272
+ bitwise_rshift(T0 x, T1 shift) noexcept
273
+ {
274
+ return x >> shift;
275
+ }
276
+ template <size_t shift, class T>
277
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T>
278
+ bitwise_rshift(T x) noexcept
279
+ {
280
+ constexpr auto bits = std::numeric_limits<T>::digits + std::numeric_limits<T>::is_signed;
281
+ static_assert(shift < bits, "Count must be less than the number of bits in T");
282
+ return x >> shift;
283
+ }
284
+
285
+ template <class T>
286
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T>
287
+ bitwise_not(T x) noexcept
288
+ {
289
+ return ~x;
290
+ }
291
+
292
+ XSIMD_INLINE bool bitwise_not(bool x) noexcept
293
+ {
294
+ return !x;
295
+ }
296
+
297
+ XSIMD_INLINE float bitwise_not(float x) noexcept
298
+ {
299
+ uint32_t ix;
300
+ std::memcpy((void*)&ix, (void*)&x, sizeof(float));
301
+ uint32_t ir = bitwise_not(ix);
302
+ float r;
303
+ std::memcpy((void*)&r, (void*)&ir, sizeof(float));
304
+ return r;
305
+ }
306
+
307
+ XSIMD_INLINE double bitwise_not(double x) noexcept
308
+ {
309
+ uint64_t ix;
310
+ std::memcpy((void*)&ix, (void*)&x, sizeof(double));
311
+ uint64_t ir = bitwise_not(ix);
312
+ double r;
313
+ std::memcpy((void*)&r, (void*)&ir, sizeof(double));
314
+ return r;
315
+ }
316
+
317
+ template <class T>
318
+ XSIMD_INLINE std::enable_if_t<std::is_scalar<T>::value, T> bitwise_andnot(T x, T y) noexcept
319
+ {
320
+ return bitwise_and(x, bitwise_not(y));
321
+ }
322
+
323
+ template <class T>
324
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T>
325
+ bitwise_or(T x, T y) noexcept
326
+ {
327
+ return x | y;
328
+ }
329
+
330
+ XSIMD_INLINE float bitwise_or(float x, float y) noexcept
331
+ {
332
+ uint32_t ix, iy;
333
+ std::memcpy((void*)&ix, (void*)&x, sizeof(float));
334
+ std::memcpy((void*)&iy, (void*)&y, sizeof(float));
335
+ uint32_t ir = bitwise_or(ix, iy);
336
+ float r;
337
+ std::memcpy((void*)&r, (void*)&ir, sizeof(float));
338
+ return r;
339
+ }
340
+
341
+ XSIMD_INLINE double bitwise_or(double x, double y) noexcept
342
+ {
343
+ uint64_t ix, iy;
344
+ std::memcpy((void*)&ix, (void*)&x, sizeof(double));
345
+ std::memcpy((void*)&iy, (void*)&y, sizeof(double));
346
+ uint64_t ir = bitwise_or(ix, iy);
347
+ double r;
348
+ std::memcpy((void*)&r, (void*)&ir, sizeof(double));
349
+ return r;
350
+ }
351
+
352
+ template <class T>
353
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T>
354
+ bitwise_xor(T x, T y) noexcept
355
+ {
356
+ return x ^ y;
357
+ }
358
+
359
+ XSIMD_INLINE float bitwise_xor(float x, float y) noexcept
360
+ {
361
+ uint32_t ix, iy;
362
+ std::memcpy((void*)&ix, (void*)&x, sizeof(float));
363
+ std::memcpy((void*)&iy, (void*)&y, sizeof(float));
364
+ uint32_t ir = bitwise_xor(ix, iy);
365
+ float r;
366
+ std::memcpy((void*)&r, (void*)&ir, sizeof(float));
367
+ return r;
368
+ }
369
+
370
+ XSIMD_INLINE double bitwise_xor(double x, double y) noexcept
371
+ {
372
+ uint64_t ix, iy;
373
+ std::memcpy((void*)&ix, (void*)&x, sizeof(double));
374
+ std::memcpy((void*)&iy, (void*)&y, sizeof(double));
375
+ uint64_t ir = bitwise_xor(ix, iy);
376
+ double r;
377
+ std::memcpy((void*)&r, (void*)&ir, sizeof(double));
378
+ return r;
379
+ }
380
+
381
+ template <class T, class Tp>
382
+ XSIMD_INLINE std::common_type_t<T, Tp> div(T const& x, Tp const& y) noexcept
383
+ {
384
+ return x / y;
385
+ }
386
+
387
+ template <class T, class Tp>
388
+ XSIMD_INLINE auto mod(T const& x, Tp const& y) noexcept
389
+ {
390
+ return x % y;
391
+ }
392
+
393
+ template <class T, class Tp>
394
+ XSIMD_INLINE std::common_type_t<T, Tp> mul(T const& x, Tp const& y) noexcept
395
+ {
396
+ return x * y;
397
+ }
398
+
399
+ template <class T>
400
+ XSIMD_INLINE T neg(T const& x) noexcept
401
+ {
402
+ return -x;
403
+ }
404
+
405
+ template <class T>
406
+ XSIMD_INLINE auto pos(T const& x) noexcept
407
+ {
408
+ return +x;
409
+ }
410
+
411
+ XSIMD_INLINE float reciprocal(float const& x) noexcept
412
+ {
413
+ return 1.f / x;
414
+ }
415
+
416
+ XSIMD_INLINE double reciprocal(double const& x) noexcept
417
+ {
418
+ return 1. / x;
419
+ }
420
+
421
+ template <class T0, class T1>
422
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T0>::value && std::is_integral<T1>::value, T0>
423
+ rotl(T0 x, T1 shift) noexcept
424
+ {
425
+ constexpr auto bits = std::numeric_limits<T0>::digits + std::numeric_limits<T0>::is_signed;
426
+ return (x << shift) | (x >> (bits - shift));
427
+ }
428
+ template <size_t count, class T>
429
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T>
430
+ rotl(T x) noexcept
431
+ {
432
+ constexpr auto bits = std::numeric_limits<T>::digits + std::numeric_limits<T>::is_signed;
433
+ static_assert(count < bits, "Count must be less than the number of bits in T");
434
+ return (x << count) | (x >> (bits - count));
435
+ }
436
+
437
+ template <class T0, class T1>
438
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T0>::value && std::is_integral<T1>::value, T0>
439
+ rotr(T0 x, T1 shift) noexcept
440
+ {
441
+ constexpr auto bits = std::numeric_limits<T0>::digits + std::numeric_limits<T0>::is_signed;
442
+ return (x >> shift) | (x << (bits - shift));
443
+ }
444
+ template <size_t count, class T>
445
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T>
446
+ rotr(T x) noexcept
447
+ {
448
+ constexpr auto bits = std::numeric_limits<T>::digits + std::numeric_limits<T>::is_signed;
449
+ static_assert(count < bits, "Count must be less than the number of bits in T");
450
+ return (x >> count) | (x << (bits - count));
451
+ }
452
+
453
+ template <class T>
454
+ XSIMD_INLINE bool isnan(std::complex<T> var) noexcept
455
+ {
456
+ return std::isnan(std::real(var)) || std::isnan(std::imag(var));
457
+ }
458
+
459
+ template <class T>
460
+ XSIMD_INLINE bool isinf(std::complex<T> var) noexcept
461
+ {
462
+ return std::isinf(std::real(var)) || std::isinf(std::imag(var));
463
+ }
464
+
465
+ template <class T>
466
+ XSIMD_INLINE bool isfinite(std::complex<T> var) noexcept
467
+ {
468
+ return std::isfinite(std::real(var)) && std::isfinite(std::imag(var));
469
+ }
470
+
471
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
472
+ using xtl::abs;
473
+ using xtl::acos;
474
+ using xtl::acosh;
475
+ using xtl::asin;
476
+ using xtl::asinh;
477
+ using xtl::atan;
478
+ using xtl::atanh;
479
+ using xtl::cos;
480
+ using xtl::cosh;
481
+ using xtl::exp;
482
+ using xtl::log;
483
+ using xtl::log10;
484
+ using xtl::norm;
485
+ using xtl::pow;
486
+ using xtl::proj;
487
+ using xtl::sin;
488
+ using xtl::sinh;
489
+ using xtl::sqrt;
490
+ using xtl::tan;
491
+ using xtl::tanh;
492
+ #endif
493
+
494
+ template <typename T, class = std::enable_if_t<std::is_scalar<T>::value>>
495
+ XSIMD_INLINE T clip(const T& val, const T& low, const T& hi) noexcept
496
+ {
497
+ assert(low <= hi && "ordered clipping bounds");
498
+ return low > val ? low : (hi < val ? hi : val);
499
+ }
500
+
501
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
502
+ XSIMD_INLINE bool is_flint(const T& x) noexcept
503
+ {
504
+ #ifdef __FAST_MATH__
505
+ return (x - std::trunc(x)) == T(0);
506
+ #else
507
+ return std::isnan(x - x) ? false : (x - std::trunc(x)) == T(0);
508
+ #endif
509
+ }
510
+
511
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
512
+ XSIMD_INLINE bool is_even(const T& x) noexcept
513
+ {
514
+ return is_flint(x * T(0.5));
515
+ }
516
+
517
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
518
+ XSIMD_INLINE bool is_odd(const T& x) noexcept
519
+ {
520
+ return is_even(x - 1.);
521
+ }
522
+
523
+ XSIMD_INLINE int32_t nearbyint_as_int(float var) noexcept
524
+ {
525
+ return static_cast<int32_t>(std::nearbyint(var));
526
+ }
527
+
528
+ XSIMD_INLINE int64_t nearbyint_as_int(double var) noexcept
529
+ {
530
+ return static_cast<int64_t>(std::nearbyint(var));
531
+ }
532
+
533
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
534
+ XSIMD_INLINE bool eq(const T& x0, const T& x1) noexcept
535
+ {
536
+ return x0 == x1;
537
+ }
538
+
539
+ template <class T>
540
+ XSIMD_INLINE bool eq(const std::complex<T>& x0, const std::complex<T>& x1) noexcept
541
+ {
542
+ return x0 == x1;
543
+ }
544
+
545
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
546
+ XSIMD_INLINE bool ge(const T& x0, const T& x1) noexcept
547
+ {
548
+ return x0 >= x1;
549
+ }
550
+
551
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
552
+ XSIMD_INLINE bool gt(const T& x0, const T& x1) noexcept
553
+ {
554
+ return x0 > x1;
555
+ }
556
+
557
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
558
+ XSIMD_INLINE bool le(const T& x0, const T& x1) noexcept
559
+ {
560
+ return x0 <= x1;
561
+ }
562
+
563
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
564
+ XSIMD_INLINE bool lt(const T& x0, const T& x1) noexcept
565
+ {
566
+ return x0 < x1;
567
+ }
568
+
569
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
570
+ XSIMD_INLINE bool neq(const T& x0, const T& x1) noexcept
571
+ {
572
+ return x0 != x1;
573
+ }
574
+
575
+ template <class T>
576
+ XSIMD_INLINE bool neq(const std::complex<T>& x0, const std::complex<T>& x1) noexcept
577
+ {
578
+ return !(x0 == x1);
579
+ }
580
+
581
+ #if defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED > 1080)
582
+ XSIMD_INLINE float exp10(const float& x) noexcept
583
+ {
584
+ return __exp10f(x);
585
+ }
586
+ XSIMD_INLINE double exp10(const double& x) noexcept
587
+ {
588
+ return __exp10(x);
589
+ }
590
+ #elif defined(__GLIBC__)
591
+ XSIMD_INLINE float exp10(const float& x) noexcept
592
+ {
593
+ return ::exp10f(x);
594
+ }
595
+ XSIMD_INLINE double exp10(const double& x) noexcept
596
+ {
597
+ return ::exp10(x);
598
+ }
599
+ #elif !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 5)
600
+ XSIMD_INLINE float exp10(const float& x) noexcept
601
+ {
602
+ return __builtin_exp10f(x);
603
+ }
604
+ XSIMD_INLINE double exp10(const double& x) noexcept
605
+ {
606
+ return __builtin_exp10(x);
607
+ }
608
+ #elif defined(_WIN32)
609
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
610
+ XSIMD_INLINE T exp10(const T& x) noexcept
611
+ {
612
+ // Very inefficient but other implementations give incorrect results
613
+ // on Windows
614
+ return std::pow(T(10), x);
615
+ }
616
+ #else
617
+ XSIMD_INLINE float exp10(const float& x) noexcept
618
+ {
619
+ const float ln10 = std::log(10.f);
620
+ return std::exp(ln10 * x);
621
+ }
622
+ XSIMD_INLINE double exp10(const double& x) noexcept
623
+ {
624
+ const double ln10 = std::log(10.);
625
+ return std::exp(ln10 * x);
626
+ }
627
+ #endif
628
+
629
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
630
+ XSIMD_INLINE auto rsqrt(const T& x) noexcept
631
+ {
632
+ using float_type = decltype(std::sqrt(x));
633
+ return static_cast<float_type>(1) / std::sqrt(x);
634
+ }
635
+
636
+ namespace detail
637
+ {
638
+ template <class C>
639
+ XSIMD_INLINE C expm1_complex_scalar_impl(const C& val) noexcept
640
+ {
641
+ using T = typename C::value_type;
642
+ T isin = std::sin(val.imag());
643
+ T rem1 = std::expm1(val.real());
644
+ T re = rem1 + T(1.);
645
+ T si = std::sin(val.imag() * T(0.5));
646
+ return std::complex<T>(rem1 - T(2.) * re * si * si, re * isin);
647
+ }
648
+ }
649
+
650
+ template <class T>
651
+ XSIMD_INLINE std::complex<T> expm1(const std::complex<T>& val) noexcept
652
+ {
653
+ return detail::expm1_complex_scalar_impl(val);
654
+ }
655
+
656
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
657
+ template <class T, bool i3ec>
658
+ XSIMD_INLINE xtl::xcomplex<T, T, i3ec> expm1(const xtl::xcomplex<T, T, i3ec>& val) noexcept
659
+ {
660
+ return detail::expm1_complex_scalar_impl(val);
661
+ }
662
+ #endif
663
+
664
+ namespace detail
665
+ {
666
+ template <class C>
667
+ XSIMD_INLINE C log1p_complex_scalar_impl(const C& val) noexcept
668
+ {
669
+ using T = typename C::value_type;
670
+ C u = C(1.) + val;
671
+ return u == C(1.) ? val : (u.real() <= T(0.) ? log(u) : log(u) * val / (u - C(1.)));
672
+ }
673
+ }
674
+
675
+ template <class T>
676
+ XSIMD_INLINE std::complex<T> log1p(const std::complex<T>& val) noexcept
677
+ {
678
+ return detail::log1p_complex_scalar_impl(val);
679
+ }
680
+
681
+ template <class T>
682
+ XSIMD_INLINE std::complex<T> log2(const std::complex<T>& val) noexcept
683
+ {
684
+ return log(val) / std::log(T(2));
685
+ }
686
+
687
+ template <typename T, class = std::enable_if_t<std::is_scalar<T>::value>>
688
+ XSIMD_INLINE T sadd(const T& lhs, const T& rhs) noexcept
689
+ {
690
+ if (std::numeric_limits<T>::is_signed)
691
+ {
692
+ if ((lhs > 0) && (rhs > std::numeric_limits<T>::max() - lhs))
693
+ {
694
+ return std::numeric_limits<T>::max();
695
+ }
696
+ else if ((lhs < 0) && (rhs < std::numeric_limits<T>::lowest() - lhs))
697
+ {
698
+ return std::numeric_limits<T>::lowest();
699
+ }
700
+ else
701
+ {
702
+ return lhs + rhs;
703
+ }
704
+ }
705
+ else
706
+ {
707
+ if (rhs > std::numeric_limits<T>::max() - lhs)
708
+ {
709
+ return std::numeric_limits<T>::max();
710
+ }
711
+ else
712
+ {
713
+ return lhs + rhs;
714
+ }
715
+ }
716
+ }
717
+
718
+ template <typename T, class = std::enable_if_t<std::is_scalar<T>::value>>
719
+ XSIMD_INLINE T ssub(const T& lhs, const T& rhs) noexcept
720
+ {
721
+ if (std::numeric_limits<T>::is_signed)
722
+ {
723
+ return sadd(lhs, (T)-rhs);
724
+ }
725
+ else
726
+ {
727
+ if (lhs < rhs)
728
+ {
729
+ return std::numeric_limits<T>::lowest();
730
+ }
731
+ else
732
+ {
733
+ return lhs - rhs;
734
+ }
735
+ }
736
+ }
737
+
738
+ namespace detail
739
+ {
740
+ template <class T0, class T1>
741
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T1>::value, T0>
742
+ ipow(const T0& x, const T1& n) noexcept
743
+ {
744
+ static_assert(std::is_integral<T1>::value, "second argument must be an integer");
745
+ T0 a = x;
746
+ T1 b = n;
747
+ bool const recip = b < 0;
748
+ T0 r(static_cast<T0>(1));
749
+ while (1)
750
+ {
751
+ if (b & 1)
752
+ {
753
+ r *= a;
754
+ }
755
+ b /= 2;
756
+ if (b == 0)
757
+ {
758
+ break;
759
+ }
760
+ a *= a;
761
+ }
762
+ return recip ? static_cast<T0>(1) / r : r;
763
+ }
764
+ }
765
+
766
+ template <class T0, class T1>
767
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T1>::value, T0>
768
+ pow(const T0& x, const T1& n) noexcept
769
+ {
770
+ return detail::ipow(x, n);
771
+ }
772
+
773
+ template <class T0, class T1, class = std::enable_if_t<std::is_scalar<T0>::value && std::is_floating_point<T1>::value>>
774
+ XSIMD_INLINE auto
775
+ pow(const T0& t0, const T1& t1) noexcept
776
+ {
777
+ return std::pow(t0, t1);
778
+ }
779
+
780
+ template <class T0, class T1>
781
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T1>::value, std::complex<T0>>
782
+ pow(const std::complex<T0>& t0, const T1& t1) noexcept
783
+ {
784
+ return detail::ipow(t0, t1);
785
+ }
786
+
787
+ template <class T0, class T1>
788
+ XSIMD_INLINE std::enable_if_t<!std::is_integral<T1>::value, std::complex<T0>>
789
+ pow(const std::complex<T0>& t0, const T1& t1) noexcept
790
+ {
791
+ return std::pow(t0, t1);
792
+ }
793
+
794
+ template <class T0, class T1, class = std::enable_if_t<std::is_scalar<T0>::value>>
795
+ XSIMD_INLINE auto
796
+ pow(const T0& t0, const std::complex<T1>& t1) noexcept
797
+ {
798
+ return std::pow(t0, t1);
799
+ }
800
+
801
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
802
+ XSIMD_INLINE T bitofsign(T const& x) noexcept
803
+ {
804
+ return T(x < T(0));
805
+ }
806
+
807
+ XSIMD_INLINE float bitofsign(float const& x) noexcept
808
+ {
809
+ return float(std::signbit(x));
810
+ }
811
+
812
+ XSIMD_INLINE double bitofsign(double const& x) noexcept
813
+ {
814
+ return double(std::signbit(x));
815
+ }
816
+
817
+ XSIMD_INLINE long double bitofsign(long double const& x) noexcept
818
+ {
819
+ return static_cast<long double>(std::signbit(x));
820
+ }
821
+
822
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
823
+ XSIMD_INLINE auto signbit(T const& v) noexcept
824
+ {
825
+ return bitofsign(v);
826
+ }
827
+
828
+ XSIMD_INLINE double sign(bool const& v) noexcept
829
+ {
830
+ return v;
831
+ }
832
+
833
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
834
+ XSIMD_INLINE T sign(const T& v) noexcept
835
+ {
836
+ return v < T(0) ? T(-1.) : v == T(0) ? T(0.)
837
+ : T(1.);
838
+ }
839
+
840
+ namespace detail
841
+ {
842
+ template <class C>
843
+ XSIMD_INLINE C sign_complex_scalar_impl(const C& v) noexcept
844
+ {
845
+ using value_type = typename C::value_type;
846
+ if (v.real())
847
+ {
848
+ return C(sign(v.real()), value_type(0));
849
+ }
850
+ else
851
+ {
852
+ return C(sign(v.imag()), value_type(0));
853
+ }
854
+ }
855
+ }
856
+
857
+ template <class T>
858
+ XSIMD_INLINE std::complex<T> sign(const std::complex<T>& v) noexcept
859
+ {
860
+ return detail::sign_complex_scalar_impl(v);
861
+ }
862
+
863
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
864
+ template <class T, bool i3ec>
865
+ XSIMD_INLINE xtl::xcomplex<T, T, i3ec> sign(const xtl::xcomplex<T, T, i3ec>& v) noexcept
866
+ {
867
+ return detail::sign_complex_scalar_impl(v);
868
+ }
869
+ #endif
870
+
871
+ XSIMD_INLINE double signnz(bool const&) noexcept
872
+ {
873
+ return 1;
874
+ }
875
+
876
+ template <class T, class = std::enable_if_t<std::is_scalar<T>::value>>
877
+ XSIMD_INLINE T signnz(const T& v) noexcept
878
+ {
879
+ return v < T(0) ? T(-1.) : T(1.);
880
+ }
881
+
882
+ template <class T, class Tp>
883
+ XSIMD_INLINE std::common_type_t<T, Tp> sub(T const& x, Tp const& y) noexcept
884
+ {
885
+ return x - y;
886
+ }
887
+
888
+ template <class T>
889
+ XSIMD_INLINE T decr(T const& x) noexcept
890
+ {
891
+ return x - T(1);
892
+ }
893
+
894
+ template <class T>
895
+ XSIMD_INLINE T decr_if(T const& x, bool mask) noexcept
896
+ {
897
+ return x - T(mask ? 1 : 0);
898
+ }
899
+
900
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
901
+ template <class T, bool i3ec>
902
+ XSIMD_INLINE xtl::xcomplex<T, T, i3ec> log2(const xtl::xcomplex<T, T, i3ec>& val) noexcept
903
+ {
904
+ return log(val) / log(T(2));
905
+ }
906
+ #endif
907
+
908
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
909
+ template <class T, bool i3ec>
910
+ XSIMD_INLINE xtl::xcomplex<T, T, i3ec> log1p(const xtl::xcomplex<T, T, i3ec>& val) noexcept
911
+ {
912
+ return detail::log1p_complex_scalar_impl(val);
913
+ }
914
+ #endif
915
+
916
+ template <class T0, class T1, class = std::enable_if_t<std::is_scalar<T0>::value && std::is_scalar<T1>::value>>
917
+ XSIMD_INLINE auto min(T0 const& self, T1 const& other) noexcept
918
+ {
919
+ return self > other ? other : self;
920
+ }
921
+
922
+ // numpy defines minimum operator on complex using lexical comparison
923
+ template <class T0, class T1>
924
+ XSIMD_INLINE std::complex<std::common_type_t<T0, T1>>
925
+ min(std::complex<T0> const& self, std::complex<T1> const& other) noexcept
926
+ {
927
+ return (self.real() < other.real()) ? (self) : (self.real() == other.real() ? (self.imag() < other.imag() ? self : other) : other);
928
+ }
929
+
930
+ template <class T0, class T1, class = std::enable_if_t<std::is_scalar<T0>::value && std::is_scalar<T1>::value>>
931
+ XSIMD_INLINE auto max(T0 const& self, T1 const& other) noexcept
932
+ {
933
+ return self < other ? other : self;
934
+ }
935
+
936
+ // numpy defines maximum operator on complex using lexical comparison
937
+ template <class T0, class T1>
938
+ XSIMD_INLINE std::complex<std::common_type_t<T0, T1>>
939
+ max(std::complex<T0> const& self, std::complex<T1> const& other) noexcept
940
+ {
941
+ return (self.real() > other.real()) ? (self) : (self.real() == other.real() ? (self.imag() > other.imag() ? self : other) : other);
942
+ }
943
+
944
+ template <class T>
945
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T> fma(const T& a, const T& b, const T& c) noexcept
946
+ {
947
+ return a * b + c;
948
+ }
949
+
950
+ template <class T>
951
+ XSIMD_INLINE std::enable_if_t<std::is_floating_point<T>::value, T> fma(const T& a, const T& b, const T& c) noexcept
952
+ {
953
+ return std::fma(a, b, c);
954
+ }
955
+
956
+ template <class T>
957
+ XSIMD_INLINE std::enable_if_t<std::is_scalar<T>::value, T> fms(const T& a, const T& b, const T& c) noexcept
958
+ {
959
+ return a * b - c;
960
+ }
961
+
962
+ namespace detail
963
+ {
964
+ template <class C>
965
+ XSIMD_INLINE C fma_complex_scalar_impl(const C& a, const C& b, const C& c) noexcept
966
+ {
967
+ return { fms(a.real(), b.real(), fms(a.imag(), b.imag(), c.real())),
968
+ fma(a.real(), b.imag(), fma(a.imag(), b.real(), c.imag())) };
969
+ }
970
+ }
971
+
972
+ template <class T>
973
+ XSIMD_INLINE std::complex<T> fma(const std::complex<T>& a, const std::complex<T>& b, const std::complex<T>& c) noexcept
974
+ {
975
+ return detail::fma_complex_scalar_impl(a, b, c);
976
+ }
977
+
978
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
979
+ template <class T, bool i3ec>
980
+ XSIMD_INLINE xtl::xcomplex<T, T, i3ec> fma(const xtl::xcomplex<T, T, i3ec>& a, const xtl::xcomplex<T, T, i3ec>& b, const xtl::xcomplex<T, T, i3ec>& c) noexcept
981
+ {
982
+ return detail::fma_complex_scalar_impl(a, b, c);
983
+ }
984
+ #endif
985
+
986
+ namespace detail
987
+ {
988
+ template <class C>
989
+ XSIMD_INLINE C fms_complex_scalar_impl(const C& a, const C& b, const C& c) noexcept
990
+ {
991
+ return { fms(a.real(), b.real(), fma(a.imag(), b.imag(), c.real())),
992
+ fma(a.real(), b.imag(), fms(a.imag(), b.real(), c.imag())) };
993
+ }
994
+ }
995
+
996
+ template <class T>
997
+ XSIMD_INLINE std::complex<T> fms(const std::complex<T>& a, const std::complex<T>& b, const std::complex<T>& c) noexcept
998
+ {
999
+ return detail::fms_complex_scalar_impl(a, b, c);
1000
+ }
1001
+
1002
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
1003
+ template <class T, bool i3ec>
1004
+ XSIMD_INLINE xtl::xcomplex<T, T, i3ec> fms(const xtl::xcomplex<T, T, i3ec>& a, const xtl::xcomplex<T, T, i3ec>& b, const xtl::xcomplex<T, T, i3ec>& c) noexcept
1005
+ {
1006
+ return detail::fms_complex_scalar_impl(a, b, c);
1007
+ }
1008
+ #endif
1009
+
1010
+ template <class T>
1011
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T> fnma(const T& a, const T& b, const T& c) noexcept
1012
+ {
1013
+ return -(a * b) + c;
1014
+ }
1015
+
1016
+ template <class T>
1017
+ XSIMD_INLINE std::enable_if_t<std::is_floating_point<T>::value, T> fnma(const T& a, const T& b, const T& c) noexcept
1018
+ {
1019
+ return std::fma(-a, b, c);
1020
+ }
1021
+
1022
+ namespace detail
1023
+ {
1024
+ template <class C>
1025
+ XSIMD_INLINE C fnma_complex_scalar_impl(const C& a, const C& b, const C& c) noexcept
1026
+ {
1027
+ return { fms(a.imag(), b.imag(), fms(a.real(), b.real(), c.real())),
1028
+ -fma(a.real(), b.imag(), fms(a.imag(), b.real(), c.imag())) };
1029
+ }
1030
+ }
1031
+
1032
+ template <class T>
1033
+ XSIMD_INLINE std::complex<T> fnma(const std::complex<T>& a, const std::complex<T>& b, const std::complex<T>& c) noexcept
1034
+ {
1035
+ return detail::fnma_complex_scalar_impl(a, b, c);
1036
+ }
1037
+
1038
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
1039
+ template <class T, bool i3ec>
1040
+ XSIMD_INLINE xtl::xcomplex<T, T, i3ec> fnma(const xtl::xcomplex<T, T, i3ec>& a, const xtl::xcomplex<T, T, i3ec>& b, const xtl::xcomplex<T, T, i3ec>& c) noexcept
1041
+ {
1042
+ return detail::fnma_complex_scalar_impl(a, b, c);
1043
+ }
1044
+ #endif
1045
+
1046
+ template <class T>
1047
+ XSIMD_INLINE std::enable_if_t<std::is_integral<T>::value, T> fnms(const T& a, const T& b, const T& c) noexcept
1048
+ {
1049
+ return -(a * b) - c;
1050
+ }
1051
+
1052
+ template <class T>
1053
+ XSIMD_INLINE std::enable_if_t<std::is_floating_point<T>::value, T> fnms(const T& a, const T& b, const T& c) noexcept
1054
+ {
1055
+ return -std::fma(a, b, c);
1056
+ }
1057
+
1058
+ namespace detail
1059
+ {
1060
+ template <class C>
1061
+ XSIMD_INLINE C fnms_complex_scalar_impl(const C& a, const C& b, const C& c) noexcept
1062
+ {
1063
+ return { fms(a.imag(), b.imag(), fma(a.real(), b.real(), c.real())),
1064
+ -fma(a.real(), b.imag(), fma(a.imag(), b.real(), c.imag())) };
1065
+ }
1066
+ }
1067
+
1068
+ template <class T>
1069
+ XSIMD_INLINE std::complex<T> fnms(const std::complex<T>& a, const std::complex<T>& b, const std::complex<T>& c) noexcept
1070
+ {
1071
+ return detail::fnms_complex_scalar_impl(a, b, c);
1072
+ }
1073
+
1074
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
1075
+ template <class T, bool i3ec>
1076
+ XSIMD_INLINE xtl::xcomplex<T, T, i3ec> fnms(const xtl::xcomplex<T, T, i3ec>& a, const xtl::xcomplex<T, T, i3ec>& b, const xtl::xcomplex<T, T, i3ec>& c) noexcept
1077
+ {
1078
+ return detail::fnms_complex_scalar_impl(a, b, c);
1079
+ }
1080
+ #endif
1081
+
1082
+ namespace detail
1083
+ {
1084
+ #define XSIMD_HASSINCOS_TRAIT(func) \
1085
+ template <class S> \
1086
+ struct has##func \
1087
+ { \
1088
+ template <class T> \
1089
+ static XSIMD_INLINE auto get(T* ptr) -> decltype(func(std::declval<T>(), std::declval<T*>(), std::declval<T*>()), std::true_type {}); \
1090
+ static XSIMD_INLINE std::false_type get(...); \
1091
+ static constexpr bool value = decltype(get((S*)nullptr))::value; \
1092
+ }
1093
+
1094
+ #define XSIMD_HASSINCOS(func, T) has##func<T>::value
1095
+
1096
+ XSIMD_HASSINCOS_TRAIT(sincos);
1097
+ XSIMD_HASSINCOS_TRAIT(sincosf);
1098
+ XSIMD_HASSINCOS_TRAIT(__sincos);
1099
+ XSIMD_HASSINCOS_TRAIT(__sincosf);
1100
+
1101
+ struct common_sincosf
1102
+ {
1103
+ template <class T>
1104
+ XSIMD_INLINE std::enable_if_t<XSIMD_HASSINCOS(sincosf, T)>
1105
+ operator()(float val, T& s, T& c)
1106
+ {
1107
+ sincosf(val, &s, &c);
1108
+ }
1109
+
1110
+ template <class T>
1111
+ XSIMD_INLINE std::enable_if_t<!XSIMD_HASSINCOS(sincosf, T) && XSIMD_HASSINCOS(__sincosf, T)>
1112
+ operator()(float val, T& s, T& c)
1113
+ {
1114
+ __sincosf(val, &s, &c);
1115
+ }
1116
+
1117
+ template <class T>
1118
+ XSIMD_INLINE std::enable_if_t<!XSIMD_HASSINCOS(sincosf, T) && !XSIMD_HASSINCOS(__sincosf, T)>
1119
+ operator()(float val, T& s, T& c)
1120
+ {
1121
+ s = std::sin(val);
1122
+ c = std::cos(val);
1123
+ }
1124
+ };
1125
+
1126
+ struct common_sincos
1127
+ {
1128
+ template <class T>
1129
+ XSIMD_INLINE std::enable_if_t<XSIMD_HASSINCOS(sincos, T)>
1130
+ operator()(double val, T& s, T& c)
1131
+ {
1132
+ sincos(val, &s, &c);
1133
+ }
1134
+
1135
+ template <class T>
1136
+ XSIMD_INLINE std::enable_if_t<!XSIMD_HASSINCOS(sincos, T) && XSIMD_HASSINCOS(__sincos, T)>
1137
+ operator()(double val, T& s, T& c)
1138
+ {
1139
+ __sincos(val, &s, &c);
1140
+ }
1141
+
1142
+ template <class T>
1143
+ XSIMD_INLINE std::enable_if_t<!XSIMD_HASSINCOS(sincos, T) && !XSIMD_HASSINCOS(__sincos, T)>
1144
+ operator()(double val, T& s, T& c)
1145
+ {
1146
+ s = std::sin(val);
1147
+ c = std::cos(val);
1148
+ }
1149
+ };
1150
+
1151
+ #undef XSIMD_HASSINCOS_TRAIT
1152
+ #undef XSIMD_HASSINCOS
1153
+ }
1154
+
1155
+ XSIMD_INLINE std::pair<float, float> sincos(float val) noexcept
1156
+ {
1157
+ float s, c;
1158
+ detail::common_sincosf {}(val, s, c);
1159
+ return std::make_pair(s, c);
1160
+ }
1161
+
1162
+ XSIMD_INLINE std::pair<double, double> sincos(double val) noexcept
1163
+ {
1164
+ double s, c;
1165
+ detail::common_sincos {}(val, s, c);
1166
+ return std::make_pair(s, c);
1167
+ }
1168
+
1169
+ template <class T>
1170
+ XSIMD_INLINE std::pair<std::complex<T>, std::complex<T>>
1171
+ sincos(const std::complex<T>& val) noexcept
1172
+ {
1173
+ return std::make_pair(std::sin(val), std::cos(val));
1174
+ }
1175
+
1176
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
1177
+ template <class T>
1178
+ XSIMD_INLINE std::pair<xtl::xcomplex<T>, xtl::xcomplex<T>> sincos(const xtl::xcomplex<T>& val) noexcept
1179
+ {
1180
+ return std::make_pair(sin(val), cos(val));
1181
+ }
1182
+ #endif
1183
+
1184
+ template <class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
1185
+ XSIMD_INLINE T frexp(T const& val, int& exp) noexcept
1186
+ {
1187
+ return std::frexp(val, &exp);
1188
+ }
1189
+
1190
+ template <class T>
1191
+ XSIMD_INLINE T select(bool cond, T const& true_br, T const& false_br) noexcept
1192
+ {
1193
+ return cond ? true_br : false_br;
1194
+ }
1195
+
1196
+ template <class T>
1197
+ XSIMD_INLINE constexpr bool batch_bool_cast(bool b) noexcept
1198
+ {
1199
+ return b;
1200
+ }
1201
+
1202
+ template <class T_out, class T_in>
1203
+ XSIMD_INLINE constexpr T_out batch_cast(T_in const& val) noexcept
1204
+ {
1205
+ static_assert(!std::is_same<T_out, bool>::value, "cannot convert to bool, use !x or x != 0");
1206
+ return static_cast<T_out>(val);
1207
+ }
1208
+ }
1209
+
1210
+ #endif