numba-cuda 0.0.0__py3-none-any.whl → 0.0.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. _numba_cuda_redirector.pth +1 -0
  2. _numba_cuda_redirector.py +74 -0
  3. numba_cuda/VERSION +1 -0
  4. numba_cuda/__init__.py +5 -0
  5. numba_cuda/_version.py +19 -0
  6. numba_cuda/numba/cuda/__init__.py +22 -0
  7. numba_cuda/numba/cuda/api.py +526 -0
  8. numba_cuda/numba/cuda/api_util.py +30 -0
  9. numba_cuda/numba/cuda/args.py +77 -0
  10. numba_cuda/numba/cuda/cg.py +62 -0
  11. numba_cuda/numba/cuda/codegen.py +378 -0
  12. numba_cuda/numba/cuda/compiler.py +422 -0
  13. numba_cuda/numba/cuda/cpp_function_wrappers.cu +47 -0
  14. numba_cuda/numba/cuda/cuda_fp16.h +3631 -0
  15. numba_cuda/numba/cuda/cuda_fp16.hpp +2465 -0
  16. numba_cuda/numba/cuda/cuda_paths.py +258 -0
  17. numba_cuda/numba/cuda/cudadecl.py +806 -0
  18. numba_cuda/numba/cuda/cudadrv/__init__.py +9 -0
  19. numba_cuda/numba/cuda/cudadrv/devicearray.py +904 -0
  20. numba_cuda/numba/cuda/cudadrv/devices.py +248 -0
  21. numba_cuda/numba/cuda/cudadrv/driver.py +3201 -0
  22. numba_cuda/numba/cuda/cudadrv/drvapi.py +398 -0
  23. numba_cuda/numba/cuda/cudadrv/dummyarray.py +452 -0
  24. numba_cuda/numba/cuda/cudadrv/enums.py +607 -0
  25. numba_cuda/numba/cuda/cudadrv/error.py +36 -0
  26. numba_cuda/numba/cuda/cudadrv/libs.py +176 -0
  27. numba_cuda/numba/cuda/cudadrv/ndarray.py +20 -0
  28. numba_cuda/numba/cuda/cudadrv/nvrtc.py +260 -0
  29. numba_cuda/numba/cuda/cudadrv/nvvm.py +707 -0
  30. numba_cuda/numba/cuda/cudadrv/rtapi.py +10 -0
  31. numba_cuda/numba/cuda/cudadrv/runtime.py +142 -0
  32. numba_cuda/numba/cuda/cudaimpl.py +1055 -0
  33. numba_cuda/numba/cuda/cudamath.py +140 -0
  34. numba_cuda/numba/cuda/decorators.py +189 -0
  35. numba_cuda/numba/cuda/descriptor.py +33 -0
  36. numba_cuda/numba/cuda/device_init.py +89 -0
  37. numba_cuda/numba/cuda/deviceufunc.py +908 -0
  38. numba_cuda/numba/cuda/dispatcher.py +1057 -0
  39. numba_cuda/numba/cuda/errors.py +59 -0
  40. numba_cuda/numba/cuda/extending.py +7 -0
  41. numba_cuda/numba/cuda/initialize.py +13 -0
  42. numba_cuda/numba/cuda/intrinsic_wrapper.py +77 -0
  43. numba_cuda/numba/cuda/intrinsics.py +198 -0
  44. numba_cuda/numba/cuda/kernels/__init__.py +0 -0
  45. numba_cuda/numba/cuda/kernels/reduction.py +262 -0
  46. numba_cuda/numba/cuda/kernels/transpose.py +65 -0
  47. numba_cuda/numba/cuda/libdevice.py +3382 -0
  48. numba_cuda/numba/cuda/libdevicedecl.py +17 -0
  49. numba_cuda/numba/cuda/libdevicefuncs.py +1057 -0
  50. numba_cuda/numba/cuda/libdeviceimpl.py +83 -0
  51. numba_cuda/numba/cuda/mathimpl.py +448 -0
  52. numba_cuda/numba/cuda/models.py +48 -0
  53. numba_cuda/numba/cuda/nvvmutils.py +235 -0
  54. numba_cuda/numba/cuda/printimpl.py +86 -0
  55. numba_cuda/numba/cuda/random.py +292 -0
  56. numba_cuda/numba/cuda/simulator/__init__.py +38 -0
  57. numba_cuda/numba/cuda/simulator/api.py +110 -0
  58. numba_cuda/numba/cuda/simulator/compiler.py +9 -0
  59. numba_cuda/numba/cuda/simulator/cudadrv/__init__.py +2 -0
  60. numba_cuda/numba/cuda/simulator/cudadrv/devicearray.py +432 -0
  61. numba_cuda/numba/cuda/simulator/cudadrv/devices.py +117 -0
  62. numba_cuda/numba/cuda/simulator/cudadrv/driver.py +62 -0
  63. numba_cuda/numba/cuda/simulator/cudadrv/drvapi.py +4 -0
  64. numba_cuda/numba/cuda/simulator/cudadrv/dummyarray.py +4 -0
  65. numba_cuda/numba/cuda/simulator/cudadrv/error.py +6 -0
  66. numba_cuda/numba/cuda/simulator/cudadrv/libs.py +2 -0
  67. numba_cuda/numba/cuda/simulator/cudadrv/nvvm.py +29 -0
  68. numba_cuda/numba/cuda/simulator/cudadrv/runtime.py +19 -0
  69. numba_cuda/numba/cuda/simulator/kernel.py +308 -0
  70. numba_cuda/numba/cuda/simulator/kernelapi.py +495 -0
  71. numba_cuda/numba/cuda/simulator/reduction.py +15 -0
  72. numba_cuda/numba/cuda/simulator/vector_types.py +58 -0
  73. numba_cuda/numba/cuda/simulator_init.py +17 -0
  74. numba_cuda/numba/cuda/stubs.py +902 -0
  75. numba_cuda/numba/cuda/target.py +440 -0
  76. numba_cuda/numba/cuda/testing.py +202 -0
  77. numba_cuda/numba/cuda/tests/__init__.py +58 -0
  78. numba_cuda/numba/cuda/tests/cudadrv/__init__.py +8 -0
  79. numba_cuda/numba/cuda/tests/cudadrv/test_array_attr.py +145 -0
  80. numba_cuda/numba/cuda/tests/cudadrv/test_context_stack.py +145 -0
  81. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_array_slicing.py +375 -0
  82. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_auto_context.py +21 -0
  83. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_devicerecord.py +179 -0
  84. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_driver.py +235 -0
  85. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_libraries.py +22 -0
  86. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_memory.py +193 -0
  87. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_ndarray.py +547 -0
  88. numba_cuda/numba/cuda/tests/cudadrv/test_deallocations.py +249 -0
  89. numba_cuda/numba/cuda/tests/cudadrv/test_detect.py +81 -0
  90. numba_cuda/numba/cuda/tests/cudadrv/test_emm_plugins.py +192 -0
  91. numba_cuda/numba/cuda/tests/cudadrv/test_events.py +38 -0
  92. numba_cuda/numba/cuda/tests/cudadrv/test_host_alloc.py +65 -0
  93. numba_cuda/numba/cuda/tests/cudadrv/test_init.py +139 -0
  94. numba_cuda/numba/cuda/tests/cudadrv/test_inline_ptx.py +37 -0
  95. numba_cuda/numba/cuda/tests/cudadrv/test_is_fp16.py +12 -0
  96. numba_cuda/numba/cuda/tests/cudadrv/test_linker.py +317 -0
  97. numba_cuda/numba/cuda/tests/cudadrv/test_managed_alloc.py +127 -0
  98. numba_cuda/numba/cuda/tests/cudadrv/test_mvc.py +54 -0
  99. numba_cuda/numba/cuda/tests/cudadrv/test_nvvm_driver.py +199 -0
  100. numba_cuda/numba/cuda/tests/cudadrv/test_pinned.py +37 -0
  101. numba_cuda/numba/cuda/tests/cudadrv/test_profiler.py +20 -0
  102. numba_cuda/numba/cuda/tests/cudadrv/test_ptds.py +149 -0
  103. numba_cuda/numba/cuda/tests/cudadrv/test_reset_device.py +36 -0
  104. numba_cuda/numba/cuda/tests/cudadrv/test_runtime.py +85 -0
  105. numba_cuda/numba/cuda/tests/cudadrv/test_select_device.py +41 -0
  106. numba_cuda/numba/cuda/tests/cudadrv/test_streams.py +122 -0
  107. numba_cuda/numba/cuda/tests/cudapy/__init__.py +8 -0
  108. numba_cuda/numba/cuda/tests/cudapy/cache_usecases.py +234 -0
  109. numba_cuda/numba/cuda/tests/cudapy/cache_with_cpu_usecases.py +41 -0
  110. numba_cuda/numba/cuda/tests/cudapy/extensions_usecases.py +58 -0
  111. numba_cuda/numba/cuda/tests/cudapy/jitlink.ptx +30 -0
  112. numba_cuda/numba/cuda/tests/cudapy/recursion_usecases.py +100 -0
  113. numba_cuda/numba/cuda/tests/cudapy/test_alignment.py +42 -0
  114. numba_cuda/numba/cuda/tests/cudapy/test_array.py +260 -0
  115. numba_cuda/numba/cuda/tests/cudapy/test_array_args.py +201 -0
  116. numba_cuda/numba/cuda/tests/cudapy/test_array_methods.py +35 -0
  117. numba_cuda/numba/cuda/tests/cudapy/test_atomics.py +1620 -0
  118. numba_cuda/numba/cuda/tests/cudapy/test_blackscholes.py +120 -0
  119. numba_cuda/numba/cuda/tests/cudapy/test_boolean.py +24 -0
  120. numba_cuda/numba/cuda/tests/cudapy/test_caching.py +545 -0
  121. numba_cuda/numba/cuda/tests/cudapy/test_casting.py +257 -0
  122. numba_cuda/numba/cuda/tests/cudapy/test_cffi.py +33 -0
  123. numba_cuda/numba/cuda/tests/cudapy/test_compiler.py +276 -0
  124. numba_cuda/numba/cuda/tests/cudapy/test_complex.py +296 -0
  125. numba_cuda/numba/cuda/tests/cudapy/test_complex_kernel.py +20 -0
  126. numba_cuda/numba/cuda/tests/cudapy/test_const_string.py +129 -0
  127. numba_cuda/numba/cuda/tests/cudapy/test_constmem.py +176 -0
  128. numba_cuda/numba/cuda/tests/cudapy/test_cooperative_groups.py +147 -0
  129. numba_cuda/numba/cuda/tests/cudapy/test_cuda_array_interface.py +435 -0
  130. numba_cuda/numba/cuda/tests/cudapy/test_cuda_jit_no_types.py +90 -0
  131. numba_cuda/numba/cuda/tests/cudapy/test_datetime.py +94 -0
  132. numba_cuda/numba/cuda/tests/cudapy/test_debug.py +101 -0
  133. numba_cuda/numba/cuda/tests/cudapy/test_debuginfo.py +221 -0
  134. numba_cuda/numba/cuda/tests/cudapy/test_device_func.py +222 -0
  135. numba_cuda/numba/cuda/tests/cudapy/test_dispatcher.py +700 -0
  136. numba_cuda/numba/cuda/tests/cudapy/test_enums.py +121 -0
  137. numba_cuda/numba/cuda/tests/cudapy/test_errors.py +79 -0
  138. numba_cuda/numba/cuda/tests/cudapy/test_exception.py +174 -0
  139. numba_cuda/numba/cuda/tests/cudapy/test_extending.py +155 -0
  140. numba_cuda/numba/cuda/tests/cudapy/test_fastmath.py +244 -0
  141. numba_cuda/numba/cuda/tests/cudapy/test_forall.py +52 -0
  142. numba_cuda/numba/cuda/tests/cudapy/test_freevar.py +29 -0
  143. numba_cuda/numba/cuda/tests/cudapy/test_frexp_ldexp.py +66 -0
  144. numba_cuda/numba/cuda/tests/cudapy/test_globals.py +60 -0
  145. numba_cuda/numba/cuda/tests/cudapy/test_gufunc.py +456 -0
  146. numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scalar.py +159 -0
  147. numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scheduling.py +95 -0
  148. numba_cuda/numba/cuda/tests/cudapy/test_idiv.py +37 -0
  149. numba_cuda/numba/cuda/tests/cudapy/test_inspect.py +165 -0
  150. numba_cuda/numba/cuda/tests/cudapy/test_intrinsics.py +1106 -0
  151. numba_cuda/numba/cuda/tests/cudapy/test_ipc.py +318 -0
  152. numba_cuda/numba/cuda/tests/cudapy/test_iterators.py +99 -0
  153. numba_cuda/numba/cuda/tests/cudapy/test_lang.py +64 -0
  154. numba_cuda/numba/cuda/tests/cudapy/test_laplace.py +119 -0
  155. numba_cuda/numba/cuda/tests/cudapy/test_libdevice.py +187 -0
  156. numba_cuda/numba/cuda/tests/cudapy/test_lineinfo.py +199 -0
  157. numba_cuda/numba/cuda/tests/cudapy/test_localmem.py +164 -0
  158. numba_cuda/numba/cuda/tests/cudapy/test_mandel.py +37 -0
  159. numba_cuda/numba/cuda/tests/cudapy/test_math.py +786 -0
  160. numba_cuda/numba/cuda/tests/cudapy/test_matmul.py +74 -0
  161. numba_cuda/numba/cuda/tests/cudapy/test_minmax.py +113 -0
  162. numba_cuda/numba/cuda/tests/cudapy/test_montecarlo.py +22 -0
  163. numba_cuda/numba/cuda/tests/cudapy/test_multigpu.py +140 -0
  164. numba_cuda/numba/cuda/tests/cudapy/test_multiprocessing.py +46 -0
  165. numba_cuda/numba/cuda/tests/cudapy/test_multithreads.py +101 -0
  166. numba_cuda/numba/cuda/tests/cudapy/test_nondet.py +49 -0
  167. numba_cuda/numba/cuda/tests/cudapy/test_operator.py +401 -0
  168. numba_cuda/numba/cuda/tests/cudapy/test_optimization.py +86 -0
  169. numba_cuda/numba/cuda/tests/cudapy/test_overload.py +335 -0
  170. numba_cuda/numba/cuda/tests/cudapy/test_powi.py +124 -0
  171. numba_cuda/numba/cuda/tests/cudapy/test_print.py +128 -0
  172. numba_cuda/numba/cuda/tests/cudapy/test_py2_div_issue.py +33 -0
  173. numba_cuda/numba/cuda/tests/cudapy/test_random.py +104 -0
  174. numba_cuda/numba/cuda/tests/cudapy/test_record_dtype.py +610 -0
  175. numba_cuda/numba/cuda/tests/cudapy/test_recursion.py +125 -0
  176. numba_cuda/numba/cuda/tests/cudapy/test_reduction.py +76 -0
  177. numba_cuda/numba/cuda/tests/cudapy/test_retrieve_autoconverted_arrays.py +83 -0
  178. numba_cuda/numba/cuda/tests/cudapy/test_serialize.py +85 -0
  179. numba_cuda/numba/cuda/tests/cudapy/test_slicing.py +37 -0
  180. numba_cuda/numba/cuda/tests/cudapy/test_sm.py +444 -0
  181. numba_cuda/numba/cuda/tests/cudapy/test_sm_creation.py +205 -0
  182. numba_cuda/numba/cuda/tests/cudapy/test_sync.py +271 -0
  183. numba_cuda/numba/cuda/tests/cudapy/test_transpose.py +80 -0
  184. numba_cuda/numba/cuda/tests/cudapy/test_ufuncs.py +277 -0
  185. numba_cuda/numba/cuda/tests/cudapy/test_userexc.py +47 -0
  186. numba_cuda/numba/cuda/tests/cudapy/test_vector_type.py +307 -0
  187. numba_cuda/numba/cuda/tests/cudapy/test_vectorize.py +283 -0
  188. numba_cuda/numba/cuda/tests/cudapy/test_vectorize_complex.py +20 -0
  189. numba_cuda/numba/cuda/tests/cudapy/test_vectorize_decor.py +69 -0
  190. numba_cuda/numba/cuda/tests/cudapy/test_vectorize_device.py +36 -0
  191. numba_cuda/numba/cuda/tests/cudapy/test_vectorize_scalar_arg.py +37 -0
  192. numba_cuda/numba/cuda/tests/cudapy/test_warning.py +139 -0
  193. numba_cuda/numba/cuda/tests/cudapy/test_warp_ops.py +276 -0
  194. numba_cuda/numba/cuda/tests/cudasim/__init__.py +6 -0
  195. numba_cuda/numba/cuda/tests/cudasim/support.py +6 -0
  196. numba_cuda/numba/cuda/tests/cudasim/test_cudasim_issues.py +102 -0
  197. numba_cuda/numba/cuda/tests/data/__init__.py +0 -0
  198. numba_cuda/numba/cuda/tests/data/cuda_include.cu +5 -0
  199. numba_cuda/numba/cuda/tests/data/error.cu +7 -0
  200. numba_cuda/numba/cuda/tests/data/jitlink.cu +23 -0
  201. numba_cuda/numba/cuda/tests/data/jitlink.ptx +51 -0
  202. numba_cuda/numba/cuda/tests/data/warn.cu +7 -0
  203. numba_cuda/numba/cuda/tests/doc_examples/__init__.py +6 -0
  204. numba_cuda/numba/cuda/tests/doc_examples/ffi/__init__.py +0 -0
  205. numba_cuda/numba/cuda/tests/doc_examples/ffi/functions.cu +49 -0
  206. numba_cuda/numba/cuda/tests/doc_examples/test_cg.py +77 -0
  207. numba_cuda/numba/cuda/tests/doc_examples/test_cpu_gpu_compat.py +76 -0
  208. numba_cuda/numba/cuda/tests/doc_examples/test_ffi.py +82 -0
  209. numba_cuda/numba/cuda/tests/doc_examples/test_laplace.py +155 -0
  210. numba_cuda/numba/cuda/tests/doc_examples/test_matmul.py +173 -0
  211. numba_cuda/numba/cuda/tests/doc_examples/test_montecarlo.py +109 -0
  212. numba_cuda/numba/cuda/tests/doc_examples/test_random.py +59 -0
  213. numba_cuda/numba/cuda/tests/doc_examples/test_reduction.py +76 -0
  214. numba_cuda/numba/cuda/tests/doc_examples/test_sessionize.py +130 -0
  215. numba_cuda/numba/cuda/tests/doc_examples/test_ufunc.py +50 -0
  216. numba_cuda/numba/cuda/tests/doc_examples/test_vecadd.py +73 -0
  217. numba_cuda/numba/cuda/tests/nocuda/__init__.py +8 -0
  218. numba_cuda/numba/cuda/tests/nocuda/test_dummyarray.py +359 -0
  219. numba_cuda/numba/cuda/tests/nocuda/test_function_resolution.py +36 -0
  220. numba_cuda/numba/cuda/tests/nocuda/test_import.py +49 -0
  221. numba_cuda/numba/cuda/tests/nocuda/test_library_lookup.py +238 -0
  222. numba_cuda/numba/cuda/tests/nocuda/test_nvvm.py +54 -0
  223. numba_cuda/numba/cuda/types.py +37 -0
  224. numba_cuda/numba/cuda/ufuncs.py +662 -0
  225. numba_cuda/numba/cuda/vector_types.py +209 -0
  226. numba_cuda/numba/cuda/vectorizers.py +252 -0
  227. numba_cuda-0.0.12.dist-info/LICENSE +25 -0
  228. numba_cuda-0.0.12.dist-info/METADATA +68 -0
  229. numba_cuda-0.0.12.dist-info/RECORD +231 -0
  230. {numba_cuda-0.0.0.dist-info → numba_cuda-0.0.12.dist-info}/WHEEL +1 -1
  231. numba_cuda-0.0.0.dist-info/METADATA +0 -6
  232. numba_cuda-0.0.0.dist-info/RECORD +0 -5
  233. {numba_cuda-0.0.0.dist-info → numba_cuda-0.0.12.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,662 @@
1
+ """Contains information on how to translate different ufuncs for the CUDA
2
+ target. It is a database of different ufuncs and how each of its loops maps to
3
+ a function that implements the inner kernel of that ufunc (the inner kernel
4
+ being the per-element function).
5
+
6
+ Use get_ufunc_info() to get the information related to a ufunc.
7
+ """
8
+
9
+ import math
10
+ import numpy as np
11
+ from functools import lru_cache
12
+ from numba.core import typing
13
+ from numba.cuda.mathimpl import (get_unary_impl_for_fn_and_ty,
14
+ get_binary_impl_for_fn_and_ty)
15
+
16
+
17
+ def get_ufunc_info(ufunc_key):
18
+ return ufunc_db()[ufunc_key]
19
+
20
+
21
+ @lru_cache
22
+ def ufunc_db():
23
+ # Imports here are at function scope to avoid circular imports
24
+ from numba.cpython import cmathimpl, mathimpl, numbers
25
+ from numba.np import npyfuncs
26
+ from numba.np.numpy_support import numpy_version
27
+
28
+ def np_unary_impl(fn, context, builder, sig, args):
29
+ npyfuncs._check_arity_and_homogeneity(sig, args, 1)
30
+ impl = get_unary_impl_for_fn_and_ty(fn, sig.args[0])
31
+ return impl(context, builder, sig, args)
32
+
33
+ def np_binary_impl(fn, context, builder, sig, args):
34
+ npyfuncs._check_arity_and_homogeneity(sig, args, 2)
35
+ impl = get_binary_impl_for_fn_and_ty(fn, sig.args[0])
36
+ return impl(context, builder, sig, args)
37
+
38
+ def np_real_log_impl(context, builder, sig, args):
39
+ return np_unary_impl(math.log, context, builder, sig, args)
40
+
41
+ def np_real_log2_impl(context, builder, sig, args):
42
+ return np_unary_impl(math.log2, context, builder, sig, args)
43
+
44
+ def np_real_log10_impl(context, builder, sig, args):
45
+ return np_unary_impl(math.log10, context, builder, sig, args)
46
+
47
+ def np_real_sin_impl(context, builder, sig, args):
48
+ return np_unary_impl(math.sin, context, builder, sig, args)
49
+
50
+ def np_real_cos_impl(context, builder, sig, args):
51
+ return np_unary_impl(math.cos, context, builder, sig, args)
52
+
53
+ def np_real_tan_impl(context, builder, sig, args):
54
+ return np_unary_impl(math.tan, context, builder, sig, args)
55
+
56
+ def np_real_asin_impl(context, builder, sig, args):
57
+ return np_unary_impl(math.asin, context, builder, sig, args)
58
+
59
+ def np_real_acos_impl(context, builder, sig, args):
60
+ return np_unary_impl(math.acos, context, builder, sig, args)
61
+
62
+ def np_real_atan_impl(context, builder, sig, args):
63
+ return np_unary_impl(math.atan, context, builder, sig, args)
64
+
65
+ def np_real_atan2_impl(context, builder, sig, args):
66
+ return np_binary_impl(math.atan2, context, builder, sig, args)
67
+
68
+ def np_real_hypot_impl(context, builder, sig, args):
69
+ return np_binary_impl(math.hypot, context, builder, sig, args)
70
+
71
+ def np_real_sinh_impl(context, builder, sig, args):
72
+ return np_unary_impl(math.sinh, context, builder, sig, args)
73
+
74
+ def np_complex_sinh_impl(context, builder, sig, args):
75
+ # npymath does not provide a complex sinh. The code in funcs.inc.src
76
+ # is translated here...
77
+ npyfuncs._check_arity_and_homogeneity(sig, args, 1)
78
+
79
+ ty = sig.args[0]
80
+ fty = ty.underlying_float
81
+ fsig1 = typing.signature(*[fty] * 2)
82
+ x = context.make_complex(builder, ty, args[0])
83
+ out = context.make_complex(builder, ty)
84
+ xr = x.real
85
+ xi = x.imag
86
+
87
+ sxi = np_real_sin_impl(context, builder, fsig1, [xi])
88
+ shxr = np_real_sinh_impl(context, builder, fsig1, [xr])
89
+ cxi = np_real_cos_impl(context, builder, fsig1, [xi])
90
+ chxr = np_real_cosh_impl(context, builder, fsig1, [xr])
91
+
92
+ out.real = builder.fmul(cxi, shxr)
93
+ out.imag = builder.fmul(sxi, chxr)
94
+
95
+ return out._getvalue()
96
+
97
+ def np_real_cosh_impl(context, builder, sig, args):
98
+ return np_unary_impl(math.cosh, context, builder, sig, args)
99
+
100
+ def np_complex_cosh_impl(context, builder, sig, args):
101
+ # npymath does not provide a complex cosh. The code in funcs.inc.src
102
+ # is translated here...
103
+ npyfuncs._check_arity_and_homogeneity(sig, args, 1)
104
+
105
+ ty = sig.args[0]
106
+ fty = ty.underlying_float
107
+ fsig1 = typing.signature(*[fty] * 2)
108
+ x = context.make_complex(builder, ty, args[0])
109
+ out = context.make_complex(builder, ty)
110
+ xr = x.real
111
+ xi = x.imag
112
+
113
+ cxi = np_real_cos_impl(context, builder, fsig1, [xi])
114
+ chxr = np_real_cosh_impl(context, builder, fsig1, [xr])
115
+ sxi = np_real_sin_impl(context, builder, fsig1, [xi])
116
+ shxr = np_real_sinh_impl(context, builder, fsig1, [xr])
117
+
118
+ out.real = builder.fmul(cxi, chxr)
119
+ out.imag = builder.fmul(sxi, shxr)
120
+
121
+ return out._getvalue()
122
+
123
+ def np_real_tanh_impl(context, builder, sig, args):
124
+ return np_unary_impl(math.tanh, context, builder, sig, args)
125
+
126
+ def np_complex_tanh_impl(context, builder, sig, args):
127
+ # npymath does not provide complex tan functions. The code
128
+ # in funcs.inc.src for tanh is translated here...
129
+ npyfuncs._check_arity_and_homogeneity(sig, args, 1)
130
+
131
+ ty = sig.args[0]
132
+ fty = ty.underlying_float
133
+ fsig1 = typing.signature(*[fty] * 2)
134
+ ONE = context.get_constant(fty, 1.0)
135
+ x = context.make_complex(builder, ty, args[0])
136
+ out = context.make_complex(builder, ty)
137
+
138
+ xr = x.real
139
+ xi = x.imag
140
+ si = np_real_sin_impl(context, builder, fsig1, [xi])
141
+ ci = np_real_cos_impl(context, builder, fsig1, [xi])
142
+ shr = np_real_sinh_impl(context, builder, fsig1, [xr])
143
+ chr_ = np_real_cosh_impl(context, builder, fsig1, [xr])
144
+ rs = builder.fmul(ci, shr)
145
+ is_ = builder.fmul(si, chr_)
146
+ rc = builder.fmul(ci, chr_)
147
+ # Note: opposite sign for `ic` from code in funcs.inc.src
148
+ ic = builder.fmul(si, shr)
149
+ sqr_rc = builder.fmul(rc, rc)
150
+ sqr_ic = builder.fmul(ic, ic)
151
+ d = builder.fadd(sqr_rc, sqr_ic)
152
+ inv_d = builder.fdiv(ONE, d)
153
+ rs_rc = builder.fmul(rs, rc)
154
+ is_ic = builder.fmul(is_, ic)
155
+ is_rc = builder.fmul(is_, rc)
156
+ rs_ic = builder.fmul(rs, ic)
157
+ numr = builder.fadd(rs_rc, is_ic)
158
+ numi = builder.fsub(is_rc, rs_ic)
159
+ out.real = builder.fmul(numr, inv_d)
160
+ out.imag = builder.fmul(numi, inv_d)
161
+
162
+ return out._getvalue()
163
+
164
+ def np_real_asinh_impl(context, builder, sig, args):
165
+ return np_unary_impl(math.asinh, context, builder, sig, args)
166
+
167
+ def np_real_acosh_impl(context, builder, sig, args):
168
+ return np_unary_impl(math.acosh, context, builder, sig, args)
169
+
170
+ def np_real_atanh_impl(context, builder, sig, args):
171
+ return np_unary_impl(math.atanh, context, builder, sig, args)
172
+
173
+ db = {}
174
+
175
+ db[np.sin] = {
176
+ 'f->f': np_real_sin_impl,
177
+ 'd->d': np_real_sin_impl,
178
+ 'F->F': npyfuncs.np_complex_sin_impl,
179
+ 'D->D': npyfuncs.np_complex_sin_impl,
180
+ }
181
+
182
+ db[np.cos] = {
183
+ 'f->f': np_real_cos_impl,
184
+ 'd->d': np_real_cos_impl,
185
+ 'F->F': npyfuncs.np_complex_cos_impl,
186
+ 'D->D': npyfuncs.np_complex_cos_impl,
187
+ }
188
+
189
+ db[np.tan] = {
190
+ 'f->f': np_real_tan_impl,
191
+ 'd->d': np_real_tan_impl,
192
+ 'F->F': cmathimpl.tan_impl,
193
+ 'D->D': cmathimpl.tan_impl,
194
+ }
195
+
196
+ db[np.arcsin] = {
197
+ 'f->f': np_real_asin_impl,
198
+ 'd->d': np_real_asin_impl,
199
+ 'F->F': cmathimpl.asin_impl,
200
+ 'D->D': cmathimpl.asin_impl,
201
+ }
202
+
203
+ db[np.arccos] = {
204
+ 'f->f': np_real_acos_impl,
205
+ 'd->d': np_real_acos_impl,
206
+ 'F->F': cmathimpl.acos_impl,
207
+ 'D->D': cmathimpl.acos_impl,
208
+ }
209
+
210
+ db[np.arctan] = {
211
+ 'f->f': np_real_atan_impl,
212
+ 'd->d': np_real_atan_impl,
213
+ 'F->F': cmathimpl.atan_impl,
214
+ 'D->D': cmathimpl.atan_impl,
215
+ }
216
+
217
+ db[np.arctan2] = {
218
+ 'ff->f': np_real_atan2_impl,
219
+ 'dd->d': np_real_atan2_impl,
220
+ }
221
+
222
+ db[np.hypot] = {
223
+ 'ff->f': np_real_hypot_impl,
224
+ 'dd->d': np_real_hypot_impl,
225
+ }
226
+
227
+ db[np.sinh] = {
228
+ 'f->f': np_real_sinh_impl,
229
+ 'd->d': np_real_sinh_impl,
230
+ 'F->F': np_complex_sinh_impl,
231
+ 'D->D': np_complex_sinh_impl,
232
+ }
233
+
234
+ db[np.cosh] = {
235
+ 'f->f': np_real_cosh_impl,
236
+ 'd->d': np_real_cosh_impl,
237
+ 'F->F': np_complex_cosh_impl,
238
+ 'D->D': np_complex_cosh_impl,
239
+ }
240
+
241
+ db[np.tanh] = {
242
+ 'f->f': np_real_tanh_impl,
243
+ 'd->d': np_real_tanh_impl,
244
+ 'F->F': np_complex_tanh_impl,
245
+ 'D->D': np_complex_tanh_impl,
246
+ }
247
+
248
+ db[np.arcsinh] = {
249
+ 'f->f': np_real_asinh_impl,
250
+ 'd->d': np_real_asinh_impl,
251
+ 'F->F': cmathimpl.asinh_impl,
252
+ 'D->D': cmathimpl.asinh_impl,
253
+ }
254
+
255
+ db[np.arccosh] = {
256
+ 'f->f': np_real_acosh_impl,
257
+ 'd->d': np_real_acosh_impl,
258
+ 'F->F': npyfuncs.np_complex_acosh_impl,
259
+ 'D->D': npyfuncs.np_complex_acosh_impl,
260
+ }
261
+
262
+ db[np.arctanh] = {
263
+ 'f->f': np_real_atanh_impl,
264
+ 'd->d': np_real_atanh_impl,
265
+ 'F->F': cmathimpl.atanh_impl,
266
+ 'D->D': cmathimpl.atanh_impl,
267
+ }
268
+
269
+ db[np.deg2rad] = {
270
+ 'f->f': mathimpl.radians_float_impl,
271
+ 'd->d': mathimpl.radians_float_impl,
272
+ }
273
+
274
+ db[np.radians] = db[np.deg2rad]
275
+
276
+ db[np.rad2deg] = {
277
+ 'f->f': mathimpl.degrees_float_impl,
278
+ 'd->d': mathimpl.degrees_float_impl,
279
+ }
280
+
281
+ db[np.degrees] = db[np.rad2deg]
282
+
283
+ db[np.greater] = {
284
+ '??->?': numbers.int_ugt_impl,
285
+ 'bb->?': numbers.int_sgt_impl,
286
+ 'BB->?': numbers.int_ugt_impl,
287
+ 'hh->?': numbers.int_sgt_impl,
288
+ 'HH->?': numbers.int_ugt_impl,
289
+ 'ii->?': numbers.int_sgt_impl,
290
+ 'II->?': numbers.int_ugt_impl,
291
+ 'll->?': numbers.int_sgt_impl,
292
+ 'LL->?': numbers.int_ugt_impl,
293
+ 'qq->?': numbers.int_sgt_impl,
294
+ 'QQ->?': numbers.int_ugt_impl,
295
+ 'ff->?': numbers.real_gt_impl,
296
+ 'dd->?': numbers.real_gt_impl,
297
+ 'FF->?': npyfuncs.np_complex_gt_impl,
298
+ 'DD->?': npyfuncs.np_complex_gt_impl,
299
+ }
300
+ if numpy_version >= (1, 25):
301
+ db[np.greater].update({
302
+ 'qQ->?': numbers.int_signed_unsigned_cmp('>'),
303
+ 'Qq->?': numbers.int_unsigned_signed_cmp('>')})
304
+
305
+ db[np.greater_equal] = {
306
+ '??->?': numbers.int_uge_impl,
307
+ 'bb->?': numbers.int_sge_impl,
308
+ 'BB->?': numbers.int_uge_impl,
309
+ 'hh->?': numbers.int_sge_impl,
310
+ 'HH->?': numbers.int_uge_impl,
311
+ 'ii->?': numbers.int_sge_impl,
312
+ 'II->?': numbers.int_uge_impl,
313
+ 'll->?': numbers.int_sge_impl,
314
+ 'LL->?': numbers.int_uge_impl,
315
+ 'qq->?': numbers.int_sge_impl,
316
+ 'QQ->?': numbers.int_uge_impl,
317
+ 'ff->?': numbers.real_ge_impl,
318
+ 'dd->?': numbers.real_ge_impl,
319
+ 'FF->?': npyfuncs.np_complex_ge_impl,
320
+ 'DD->?': npyfuncs.np_complex_ge_impl,
321
+ }
322
+ if numpy_version >= (1, 25):
323
+ db[np.greater_equal].update({
324
+ 'qQ->?': numbers.int_signed_unsigned_cmp('>='),
325
+ 'Qq->?': numbers.int_unsigned_signed_cmp('>=')})
326
+
327
+ db[np.less] = {
328
+ '??->?': numbers.int_ult_impl,
329
+ 'bb->?': numbers.int_slt_impl,
330
+ 'BB->?': numbers.int_ult_impl,
331
+ 'hh->?': numbers.int_slt_impl,
332
+ 'HH->?': numbers.int_ult_impl,
333
+ 'ii->?': numbers.int_slt_impl,
334
+ 'II->?': numbers.int_ult_impl,
335
+ 'll->?': numbers.int_slt_impl,
336
+ 'LL->?': numbers.int_ult_impl,
337
+ 'qq->?': numbers.int_slt_impl,
338
+ 'QQ->?': numbers.int_ult_impl,
339
+ 'ff->?': numbers.real_lt_impl,
340
+ 'dd->?': numbers.real_lt_impl,
341
+ 'FF->?': npyfuncs.np_complex_lt_impl,
342
+ 'DD->?': npyfuncs.np_complex_lt_impl,
343
+ }
344
+ if numpy_version >= (1, 25):
345
+ db[np.less].update({
346
+ 'qQ->?': numbers.int_signed_unsigned_cmp('<'),
347
+ 'Qq->?': numbers.int_unsigned_signed_cmp('<')})
348
+
349
+ db[np.less_equal] = {
350
+ '??->?': numbers.int_ule_impl,
351
+ 'bb->?': numbers.int_sle_impl,
352
+ 'BB->?': numbers.int_ule_impl,
353
+ 'hh->?': numbers.int_sle_impl,
354
+ 'HH->?': numbers.int_ule_impl,
355
+ 'ii->?': numbers.int_sle_impl,
356
+ 'II->?': numbers.int_ule_impl,
357
+ 'll->?': numbers.int_sle_impl,
358
+ 'LL->?': numbers.int_ule_impl,
359
+ 'qq->?': numbers.int_sle_impl,
360
+ 'QQ->?': numbers.int_ule_impl,
361
+ 'ff->?': numbers.real_le_impl,
362
+ 'dd->?': numbers.real_le_impl,
363
+ 'FF->?': npyfuncs.np_complex_le_impl,
364
+ 'DD->?': npyfuncs.np_complex_le_impl,
365
+ }
366
+ if numpy_version >= (1, 25):
367
+ db[np.less_equal].update({
368
+ 'qQ->?': numbers.int_signed_unsigned_cmp('<='),
369
+ 'Qq->?': numbers.int_unsigned_signed_cmp('<=')})
370
+
371
+ db[np.not_equal] = {
372
+ '??->?': numbers.int_ne_impl,
373
+ 'bb->?': numbers.int_ne_impl,
374
+ 'BB->?': numbers.int_ne_impl,
375
+ 'hh->?': numbers.int_ne_impl,
376
+ 'HH->?': numbers.int_ne_impl,
377
+ 'ii->?': numbers.int_ne_impl,
378
+ 'II->?': numbers.int_ne_impl,
379
+ 'll->?': numbers.int_ne_impl,
380
+ 'LL->?': numbers.int_ne_impl,
381
+ 'qq->?': numbers.int_ne_impl,
382
+ 'QQ->?': numbers.int_ne_impl,
383
+ 'ff->?': numbers.real_ne_impl,
384
+ 'dd->?': numbers.real_ne_impl,
385
+ 'FF->?': npyfuncs.np_complex_ne_impl,
386
+ 'DD->?': npyfuncs.np_complex_ne_impl,
387
+ }
388
+ if numpy_version >= (1, 25):
389
+ db[np.not_equal].update({
390
+ 'qQ->?': numbers.int_signed_unsigned_cmp('!='),
391
+ 'Qq->?': numbers.int_unsigned_signed_cmp('!=')})
392
+
393
+ db[np.equal] = {
394
+ '??->?': numbers.int_eq_impl,
395
+ 'bb->?': numbers.int_eq_impl,
396
+ 'BB->?': numbers.int_eq_impl,
397
+ 'hh->?': numbers.int_eq_impl,
398
+ 'HH->?': numbers.int_eq_impl,
399
+ 'ii->?': numbers.int_eq_impl,
400
+ 'II->?': numbers.int_eq_impl,
401
+ 'll->?': numbers.int_eq_impl,
402
+ 'LL->?': numbers.int_eq_impl,
403
+ 'qq->?': numbers.int_eq_impl,
404
+ 'QQ->?': numbers.int_eq_impl,
405
+ 'ff->?': numbers.real_eq_impl,
406
+ 'dd->?': numbers.real_eq_impl,
407
+ 'FF->?': npyfuncs.np_complex_eq_impl,
408
+ 'DD->?': npyfuncs.np_complex_eq_impl,
409
+ }
410
+ if numpy_version >= (1, 25):
411
+ db[np.equal].update({
412
+ 'qQ->?': numbers.int_signed_unsigned_cmp('=='),
413
+ 'Qq->?': numbers.int_unsigned_signed_cmp('==')})
414
+
415
+ db[np.logical_and] = {
416
+ '??->?': npyfuncs.np_logical_and_impl,
417
+ 'bb->?': npyfuncs.np_logical_and_impl,
418
+ 'BB->?': npyfuncs.np_logical_and_impl,
419
+ 'hh->?': npyfuncs.np_logical_and_impl,
420
+ 'HH->?': npyfuncs.np_logical_and_impl,
421
+ 'ii->?': npyfuncs.np_logical_and_impl,
422
+ 'II->?': npyfuncs.np_logical_and_impl,
423
+ 'll->?': npyfuncs.np_logical_and_impl,
424
+ 'LL->?': npyfuncs.np_logical_and_impl,
425
+ 'qq->?': npyfuncs.np_logical_and_impl,
426
+ 'QQ->?': npyfuncs.np_logical_and_impl,
427
+ 'ff->?': npyfuncs.np_logical_and_impl,
428
+ 'dd->?': npyfuncs.np_logical_and_impl,
429
+ 'FF->?': npyfuncs.np_complex_logical_and_impl,
430
+ 'DD->?': npyfuncs.np_complex_logical_and_impl,
431
+ }
432
+
433
+ db[np.logical_or] = {
434
+ '??->?': npyfuncs.np_logical_or_impl,
435
+ 'bb->?': npyfuncs.np_logical_or_impl,
436
+ 'BB->?': npyfuncs.np_logical_or_impl,
437
+ 'hh->?': npyfuncs.np_logical_or_impl,
438
+ 'HH->?': npyfuncs.np_logical_or_impl,
439
+ 'ii->?': npyfuncs.np_logical_or_impl,
440
+ 'II->?': npyfuncs.np_logical_or_impl,
441
+ 'll->?': npyfuncs.np_logical_or_impl,
442
+ 'LL->?': npyfuncs.np_logical_or_impl,
443
+ 'qq->?': npyfuncs.np_logical_or_impl,
444
+ 'QQ->?': npyfuncs.np_logical_or_impl,
445
+ 'ff->?': npyfuncs.np_logical_or_impl,
446
+ 'dd->?': npyfuncs.np_logical_or_impl,
447
+ 'FF->?': npyfuncs.np_complex_logical_or_impl,
448
+ 'DD->?': npyfuncs.np_complex_logical_or_impl,
449
+ }
450
+
451
+ db[np.logical_xor] = {
452
+ '??->?': npyfuncs.np_logical_xor_impl,
453
+ 'bb->?': npyfuncs.np_logical_xor_impl,
454
+ 'BB->?': npyfuncs.np_logical_xor_impl,
455
+ 'hh->?': npyfuncs.np_logical_xor_impl,
456
+ 'HH->?': npyfuncs.np_logical_xor_impl,
457
+ 'ii->?': npyfuncs.np_logical_xor_impl,
458
+ 'II->?': npyfuncs.np_logical_xor_impl,
459
+ 'll->?': npyfuncs.np_logical_xor_impl,
460
+ 'LL->?': npyfuncs.np_logical_xor_impl,
461
+ 'qq->?': npyfuncs.np_logical_xor_impl,
462
+ 'QQ->?': npyfuncs.np_logical_xor_impl,
463
+ 'ff->?': npyfuncs.np_logical_xor_impl,
464
+ 'dd->?': npyfuncs.np_logical_xor_impl,
465
+ 'FF->?': npyfuncs.np_complex_logical_xor_impl,
466
+ 'DD->?': npyfuncs.np_complex_logical_xor_impl,
467
+ }
468
+
469
+ db[np.logical_not] = {
470
+ '?->?': npyfuncs.np_logical_not_impl,
471
+ 'b->?': npyfuncs.np_logical_not_impl,
472
+ 'B->?': npyfuncs.np_logical_not_impl,
473
+ 'h->?': npyfuncs.np_logical_not_impl,
474
+ 'H->?': npyfuncs.np_logical_not_impl,
475
+ 'i->?': npyfuncs.np_logical_not_impl,
476
+ 'I->?': npyfuncs.np_logical_not_impl,
477
+ 'l->?': npyfuncs.np_logical_not_impl,
478
+ 'L->?': npyfuncs.np_logical_not_impl,
479
+ 'q->?': npyfuncs.np_logical_not_impl,
480
+ 'Q->?': npyfuncs.np_logical_not_impl,
481
+ 'f->?': npyfuncs.np_logical_not_impl,
482
+ 'd->?': npyfuncs.np_logical_not_impl,
483
+ 'F->?': npyfuncs.np_complex_logical_not_impl,
484
+ 'D->?': npyfuncs.np_complex_logical_not_impl,
485
+ }
486
+
487
+ db[np.maximum] = {
488
+ '??->?': npyfuncs.np_logical_or_impl,
489
+ 'bb->b': npyfuncs.np_int_smax_impl,
490
+ 'BB->B': npyfuncs.np_int_umax_impl,
491
+ 'hh->h': npyfuncs.np_int_smax_impl,
492
+ 'HH->H': npyfuncs.np_int_umax_impl,
493
+ 'ii->i': npyfuncs.np_int_smax_impl,
494
+ 'II->I': npyfuncs.np_int_umax_impl,
495
+ 'll->l': npyfuncs.np_int_smax_impl,
496
+ 'LL->L': npyfuncs.np_int_umax_impl,
497
+ 'qq->q': npyfuncs.np_int_smax_impl,
498
+ 'QQ->Q': npyfuncs.np_int_umax_impl,
499
+ 'ff->f': npyfuncs.np_real_maximum_impl,
500
+ 'dd->d': npyfuncs.np_real_maximum_impl,
501
+ 'FF->F': npyfuncs.np_complex_maximum_impl,
502
+ 'DD->D': npyfuncs.np_complex_maximum_impl,
503
+ }
504
+
505
+ db[np.minimum] = {
506
+ '??->?': npyfuncs.np_logical_and_impl,
507
+ 'bb->b': npyfuncs.np_int_smin_impl,
508
+ 'BB->B': npyfuncs.np_int_umin_impl,
509
+ 'hh->h': npyfuncs.np_int_smin_impl,
510
+ 'HH->H': npyfuncs.np_int_umin_impl,
511
+ 'ii->i': npyfuncs.np_int_smin_impl,
512
+ 'II->I': npyfuncs.np_int_umin_impl,
513
+ 'll->l': npyfuncs.np_int_smin_impl,
514
+ 'LL->L': npyfuncs.np_int_umin_impl,
515
+ 'qq->q': npyfuncs.np_int_smin_impl,
516
+ 'QQ->Q': npyfuncs.np_int_umin_impl,
517
+ 'ff->f': npyfuncs.np_real_minimum_impl,
518
+ 'dd->d': npyfuncs.np_real_minimum_impl,
519
+ 'FF->F': npyfuncs.np_complex_minimum_impl,
520
+ 'DD->D': npyfuncs.np_complex_minimum_impl,
521
+ }
522
+
523
+ db[np.fmax] = {
524
+ '??->?': npyfuncs.np_logical_or_impl,
525
+ 'bb->b': npyfuncs.np_int_smax_impl,
526
+ 'BB->B': npyfuncs.np_int_umax_impl,
527
+ 'hh->h': npyfuncs.np_int_smax_impl,
528
+ 'HH->H': npyfuncs.np_int_umax_impl,
529
+ 'ii->i': npyfuncs.np_int_smax_impl,
530
+ 'II->I': npyfuncs.np_int_umax_impl,
531
+ 'll->l': npyfuncs.np_int_smax_impl,
532
+ 'LL->L': npyfuncs.np_int_umax_impl,
533
+ 'qq->q': npyfuncs.np_int_smax_impl,
534
+ 'QQ->Q': npyfuncs.np_int_umax_impl,
535
+ 'ff->f': npyfuncs.np_real_fmax_impl,
536
+ 'dd->d': npyfuncs.np_real_fmax_impl,
537
+ 'FF->F': npyfuncs.np_complex_fmax_impl,
538
+ 'DD->D': npyfuncs.np_complex_fmax_impl,
539
+ }
540
+
541
+ db[np.fmin] = {
542
+ '??->?': npyfuncs.np_logical_and_impl,
543
+ 'bb->b': npyfuncs.np_int_smin_impl,
544
+ 'BB->B': npyfuncs.np_int_umin_impl,
545
+ 'hh->h': npyfuncs.np_int_smin_impl,
546
+ 'HH->H': npyfuncs.np_int_umin_impl,
547
+ 'ii->i': npyfuncs.np_int_smin_impl,
548
+ 'II->I': npyfuncs.np_int_umin_impl,
549
+ 'll->l': npyfuncs.np_int_smin_impl,
550
+ 'LL->L': npyfuncs.np_int_umin_impl,
551
+ 'qq->q': npyfuncs.np_int_smin_impl,
552
+ 'QQ->Q': npyfuncs.np_int_umin_impl,
553
+ 'ff->f': npyfuncs.np_real_fmin_impl,
554
+ 'dd->d': npyfuncs.np_real_fmin_impl,
555
+ 'FF->F': npyfuncs.np_complex_fmin_impl,
556
+ 'DD->D': npyfuncs.np_complex_fmin_impl,
557
+ }
558
+
559
+ db[np.bitwise_and] = {
560
+ '??->?': numbers.int_and_impl,
561
+ 'bb->b': numbers.int_and_impl,
562
+ 'BB->B': numbers.int_and_impl,
563
+ 'hh->h': numbers.int_and_impl,
564
+ 'HH->H': numbers.int_and_impl,
565
+ 'ii->i': numbers.int_and_impl,
566
+ 'II->I': numbers.int_and_impl,
567
+ 'll->l': numbers.int_and_impl,
568
+ 'LL->L': numbers.int_and_impl,
569
+ 'qq->q': numbers.int_and_impl,
570
+ 'QQ->Q': numbers.int_and_impl,
571
+ }
572
+
573
+ db[np.bitwise_or] = {
574
+ '??->?': numbers.int_or_impl,
575
+ 'bb->b': numbers.int_or_impl,
576
+ 'BB->B': numbers.int_or_impl,
577
+ 'hh->h': numbers.int_or_impl,
578
+ 'HH->H': numbers.int_or_impl,
579
+ 'ii->i': numbers.int_or_impl,
580
+ 'II->I': numbers.int_or_impl,
581
+ 'll->l': numbers.int_or_impl,
582
+ 'LL->L': numbers.int_or_impl,
583
+ 'qq->q': numbers.int_or_impl,
584
+ 'QQ->Q': numbers.int_or_impl,
585
+ }
586
+
587
+ db[np.bitwise_xor] = {
588
+ '??->?': numbers.int_xor_impl,
589
+ 'bb->b': numbers.int_xor_impl,
590
+ 'BB->B': numbers.int_xor_impl,
591
+ 'hh->h': numbers.int_xor_impl,
592
+ 'HH->H': numbers.int_xor_impl,
593
+ 'ii->i': numbers.int_xor_impl,
594
+ 'II->I': numbers.int_xor_impl,
595
+ 'll->l': numbers.int_xor_impl,
596
+ 'LL->L': numbers.int_xor_impl,
597
+ 'qq->q': numbers.int_xor_impl,
598
+ 'QQ->Q': numbers.int_xor_impl,
599
+ }
600
+
601
+ db[np.invert] = {
602
+ '?->?': numbers.int_invert_impl,
603
+ 'b->b': numbers.int_invert_impl,
604
+ 'B->B': numbers.int_invert_impl,
605
+ 'h->h': numbers.int_invert_impl,
606
+ 'H->H': numbers.int_invert_impl,
607
+ 'i->i': numbers.int_invert_impl,
608
+ 'I->I': numbers.int_invert_impl,
609
+ 'l->l': numbers.int_invert_impl,
610
+ 'L->L': numbers.int_invert_impl,
611
+ 'q->q': numbers.int_invert_impl,
612
+ 'Q->Q': numbers.int_invert_impl,
613
+ }
614
+
615
+ db[np.left_shift] = {
616
+ 'bb->b': numbers.int_shl_impl,
617
+ 'BB->B': numbers.int_shl_impl,
618
+ 'hh->h': numbers.int_shl_impl,
619
+ 'HH->H': numbers.int_shl_impl,
620
+ 'ii->i': numbers.int_shl_impl,
621
+ 'II->I': numbers.int_shl_impl,
622
+ 'll->l': numbers.int_shl_impl,
623
+ 'LL->L': numbers.int_shl_impl,
624
+ 'qq->q': numbers.int_shl_impl,
625
+ 'QQ->Q': numbers.int_shl_impl,
626
+ }
627
+
628
+ db[np.right_shift] = {
629
+ 'bb->b': numbers.int_shr_impl,
630
+ 'BB->B': numbers.int_shr_impl,
631
+ 'hh->h': numbers.int_shr_impl,
632
+ 'HH->H': numbers.int_shr_impl,
633
+ 'ii->i': numbers.int_shr_impl,
634
+ 'II->I': numbers.int_shr_impl,
635
+ 'll->l': numbers.int_shr_impl,
636
+ 'LL->L': numbers.int_shr_impl,
637
+ 'qq->q': numbers.int_shr_impl,
638
+ 'QQ->Q': numbers.int_shr_impl,
639
+ }
640
+
641
+ db[np.log] = {
642
+ 'f->f': np_real_log_impl,
643
+ 'd->d': np_real_log_impl,
644
+ 'F->F': npyfuncs.np_complex_log_impl,
645
+ 'D->D': npyfuncs.np_complex_log_impl,
646
+ }
647
+
648
+ db[np.log2] = {
649
+ 'f->f': np_real_log2_impl,
650
+ 'd->d': np_real_log2_impl,
651
+ 'F->F': npyfuncs.np_complex_log2_impl,
652
+ 'D->D': npyfuncs.np_complex_log2_impl,
653
+ }
654
+
655
+ db[np.log10] = {
656
+ 'f->f': np_real_log10_impl,
657
+ 'd->d': np_real_log10_impl,
658
+ 'F->F': npyfuncs.np_complex_log10_impl,
659
+ 'D->D': npyfuncs.np_complex_log10_impl,
660
+ }
661
+
662
+ return db