numpy 2.5.2__cp315-cp315-win32.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 (942) hide show
  1. numpy/__config__.py +170 -0
  2. numpy/__config__.pyi +108 -0
  3. numpy/__init__.cython-30.pxd +1312 -0
  4. numpy/__init__.pxd +12 -0
  5. numpy/__init__.py +926 -0
  6. numpy/__init__.pyi +7691 -0
  7. numpy/_array_api_info.py +349 -0
  8. numpy/_array_api_info.pyi +177 -0
  9. numpy/_configtool.py +39 -0
  10. numpy/_configtool.pyi +1 -0
  11. numpy/_core/__init__.py +203 -0
  12. numpy/_core/__init__.pyi +666 -0
  13. numpy/_core/_add_newdocs.py +7131 -0
  14. numpy/_core/_add_newdocs.pyi +2 -0
  15. numpy/_core/_add_newdocs_scalars.py +381 -0
  16. numpy/_core/_add_newdocs_scalars.pyi +16 -0
  17. numpy/_core/_asarray.py +130 -0
  18. numpy/_core/_asarray.pyi +41 -0
  19. numpy/_core/_dtype.py +366 -0
  20. numpy/_core/_dtype.pyi +54 -0
  21. numpy/_core/_dtype_ctypes.py +120 -0
  22. numpy/_core/_dtype_ctypes.pyi +83 -0
  23. numpy/_core/_exceptions.py +162 -0
  24. numpy/_core/_exceptions.pyi +48 -0
  25. numpy/_core/_internal.py +964 -0
  26. numpy/_core/_internal.pyi +56 -0
  27. numpy/_core/_methods.py +252 -0
  28. numpy/_core/_methods.pyi +22 -0
  29. numpy/_core/_multiarray_tests.cp315-win32.lib +0 -0
  30. numpy/_core/_multiarray_tests.cp315-win32.pyd +0 -0
  31. numpy/_core/_multiarray_umath.cp315-win32.lib +0 -0
  32. numpy/_core/_multiarray_umath.cp315-win32.pyd +0 -0
  33. numpy/_core/_operand_flag_tests.cp315-win32.lib +0 -0
  34. numpy/_core/_operand_flag_tests.cp315-win32.pyd +0 -0
  35. numpy/_core/_rational_tests.cp315-win32.lib +0 -0
  36. numpy/_core/_rational_tests.cp315-win32.pyd +0 -0
  37. numpy/_core/_simd.cp315-win32.lib +0 -0
  38. numpy/_core/_simd.cp315-win32.pyd +0 -0
  39. numpy/_core/_simd.pyi +35 -0
  40. numpy/_core/_string_helpers.py +100 -0
  41. numpy/_core/_string_helpers.pyi +12 -0
  42. numpy/_core/_struct_ufunc_tests.cp315-win32.lib +0 -0
  43. numpy/_core/_struct_ufunc_tests.cp315-win32.pyd +0 -0
  44. numpy/_core/_type_aliases.py +130 -0
  45. numpy/_core/_type_aliases.pyi +86 -0
  46. numpy/_core/_ufunc_config.py +515 -0
  47. numpy/_core/_ufunc_config.pyi +67 -0
  48. numpy/_core/_umath_tests.cp315-win32.lib +0 -0
  49. numpy/_core/_umath_tests.cp315-win32.pyd +0 -0
  50. numpy/_core/_umath_tests.pyi +51 -0
  51. numpy/_core/arrayprint.py +1788 -0
  52. numpy/_core/arrayprint.pyi +152 -0
  53. numpy/_core/cversions.py +13 -0
  54. numpy/_core/defchararray.py +1429 -0
  55. numpy/_core/defchararray.pyi +778 -0
  56. numpy/_core/einsumfunc.py +1647 -0
  57. numpy/_core/einsumfunc.pyi +179 -0
  58. numpy/_core/fromnumeric.py +4271 -0
  59. numpy/_core/fromnumeric.pyi +3144 -0
  60. numpy/_core/function_base.py +547 -0
  61. numpy/_core/function_base.pyi +444 -0
  62. numpy/_core/getlimits.py +449 -0
  63. numpy/_core/getlimits.pyi +124 -0
  64. numpy/_core/include/numpy/__multiarray_api.c +386 -0
  65. numpy/_core/include/numpy/__multiarray_api.h +1708 -0
  66. numpy/_core/include/numpy/__ufunc_api.c +56 -0
  67. numpy/_core/include/numpy/__ufunc_api.h +357 -0
  68. numpy/_core/include/numpy/_neighborhood_iterator_imp.h +90 -0
  69. numpy/_core/include/numpy/_numpyconfig.h +33 -0
  70. numpy/_core/include/numpy/_public_dtype_api_table.h +86 -0
  71. numpy/_core/include/numpy/arrayobject.h +7 -0
  72. numpy/_core/include/numpy/arrayscalars.h +228 -0
  73. numpy/_core/include/numpy/dtype_api.h +557 -0
  74. numpy/_core/include/numpy/halffloat.h +70 -0
  75. numpy/_core/include/numpy/ndarrayobject.h +288 -0
  76. numpy/_core/include/numpy/ndarraytypes.h +2075 -0
  77. numpy/_core/include/numpy/npy_2_compat.h +430 -0
  78. numpy/_core/include/numpy/npy_2_complexcompat.h +28 -0
  79. numpy/_core/include/numpy/npy_3kcompat.h +374 -0
  80. numpy/_core/include/numpy/npy_common.h +989 -0
  81. numpy/_core/include/numpy/npy_cpu.h +126 -0
  82. numpy/_core/include/numpy/npy_endian.h +79 -0
  83. numpy/_core/include/numpy/npy_math.h +602 -0
  84. numpy/_core/include/numpy/npy_no_deprecated_api.h +20 -0
  85. numpy/_core/include/numpy/npy_os.h +42 -0
  86. numpy/_core/include/numpy/numpyconfig.h +187 -0
  87. numpy/_core/include/numpy/random/LICENSE.txt +21 -0
  88. numpy/_core/include/numpy/random/bitgen.h +20 -0
  89. numpy/_core/include/numpy/random/distributions.h +209 -0
  90. numpy/_core/include/numpy/random/libdivide.h +2079 -0
  91. numpy/_core/include/numpy/ufuncobject.h +368 -0
  92. numpy/_core/include/numpy/utils.h +99 -0
  93. numpy/_core/lib/npymath.lib +0 -0
  94. numpy/_core/lib/pkgconfig/numpy.pc +7 -0
  95. numpy/_core/memmap.py +362 -0
  96. numpy/_core/memmap.pyi +94 -0
  97. numpy/_core/multiarray.py +1743 -0
  98. numpy/_core/multiarray.pyi +1892 -0
  99. numpy/_core/numeric.py +2707 -0
  100. numpy/_core/numeric.pyi +1366 -0
  101. numpy/_core/numerictypes.py +576 -0
  102. numpy/_core/numerictypes.pyi +196 -0
  103. numpy/_core/overrides.py +188 -0
  104. numpy/_core/overrides.pyi +44 -0
  105. numpy/_core/printoptions.py +32 -0
  106. numpy/_core/printoptions.pyi +28 -0
  107. numpy/_core/records.py +1089 -0
  108. numpy/_core/records.pyi +336 -0
  109. numpy/_core/shape_base.py +996 -0
  110. numpy/_core/shape_base.pyi +210 -0
  111. numpy/_core/strings.py +1813 -0
  112. numpy/_core/strings.pyi +481 -0
  113. numpy/_core/tests/_locales.py +72 -0
  114. numpy/_core/tests/_natype.py +144 -0
  115. numpy/_core/tests/data/astype_copy.pkl +0 -0
  116. numpy/_core/tests/data/generate_umath_validation_data.cpp +170 -0
  117. numpy/_core/tests/data/recarray_from_file.fits +0 -0
  118. numpy/_core/tests/data/umath-validation-set-README.txt +15 -0
  119. numpy/_core/tests/data/umath-validation-set-arccos.csv +1429 -0
  120. numpy/_core/tests/data/umath-validation-set-arccosh.csv +1429 -0
  121. numpy/_core/tests/data/umath-validation-set-arcsin.csv +1429 -0
  122. numpy/_core/tests/data/umath-validation-set-arcsinh.csv +1429 -0
  123. numpy/_core/tests/data/umath-validation-set-arctan.csv +1429 -0
  124. numpy/_core/tests/data/umath-validation-set-arctanh.csv +1429 -0
  125. numpy/_core/tests/data/umath-validation-set-cbrt.csv +1429 -0
  126. numpy/_core/tests/data/umath-validation-set-cos.csv +1375 -0
  127. numpy/_core/tests/data/umath-validation-set-cosh.csv +1429 -0
  128. numpy/_core/tests/data/umath-validation-set-exp.csv +412 -0
  129. numpy/_core/tests/data/umath-validation-set-exp2.csv +1429 -0
  130. numpy/_core/tests/data/umath-validation-set-expm1.csv +1429 -0
  131. numpy/_core/tests/data/umath-validation-set-log.csv +271 -0
  132. numpy/_core/tests/data/umath-validation-set-log10.csv +1629 -0
  133. numpy/_core/tests/data/umath-validation-set-log1p.csv +1429 -0
  134. numpy/_core/tests/data/umath-validation-set-log2.csv +1629 -0
  135. numpy/_core/tests/data/umath-validation-set-sin.csv +1370 -0
  136. numpy/_core/tests/data/umath-validation-set-sinh.csv +1429 -0
  137. numpy/_core/tests/data/umath-validation-set-tan.csv +1429 -0
  138. numpy/_core/tests/data/umath-validation-set-tanh.csv +1429 -0
  139. numpy/_core/tests/examples/cython/checks.pyx +381 -0
  140. numpy/_core/tests/examples/cython/meson.build +52 -0
  141. numpy/_core/tests/examples/cython/setup.py +39 -0
  142. numpy/_core/tests/examples/limited_api/limited_api.c +455 -0
  143. numpy/_core/tests/examples/limited_api/limited_api_cython.pyx +155 -0
  144. numpy/_core/tests/examples/limited_api/meson.build +94 -0
  145. numpy/_core/tests/examples/limited_api/setup.py +24 -0
  146. numpy/_core/tests/test__exceptions.py +90 -0
  147. numpy/_core/tests/test_abc.py +54 -0
  148. numpy/_core/tests/test_api.py +668 -0
  149. numpy/_core/tests/test_argparse.py +90 -0
  150. numpy/_core/tests/test_array_api_info.py +113 -0
  151. numpy/_core/tests/test_array_coercion.py +943 -0
  152. numpy/_core/tests/test_array_interface.py +222 -0
  153. numpy/_core/tests/test_arraymethod.py +85 -0
  154. numpy/_core/tests/test_arrayobject.py +198 -0
  155. numpy/_core/tests/test_arrayprint.py +1363 -0
  156. numpy/_core/tests/test_casting_floatingpoint_errors.py +154 -0
  157. numpy/_core/tests/test_casting_unittests.py +970 -0
  158. numpy/_core/tests/test_conversion_utils.py +209 -0
  159. numpy/_core/tests/test_cpu_dispatcher.py +48 -0
  160. numpy/_core/tests/test_cpu_features.py +533 -0
  161. numpy/_core/tests/test_custom_dtypes.py +511 -0
  162. numpy/_core/tests/test_cython.py +377 -0
  163. numpy/_core/tests/test_datetime.py +3220 -0
  164. numpy/_core/tests/test_defchararray.py +879 -0
  165. numpy/_core/tests/test_deprecations.py +511 -0
  166. numpy/_core/tests/test_dlpack.py +262 -0
  167. numpy/_core/tests/test_dtype.py +2107 -0
  168. numpy/_core/tests/test_einsum.py +1368 -0
  169. numpy/_core/tests/test_errstate.py +131 -0
  170. numpy/_core/tests/test_extint128.py +217 -0
  171. numpy/_core/tests/test_finfo.py +86 -0
  172. numpy/_core/tests/test_function_base.py +502 -0
  173. numpy/_core/tests/test_getlimits.py +188 -0
  174. numpy/_core/tests/test_half.py +589 -0
  175. numpy/_core/tests/test_hashtable.py +156 -0
  176. numpy/_core/tests/test_indexerrors.py +122 -0
  177. numpy/_core/tests/test_indexing.py +1717 -0
  178. numpy/_core/tests/test_item_selection.py +178 -0
  179. numpy/_core/tests/test_limited_api.py +254 -0
  180. numpy/_core/tests/test_longdouble.py +370 -0
  181. numpy/_core/tests/test_mem_overlap.py +933 -0
  182. numpy/_core/tests/test_mem_policy.py +448 -0
  183. numpy/_core/tests/test_memmap.py +286 -0
  184. numpy/_core/tests/test_multiarray.py +11569 -0
  185. numpy/_core/tests/test_multiprocessing.py +55 -0
  186. numpy/_core/tests/test_multithreading.py +746 -0
  187. numpy/_core/tests/test_nditer.py +3690 -0
  188. numpy/_core/tests/test_nep50_promotions.py +287 -0
  189. numpy/_core/tests/test_numeric.py +4278 -0
  190. numpy/_core/tests/test_numerictypes.py +640 -0
  191. numpy/_core/tests/test_overrides.py +800 -0
  192. numpy/_core/tests/test_print.py +202 -0
  193. numpy/_core/tests/test_protocols.py +46 -0
  194. numpy/_core/tests/test_records.py +595 -0
  195. numpy/_core/tests/test_regression.py +2672 -0
  196. numpy/_core/tests/test_scalar_ctors.py +203 -0
  197. numpy/_core/tests/test_scalar_methods.py +327 -0
  198. numpy/_core/tests/test_scalarbuffer.py +154 -0
  199. numpy/_core/tests/test_scalarinherit.py +105 -0
  200. numpy/_core/tests/test_scalarmath.py +1167 -0
  201. numpy/_core/tests/test_scalarprint.py +403 -0
  202. numpy/_core/tests/test_shape_base.py +899 -0
  203. numpy/_core/tests/test_simd.py +1345 -0
  204. numpy/_core/tests/test_simd_module.py +105 -0
  205. numpy/_core/tests/test_stringdtype.py +2573 -0
  206. numpy/_core/tests/test_strings.py +1506 -0
  207. numpy/_core/tests/test_ufunc.py +3452 -0
  208. numpy/_core/tests/test_umath.py +5231 -0
  209. numpy/_core/tests/test_umath_accuracy.py +92 -0
  210. numpy/_core/tests/test_umath_complex.py +631 -0
  211. numpy/_core/tests/test_unicode.py +369 -0
  212. numpy/_core/umath.py +59 -0
  213. numpy/_core/umath.pyi +232 -0
  214. numpy/_distributor_init.py +15 -0
  215. numpy/_distributor_init.pyi +1 -0
  216. numpy/_expired_attrs_2_0.py +78 -0
  217. numpy/_expired_attrs_2_0.pyi +61 -0
  218. numpy/_globals.py +121 -0
  219. numpy/_globals.pyi +17 -0
  220. numpy/_pyinstaller/__init__.py +0 -0
  221. numpy/_pyinstaller/__init__.pyi +0 -0
  222. numpy/_pyinstaller/hook-numpy.py +35 -0
  223. numpy/_pyinstaller/hook-numpy.pyi +6 -0
  224. numpy/_pyinstaller/tests/__init__.py +16 -0
  225. numpy/_pyinstaller/tests/pyinstaller-smoke.py +32 -0
  226. numpy/_pyinstaller/tests/test_pyinstaller.py +35 -0
  227. numpy/_pytesttester.py +186 -0
  228. numpy/_pytesttester.pyi +18 -0
  229. numpy/_typing/__init__.py +147 -0
  230. numpy/_typing/_add_docstring.py +153 -0
  231. numpy/_typing/_array_like.py +92 -0
  232. numpy/_typing/_char_codes.py +156 -0
  233. numpy/_typing/_dtype_like.py +108 -0
  234. numpy/_typing/_extended_precision.py +15 -0
  235. numpy/_typing/_nbit.py +17 -0
  236. numpy/_typing/_nbit_base.py +93 -0
  237. numpy/_typing/_nbit_base.pyi +39 -0
  238. numpy/_typing/_nested_sequence.py +85 -0
  239. numpy/_typing/_scalars.py +20 -0
  240. numpy/_typing/_shape.py +8 -0
  241. numpy/_typing/_ufunc.py +7 -0
  242. numpy/_typing/_ufunc.pyi +970 -0
  243. numpy/_utils/__init__.py +95 -0
  244. numpy/_utils/__init__.pyi +25 -0
  245. numpy/_utils/_conversions.py +18 -0
  246. numpy/_utils/_conversions.pyi +4 -0
  247. numpy/_utils/_inspect.py +192 -0
  248. numpy/_utils/_inspect.pyi +67 -0
  249. numpy/_utils/_pep440.py +486 -0
  250. numpy/_utils/_pep440.pyi +121 -0
  251. numpy/char/__init__.py +31 -0
  252. numpy/char/__init__.pyi +111 -0
  253. numpy/conftest.py +249 -0
  254. numpy/core/__init__.py +33 -0
  255. numpy/core/__init__.pyi +45 -0
  256. numpy/core/_dtype.py +10 -0
  257. numpy/core/_dtype.pyi +0 -0
  258. numpy/core/_dtype_ctypes.py +10 -0
  259. numpy/core/_dtype_ctypes.pyi +0 -0
  260. numpy/core/_internal.py +27 -0
  261. numpy/core/_internal.pyi +1 -0
  262. numpy/core/_multiarray_umath.py +57 -0
  263. numpy/core/_utils.py +21 -0
  264. numpy/core/arrayprint.py +10 -0
  265. numpy/core/arrayprint.pyi +4 -0
  266. numpy/core/defchararray.py +10 -0
  267. numpy/core/defchararray.pyi +4 -0
  268. numpy/core/einsumfunc.py +10 -0
  269. numpy/core/einsumfunc.pyi +4 -0
  270. numpy/core/fromnumeric.py +10 -0
  271. numpy/core/fromnumeric.pyi +4 -0
  272. numpy/core/function_base.py +10 -0
  273. numpy/core/function_base.pyi +4 -0
  274. numpy/core/getlimits.py +10 -0
  275. numpy/core/getlimits.pyi +4 -0
  276. numpy/core/multiarray.py +25 -0
  277. numpy/core/multiarray.pyi +4 -0
  278. numpy/core/numeric.py +12 -0
  279. numpy/core/numeric.pyi +4 -0
  280. numpy/core/numerictypes.py +10 -0
  281. numpy/core/numerictypes.pyi +4 -0
  282. numpy/core/overrides.py +10 -0
  283. numpy/core/overrides.pyi +7 -0
  284. numpy/core/records.py +10 -0
  285. numpy/core/records.pyi +4 -0
  286. numpy/core/shape_base.py +10 -0
  287. numpy/core/shape_base.pyi +4 -0
  288. numpy/core/umath.py +10 -0
  289. numpy/core/umath.pyi +4 -0
  290. numpy/ctypeslib/__init__.py +13 -0
  291. numpy/ctypeslib/__init__.pyi +15 -0
  292. numpy/ctypeslib/_ctypeslib.py +603 -0
  293. numpy/ctypeslib/_ctypeslib.pyi +222 -0
  294. numpy/doc/ufuncs.py +138 -0
  295. numpy/dtypes.py +86 -0
  296. numpy/dtypes.pyi +627 -0
  297. numpy/exceptions.py +246 -0
  298. numpy/exceptions.pyi +27 -0
  299. numpy/f2py/__init__.py +80 -0
  300. numpy/f2py/__init__.pyi +5 -0
  301. numpy/f2py/__main__.py +5 -0
  302. numpy/f2py/__version__.py +1 -0
  303. numpy/f2py/__version__.pyi +1 -0
  304. numpy/f2py/_backends/__init__.py +6 -0
  305. numpy/f2py/_backends/__init__.pyi +5 -0
  306. numpy/f2py/_backends/_backend.py +44 -0
  307. numpy/f2py/_backends/_backend.pyi +46 -0
  308. numpy/f2py/_backends/_meson.py +244 -0
  309. numpy/f2py/_backends/_meson.pyi +61 -0
  310. numpy/f2py/_backends/meson.build.template +63 -0
  311. numpy/f2py/_isocbind.py +62 -0
  312. numpy/f2py/_isocbind.pyi +13 -0
  313. numpy/f2py/_src_pyf.py +247 -0
  314. numpy/f2py/_src_pyf.pyi +28 -0
  315. numpy/f2py/auxfuncs.py +1005 -0
  316. numpy/f2py/auxfuncs.pyi +259 -0
  317. numpy/f2py/capi_maps.py +811 -0
  318. numpy/f2py/capi_maps.pyi +33 -0
  319. numpy/f2py/cb_rules.py +649 -0
  320. numpy/f2py/cb_rules.pyi +17 -0
  321. numpy/f2py/cfuncs.py +1579 -0
  322. numpy/f2py/cfuncs.pyi +31 -0
  323. numpy/f2py/common_rules.py +145 -0
  324. numpy/f2py/common_rules.pyi +9 -0
  325. numpy/f2py/crackfortran.py +3727 -0
  326. numpy/f2py/crackfortran.pyi +254 -0
  327. numpy/f2py/diagnose.py +57 -0
  328. numpy/f2py/diagnose.pyi +1 -0
  329. numpy/f2py/f2py2e.py +755 -0
  330. numpy/f2py/f2py2e.pyi +69 -0
  331. numpy/f2py/f90mod_rules.py +281 -0
  332. numpy/f2py/f90mod_rules.pyi +16 -0
  333. numpy/f2py/func2subr.py +329 -0
  334. numpy/f2py/func2subr.pyi +7 -0
  335. numpy/f2py/rules.py +1641 -0
  336. numpy/f2py/rules.pyi +36 -0
  337. numpy/f2py/setup.cfg +3 -0
  338. numpy/f2py/src/fortranobject.c +1471 -0
  339. numpy/f2py/src/fortranobject.h +173 -0
  340. numpy/f2py/symbolic.py +1518 -0
  341. numpy/f2py/symbolic.pyi +220 -0
  342. numpy/f2py/tests/__init__.py +16 -0
  343. numpy/f2py/tests/src/abstract_interface/foo.f90 +34 -0
  344. numpy/f2py/tests/src/abstract_interface/gh18403_mod.f90 +6 -0
  345. numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c +262 -0
  346. numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap +1 -0
  347. numpy/f2py/tests/src/assumed_shape/foo_free.f90 +34 -0
  348. numpy/f2py/tests/src/assumed_shape/foo_mod.f90 +41 -0
  349. numpy/f2py/tests/src/assumed_shape/foo_use.f90 +19 -0
  350. numpy/f2py/tests/src/assumed_shape/precision.f90 +4 -0
  351. numpy/f2py/tests/src/block_docstring/foo.f +6 -0
  352. numpy/f2py/tests/src/callback/foo.f +62 -0
  353. numpy/f2py/tests/src/callback/gh17797.f90 +7 -0
  354. numpy/f2py/tests/src/callback/gh18335.f90 +17 -0
  355. numpy/f2py/tests/src/callback/gh25211.f +10 -0
  356. numpy/f2py/tests/src/callback/gh25211.pyf +18 -0
  357. numpy/f2py/tests/src/callback/gh26681.f90 +18 -0
  358. numpy/f2py/tests/src/cli/gh_22819.pyf +6 -0
  359. numpy/f2py/tests/src/cli/hi77.f +3 -0
  360. numpy/f2py/tests/src/cli/hiworld.f90 +3 -0
  361. numpy/f2py/tests/src/common/block.f +11 -0
  362. numpy/f2py/tests/src/common/gh19161.f90 +10 -0
  363. numpy/f2py/tests/src/crackfortran/accesstype.f90 +13 -0
  364. numpy/f2py/tests/src/crackfortran/common_with_division.f +17 -0
  365. numpy/f2py/tests/src/crackfortran/data_common.f +8 -0
  366. numpy/f2py/tests/src/crackfortran/data_multiplier.f +5 -0
  367. numpy/f2py/tests/src/crackfortran/data_stmts.f90 +20 -0
  368. numpy/f2py/tests/src/crackfortran/data_with_comments.f +8 -0
  369. numpy/f2py/tests/src/crackfortran/foo_deps.f90 +6 -0
  370. numpy/f2py/tests/src/crackfortran/gh15035.f +16 -0
  371. numpy/f2py/tests/src/crackfortran/gh17859.f +12 -0
  372. numpy/f2py/tests/src/crackfortran/gh22648.pyf +7 -0
  373. numpy/f2py/tests/src/crackfortran/gh23533.f +5 -0
  374. numpy/f2py/tests/src/crackfortran/gh23598.f90 +4 -0
  375. numpy/f2py/tests/src/crackfortran/gh23598Warn.f90 +11 -0
  376. numpy/f2py/tests/src/crackfortran/gh23879.f90 +20 -0
  377. numpy/f2py/tests/src/crackfortran/gh27697.f90 +12 -0
  378. numpy/f2py/tests/src/crackfortran/gh2848.f90 +13 -0
  379. numpy/f2py/tests/src/crackfortran/operators.f90 +49 -0
  380. numpy/f2py/tests/src/crackfortran/privatemod.f90 +11 -0
  381. numpy/f2py/tests/src/crackfortran/publicmod.f90 +10 -0
  382. numpy/f2py/tests/src/crackfortran/pubprivmod.f90 +10 -0
  383. numpy/f2py/tests/src/crackfortran/unicode_comment.f90 +4 -0
  384. numpy/f2py/tests/src/f2cmap/.f2py_f2cmap +1 -0
  385. numpy/f2py/tests/src/f2cmap/isoFortranEnvMap.f90 +9 -0
  386. numpy/f2py/tests/src/inplace/foo.f +31 -0
  387. numpy/f2py/tests/src/isocintrin/isoCtests.f90 +34 -0
  388. numpy/f2py/tests/src/kind/foo.f90 +20 -0
  389. numpy/f2py/tests/src/mixed/foo.f +5 -0
  390. numpy/f2py/tests/src/mixed/foo_fixed.f90 +8 -0
  391. numpy/f2py/tests/src/mixed/foo_free.f90 +8 -0
  392. numpy/f2py/tests/src/modules/gh25337/data.f90 +8 -0
  393. numpy/f2py/tests/src/modules/gh25337/use_data.f90 +6 -0
  394. numpy/f2py/tests/src/modules/gh26920/two_mods_with_no_public_entities.f90 +21 -0
  395. numpy/f2py/tests/src/modules/gh26920/two_mods_with_one_public_routine.f90 +21 -0
  396. numpy/f2py/tests/src/modules/module_data_docstring.f90 +12 -0
  397. numpy/f2py/tests/src/modules/use_modules.f90 +20 -0
  398. numpy/f2py/tests/src/negative_bounds/issue_20853.f90 +7 -0
  399. numpy/f2py/tests/src/parameter/constant_array.f90 +45 -0
  400. numpy/f2py/tests/src/parameter/constant_both.f90 +57 -0
  401. numpy/f2py/tests/src/parameter/constant_compound.f90 +15 -0
  402. numpy/f2py/tests/src/parameter/constant_integer.f90 +22 -0
  403. numpy/f2py/tests/src/parameter/constant_non_compound.f90 +23 -0
  404. numpy/f2py/tests/src/parameter/constant_real.f90 +23 -0
  405. numpy/f2py/tests/src/quoted_character/foo.f +14 -0
  406. numpy/f2py/tests/src/regression/AB.inc +1 -0
  407. numpy/f2py/tests/src/regression/assignOnlyModule.f90 +25 -0
  408. numpy/f2py/tests/src/regression/complex_struct_compat.f90 +8 -0
  409. numpy/f2py/tests/src/regression/complex_struct_compat.pyf +12 -0
  410. numpy/f2py/tests/src/regression/datonly.f90 +17 -0
  411. numpy/f2py/tests/src/regression/f77comments.f +26 -0
  412. numpy/f2py/tests/src/regression/f77fixedform.f95 +5 -0
  413. numpy/f2py/tests/src/regression/f90continuation.f90 +9 -0
  414. numpy/f2py/tests/src/regression/incfile.f90 +5 -0
  415. numpy/f2py/tests/src/regression/inout.f90 +9 -0
  416. numpy/f2py/tests/src/regression/lower_f2py_fortran.f90 +5 -0
  417. numpy/f2py/tests/src/regression/mod_derived_types.f90 +23 -0
  418. numpy/f2py/tests/src/return_character/foo77.f +45 -0
  419. numpy/f2py/tests/src/return_character/foo90.f90 +48 -0
  420. numpy/f2py/tests/src/return_complex/foo77.f +45 -0
  421. numpy/f2py/tests/src/return_complex/foo90.f90 +48 -0
  422. numpy/f2py/tests/src/return_integer/foo77.f +56 -0
  423. numpy/f2py/tests/src/return_integer/foo90.f90 +59 -0
  424. numpy/f2py/tests/src/return_logical/foo77.f +56 -0
  425. numpy/f2py/tests/src/return_logical/foo90.f90 +59 -0
  426. numpy/f2py/tests/src/return_real/foo77.f +45 -0
  427. numpy/f2py/tests/src/return_real/foo90.f90 +48 -0
  428. numpy/f2py/tests/src/routines/funcfortranname.f +5 -0
  429. numpy/f2py/tests/src/routines/funcfortranname.pyf +11 -0
  430. numpy/f2py/tests/src/routines/subrout.f +4 -0
  431. numpy/f2py/tests/src/routines/subrout.pyf +10 -0
  432. numpy/f2py/tests/src/size/foo.f90 +44 -0
  433. numpy/f2py/tests/src/string/char.f90 +29 -0
  434. numpy/f2py/tests/src/string/fixed_string.f90 +34 -0
  435. numpy/f2py/tests/src/string/gh24008.f +8 -0
  436. numpy/f2py/tests/src/string/gh24662.f90 +7 -0
  437. numpy/f2py/tests/src/string/gh25286.f90 +14 -0
  438. numpy/f2py/tests/src/string/gh25286.pyf +12 -0
  439. numpy/f2py/tests/src/string/gh25286_bc.pyf +12 -0
  440. numpy/f2py/tests/src/string/scalar_string.f90 +9 -0
  441. numpy/f2py/tests/src/string/string.f +12 -0
  442. numpy/f2py/tests/src/value_attrspec/gh21665.f90 +9 -0
  443. numpy/f2py/tests/test_abstract_interface.py +26 -0
  444. numpy/f2py/tests/test_array_from_pyobj.py +732 -0
  445. numpy/f2py/tests/test_assumed_shape.py +52 -0
  446. numpy/f2py/tests/test_block_docstring.py +16 -0
  447. numpy/f2py/tests/test_callback.py +262 -0
  448. numpy/f2py/tests/test_capi_maps.py +10 -0
  449. numpy/f2py/tests/test_character.py +644 -0
  450. numpy/f2py/tests/test_common.py +24 -0
  451. numpy/f2py/tests/test_crackfortran.py +427 -0
  452. numpy/f2py/tests/test_data.py +74 -0
  453. numpy/f2py/tests/test_docs.py +66 -0
  454. numpy/f2py/tests/test_f2cmap.py +20 -0
  455. numpy/f2py/tests/test_f2py2e.py +1006 -0
  456. numpy/f2py/tests/test_inplace.py +49 -0
  457. numpy/f2py/tests/test_isoc.py +56 -0
  458. numpy/f2py/tests/test_kind.py +53 -0
  459. numpy/f2py/tests/test_mixed.py +31 -0
  460. numpy/f2py/tests/test_modules.py +87 -0
  461. numpy/f2py/tests/test_parameter.py +121 -0
  462. numpy/f2py/tests/test_pyf_src.py +43 -0
  463. numpy/f2py/tests/test_quoted_character.py +19 -0
  464. numpy/f2py/tests/test_regression.py +202 -0
  465. numpy/f2py/tests/test_return_character.py +48 -0
  466. numpy/f2py/tests/test_return_complex.py +67 -0
  467. numpy/f2py/tests/test_return_integer.py +55 -0
  468. numpy/f2py/tests/test_return_logical.py +66 -0
  469. numpy/f2py/tests/test_return_real.py +109 -0
  470. numpy/f2py/tests/test_routines.py +29 -0
  471. numpy/f2py/tests/test_semicolon_split.py +76 -0
  472. numpy/f2py/tests/test_size.py +42 -0
  473. numpy/f2py/tests/test_string.py +102 -0
  474. numpy/f2py/tests/test_symbolic.py +501 -0
  475. numpy/f2py/tests/test_value_attrspec.py +15 -0
  476. numpy/f2py/tests/util.py +442 -0
  477. numpy/f2py/use_rules.py +100 -0
  478. numpy/f2py/use_rules.pyi +9 -0
  479. numpy/fft/__init__.py +213 -0
  480. numpy/fft/__init__.pyi +38 -0
  481. numpy/fft/_helper.py +235 -0
  482. numpy/fft/_helper.pyi +145 -0
  483. numpy/fft/_pocketfft.py +1693 -0
  484. numpy/fft/_pocketfft.pyi +1131 -0
  485. numpy/fft/_pocketfft_umath.cp315-win32.lib +0 -0
  486. numpy/fft/_pocketfft_umath.cp315-win32.pyd +0 -0
  487. numpy/fft/tests/__init__.py +0 -0
  488. numpy/fft/tests/test_helper.py +167 -0
  489. numpy/fft/tests/test_pocketfft.py +609 -0
  490. numpy/lib/__init__.py +90 -0
  491. numpy/lib/__init__.pyi +52 -0
  492. numpy/lib/_array_utils_impl.py +62 -0
  493. numpy/lib/_array_utils_impl.pyi +10 -0
  494. numpy/lib/_arraypad_impl.py +926 -0
  495. numpy/lib/_arraypad_impl.pyi +99 -0
  496. numpy/lib/_arraysetops_impl.py +1158 -0
  497. numpy/lib/_arraysetops_impl.pyi +460 -0
  498. numpy/lib/_arrayterator_impl.py +224 -0
  499. numpy/lib/_arrayterator_impl.pyi +45 -0
  500. numpy/lib/_datasource.py +700 -0
  501. numpy/lib/_datasource.pyi +30 -0
  502. numpy/lib/_format_impl.py +1038 -0
  503. numpy/lib/_format_impl.pyi +56 -0
  504. numpy/lib/_function_base_impl.py +5775 -0
  505. numpy/lib/_function_base_impl.pyi +2315 -0
  506. numpy/lib/_histograms_impl.py +1085 -0
  507. numpy/lib/_histograms_impl.pyi +273 -0
  508. numpy/lib/_index_tricks_impl.py +1048 -0
  509. numpy/lib/_index_tricks_impl.pyi +350 -0
  510. numpy/lib/_iotools.py +900 -0
  511. numpy/lib/_iotools.pyi +113 -0
  512. numpy/lib/_nanfunctions_impl.py +2006 -0
  513. numpy/lib/_nanfunctions_impl.pyi +48 -0
  514. numpy/lib/_npyio_impl.py +2491 -0
  515. numpy/lib/_npyio_impl.pyi +288 -0
  516. numpy/lib/_polynomial_impl.py +1467 -0
  517. numpy/lib/_polynomial_impl.pyi +435 -0
  518. numpy/lib/_scimath_impl.py +642 -0
  519. numpy/lib/_scimath_impl.pyi +93 -0
  520. numpy/lib/_shape_base_impl.py +1247 -0
  521. numpy/lib/_shape_base_impl.pyi +256 -0
  522. numpy/lib/_stride_tricks_impl.py +656 -0
  523. numpy/lib/_stride_tricks_impl.pyi +75 -0
  524. numpy/lib/_twodim_base_impl.py +1242 -0
  525. numpy/lib/_twodim_base_impl.pyi +397 -0
  526. numpy/lib/_type_check_impl.py +714 -0
  527. numpy/lib/_type_check_impl.pyi +450 -0
  528. numpy/lib/_ufunclike_impl.py +212 -0
  529. numpy/lib/_ufunclike_impl.pyi +41 -0
  530. numpy/lib/_user_array_impl.py +310 -0
  531. numpy/lib/_user_array_impl.pyi +229 -0
  532. numpy/lib/_utils_impl.py +541 -0
  533. numpy/lib/_utils_impl.pyi +18 -0
  534. numpy/lib/_version.py +153 -0
  535. numpy/lib/_version.pyi +22 -0
  536. numpy/lib/array_utils.py +7 -0
  537. numpy/lib/array_utils.pyi +6 -0
  538. numpy/lib/format.py +24 -0
  539. numpy/lib/format.pyi +24 -0
  540. numpy/lib/introspect.py +94 -0
  541. numpy/lib/introspect.pyi +3 -0
  542. numpy/lib/mixins.py +180 -0
  543. numpy/lib/mixins.pyi +78 -0
  544. numpy/lib/npyio.py +1 -0
  545. numpy/lib/npyio.pyi +5 -0
  546. numpy/lib/recfunctions.py +1681 -0
  547. numpy/lib/recfunctions.pyi +436 -0
  548. numpy/lib/scimath.py +13 -0
  549. numpy/lib/scimath.pyi +12 -0
  550. numpy/lib/stride_tricks.py +1 -0
  551. numpy/lib/stride_tricks.pyi +4 -0
  552. numpy/lib/tests/__init__.py +0 -0
  553. numpy/lib/tests/data/py2-np0-objarr.npy +0 -0
  554. numpy/lib/tests/data/py2-objarr.npy +0 -0
  555. numpy/lib/tests/data/py2-objarr.npz +0 -0
  556. numpy/lib/tests/data/py3-objarr.npy +0 -0
  557. numpy/lib/tests/data/py3-objarr.npz +0 -0
  558. numpy/lib/tests/data/python3.npy +0 -0
  559. numpy/lib/tests/data/win64python2.npy +0 -0
  560. numpy/lib/tests/test__datasource.py +328 -0
  561. numpy/lib/tests/test__iotools.py +358 -0
  562. numpy/lib/tests/test__version.py +64 -0
  563. numpy/lib/tests/test_array_utils.py +32 -0
  564. numpy/lib/tests/test_arraypad.py +1427 -0
  565. numpy/lib/tests/test_arraysetops.py +1304 -0
  566. numpy/lib/tests/test_arrayterator.py +45 -0
  567. numpy/lib/tests/test_format.py +1043 -0
  568. numpy/lib/tests/test_function_base.py +4787 -0
  569. numpy/lib/tests/test_histograms.py +855 -0
  570. numpy/lib/tests/test_index_tricks.py +703 -0
  571. numpy/lib/tests/test_io.py +2733 -0
  572. numpy/lib/tests/test_loadtxt.py +1077 -0
  573. numpy/lib/tests/test_mixins.py +215 -0
  574. numpy/lib/tests/test_nanfunctions.py +1449 -0
  575. numpy/lib/tests/test_packbits.py +374 -0
  576. numpy/lib/tests/test_polynomial.py +333 -0
  577. numpy/lib/tests/test_recfunctions.py +1042 -0
  578. numpy/lib/tests/test_regression.py +231 -0
  579. numpy/lib/tests/test_shape_base.py +813 -0
  580. numpy/lib/tests/test_stride_tricks.py +890 -0
  581. numpy/lib/tests/test_twodim_base.py +564 -0
  582. numpy/lib/tests/test_type_check.py +473 -0
  583. numpy/lib/tests/test_ufunclike.py +121 -0
  584. numpy/lib/tests/test_utils.py +80 -0
  585. numpy/lib/user_array.py +1 -0
  586. numpy/lib/user_array.pyi +1 -0
  587. numpy/linalg/__init__.py +95 -0
  588. numpy/linalg/__init__.pyi +71 -0
  589. numpy/linalg/_linalg.py +3649 -0
  590. numpy/linalg/_linalg.pyi +1230 -0
  591. numpy/linalg/_umath_linalg.cp315-win32.lib +0 -0
  592. numpy/linalg/_umath_linalg.cp315-win32.pyd +0 -0
  593. numpy/linalg/_umath_linalg.pyi +60 -0
  594. numpy/linalg/lapack_lite.cp315-win32.lib +0 -0
  595. numpy/linalg/lapack_lite.cp315-win32.pyd +0 -0
  596. numpy/linalg/lapack_lite.pyi +143 -0
  597. numpy/linalg/tests/__init__.py +0 -0
  598. numpy/linalg/tests/test_deprecations.py +21 -0
  599. numpy/linalg/tests/test_linalg.py +2492 -0
  600. numpy/linalg/tests/test_regression.py +191 -0
  601. numpy/ma/API_CHANGES.txt +135 -0
  602. numpy/ma/LICENSE +24 -0
  603. numpy/ma/README.rst +236 -0
  604. numpy/ma/__init__.py +53 -0
  605. numpy/ma/__init__.pyi +458 -0
  606. numpy/ma/core.py +9000 -0
  607. numpy/ma/core.pyi +4767 -0
  608. numpy/ma/extras.py +2266 -0
  609. numpy/ma/extras.pyi +770 -0
  610. numpy/ma/mrecords.py +739 -0
  611. numpy/ma/mrecords.pyi +313 -0
  612. numpy/ma/tests/__init__.py +0 -0
  613. numpy/ma/tests/test_arrayobject.py +40 -0
  614. numpy/ma/tests/test_core.py +6112 -0
  615. numpy/ma/tests/test_deprecations.py +73 -0
  616. numpy/ma/tests/test_extras.py +1945 -0
  617. numpy/ma/tests/test_mrecords.py +495 -0
  618. numpy/ma/tests/test_old_ma.py +939 -0
  619. numpy/ma/tests/test_regression.py +83 -0
  620. numpy/ma/tests/test_subclassing.py +469 -0
  621. numpy/ma/testutils.py +294 -0
  622. numpy/ma/testutils.pyi +69 -0
  623. numpy/matlib.py +380 -0
  624. numpy/matlib.pyi +580 -0
  625. numpy/matrixlib/__init__.py +12 -0
  626. numpy/matrixlib/__init__.pyi +3 -0
  627. numpy/matrixlib/defmatrix.py +1117 -0
  628. numpy/matrixlib/defmatrix.pyi +211 -0
  629. numpy/matrixlib/tests/__init__.py +0 -0
  630. numpy/matrixlib/tests/test_defmatrix.py +475 -0
  631. numpy/matrixlib/tests/test_interaction.py +360 -0
  632. numpy/matrixlib/tests/test_masked_matrix.py +240 -0
  633. numpy/matrixlib/tests/test_matrix_linalg.py +110 -0
  634. numpy/matrixlib/tests/test_multiarray.py +17 -0
  635. numpy/matrixlib/tests/test_numeric.py +18 -0
  636. numpy/matrixlib/tests/test_regression.py +31 -0
  637. numpy/polynomial/__init__.py +187 -0
  638. numpy/polynomial/__init__.pyi +31 -0
  639. numpy/polynomial/_polybase.py +1191 -0
  640. numpy/polynomial/_polybase.pyi +255 -0
  641. numpy/polynomial/_polytypes.pyi +536 -0
  642. numpy/polynomial/chebyshev.py +2053 -0
  643. numpy/polynomial/chebyshev.pyi +173 -0
  644. numpy/polynomial/hermite.py +1794 -0
  645. numpy/polynomial/hermite.pyi +110 -0
  646. numpy/polynomial/hermite_e.py +1692 -0
  647. numpy/polynomial/hermite_e.pyi +110 -0
  648. numpy/polynomial/laguerre.py +1729 -0
  649. numpy/polynomial/laguerre.pyi +103 -0
  650. numpy/polynomial/legendre.py +1655 -0
  651. numpy/polynomial/legendre.pyi +103 -0
  652. numpy/polynomial/polynomial.py +1683 -0
  653. numpy/polynomial/polynomial.pyi +112 -0
  654. numpy/polynomial/polyutils.py +759 -0
  655. numpy/polynomial/polyutils.pyi +295 -0
  656. numpy/polynomial/tests/__init__.py +0 -0
  657. numpy/polynomial/tests/test_chebyshev.py +639 -0
  658. numpy/polynomial/tests/test_classes.py +625 -0
  659. numpy/polynomial/tests/test_hermite.py +574 -0
  660. numpy/polynomial/tests/test_hermite_e.py +575 -0
  661. numpy/polynomial/tests/test_laguerre.py +556 -0
  662. numpy/polynomial/tests/test_legendre.py +587 -0
  663. numpy/polynomial/tests/test_polynomial.py +713 -0
  664. numpy/polynomial/tests/test_polyutils.py +123 -0
  665. numpy/polynomial/tests/test_printing.py +562 -0
  666. numpy/polynomial/tests/test_symbol.py +217 -0
  667. numpy/py.typed +0 -0
  668. numpy/random/LICENSE.md +71 -0
  669. numpy/random/__init__.pxd +14 -0
  670. numpy/random/__init__.py +213 -0
  671. numpy/random/__init__.pyi +124 -0
  672. numpy/random/_bounded_integers.cp315-win32.lib +0 -0
  673. numpy/random/_bounded_integers.cp315-win32.pyd +0 -0
  674. numpy/random/_bounded_integers.pxd +38 -0
  675. numpy/random/_bounded_integers.pyi +1 -0
  676. numpy/random/_common.cp315-win32.lib +0 -0
  677. numpy/random/_common.cp315-win32.pyd +0 -0
  678. numpy/random/_common.pxd +110 -0
  679. numpy/random/_common.pyi +17 -0
  680. numpy/random/_examples/cffi/extending.py +44 -0
  681. numpy/random/_examples/cffi/parse.py +53 -0
  682. numpy/random/_examples/cython/extending.pyx +77 -0
  683. numpy/random/_examples/cython/extending_distributions.pyx +117 -0
  684. numpy/random/_examples/cython/meson.build +53 -0
  685. numpy/random/_examples/numba/extending.py +86 -0
  686. numpy/random/_examples/numba/extending_distributions.py +67 -0
  687. numpy/random/_generator.cp315-win32.lib +0 -0
  688. numpy/random/_generator.cp315-win32.pyd +0 -0
  689. numpy/random/_generator.pyi +769 -0
  690. numpy/random/_mt19937.cp315-win32.lib +0 -0
  691. numpy/random/_mt19937.cp315-win32.pyd +0 -0
  692. numpy/random/_mt19937.pyi +27 -0
  693. numpy/random/_pcg64.cp315-win32.lib +0 -0
  694. numpy/random/_pcg64.cp315-win32.pyd +0 -0
  695. numpy/random/_pcg64.pyi +36 -0
  696. numpy/random/_philox.cp315-win32.lib +0 -0
  697. numpy/random/_philox.cp315-win32.pyd +0 -0
  698. numpy/random/_philox.pyi +36 -0
  699. numpy/random/_pickle.py +88 -0
  700. numpy/random/_pickle.pyi +43 -0
  701. numpy/random/_sfc64.cp315-win32.lib +0 -0
  702. numpy/random/_sfc64.cp315-win32.pyd +0 -0
  703. numpy/random/_sfc64.pyi +25 -0
  704. numpy/random/bit_generator.cp315-win32.lib +0 -0
  705. numpy/random/bit_generator.cp315-win32.pyd +0 -0
  706. numpy/random/bit_generator.pxd +35 -0
  707. numpy/random/bit_generator.pyi +122 -0
  708. numpy/random/c_distributions.pxd +119 -0
  709. numpy/random/lib/npyrandom.lib +0 -0
  710. numpy/random/mtrand.cp315-win32.lib +0 -0
  711. numpy/random/mtrand.cp315-win32.pyd +0 -0
  712. numpy/random/mtrand.pyi +996 -0
  713. numpy/random/tests/__init__.py +0 -0
  714. numpy/random/tests/data/__init__.py +0 -0
  715. numpy/random/tests/data/generator_pcg64_np121.pkl.gz +0 -0
  716. numpy/random/tests/data/generator_pcg64_np126.pkl.gz +0 -0
  717. numpy/random/tests/data/mt19937-testset-1.csv +1001 -0
  718. numpy/random/tests/data/mt19937-testset-2.csv +1001 -0
  719. numpy/random/tests/data/pcg64-testset-1.csv +1001 -0
  720. numpy/random/tests/data/pcg64-testset-2.csv +1001 -0
  721. numpy/random/tests/data/pcg64dxsm-testset-1.csv +1001 -0
  722. numpy/random/tests/data/pcg64dxsm-testset-2.csv +1001 -0
  723. numpy/random/tests/data/philox-testset-1.csv +1001 -0
  724. numpy/random/tests/data/philox-testset-2.csv +1001 -0
  725. numpy/random/tests/data/sfc64-testset-1.csv +1001 -0
  726. numpy/random/tests/data/sfc64-testset-2.csv +1001 -0
  727. numpy/random/tests/data/sfc64_np126.pkl.gz +0 -0
  728. numpy/random/tests/test_direct.py +620 -0
  729. numpy/random/tests/test_extending.py +129 -0
  730. numpy/random/tests/test_generator_mt19937.py +2830 -0
  731. numpy/random/tests/test_generator_mt19937_regressions.py +240 -0
  732. numpy/random/tests/test_random.py +1723 -0
  733. numpy/random/tests/test_randomstate.py +2107 -0
  734. numpy/random/tests/test_randomstate_regression.py +249 -0
  735. numpy/random/tests/test_regression.py +174 -0
  736. numpy/random/tests/test_seed_sequence.py +103 -0
  737. numpy/random/tests/test_smoke.py +882 -0
  738. numpy/rec/__init__.py +2 -0
  739. numpy/rec/__init__.pyi +23 -0
  740. numpy/strings/__init__.py +2 -0
  741. numpy/strings/__init__.pyi +97 -0
  742. numpy/testing/__init__.py +22 -0
  743. numpy/testing/__init__.pyi +107 -0
  744. numpy/testing/_private/__init__.py +0 -0
  745. numpy/testing/_private/__init__.pyi +0 -0
  746. numpy/testing/_private/extbuild.py +247 -0
  747. numpy/testing/_private/extbuild.pyi +25 -0
  748. numpy/testing/_private/utils.py +2899 -0
  749. numpy/testing/_private/utils.pyi +501 -0
  750. numpy/testing/overrides.py +84 -0
  751. numpy/testing/overrides.pyi +10 -0
  752. numpy/testing/print_coercion_tables.py +207 -0
  753. numpy/testing/print_coercion_tables.pyi +26 -0
  754. numpy/testing/tests/__init__.py +0 -0
  755. numpy/testing/tests/test_utils.py +2147 -0
  756. numpy/tests/__init__.py +0 -0
  757. numpy/tests/test__all__.py +10 -0
  758. numpy/tests/test_configtool.py +51 -0
  759. numpy/tests/test_ctypeslib.py +406 -0
  760. numpy/tests/test_lazyloading.py +35 -0
  761. numpy/tests/test_matlib.py +59 -0
  762. numpy/tests/test_numpy_config.py +47 -0
  763. numpy/tests/test_numpy_version.py +54 -0
  764. numpy/tests/test_public_api.py +723 -0
  765. numpy/tests/test_reloading.py +69 -0
  766. numpy/tests/test_scripts.py +45 -0
  767. numpy/tests/test_warnings.py +81 -0
  768. numpy/typing/__init__.py +225 -0
  769. numpy/typing/__init__.pyi +8 -0
  770. numpy/typing/mypy_plugin.py +200 -0
  771. numpy/typing/tests/__init__.py +0 -0
  772. numpy/typing/tests/data/fail/arithmetic.pyi +126 -0
  773. numpy/typing/tests/data/fail/array_constructors.pyi +34 -0
  774. numpy/typing/tests/data/fail/array_like.pyi +15 -0
  775. numpy/typing/tests/data/fail/array_pad.pyi +6 -0
  776. numpy/typing/tests/data/fail/arrayprint.pyi +15 -0
  777. numpy/typing/tests/data/fail/arrayterator.pyi +14 -0
  778. numpy/typing/tests/data/fail/bitwise_ops.pyi +17 -0
  779. numpy/typing/tests/data/fail/char.pyi +60 -0
  780. numpy/typing/tests/data/fail/chararray.pyi +61 -0
  781. numpy/typing/tests/data/fail/comparisons.pyi +27 -0
  782. numpy/typing/tests/data/fail/constants.pyi +3 -0
  783. numpy/typing/tests/data/fail/datasource.pyi +16 -0
  784. numpy/typing/tests/data/fail/dtype.pyi +17 -0
  785. numpy/typing/tests/data/fail/einsumfunc.pyi +12 -0
  786. numpy/typing/tests/data/fail/flatiter.pyi +38 -0
  787. numpy/typing/tests/data/fail/fromnumeric.pyi +149 -0
  788. numpy/typing/tests/data/fail/histograms.pyi +12 -0
  789. numpy/typing/tests/data/fail/index_tricks.pyi +14 -0
  790. numpy/typing/tests/data/fail/lib_function_base.pyi +60 -0
  791. numpy/typing/tests/data/fail/lib_polynomial.pyi +29 -0
  792. numpy/typing/tests/data/fail/lib_utils.pyi +3 -0
  793. numpy/typing/tests/data/fail/lib_version.pyi +6 -0
  794. numpy/typing/tests/data/fail/linalg.pyi +48 -0
  795. numpy/typing/tests/data/fail/ma.pyi +152 -0
  796. numpy/typing/tests/data/fail/memmap.pyi +5 -0
  797. numpy/typing/tests/data/fail/modules.pyi +17 -0
  798. numpy/typing/tests/data/fail/multiarray.pyi +52 -0
  799. numpy/typing/tests/data/fail/ndarray.pyi +11 -0
  800. numpy/typing/tests/data/fail/ndarray_misc.pyi +49 -0
  801. numpy/typing/tests/data/fail/nditer.pyi +7 -0
  802. numpy/typing/tests/data/fail/nested_sequence.pyi +17 -0
  803. numpy/typing/tests/data/fail/npyio.pyi +24 -0
  804. numpy/typing/tests/data/fail/numerictypes.pyi +5 -0
  805. numpy/typing/tests/data/fail/random.pyi +62 -0
  806. numpy/typing/tests/data/fail/rec.pyi +17 -0
  807. numpy/typing/tests/data/fail/scalars.pyi +86 -0
  808. numpy/typing/tests/data/fail/shape.pyi +7 -0
  809. numpy/typing/tests/data/fail/shape_base.pyi +8 -0
  810. numpy/typing/tests/data/fail/stride_tricks.pyi +9 -0
  811. numpy/typing/tests/data/fail/strings.pyi +41 -0
  812. numpy/typing/tests/data/fail/testing.pyi +28 -0
  813. numpy/typing/tests/data/fail/twodim_base.pyi +39 -0
  814. numpy/typing/tests/data/fail/type_check.pyi +13 -0
  815. numpy/typing/tests/data/fail/ufunc_config.pyi +21 -0
  816. numpy/typing/tests/data/fail/ufunclike.pyi +21 -0
  817. numpy/typing/tests/data/fail/ufuncs.pyi +17 -0
  818. numpy/typing/tests/data/fail/warnings_and_errors.pyi +5 -0
  819. numpy/typing/tests/data/misc/extended_precision.pyi +9 -0
  820. numpy/typing/tests/data/mypy.ini +8 -0
  821. numpy/typing/tests/data/pass/arithmetic.py +614 -0
  822. numpy/typing/tests/data/pass/array_constructors.py +137 -0
  823. numpy/typing/tests/data/pass/array_like.py +37 -0
  824. numpy/typing/tests/data/pass/arrayprint.py +37 -0
  825. numpy/typing/tests/data/pass/arrayterator.py +28 -0
  826. numpy/typing/tests/data/pass/bitwise_ops.py +131 -0
  827. numpy/typing/tests/data/pass/comparisons.py +316 -0
  828. numpy/typing/tests/data/pass/dtype.py +57 -0
  829. numpy/typing/tests/data/pass/einsumfunc.py +36 -0
  830. numpy/typing/tests/data/pass/flatiter.py +26 -0
  831. numpy/typing/tests/data/pass/fromnumeric.py +272 -0
  832. numpy/typing/tests/data/pass/index_tricks.py +62 -0
  833. numpy/typing/tests/data/pass/lib_user_array.py +22 -0
  834. numpy/typing/tests/data/pass/lib_utils.py +19 -0
  835. numpy/typing/tests/data/pass/lib_version.py +18 -0
  836. numpy/typing/tests/data/pass/literal.py +52 -0
  837. numpy/typing/tests/data/pass/ma.py +199 -0
  838. numpy/typing/tests/data/pass/mod.py +149 -0
  839. numpy/typing/tests/data/pass/modules.py +45 -0
  840. numpy/typing/tests/data/pass/multiarray.py +77 -0
  841. numpy/typing/tests/data/pass/ndarray_conversion.py +81 -0
  842. numpy/typing/tests/data/pass/ndarray_misc.py +199 -0
  843. numpy/typing/tests/data/pass/ndarray_shape_manipulation.py +47 -0
  844. numpy/typing/tests/data/pass/nditer.py +4 -0
  845. numpy/typing/tests/data/pass/numeric.py +90 -0
  846. numpy/typing/tests/data/pass/numerictypes.py +17 -0
  847. numpy/typing/tests/data/pass/random.py +1498 -0
  848. numpy/typing/tests/data/pass/recfunctions.py +164 -0
  849. numpy/typing/tests/data/pass/scalars.py +262 -0
  850. numpy/typing/tests/data/pass/shape.py +19 -0
  851. numpy/typing/tests/data/pass/simple.py +170 -0
  852. numpy/typing/tests/data/pass/ufunc_config.py +64 -0
  853. numpy/typing/tests/data/pass/ufunclike.py +52 -0
  854. numpy/typing/tests/data/pass/ufuncs.py +16 -0
  855. numpy/typing/tests/data/pass/warnings_and_errors.py +6 -0
  856. numpy/typing/tests/data/reveal/arithmetic.pyi +726 -0
  857. numpy/typing/tests/data/reveal/array_api_info.pyi +70 -0
  858. numpy/typing/tests/data/reveal/array_constructors.pyi +331 -0
  859. numpy/typing/tests/data/reveal/arraypad.pyi +32 -0
  860. numpy/typing/tests/data/reveal/arrayprint.pyi +25 -0
  861. numpy/typing/tests/data/reveal/arraysetops.pyi +80 -0
  862. numpy/typing/tests/data/reveal/arrayterator.pyi +27 -0
  863. numpy/typing/tests/data/reveal/bitwise_ops.pyi +166 -0
  864. numpy/typing/tests/data/reveal/char.pyi +228 -0
  865. numpy/typing/tests/data/reveal/chararray.pyi +138 -0
  866. numpy/typing/tests/data/reveal/comparisons.pyi +264 -0
  867. numpy/typing/tests/data/reveal/constants.pyi +14 -0
  868. numpy/typing/tests/data/reveal/ctypeslib.pyi +86 -0
  869. numpy/typing/tests/data/reveal/datasource.pyi +23 -0
  870. numpy/typing/tests/data/reveal/dtype.pyi +166 -0
  871. numpy/typing/tests/data/reveal/einsumfunc.pyi +46 -0
  872. numpy/typing/tests/data/reveal/emath.pyi +54 -0
  873. numpy/typing/tests/data/reveal/fft.pyi +189 -0
  874. numpy/typing/tests/data/reveal/flatiter.pyi +86 -0
  875. numpy/typing/tests/data/reveal/fromnumeric.pyi +574 -0
  876. numpy/typing/tests/data/reveal/getlimits.pyi +53 -0
  877. numpy/typing/tests/data/reveal/histograms.pyi +69 -0
  878. numpy/typing/tests/data/reveal/index_tricks.pyi +148 -0
  879. numpy/typing/tests/data/reveal/lib_function_base.pyi +413 -0
  880. numpy/typing/tests/data/reveal/lib_polynomial.pyi +147 -0
  881. numpy/typing/tests/data/reveal/lib_utils.pyi +17 -0
  882. numpy/typing/tests/data/reveal/lib_version.pyi +20 -0
  883. numpy/typing/tests/data/reveal/linalg.pyi +517 -0
  884. numpy/typing/tests/data/reveal/ma.pyi +1103 -0
  885. numpy/typing/tests/data/reveal/matrix.pyi +73 -0
  886. numpy/typing/tests/data/reveal/memmap.pyi +21 -0
  887. numpy/typing/tests/data/reveal/mod.pyi +179 -0
  888. numpy/typing/tests/data/reveal/modules.pyi +51 -0
  889. numpy/typing/tests/data/reveal/multiarray.pyi +336 -0
  890. numpy/typing/tests/data/reveal/nbit_base_example.pyi +17 -0
  891. numpy/typing/tests/data/reveal/ndarray_assignability.pyi +79 -0
  892. numpy/typing/tests/data/reveal/ndarray_conversion.pyi +83 -0
  893. numpy/typing/tests/data/reveal/ndarray_misc.pyi +428 -0
  894. numpy/typing/tests/data/reveal/ndarray_shape_manipulation.pyi +47 -0
  895. numpy/typing/tests/data/reveal/nditer.pyi +49 -0
  896. numpy/typing/tests/data/reveal/nested_sequence.pyi +25 -0
  897. numpy/typing/tests/data/reveal/npyio.pyi +85 -0
  898. numpy/typing/tests/data/reveal/numeric.pyi +176 -0
  899. numpy/typing/tests/data/reveal/numerictypes.pyi +16 -0
  900. numpy/typing/tests/data/reveal/polynomial_polybase.pyi +216 -0
  901. numpy/typing/tests/data/reveal/polynomial_polyutils.pyi +218 -0
  902. numpy/typing/tests/data/reveal/polynomial_series.pyi +138 -0
  903. numpy/typing/tests/data/reveal/random.pyi +1357 -0
  904. numpy/typing/tests/data/reveal/rec.pyi +177 -0
  905. numpy/typing/tests/data/reveal/scalars.pyi +288 -0
  906. numpy/typing/tests/data/reveal/shape.pyi +13 -0
  907. numpy/typing/tests/data/reveal/shape_base.pyi +84 -0
  908. numpy/typing/tests/data/reveal/stride_tricks.pyi +27 -0
  909. numpy/typing/tests/data/reveal/strings.pyi +198 -0
  910. numpy/typing/tests/data/reveal/testing.pyi +196 -0
  911. numpy/typing/tests/data/reveal/twodim_base.pyi +231 -0
  912. numpy/typing/tests/data/reveal/type_check.pyi +94 -0
  913. numpy/typing/tests/data/reveal/ufunc_config.pyi +30 -0
  914. numpy/typing/tests/data/reveal/ufunclike.pyi +31 -0
  915. numpy/typing/tests/data/reveal/ufuncs.pyi +142 -0
  916. numpy/typing/tests/data/reveal/warnings_and_errors.pyi +11 -0
  917. numpy/typing/tests/test_isfile.py +35 -0
  918. numpy/typing/tests/test_runtime.py +103 -0
  919. numpy/typing/tests/test_typing.py +207 -0
  920. numpy/version.py +11 -0
  921. numpy/version.pyi +9 -0
  922. numpy-2.5.2.dist-info/METADATA +139 -0
  923. numpy-2.5.2.dist-info/RECORD +942 -0
  924. numpy-2.5.2.dist-info/WHEEL +4 -0
  925. numpy-2.5.2.dist-info/entry_points.txt +13 -0
  926. numpy-2.5.2.dist-info/licenses/LICENSE.txt +914 -0
  927. numpy-2.5.2.dist-info/licenses/numpy/_core/include/numpy/libdivide/LICENSE.txt +21 -0
  928. numpy-2.5.2.dist-info/licenses/numpy/_core/src/common/pythoncapi-compat/COPYING +14 -0
  929. numpy-2.5.2.dist-info/licenses/numpy/_core/src/highway/LICENSE +371 -0
  930. numpy-2.5.2.dist-info/licenses/numpy/_core/src/multiarray/dragon4_LICENSE.txt +27 -0
  931. numpy-2.5.2.dist-info/licenses/numpy/_core/src/npysort/x86-simd-sort/LICENSE.md +28 -0
  932. numpy-2.5.2.dist-info/licenses/numpy/_core/src/umath/svml/LICENSE +30 -0
  933. numpy-2.5.2.dist-info/licenses/numpy/fft/pocketfft/LICENSE.md +25 -0
  934. numpy-2.5.2.dist-info/licenses/numpy/linalg/lapack_lite/LICENSE.txt +48 -0
  935. numpy-2.5.2.dist-info/licenses/numpy/ma/LICENSE +24 -0
  936. numpy-2.5.2.dist-info/licenses/numpy/random/LICENSE.md +71 -0
  937. numpy-2.5.2.dist-info/licenses/numpy/random/src/distributions/LICENSE.md +61 -0
  938. numpy-2.5.2.dist-info/licenses/numpy/random/src/mt19937/LICENSE.md +61 -0
  939. numpy-2.5.2.dist-info/licenses/numpy/random/src/pcg64/LICENSE.md +22 -0
  940. numpy-2.5.2.dist-info/licenses/numpy/random/src/philox/LICENSE.md +31 -0
  941. numpy-2.5.2.dist-info/licenses/numpy/random/src/sfc64/LICENSE.md +27 -0
  942. numpy-2.5.2.dist-info/licenses/numpy/random/src/splitmix64/LICENSE.md +9 -0
@@ -0,0 +1,1743 @@
1
+ """
2
+ Create the numpy._core.multiarray namespace for backward compatibility.
3
+ In v1.16 the multiarray and umath c-extension modules were merged into
4
+ a single _multiarray_umath extension module. So we replicate the old
5
+ namespace by importing from the extension module.
6
+
7
+ """
8
+
9
+ import functools
10
+
11
+ from . import _multiarray_umath, overrides
12
+ from ._multiarray_umath import *
13
+
14
+ # These imports are needed for backward compatibility,
15
+ # do not change them. issue gh-15518
16
+ # _get_ndarray_c_version is semi-public, on purpose not added to __all__
17
+ from ._multiarray_umath import ( # noqa: F401
18
+ _ARRAY_API,
19
+ _flagdict,
20
+ _get_madvise_hugepage,
21
+ _get_ndarray_c_version,
22
+ _monotonicity,
23
+ _place,
24
+ _reconstruct,
25
+ _set_madvise_hugepage,
26
+ _vec_string,
27
+ from_dlpack,
28
+ )
29
+
30
+ __all__ = [
31
+ '_ARRAY_API', 'ALLOW_THREADS', 'BUFSIZE', 'CLIP', 'DATETIMEUNITS',
32
+ 'ITEM_HASOBJECT', 'ITEM_IS_POINTER', 'LIST_PICKLE', 'MAXDIMS',
33
+ 'MAY_SHARE_BOUNDS', 'MAY_SHARE_EXACT', 'NEEDS_INIT', 'NEEDS_PYAPI',
34
+ 'RAISE', 'USE_GETITEM', 'USE_SETITEM', 'WRAP',
35
+ '_flagdict', 'from_dlpack', '_place', '_reconstruct', '_vec_string',
36
+ '_monotonicity', 'add_docstring', 'arange', 'array', 'asarray',
37
+ 'asanyarray', 'ascontiguousarray', 'asfortranarray', 'bincount',
38
+ 'broadcast', 'busday_count', 'busday_offset', 'busdaycalendar', 'can_cast',
39
+ 'compare_chararrays', 'concatenate', 'copyto', 'correlate', 'correlate2',
40
+ 'count_nonzero', 'c_einsum', 'datetime_as_string', 'datetime_data',
41
+ 'dot', 'dragon4_positional', 'dragon4_scientific', 'dtype',
42
+ 'empty', 'empty_like', 'error', 'flagsobj', 'flatiter', 'format_longfloat',
43
+ 'frombuffer', 'fromfile', 'fromiter', 'fromstring',
44
+ 'get_handler_name', 'get_handler_version', 'inner', 'interp',
45
+ 'interp_complex', 'is_busday', 'lexsort', 'matmul', 'vecdot',
46
+ 'may_share_memory', 'min_scalar_type', 'ndarray', 'nditer', 'nested_iters',
47
+ 'normalize_axis_index', 'packbits', 'promote_types', 'putmask',
48
+ 'ravel_multi_index', 'result_type', 'scalar', 'set_datetimeparse_function',
49
+ 'set_typeDict', 'shares_memory', 'typeinfo',
50
+ 'unpackbits', 'unravel_index', 'vdot', 'where', 'zeros']
51
+
52
+ # For backward compatibility, make sure pickle imports
53
+ # these functions from here
54
+ _reconstruct.__module__ = 'numpy._core.multiarray'
55
+ scalar.__module__ = 'numpy._core.multiarray'
56
+
57
+
58
+ from_dlpack.__module__ = 'numpy'
59
+ arange.__module__ = 'numpy'
60
+ array.__module__ = 'numpy'
61
+ asarray.__module__ = 'numpy'
62
+ asanyarray.__module__ = 'numpy'
63
+ ascontiguousarray.__module__ = 'numpy'
64
+ asfortranarray.__module__ = 'numpy'
65
+ datetime_data.__module__ = 'numpy'
66
+ empty.__module__ = 'numpy'
67
+ frombuffer.__module__ = 'numpy'
68
+ fromfile.__module__ = 'numpy'
69
+ fromiter.__module__ = 'numpy'
70
+ frompyfunc.__module__ = 'numpy'
71
+ fromstring.__module__ = 'numpy'
72
+ may_share_memory.__module__ = 'numpy'
73
+ nested_iters.__module__ = 'numpy'
74
+ promote_types.__module__ = 'numpy'
75
+ zeros.__module__ = 'numpy'
76
+ normalize_axis_index.__module__ = 'numpy.lib.array_utils'
77
+ add_docstring.__module__ = 'numpy.lib'
78
+ compare_chararrays.__module__ = 'numpy.char'
79
+
80
+
81
+ def _override___module__():
82
+ namespace_names = globals()
83
+ for ufunc_name in [
84
+ 'absolute', 'arccos', 'arccosh', 'add', 'arcsin', 'arcsinh', 'arctan',
85
+ 'arctan2', 'arctanh', 'bitwise_and', 'bitwise_count', 'invert',
86
+ 'left_shift', 'bitwise_or', 'right_shift', 'bitwise_xor', 'cbrt',
87
+ 'ceil', 'conjugate', 'copysign', 'cos', 'cosh', 'deg2rad', 'degrees',
88
+ 'divide', 'divmod', 'equal', 'exp', 'exp2', 'expm1', 'fabs',
89
+ 'float_power', 'floor', 'floor_divide', 'fmax', 'fmin', 'fmod',
90
+ 'frexp', 'gcd', 'greater', 'greater_equal', 'heaviside', 'hypot',
91
+ 'isfinite', 'isinf', 'isnan', 'isnat', 'lcm', 'ldexp', 'less',
92
+ 'less_equal', 'log', 'log10', 'log1p', 'log2', 'logaddexp',
93
+ 'logaddexp2', 'logical_and', 'logical_not', 'logical_or',
94
+ 'logical_xor', 'matmul', 'matvec', 'maximum', 'minimum', 'remainder',
95
+ 'modf', 'multiply', 'negative', 'nextafter', 'not_equal', 'positive',
96
+ 'power', 'rad2deg', 'radians', 'reciprocal', 'rint', 'sign', 'signbit',
97
+ 'sin', 'sinh', 'spacing', 'sqrt', 'square', 'subtract', 'tan', 'tanh',
98
+ 'trunc', 'vecdot', 'vecmat',
99
+ ]:
100
+ ufunc = namespace_names[ufunc_name]
101
+ ufunc.__module__ = "numpy"
102
+ ufunc.__qualname__ = ufunc_name
103
+
104
+
105
+ _override___module__()
106
+
107
+
108
+ # We can't verify dispatcher signatures because NumPy's C functions don't
109
+ # support introspection.
110
+ array_function_from_c_func_and_dispatcher = functools.partial(
111
+ overrides.array_function_from_dispatcher,
112
+ module='numpy', docs_from_dispatcher=True, verify=False)
113
+
114
+
115
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.empty_like)
116
+ def empty_like(
117
+ prototype, dtype=None, order="K", subok=True, shape=None, *, device=None
118
+ ):
119
+ """
120
+ empty_like(
121
+ prototype,
122
+ /,
123
+ dtype=None,
124
+ order='K',
125
+ subok=True,
126
+ shape=None,
127
+ *,
128
+ device=None,
129
+ )
130
+ --
131
+
132
+ Return a new array with the same shape and type as a given array.
133
+
134
+ Parameters
135
+ ----------
136
+ prototype : array_like
137
+ The shape and data-type of `prototype` define these same attributes
138
+ of the returned array.
139
+ dtype : data-type, optional
140
+ Overrides the data type of the result.
141
+ order : {'C', 'F', 'A', or 'K'}, optional
142
+ Overrides the memory layout of the result. 'C' means C-order,
143
+ 'F' means F-order, 'A' means 'F' if `prototype` is Fortran
144
+ contiguous, 'C' otherwise. 'K' means match the layout of `prototype`
145
+ as closely as possible.
146
+ subok : bool, optional.
147
+ If True, then the newly created array will use the sub-class
148
+ type of `prototype`, otherwise it will be a base-class array. Defaults
149
+ to True.
150
+ shape : int or sequence of ints, optional.
151
+ Overrides the shape of the result. If order='K' and the number of
152
+ dimensions is unchanged, will try to keep order, otherwise,
153
+ order='C' is implied.
154
+ device : str, optional
155
+ The device on which to place the created array. Default: None.
156
+ For Array-API interoperability only, so must be ``"cpu"`` if passed.
157
+
158
+ .. versionadded:: 2.0.0
159
+
160
+ Returns
161
+ -------
162
+ out : ndarray
163
+ Array of uninitialized (arbitrary) data with the same
164
+ shape and type as `prototype`.
165
+
166
+ See Also
167
+ --------
168
+ ones_like : Return an array of ones with shape and type of input.
169
+ zeros_like : Return an array of zeros with shape and type of input.
170
+ full_like : Return a new array with shape of input filled with value.
171
+ empty : Return a new uninitialized array.
172
+
173
+ Notes
174
+ -----
175
+ Unlike other array creation functions (e.g. `zeros_like`, `ones_like`,
176
+ `full_like`), `empty_like` does not initialize the values of the array,
177
+ and may therefore be marginally faster. However, the values stored in the
178
+ newly allocated array are arbitrary. For reproducible behavior, be sure
179
+ to set each element of the array before reading.
180
+
181
+ Examples
182
+ --------
183
+ >>> import numpy as np
184
+ >>> a = ([1,2,3], [4,5,6]) # a is array-like
185
+ >>> np.empty_like(a)
186
+ array([[-1073741821, -1073741821, 3], # uninitialized
187
+ [ 0, 0, -1073741821]])
188
+ >>> a = np.array([[1., 2., 3.],[4.,5.,6.]])
189
+ >>> np.empty_like(a)
190
+ array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], # uninitialized
191
+ [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]])
192
+
193
+ """
194
+ return (prototype,)
195
+
196
+
197
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.concatenate)
198
+ def concatenate(arrays, axis=0, out=None, *, dtype=None, casting="same_kind"):
199
+ """
200
+ concatenate(
201
+ arrays,
202
+ /,
203
+ axis=0,
204
+ out=None,
205
+ *,
206
+ dtype=None,
207
+ casting="same_kind",
208
+ )
209
+ --
210
+
211
+ Join a sequence of arrays along an existing axis.
212
+
213
+ .. versionadded:: 2.0
214
+ ``numpy.concat`` added as a shorthand for ``numpy.concatenate``.
215
+
216
+ Parameters
217
+ ----------
218
+ a1, a2, ... : sequence of array_like
219
+ The arrays must have the same shape, except in the dimension
220
+ corresponding to `axis` (the first, by default).
221
+ axis : int, optional
222
+ The axis along which the arrays will be joined. If axis is None,
223
+ arrays are flattened before use. Default is 0.
224
+ out : ndarray, optional
225
+ If provided, the destination to place the result. The shape must be
226
+ correct, matching that of what concatenate would have returned if no
227
+ out argument were specified.
228
+ dtype : str or dtype
229
+ If provided, the destination array will have this dtype. Cannot be
230
+ provided together with `out`.
231
+
232
+ .. versionadded:: 1.20.0
233
+
234
+ casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional
235
+ Controls what kind of data casting may occur. Defaults to 'same_kind'.
236
+ For a description of the options, please see :term:`casting`.
237
+
238
+ .. versionadded:: 1.20.0
239
+
240
+ Returns
241
+ -------
242
+ res : ndarray
243
+ The concatenated array.
244
+
245
+ See Also
246
+ --------
247
+ ma.concatenate : Concatenate function that preserves input masks.
248
+ array_split : Split an array into multiple sub-arrays of equal or
249
+ near-equal size.
250
+ split : Split array into a list of multiple sub-arrays of equal size.
251
+ hsplit : Split array into multiple sub-arrays horizontally (column wise).
252
+ vsplit : Split array into multiple sub-arrays vertically (row wise).
253
+ dsplit : Split array into multiple sub-arrays along the 3rd axis (depth).
254
+ stack : Stack a sequence of arrays along a new axis.
255
+ block : Assemble arrays from blocks.
256
+ hstack : Stack arrays in sequence horizontally (column wise).
257
+ vstack : Stack arrays in sequence vertically (row wise).
258
+ dstack : Stack arrays in sequence depth wise (along third dimension).
259
+ column_stack : Stack 1-D arrays as columns into a 2-D array.
260
+
261
+ Notes
262
+ -----
263
+ When one or more of the arrays to be concatenated is a MaskedArray,
264
+ this function will return a MaskedArray object instead of an ndarray,
265
+ but the input masks are *not* preserved. In cases where a MaskedArray
266
+ is expected as input, use the ma.concatenate function from the masked
267
+ array module instead.
268
+
269
+ Examples
270
+ --------
271
+ >>> import numpy as np
272
+ >>> a = np.array([[1, 2], [3, 4]])
273
+ >>> b = np.array([[5, 6]])
274
+ >>> np.concatenate((a, b), axis=0)
275
+ array([[1, 2],
276
+ [3, 4],
277
+ [5, 6]])
278
+ >>> np.concatenate((a, b.T), axis=1)
279
+ array([[1, 2, 5],
280
+ [3, 4, 6]])
281
+ >>> np.concatenate((a, b), axis=None)
282
+ array([1, 2, 3, 4, 5, 6])
283
+
284
+ This function will not preserve masking of MaskedArray inputs.
285
+
286
+ >>> a = np.ma.arange(3)
287
+ >>> a[1] = np.ma.masked
288
+ >>> b = np.arange(2, 5)
289
+ >>> a
290
+ masked_array(data=[0, --, 2],
291
+ mask=[False, True, False],
292
+ fill_value=999999)
293
+ >>> b
294
+ array([2, 3, 4])
295
+ >>> np.concatenate([a, b])
296
+ masked_array(data=[0, 1, 2, 2, 3, 4],
297
+ mask=False,
298
+ fill_value=999999)
299
+ >>> np.ma.concatenate([a, b])
300
+ masked_array(data=[0, --, 2, 2, 3, 4],
301
+ mask=[False, True, False, False, False, False],
302
+ fill_value=999999)
303
+
304
+ """
305
+ if out is not None:
306
+ # optimize for the typical case where only arrays is provided
307
+ arrays = list(arrays)
308
+ arrays.append(out)
309
+ return arrays
310
+
311
+
312
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.inner)
313
+ def inner(a, b, /):
314
+ """
315
+ inner(a, b, /)
316
+
317
+ Inner product of two arrays.
318
+
319
+ Ordinary inner product of vectors for 1-D arrays (without complex
320
+ conjugation), in higher dimensions a sum product over the last axes.
321
+
322
+ Parameters
323
+ ----------
324
+ a, b : array_like
325
+ If `a` and `b` are nonscalar, their last dimensions must match.
326
+
327
+ Returns
328
+ -------
329
+ out : ndarray
330
+ If `a` and `b` are both
331
+ scalars or both 1-D arrays then a scalar is returned; otherwise
332
+ an array is returned.
333
+ ``out.shape = (*a.shape[:-1], *b.shape[:-1])``
334
+
335
+ Raises
336
+ ------
337
+ ValueError
338
+ If both `a` and `b` are nonscalar and their last dimensions have
339
+ different sizes.
340
+
341
+ See Also
342
+ --------
343
+ tensordot : Sum products over arbitrary axes.
344
+ dot : Generalised matrix product, using second last dimension of `b`.
345
+ vecdot : Vector dot product of two arrays.
346
+ einsum : Einstein summation convention.
347
+
348
+ Notes
349
+ -----
350
+ For vectors (1-D arrays) it computes the ordinary inner-product::
351
+
352
+ np.inner(a, b) = sum(a[:]*b[:])
353
+
354
+ More generally, if ``ndim(a) = r > 0`` and ``ndim(b) = s > 0``::
355
+
356
+ np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1))
357
+
358
+ or explicitly::
359
+
360
+ np.inner(a, b)[i0,...,ir-2,j0,...,js-2]
361
+ = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:])
362
+
363
+ In addition `a` or `b` may be scalars, in which case::
364
+
365
+ np.inner(a,b) = a*b
366
+
367
+ Examples
368
+ --------
369
+ Ordinary inner product for vectors:
370
+
371
+ >>> import numpy as np
372
+ >>> a = np.array([1,2,3])
373
+ >>> b = np.array([0,1,0])
374
+ >>> np.inner(a, b)
375
+ 2
376
+
377
+ Some multidimensional examples:
378
+
379
+ >>> a = np.arange(24).reshape((2,3,4))
380
+ >>> b = np.arange(4)
381
+ >>> c = np.inner(a, b)
382
+ >>> c.shape
383
+ (2, 3)
384
+ >>> c
385
+ array([[ 14, 38, 62],
386
+ [ 86, 110, 134]])
387
+
388
+ >>> a = np.arange(2).reshape((1,1,2))
389
+ >>> b = np.arange(6).reshape((3,2))
390
+ >>> c = np.inner(a, b)
391
+ >>> c.shape
392
+ (1, 1, 3)
393
+ >>> c
394
+ array([[[1, 3, 5]]])
395
+
396
+ An example where `b` is a scalar:
397
+
398
+ >>> np.inner(np.eye(2), 7)
399
+ array([[7., 0.],
400
+ [0., 7.]])
401
+
402
+ """
403
+ return (a, b)
404
+
405
+
406
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.where)
407
+ def where(condition, x=None, y=None, /):
408
+ """
409
+ where(condition, [x, y], /)
410
+
411
+ Return elements chosen from `x` or `y` depending on `condition`.
412
+
413
+ .. note::
414
+ When only `condition` is provided, this function is a shorthand for
415
+ ``np.asarray(condition).nonzero()``. Using `nonzero` directly should be
416
+ preferred, as it behaves correctly for subclasses. The rest of this
417
+ documentation covers only the case where all three arguments are
418
+ provided.
419
+
420
+ Parameters
421
+ ----------
422
+ condition : array_like, bool
423
+ Where True, yield `x`, otherwise yield `y`.
424
+ x, y : array_like
425
+ Values from which to choose. `x`, `y` and `condition` need to be
426
+ broadcastable to some shape.
427
+
428
+ Returns
429
+ -------
430
+ out : ndarray
431
+ An array with elements from `x` where `condition` is True, and elements
432
+ from `y` elsewhere.
433
+
434
+ See Also
435
+ --------
436
+ choose
437
+ nonzero : The function that is called when x and y are omitted
438
+
439
+ Notes
440
+ -----
441
+ If all the arrays are 1-D, `where` is equivalent to::
442
+
443
+ [xv if c else yv
444
+ for c, xv, yv in zip(condition, x, y)]
445
+
446
+ Examples
447
+ --------
448
+ >>> import numpy as np
449
+ >>> a = np.arange(10)
450
+ >>> a
451
+ array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
452
+ >>> np.where(a < 5, a, 10*a)
453
+ array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90])
454
+
455
+ This can be used on multidimensional arrays too:
456
+
457
+ >>> np.where([[True, False], [True, True]],
458
+ ... [[1, 2], [3, 4]],
459
+ ... [[9, 8], [7, 6]])
460
+ array([[1, 8],
461
+ [3, 4]])
462
+
463
+ The shapes of x, y, and the condition are broadcast together:
464
+
465
+ >>> x, y = np.ogrid[:3, :4]
466
+ >>> np.where(x < y, x, 10 + y) # both x and 10+y are broadcast
467
+ array([[10, 0, 0, 0],
468
+ [10, 11, 1, 1],
469
+ [10, 11, 12, 2]])
470
+
471
+ >>> a = np.array([[0, 1, 2],
472
+ ... [0, 2, 4],
473
+ ... [0, 3, 6]])
474
+ >>> np.where(a < 4, a, -1) # -1 is broadcast
475
+ array([[ 0, 1, 2],
476
+ [ 0, 2, -1],
477
+ [ 0, 3, -1]])
478
+ """
479
+ return (condition, x, y)
480
+
481
+
482
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.lexsort)
483
+ def lexsort(keys, axis=-1):
484
+ """
485
+ lexsort(keys, axis=-1)
486
+
487
+ Perform an indirect stable sort using a sequence of keys.
488
+
489
+ Given multiple sorting keys, lexsort returns an array of integer indices
490
+ that describes the sort order by multiple keys. The last key in the
491
+ sequence is used for the primary sort order, ties are broken by the
492
+ second-to-last key, and so on.
493
+
494
+ Parameters
495
+ ----------
496
+ keys : (k, m, n, ...) array-like
497
+ The `k` keys to be sorted. The *last* key (e.g, the last
498
+ row if `keys` is a 2D array) is the primary sort key.
499
+ Each element of `keys` along the zeroth axis must be
500
+ an array-like object of the same shape.
501
+ axis : int, optional
502
+ Axis to be indirectly sorted. By default, sort over the last axis
503
+ of each sequence. Separate slices along `axis` sorted over
504
+ independently; see last example.
505
+
506
+ Returns
507
+ -------
508
+ indices : (m, n, ...) ndarray of ints
509
+ Array of indices that sort the keys along the specified axis.
510
+
511
+ See Also
512
+ --------
513
+ argsort : Indirect sort.
514
+ ndarray.sort : In-place sort.
515
+ sort : Return a sorted copy of an array.
516
+
517
+ Examples
518
+ --------
519
+ Sort names: first by surname, then by name.
520
+
521
+ >>> import numpy as np
522
+ >>> surnames = ('Hertz', 'Galilei', 'Hertz')
523
+ >>> first_names = ('Heinrich', 'Galileo', 'Gustav')
524
+ >>> ind = np.lexsort((first_names, surnames))
525
+ >>> ind
526
+ array([1, 2, 0])
527
+
528
+ >>> [surnames[i] + ", " + first_names[i] for i in ind]
529
+ ['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich']
530
+
531
+ Sort according to two numerical keys, first by elements
532
+ of ``a``, then breaking ties according to elements of ``b``:
533
+
534
+ >>> a = [1, 5, 1, 4, 3, 4, 4] # First sequence
535
+ >>> b = [9, 4, 0, 4, 0, 2, 1] # Second sequence
536
+ >>> ind = np.lexsort((b, a)) # Sort by `a`, then by `b`
537
+ >>> ind
538
+ array([2, 0, 4, 6, 5, 3, 1])
539
+ >>> [(a[i], b[i]) for i in ind]
540
+ [(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)]
541
+
542
+ Compare against `argsort`, which would sort each key independently.
543
+
544
+ >>> np.argsort((b, a), kind='stable')
545
+ array([[2, 4, 6, 5, 1, 3, 0],
546
+ [0, 2, 4, 3, 5, 6, 1]])
547
+
548
+ To sort lexicographically with `argsort`, we would need to provide a
549
+ structured array.
550
+
551
+ >>> x = np.array([(ai, bi) for ai, bi in zip(a, b)],
552
+ ... dtype = np.dtype([('x', int), ('y', int)]))
553
+ >>> np.argsort(x) # or np.argsort(x, order=('x', 'y'))
554
+ array([2, 0, 4, 6, 5, 3, 1])
555
+
556
+ The zeroth axis of `keys` always corresponds with the sequence of keys,
557
+ so 2D arrays are treated just like other sequences of keys.
558
+
559
+ >>> arr = np.asarray([b, a])
560
+ >>> ind2 = np.lexsort(arr)
561
+ >>> np.testing.assert_equal(ind2, ind)
562
+
563
+ Accordingly, the `axis` parameter refers to an axis of *each* key, not of
564
+ the `keys` argument itself. For instance, the array ``arr`` is treated as
565
+ a sequence of two 1-D keys, so specifying ``axis=0`` is equivalent to
566
+ using the default axis, ``axis=-1``.
567
+
568
+ >>> np.testing.assert_equal(np.lexsort(arr, axis=0),
569
+ ... np.lexsort(arr, axis=-1))
570
+
571
+ For higher-dimensional arrays, the axis parameter begins to matter. The
572
+ resulting array has the same shape as each key, and the values are what
573
+ we would expect if `lexsort` were performed on corresponding slices
574
+ of the keys independently. For instance,
575
+
576
+ >>> x = [[1, 2, 3, 4],
577
+ ... [4, 3, 2, 1],
578
+ ... [2, 1, 4, 3]]
579
+ >>> y = [[2, 2, 1, 1],
580
+ ... [1, 2, 1, 2],
581
+ ... [1, 1, 2, 1]]
582
+ >>> np.lexsort((x, y), axis=1)
583
+ array([[2, 3, 0, 1],
584
+ [2, 0, 3, 1],
585
+ [1, 0, 3, 2]])
586
+
587
+ Each row of the result is what we would expect if we were to perform
588
+ `lexsort` on the corresponding row of the keys:
589
+
590
+ >>> for i in range(3):
591
+ ... print(np.lexsort((x[i], y[i])))
592
+ [2 3 0 1]
593
+ [2 0 3 1]
594
+ [1 0 3 2]
595
+
596
+ """
597
+ if isinstance(keys, tuple):
598
+ return keys
599
+ else:
600
+ return (keys,)
601
+
602
+
603
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.can_cast)
604
+ def can_cast(from_, to, casting="safe"):
605
+ """
606
+ can_cast(from_, to, casting='safe')
607
+
608
+ Returns True if cast between data types can occur according to the
609
+ casting rule.
610
+
611
+ Parameters
612
+ ----------
613
+ from_ : dtype, dtype specifier, NumPy scalar, or array
614
+ Data type, NumPy scalar, or array to cast from.
615
+ to : dtype or dtype specifier
616
+ Data type to cast to.
617
+ casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional
618
+ Controls what kind of data casting may occur.
619
+
620
+ * 'no' means the data types should not be cast at all.
621
+ * 'equiv' means only byte-order changes are allowed.
622
+ * 'safe' means only casts which can preserve values are allowed.
623
+ * 'same_kind' means only safe casts or casts within a kind,
624
+ like float64 to float32, are allowed.
625
+ * 'unsafe' means any data conversions may be done.
626
+
627
+ Returns
628
+ -------
629
+ out : bool
630
+ True if cast can occur according to the casting rule.
631
+
632
+ Notes
633
+ -----
634
+ .. versionchanged:: 2.0
635
+ This function does not support Python scalars anymore and does not
636
+ apply any value-based logic for 0-D arrays and NumPy scalars.
637
+
638
+ See also
639
+ --------
640
+ dtype, result_type
641
+
642
+ Examples
643
+ --------
644
+ Basic examples
645
+
646
+ >>> import numpy as np
647
+ >>> np.can_cast(np.int32, np.int64)
648
+ True
649
+ >>> np.can_cast(np.float64, complex)
650
+ True
651
+ >>> np.can_cast(complex, float)
652
+ False
653
+
654
+ >>> np.can_cast('i8', 'f8')
655
+ True
656
+ >>> np.can_cast('i8', 'f4')
657
+ False
658
+ >>> np.can_cast('i4', 'S4')
659
+ False
660
+
661
+ """
662
+ return (from_,)
663
+
664
+
665
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.min_scalar_type)
666
+ def min_scalar_type(a, /):
667
+ """
668
+ min_scalar_type(a, /)
669
+
670
+ For scalar ``a``, returns the data type with the smallest size
671
+ and smallest scalar kind which can hold its value. For non-scalar
672
+ array ``a``, returns the vector's dtype unmodified.
673
+
674
+ Floating point values are not demoted to integers,
675
+ and complex values are not demoted to floats.
676
+
677
+ Parameters
678
+ ----------
679
+ a : scalar or array_like
680
+ The value whose minimal data type is to be found.
681
+
682
+ Returns
683
+ -------
684
+ out : dtype
685
+ The minimal data type.
686
+
687
+ See Also
688
+ --------
689
+ result_type, promote_types, dtype, can_cast
690
+
691
+ Examples
692
+ --------
693
+ >>> import numpy as np
694
+ >>> np.min_scalar_type(10)
695
+ dtype('uint8')
696
+
697
+ >>> np.min_scalar_type(-260)
698
+ dtype('int16')
699
+
700
+ >>> np.min_scalar_type(3.1)
701
+ dtype('float16')
702
+
703
+ >>> np.min_scalar_type(1e50)
704
+ dtype('float64')
705
+
706
+ >>> np.min_scalar_type(np.arange(4, dtype=np.float64))
707
+ dtype('float64')
708
+
709
+ """
710
+ return (a,)
711
+
712
+
713
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.result_type)
714
+ def result_type(*arrays_and_dtypes):
715
+ """
716
+ result_type(*arrays_and_dtypes)
717
+
718
+ Returns the type that results from applying the NumPy
719
+ :ref:`type promotion <arrays.promotion>` rules to the arguments.
720
+
721
+ Parameters
722
+ ----------
723
+ arrays_and_dtypes : list of arrays and dtypes
724
+ The operands of some operation whose result type is needed.
725
+
726
+ Returns
727
+ -------
728
+ out : dtype
729
+ The result type.
730
+
731
+ See also
732
+ --------
733
+ dtype, promote_types, min_scalar_type, can_cast
734
+
735
+ Examples
736
+ --------
737
+ >>> import numpy as np
738
+ >>> np.result_type(3, np.arange(7, dtype=np.int8))
739
+ dtype('int8')
740
+
741
+ >>> np.result_type(np.int32, np.complex64)
742
+ dtype('complex128')
743
+
744
+ >>> np.result_type(3.0, -2)
745
+ dtype('float64')
746
+
747
+ """
748
+ return arrays_and_dtypes
749
+
750
+
751
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.dot)
752
+ def dot(a, b, out=None):
753
+ """
754
+ dot(a, b, out=None)
755
+
756
+ Dot product of two arrays. Specifically,
757
+
758
+ - If both `a` and `b` are 1-D arrays, it is inner product of vectors
759
+ (without complex conjugation).
760
+
761
+ - If both `a` and `b` are 2-D arrays, it is matrix multiplication,
762
+ but using :func:`matmul` or ``a @ b`` is preferred.
763
+
764
+ - If either `a` or `b` is 0-D (scalar), it is equivalent to
765
+ :func:`multiply` and using ``numpy.multiply(a, b)`` or ``a * b`` is
766
+ preferred.
767
+
768
+ - If `a` is an N-D array and `b` is a 1-D array, it is a sum product over
769
+ the last axis of `a` and `b`.
770
+
771
+ - If `a` is an N-D array and `b` is an M-D array (where ``M>=2``), it is a
772
+ sum product over the last axis of `a` and the second-to-last axis of
773
+ `b`::
774
+
775
+ dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])
776
+
777
+ It uses an optimized BLAS library when possible (see `numpy.linalg`).
778
+
779
+ Parameters
780
+ ----------
781
+ a : array_like
782
+ First argument.
783
+ b : array_like
784
+ Second argument.
785
+ out : ndarray, optional
786
+ Output argument. This must have the exact kind that would be returned
787
+ if it was not used. In particular, it must have the right type, must be
788
+ C-contiguous, and its dtype must be the dtype that would be returned
789
+ for `dot(a,b)`. This is a performance feature. Therefore, if these
790
+ conditions are not met, an exception is raised, instead of attempting
791
+ to be flexible.
792
+
793
+ Returns
794
+ -------
795
+ output : ndarray
796
+ Returns the dot product of `a` and `b`. If `a` and `b` are both
797
+ scalars or both 1-D arrays then a scalar is returned; otherwise
798
+ an array is returned.
799
+ If `out` is given, then it is returned.
800
+
801
+ Raises
802
+ ------
803
+ ValueError
804
+ If the last dimension of `a` is not the same size as
805
+ the second-to-last dimension of `b`.
806
+
807
+ See Also
808
+ --------
809
+ vdot : Complex-conjugating dot product.
810
+ vecdot : Vector dot product of two arrays.
811
+ tensordot : Sum products over arbitrary axes.
812
+ einsum : Einstein summation convention.
813
+ matmul : '@' operator as method with out parameter.
814
+ linalg.multi_dot : Chained dot product.
815
+
816
+ Examples
817
+ --------
818
+ >>> import numpy as np
819
+ >>> np.dot(3, 4)
820
+ 12
821
+
822
+ Neither argument is complex-conjugated:
823
+
824
+ >>> np.dot([2j, 3j], [2j, 3j])
825
+ (-13+0j)
826
+
827
+ For 2-D arrays it is the matrix product:
828
+
829
+ >>> a = [[1, 0], [0, 1]]
830
+ >>> b = [[4, 1], [2, 2]]
831
+ >>> np.dot(a, b)
832
+ array([[4, 1],
833
+ [2, 2]])
834
+
835
+ >>> a = np.arange(3*4*5*6).reshape((3,4,5,6))
836
+ >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3))
837
+ >>> np.dot(a, b)[2,3,2,1,2,2]
838
+ 499128
839
+ >>> sum(a[2,3,2,:] * b[1,2,:,2])
840
+ 499128
841
+
842
+ """
843
+ return (a, b, out)
844
+
845
+
846
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.vdot)
847
+ def vdot(a, b, /):
848
+ r"""
849
+ vdot(a, b, /)
850
+
851
+ Return the dot product of two vectors.
852
+
853
+ The `vdot` function handles complex numbers differently than `dot`:
854
+ if the first argument is complex, it is replaced by its complex conjugate
855
+ in the dot product calculation. `vdot` also handles multidimensional
856
+ arrays differently than `dot`: it does not perform a matrix product, but
857
+ flattens the arguments to 1-D arrays before taking a vector dot product.
858
+
859
+ Consequently, when the arguments are 2-D arrays of the same shape, this
860
+ function effectively returns their
861
+ `Frobenius inner product <https://en.wikipedia.org/wiki/Frobenius_inner_product>`_
862
+ (also known as the *trace inner product* or the *standard inner product*
863
+ on a vector space of matrices).
864
+
865
+ Parameters
866
+ ----------
867
+ a : array_like
868
+ If `a` is complex the complex conjugate is taken before calculation
869
+ of the dot product.
870
+ b : array_like
871
+ Second argument to the dot product.
872
+
873
+ Returns
874
+ -------
875
+ output : ndarray
876
+ Dot product of `a` and `b`. Can be an int, float, or
877
+ complex depending on the types of `a` and `b`.
878
+
879
+ See Also
880
+ --------
881
+ dot : Return the dot product without using the complex conjugate of the
882
+ first argument.
883
+
884
+ Examples
885
+ --------
886
+ >>> import numpy as np
887
+ >>> a = np.array([1+2j,3+4j])
888
+ >>> b = np.array([5+6j,7+8j])
889
+ >>> np.vdot(a, b)
890
+ (70-8j)
891
+ >>> np.vdot(b, a)
892
+ (70+8j)
893
+
894
+ Note that higher-dimensional arrays are flattened!
895
+
896
+ >>> a = np.array([[1, 4], [5, 6]])
897
+ >>> b = np.array([[4, 1], [2, 2]])
898
+ >>> np.vdot(a, b)
899
+ 30
900
+ >>> np.vdot(b, a)
901
+ 30
902
+ >>> 1*4 + 4*1 + 5*2 + 6*2
903
+ 30
904
+
905
+ """
906
+ return (a, b)
907
+
908
+
909
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.bincount)
910
+ def bincount(x, /, weights=None, minlength=0):
911
+ """
912
+ bincount(x, /, weights=None, minlength=0)
913
+
914
+ Count number of occurrences of each value in array of non-negative ints.
915
+
916
+ The number of bins (of size 1) is one larger than the largest value in
917
+ `x`. If `minlength` is specified, there will be at least this number
918
+ of bins in the output array (though it will be longer if necessary,
919
+ depending on the contents of `x`).
920
+ Each bin gives the number of occurrences of its index value in `x`.
921
+ If `weights` is specified the input array is weighted by it, i.e. if a
922
+ value ``n`` is found at position ``i``, ``out[n] += weight[i]`` instead
923
+ of ``out[n] += 1``.
924
+
925
+ Parameters
926
+ ----------
927
+ x : array_like, 1 dimension, nonnegative ints
928
+ Input array.
929
+ weights : array_like, optional
930
+ Weights, array of the same shape as `x`.
931
+ minlength : int, optional
932
+ A minimum number of bins for the output array.
933
+
934
+ Returns
935
+ -------
936
+ out : ndarray of ints
937
+ The result of binning the input array.
938
+ The length of `out` is equal to ``np.amax(x)+1``.
939
+
940
+ Raises
941
+ ------
942
+ ValueError
943
+ If the input is not 1-dimensional, or contains elements with negative
944
+ values, or if `minlength` is negative.
945
+ TypeError
946
+ If the type of the input is float or complex.
947
+
948
+ See Also
949
+ --------
950
+ histogram, digitize, unique
951
+
952
+ Examples
953
+ --------
954
+ >>> import numpy as np
955
+ >>> np.bincount(np.arange(5))
956
+ array([1, 1, 1, 1, 1])
957
+ >>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7]))
958
+ array([1, 3, 1, 1, 0, 0, 0, 1])
959
+
960
+ >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23])
961
+ >>> np.bincount(x).size == np.amax(x)+1
962
+ True
963
+
964
+ The input array needs to be of integer dtype, otherwise a
965
+ TypeError is raised:
966
+
967
+ >>> np.bincount(np.arange(5, dtype=np.float64))
968
+ Traceback (most recent call last):
969
+ ...
970
+ TypeError: Cannot cast array data from dtype('float64') to dtype('int64')
971
+ according to the rule 'safe'
972
+
973
+ A possible use of ``bincount`` is to perform sums over
974
+ variable-size chunks of an array, using the ``weights`` keyword.
975
+
976
+ >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights
977
+ >>> x = np.array([0, 1, 1, 2, 2, 2])
978
+ >>> np.bincount(x, weights=w)
979
+ array([ 0.3, 0.7, 1.1])
980
+
981
+ """
982
+ return (x, weights)
983
+
984
+
985
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.ravel_multi_index)
986
+ def ravel_multi_index(multi_index, dims, mode="raise", order="C"):
987
+ """
988
+ ravel_multi_index(multi_index, dims, mode='raise', order='C')
989
+
990
+ Converts a tuple of index arrays into an array of flat
991
+ indices, applying boundary modes to the multi-index.
992
+
993
+ Parameters
994
+ ----------
995
+ multi_index : tuple of array_like
996
+ A tuple of integer arrays, one array for each dimension.
997
+ dims : tuple of ints
998
+ The shape of array into which the indices from ``multi_index`` apply.
999
+ mode : {'raise', 'wrap', 'clip'}, optional
1000
+ Specifies how out-of-bounds indices are handled. Can specify
1001
+ either one mode or a tuple of modes, one mode per index.
1002
+
1003
+ * 'raise' -- raise an error (default)
1004
+ * 'wrap' -- wrap around
1005
+ * 'clip' -- clip to the range
1006
+
1007
+ In 'clip' mode, a negative index which would normally
1008
+ wrap will clip to 0 instead.
1009
+ order : {'C', 'F'}, optional
1010
+ Determines whether the multi-index should be viewed as
1011
+ indexing in row-major (C-style) or column-major
1012
+ (Fortran-style) order.
1013
+
1014
+ Returns
1015
+ -------
1016
+ raveled_indices : ndarray
1017
+ An array of indices into the flattened version of an array
1018
+ of dimensions ``dims``.
1019
+
1020
+ See Also
1021
+ --------
1022
+ unravel_index
1023
+
1024
+ Examples
1025
+ --------
1026
+ >>> import numpy as np
1027
+ >>> arr = np.array([[3,6,6],[4,5,1]])
1028
+ >>> np.ravel_multi_index(arr, (7,6))
1029
+ array([22, 41, 37])
1030
+ >>> np.ravel_multi_index(arr, (7,6), order='F')
1031
+ array([31, 41, 13])
1032
+ >>> np.ravel_multi_index(arr, (4,6), mode='clip')
1033
+ array([22, 23, 19])
1034
+ >>> np.ravel_multi_index(arr, (4,4), mode=('clip','wrap'))
1035
+ array([12, 13, 13])
1036
+
1037
+ >>> np.ravel_multi_index((3,1,4,1), (6,7,8,9))
1038
+ 1621
1039
+ """
1040
+ return multi_index
1041
+
1042
+
1043
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.unravel_index)
1044
+ def unravel_index(indices, shape, order="C"):
1045
+ """
1046
+ unravel_index(indices, shape, order='C')
1047
+
1048
+ Converts a flat index or array of flat indices into a tuple
1049
+ of coordinate arrays.
1050
+
1051
+ Parameters
1052
+ ----------
1053
+ indices : array_like
1054
+ An integer array whose elements are indices into the flattened
1055
+ version of an array of dimensions ``shape``. Before version 1.6.0,
1056
+ this function accepted just one index value.
1057
+ shape : tuple of ints
1058
+ The shape of the array to use for unraveling ``indices``.
1059
+ order : {'C', 'F'}, optional
1060
+ Determines whether the indices should be viewed as indexing in
1061
+ row-major (C-style) or column-major (Fortran-style) order.
1062
+
1063
+ Returns
1064
+ -------
1065
+ unraveled_coords : tuple of ndarray
1066
+ Each array in the tuple has the same shape as the ``indices``
1067
+ array.
1068
+
1069
+ See Also
1070
+ --------
1071
+ ravel_multi_index
1072
+
1073
+ Examples
1074
+ --------
1075
+ >>> import numpy as np
1076
+ >>> np.unravel_index([22, 41, 37], (7,6))
1077
+ (array([3, 6, 6]), array([4, 5, 1]))
1078
+ >>> np.unravel_index([31, 41, 13], (7,6), order='F')
1079
+ (array([3, 6, 6]), array([4, 5, 1]))
1080
+
1081
+ >>> np.unravel_index(1621, (6,7,8,9))
1082
+ (3, 1, 4, 1)
1083
+
1084
+ """
1085
+ return (indices,)
1086
+
1087
+
1088
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.copyto)
1089
+ def copyto(dst, src, casting="same_kind", where=True):
1090
+ """
1091
+ copyto(dst, src, casting='same_kind', where=True)
1092
+
1093
+ Copies values from one array to another, broadcasting as necessary.
1094
+
1095
+ Raises a TypeError if the `casting` rule is violated, and if
1096
+ `where` is provided, it selects which elements to copy.
1097
+
1098
+ Parameters
1099
+ ----------
1100
+ dst : ndarray
1101
+ The array into which values are copied.
1102
+ src : array_like
1103
+ The array from which values are copied.
1104
+ casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional
1105
+ Controls what kind of data casting may occur when copying.
1106
+
1107
+ * 'no' means the data types should not be cast at all.
1108
+ * 'equiv' means only byte-order changes are allowed.
1109
+ * 'safe' means only casts which can preserve values are allowed.
1110
+ * 'same_kind' means only safe casts or casts within a kind,
1111
+ like float64 to float32, are allowed.
1112
+ * 'unsafe' means any data conversions may be done.
1113
+ where : array_like of bool, optional
1114
+ A boolean array which is broadcasted to match the dimensions
1115
+ of `dst`, and selects elements to copy from `src` to `dst`
1116
+ wherever it contains the value True.
1117
+
1118
+ Examples
1119
+ --------
1120
+ >>> import numpy as np
1121
+ >>> A = np.array([4, 5, 6])
1122
+ >>> B = [1, 2, 3]
1123
+ >>> np.copyto(A, B)
1124
+ >>> A
1125
+ array([1, 2, 3])
1126
+
1127
+ >>> A = np.array([[1, 2, 3], [4, 5, 6]])
1128
+ >>> B = [[4, 5, 6], [7, 8, 9]]
1129
+ >>> np.copyto(A, B)
1130
+ >>> A
1131
+ array([[4, 5, 6],
1132
+ [7, 8, 9]])
1133
+
1134
+ """
1135
+ return (dst, src, where)
1136
+
1137
+
1138
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.putmask)
1139
+ def putmask(a, /, mask, values):
1140
+ """
1141
+ putmask(a, /, mask, values)
1142
+
1143
+ Changes elements of an array based on conditional and input values.
1144
+
1145
+ Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``.
1146
+
1147
+ If `values` is not the same size as `a` and `mask` then it will repeat.
1148
+ This gives behavior different from ``a[mask] = values``.
1149
+
1150
+ Parameters
1151
+ ----------
1152
+ a : ndarray
1153
+ Target array.
1154
+ mask : array_like
1155
+ Boolean mask array. It has to be the same shape as `a`.
1156
+ values : array_like
1157
+ Values to put into `a` where `mask` is True. If `values` is smaller
1158
+ than `a` it will be repeated.
1159
+
1160
+ See Also
1161
+ --------
1162
+ place, put, take, copyto
1163
+
1164
+ Examples
1165
+ --------
1166
+ >>> import numpy as np
1167
+ >>> x = np.arange(6).reshape(2, 3)
1168
+ >>> np.putmask(x, x>2, x**2)
1169
+ >>> x
1170
+ array([[ 0, 1, 2],
1171
+ [ 9, 16, 25]])
1172
+
1173
+ If `values` is smaller than `a` it is repeated:
1174
+
1175
+ >>> x = np.arange(5)
1176
+ >>> np.putmask(x, x>1, [-33, -44])
1177
+ >>> x
1178
+ array([ 0, 1, -33, -44, -33])
1179
+
1180
+ """
1181
+ return (a, mask, values)
1182
+
1183
+
1184
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.packbits)
1185
+ def packbits(a, /, axis=None, bitorder="big"):
1186
+ """
1187
+ packbits(a, /, axis=None, bitorder='big')
1188
+
1189
+ Packs the elements of a binary-valued array into bits in a uint8 array.
1190
+
1191
+ The result is padded to full bytes by inserting zero bits at the end.
1192
+
1193
+ Parameters
1194
+ ----------
1195
+ a : array_like
1196
+ An array of integers or booleans whose elements should be packed to
1197
+ bits.
1198
+ axis : int, optional
1199
+ The dimension over which bit-packing is done.
1200
+ ``None`` implies packing the flattened array.
1201
+ bitorder : {'big', 'little'}, optional
1202
+ The order of the input bits. 'big' will mimic bin(val),
1203
+ ``[0, 0, 0, 0, 0, 0, 1, 1] => 3 = 0b00000011``, 'little' will
1204
+ reverse the order so ``[1, 1, 0, 0, 0, 0, 0, 0] => 3``.
1205
+ Defaults to 'big'.
1206
+
1207
+ Returns
1208
+ -------
1209
+ packed : ndarray
1210
+ Array of type uint8 whose elements represent bits corresponding to the
1211
+ logical (0 or nonzero) value of the input elements. The shape of
1212
+ `packed` has the same number of dimensions as the input (unless `axis`
1213
+ is None, in which case the output is 1-D).
1214
+
1215
+ See Also
1216
+ --------
1217
+ unpackbits: Unpacks elements of a uint8 array into a binary-valued output
1218
+ array.
1219
+
1220
+ Examples
1221
+ --------
1222
+ >>> import numpy as np
1223
+ >>> a = np.array([[[1,0,1],
1224
+ ... [0,1,0]],
1225
+ ... [[1,1,0],
1226
+ ... [0,0,1]]])
1227
+ >>> b = np.packbits(a, axis=-1)
1228
+ >>> b
1229
+ array([[[160],
1230
+ [ 64]],
1231
+ [[192],
1232
+ [ 32]]], dtype=uint8)
1233
+
1234
+ Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000,
1235
+ and 32 = 0010 0000.
1236
+
1237
+ """
1238
+ return (a,)
1239
+
1240
+
1241
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.unpackbits)
1242
+ def unpackbits(a, /, axis=None, count=None, bitorder="big"):
1243
+ """
1244
+ unpackbits(a, /, axis=None, count=None, bitorder='big')
1245
+
1246
+ Unpacks elements of a uint8 array into a binary-valued output array.
1247
+
1248
+ Each element of `a` represents a bit-field that should be unpacked
1249
+ into a binary-valued output array. The shape of the output array is
1250
+ either 1-D (if `axis` is ``None``) or the same shape as the input
1251
+ array with unpacking done along the axis specified.
1252
+
1253
+ Parameters
1254
+ ----------
1255
+ a : ndarray, uint8 type
1256
+ Input array.
1257
+ axis : int, optional
1258
+ The dimension over which bit-unpacking is done.
1259
+ ``None`` implies unpacking the flattened array.
1260
+ count : int or None, optional
1261
+ The number of elements to unpack along `axis`, provided as a way
1262
+ of undoing the effect of packing a size that is not a multiple
1263
+ of eight. A non-negative number means to only unpack `count`
1264
+ bits. A negative number means to trim off that many bits from
1265
+ the end. ``None`` means to unpack the entire array (the
1266
+ default). Counts larger than the available number of bits will
1267
+ add zero padding to the output. Negative counts must not
1268
+ exceed the available number of bits.
1269
+ bitorder : {'big', 'little'}, optional
1270
+ The order of the returned bits. 'big' will mimic bin(val),
1271
+ ``3 = 0b00000011 => [0, 0, 0, 0, 0, 0, 1, 1]``, 'little' will reverse
1272
+ the order to ``[1, 1, 0, 0, 0, 0, 0, 0]``.
1273
+ Defaults to 'big'.
1274
+
1275
+ Returns
1276
+ -------
1277
+ unpacked : ndarray, uint8 type
1278
+ The elements are binary-valued (0 or 1).
1279
+
1280
+ See Also
1281
+ --------
1282
+ packbits : Packs the elements of a binary-valued array into bits in
1283
+ a uint8 array.
1284
+
1285
+ Examples
1286
+ --------
1287
+ >>> import numpy as np
1288
+ >>> a = np.array([[2], [7], [23]], dtype=np.uint8)
1289
+ >>> a
1290
+ array([[ 2],
1291
+ [ 7],
1292
+ [23]], dtype=uint8)
1293
+ >>> b = np.unpackbits(a, axis=1)
1294
+ >>> b
1295
+ array([[0, 0, 0, 0, 0, 0, 1, 0],
1296
+ [0, 0, 0, 0, 0, 1, 1, 1],
1297
+ [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8)
1298
+ >>> c = np.unpackbits(a, axis=1, count=-3)
1299
+ >>> c
1300
+ array([[0, 0, 0, 0, 0],
1301
+ [0, 0, 0, 0, 0],
1302
+ [0, 0, 0, 1, 0]], dtype=uint8)
1303
+
1304
+ >>> p = np.packbits(b, axis=0)
1305
+ >>> np.unpackbits(p, axis=0)
1306
+ array([[0, 0, 0, 0, 0, 0, 1, 0],
1307
+ [0, 0, 0, 0, 0, 1, 1, 1],
1308
+ [0, 0, 0, 1, 0, 1, 1, 1],
1309
+ [0, 0, 0, 0, 0, 0, 0, 0],
1310
+ [0, 0, 0, 0, 0, 0, 0, 0],
1311
+ [0, 0, 0, 0, 0, 0, 0, 0],
1312
+ [0, 0, 0, 0, 0, 0, 0, 0],
1313
+ [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
1314
+ >>> np.array_equal(b, np.unpackbits(p, axis=0, count=b.shape[0]))
1315
+ True
1316
+
1317
+ """
1318
+ return (a,)
1319
+
1320
+
1321
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.shares_memory)
1322
+ def shares_memory(a, b, /, max_work=-1):
1323
+ """
1324
+ shares_memory(a, b, /, max_work=-1)
1325
+
1326
+ Determine if two arrays share memory.
1327
+
1328
+ .. warning::
1329
+
1330
+ This function can be exponentially slow for some inputs, unless
1331
+ `max_work` is set to zero or a positive integer.
1332
+ If in doubt, use `numpy.may_share_memory` instead.
1333
+
1334
+ Parameters
1335
+ ----------
1336
+ a, b : ndarray
1337
+ Input arrays
1338
+ max_work : int, optional
1339
+ Effort to spend on solving the overlap problem (maximum number
1340
+ of candidate solutions to consider). The following special
1341
+ values are recognized:
1342
+
1343
+ max_work=-1 (default)
1344
+ The problem is solved exactly. In this case, the function returns
1345
+ True only if there is an element shared between the arrays. Finding
1346
+ the exact solution may take extremely long in some cases.
1347
+ max_work=0
1348
+ Only the memory bounds of a and b are checked.
1349
+ This is equivalent to using ``may_share_memory()``.
1350
+
1351
+ Raises
1352
+ ------
1353
+ numpy.exceptions.TooHardError
1354
+ Exceeded max_work.
1355
+
1356
+ Returns
1357
+ -------
1358
+ out : bool
1359
+
1360
+ See Also
1361
+ --------
1362
+ may_share_memory
1363
+
1364
+ Examples
1365
+ --------
1366
+ >>> import numpy as np
1367
+ >>> x = np.array([1, 2, 3, 4])
1368
+ >>> np.shares_memory(x, np.array([5, 6, 7]))
1369
+ False
1370
+ >>> np.shares_memory(x[::2], x)
1371
+ True
1372
+ >>> np.shares_memory(x[::2], x[1::2])
1373
+ False
1374
+
1375
+ Checking whether two arrays share memory is NP-complete, and
1376
+ runtime may increase exponentially in the number of
1377
+ dimensions. Hence, `max_work` should generally be set to a finite
1378
+ number, as it is possible to construct examples that take
1379
+ extremely long to run:
1380
+
1381
+ >>> from numpy.lib.stride_tricks import as_strided
1382
+ >>> x = np.zeros([192163377], dtype=np.int8)
1383
+ >>> x1 = as_strided(
1384
+ ... x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049))
1385
+ >>> x2 = as_strided(
1386
+ ... x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1))
1387
+ >>> np.shares_memory(x1, x2, max_work=1000)
1388
+ Traceback (most recent call last):
1389
+ ...
1390
+ numpy.exceptions.TooHardError: Exceeded max_work
1391
+
1392
+ Running ``np.shares_memory(x1, x2)`` without `max_work` set takes
1393
+ around 1 minute for this case. It is possible to find problems
1394
+ that take still significantly longer.
1395
+
1396
+ """
1397
+ return (a, b)
1398
+
1399
+
1400
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.may_share_memory)
1401
+ def may_share_memory(a, b, /, max_work=0):
1402
+ """
1403
+ may_share_memory(a, b, /, max_work=0)
1404
+
1405
+ Determine if two arrays might share memory
1406
+
1407
+ A return of True does not necessarily mean that the two arrays
1408
+ share any element. It just means that they *might*.
1409
+
1410
+ Only the memory bounds of a and b are checked by default.
1411
+
1412
+ Parameters
1413
+ ----------
1414
+ a, b : ndarray
1415
+ Input arrays
1416
+ max_work : int, optional
1417
+ Effort to spend on solving the overlap problem. See
1418
+ `shares_memory` for details. Default for ``may_share_memory``
1419
+ is to do a bounds check.
1420
+
1421
+ Returns
1422
+ -------
1423
+ out : bool
1424
+
1425
+ See Also
1426
+ --------
1427
+ shares_memory
1428
+
1429
+ Examples
1430
+ --------
1431
+ >>> import numpy as np
1432
+ >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9]))
1433
+ False
1434
+ >>> x = np.zeros([3, 4])
1435
+ >>> np.may_share_memory(x[:,0], x[:,1])
1436
+ True
1437
+
1438
+ """
1439
+ return (a, b)
1440
+
1441
+
1442
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.is_busday)
1443
+ def is_busday(dates, weekmask="1111100", holidays=None, busdaycal=None, out=None):
1444
+ """
1445
+ is_busday(
1446
+ dates,
1447
+ weekmask='1111100',
1448
+ holidays=None,
1449
+ busdaycal=None,
1450
+ out=None,
1451
+ )
1452
+
1453
+ Calculates which of the given dates are valid days, and which are not.
1454
+
1455
+ Parameters
1456
+ ----------
1457
+ dates : array_like of datetime64[D]
1458
+ The array of dates to process.
1459
+ weekmask : str or array_like of bool, optional
1460
+ A seven-element array indicating which of Monday through Sunday are
1461
+ valid days. May be specified as a length-seven list or array, like
1462
+ [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string
1463
+ like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for
1464
+ weekdays, optionally separated by white space. Valid abbreviations
1465
+ are: Mon Tue Wed Thu Fri Sat Sun
1466
+ holidays : array_like of datetime64[D], optional
1467
+ An array of dates to consider as invalid dates. They may be
1468
+ specified in any order, and NaT (not-a-time) dates are ignored.
1469
+ This list is saved in a normalized form that is suited for
1470
+ fast calculations of valid days.
1471
+ busdaycal : busdaycalendar, optional
1472
+ A `busdaycalendar` object which specifies the valid days. If this
1473
+ parameter is provided, neither weekmask nor holidays may be
1474
+ provided.
1475
+ out : array of bool, optional
1476
+ If provided, this array is filled with the result.
1477
+
1478
+ Returns
1479
+ -------
1480
+ out : array of bool
1481
+ An array with the same shape as ``dates``, containing True for
1482
+ each valid day, and False for each invalid day.
1483
+
1484
+ See Also
1485
+ --------
1486
+ busdaycalendar : An object that specifies a custom set of valid days.
1487
+ busday_offset : Applies an offset counted in valid days.
1488
+ busday_count : Counts how many valid days are in a half-open date range.
1489
+
1490
+ Examples
1491
+ --------
1492
+ >>> import numpy as np
1493
+ >>> # The weekdays are Friday, Saturday, and Monday
1494
+ ... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'],
1495
+ ... holidays=['2011-07-01', '2011-07-04', '2011-07-17'])
1496
+ array([False, False, True])
1497
+ """
1498
+ return (dates, weekmask, holidays, out)
1499
+
1500
+
1501
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.busday_offset)
1502
+ def busday_offset(dates, offsets, roll="raise", weekmask="1111100", holidays=None,
1503
+ busdaycal=None, out=None):
1504
+ """
1505
+ busday_offset(
1506
+ dates,
1507
+ offsets,
1508
+ roll='raise',
1509
+ weekmask='1111100',
1510
+ holidays=None,
1511
+ busdaycal=None,
1512
+ out=None,
1513
+ )
1514
+
1515
+ First adjusts the date to fall on a valid day according to
1516
+ the ``roll`` rule, then applies offsets to the given dates
1517
+ counted in valid days.
1518
+
1519
+ Parameters
1520
+ ----------
1521
+ dates : array_like of datetime64[D]
1522
+ The array of dates to process.
1523
+ offsets : array_like of int
1524
+ The array of offsets, which is broadcast with ``dates``.
1525
+ roll : {'raise', 'nat', 'forward', 'following', 'backward', 'preceding', \
1526
+ 'modifiedfollowing', 'modifiedpreceding'}, optional
1527
+ How to treat dates that do not fall on a valid day. The default
1528
+ is 'raise'.
1529
+
1530
+ * 'raise' means to raise an exception for an invalid day.
1531
+ * 'nat' means to return a NaT (not-a-time) for an invalid day.
1532
+ * 'forward' and 'following' mean to take the first valid day
1533
+ later in time.
1534
+ * 'backward' and 'preceding' mean to take the first valid day
1535
+ earlier in time.
1536
+ * 'modifiedfollowing' means to take the first valid day
1537
+ later in time unless it is across a Month boundary, in which
1538
+ case to take the first valid day earlier in time.
1539
+ * 'modifiedpreceding' means to take the first valid day
1540
+ earlier in time unless it is across a Month boundary, in which
1541
+ case to take the first valid day later in time.
1542
+ weekmask : str or array_like of bool, optional
1543
+ A seven-element array indicating which of Monday through Sunday are
1544
+ valid days. May be specified as a length-seven list or array, like
1545
+ [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string
1546
+ like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for
1547
+ weekdays, optionally separated by white space. Valid abbreviations
1548
+ are: Mon Tue Wed Thu Fri Sat Sun
1549
+ holidays : array_like of datetime64[D], optional
1550
+ An array of dates to consider as invalid dates. They may be
1551
+ specified in any order, and NaT (not-a-time) dates are ignored.
1552
+ This list is saved in a normalized form that is suited for
1553
+ fast calculations of valid days.
1554
+ busdaycal : busdaycalendar, optional
1555
+ A `busdaycalendar` object which specifies the valid days. If this
1556
+ parameter is provided, neither weekmask nor holidays may be
1557
+ provided.
1558
+ out : array of datetime64[D], optional
1559
+ If provided, this array is filled with the result.
1560
+
1561
+ Returns
1562
+ -------
1563
+ out : array of datetime64[D]
1564
+ An array with a shape from broadcasting ``dates`` and ``offsets``
1565
+ together, containing the dates with offsets applied.
1566
+
1567
+ See Also
1568
+ --------
1569
+ busdaycalendar : An object that specifies a custom set of valid days.
1570
+ is_busday : Returns a boolean array indicating valid days.
1571
+ busday_count : Counts how many valid days are in a half-open date range.
1572
+
1573
+ Examples
1574
+ --------
1575
+ >>> import numpy as np
1576
+ >>> # First business day in October 2011 (not accounting for holidays)
1577
+ ... np.busday_offset('2011-10', 0, roll='forward')
1578
+ np.datetime64('2011-10-03')
1579
+ >>> # Last business day in February 2012 (not accounting for holidays)
1580
+ ... np.busday_offset('2012-03', -1, roll='forward')
1581
+ np.datetime64('2012-02-29')
1582
+ >>> # Third Wednesday in January 2011
1583
+ ... np.busday_offset('2011-01', 2, roll='forward', weekmask='Wed')
1584
+ np.datetime64('2011-01-19')
1585
+ >>> # 2012 Mother's Day in Canada and the U.S.
1586
+ ... np.busday_offset('2012-05', 1, roll='forward', weekmask='Sun')
1587
+ np.datetime64('2012-05-13')
1588
+
1589
+ >>> # First business day on or after a date
1590
+ ... np.busday_offset('2011-03-20', 0, roll='forward')
1591
+ np.datetime64('2011-03-21')
1592
+ >>> np.busday_offset('2011-03-22', 0, roll='forward')
1593
+ np.datetime64('2011-03-22')
1594
+ >>> # First business day after a date
1595
+ ... np.busday_offset('2011-03-20', 1, roll='backward')
1596
+ np.datetime64('2011-03-21')
1597
+ >>> np.busday_offset('2011-03-22', 1, roll='backward')
1598
+ np.datetime64('2011-03-23')
1599
+ """
1600
+ return (dates, offsets, weekmask, holidays, out)
1601
+
1602
+
1603
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.busday_count)
1604
+ def busday_count(begindates, enddates, weekmask="1111100", holidays=(),
1605
+ busdaycal=None, out=None):
1606
+ """
1607
+ busday_count(
1608
+ begindates,
1609
+ enddates,
1610
+ weekmask='1111100',
1611
+ holidays=[],
1612
+ busdaycal=None,
1613
+ out=None
1614
+ )
1615
+
1616
+ Counts the number of valid days between `begindates` and
1617
+ `enddates`, not including the day of `enddates`.
1618
+
1619
+ If ``enddates`` specifies a date value that is earlier than the
1620
+ corresponding ``begindates`` date value, the count will be negative.
1621
+
1622
+ Parameters
1623
+ ----------
1624
+ begindates : array_like of datetime64[D]
1625
+ The array of the first dates for counting.
1626
+ enddates : array_like of datetime64[D]
1627
+ The array of the end dates for counting, which are excluded
1628
+ from the count themselves.
1629
+ weekmask : str or array_like of bool, optional
1630
+ A seven-element array indicating which of Monday through Sunday are
1631
+ valid days. May be specified as a length-seven list or array, like
1632
+ [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string
1633
+ like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for
1634
+ weekdays, optionally separated by white space. Valid abbreviations
1635
+ are: Mon Tue Wed Thu Fri Sat Sun
1636
+ holidays : array_like of datetime64[D], optional
1637
+ An array of dates to consider as invalid dates. They may be
1638
+ specified in any order, and NaT (not-a-time) dates are ignored.
1639
+ This list is saved in a normalized form that is suited for
1640
+ fast calculations of valid days.
1641
+ busdaycal : busdaycalendar, optional
1642
+ A `busdaycalendar` object which specifies the valid days. If this
1643
+ parameter is provided, neither weekmask nor holidays may be
1644
+ provided.
1645
+ out : array of int, optional
1646
+ If provided, this array is filled with the result.
1647
+
1648
+ Returns
1649
+ -------
1650
+ out : array of int
1651
+ An array with a shape from broadcasting ``begindates`` and ``enddates``
1652
+ together, containing the number of valid days between
1653
+ the begin and end dates.
1654
+
1655
+ See Also
1656
+ --------
1657
+ busdaycalendar : An object that specifies a custom set of valid days.
1658
+ is_busday : Returns a boolean array indicating valid days.
1659
+ busday_offset : Applies an offset counted in valid days.
1660
+
1661
+ Examples
1662
+ --------
1663
+ >>> import numpy as np
1664
+ >>> # Number of weekdays in January 2011
1665
+ ... np.busday_count('2011-01', '2011-02')
1666
+ 21
1667
+ >>> # Number of weekdays in 2011
1668
+ >>> np.busday_count('2011', '2012')
1669
+ 260
1670
+ >>> # Number of Saturdays in 2011
1671
+ ... np.busday_count('2011', '2012', weekmask='Sat')
1672
+ 53
1673
+ """
1674
+ return (begindates, enddates, weekmask, holidays, out)
1675
+
1676
+
1677
+ @array_function_from_c_func_and_dispatcher(_multiarray_umath.datetime_as_string)
1678
+ def datetime_as_string(arr, unit=None, timezone="naive", casting="same_kind"):
1679
+ """
1680
+ datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind')
1681
+
1682
+ Convert an array of datetimes into an array of strings.
1683
+
1684
+ Parameters
1685
+ ----------
1686
+ arr : array_like of datetime64
1687
+ The array of UTC timestamps to format.
1688
+ unit : str
1689
+ One of None, 'auto', or
1690
+ a :ref:`datetime unit <arrays.dtypes.dateunits>`.
1691
+ timezone : {'naive', 'UTC', 'local'} or tzinfo
1692
+ Timezone information to use when displaying the datetime. If 'UTC',
1693
+ end with a Z to indicate UTC time. If 'local', convert to the local
1694
+ timezone first, and suffix with a +-#### timezone offset. If a tzinfo
1695
+ object, then do as with 'local', but use the specified timezone.
1696
+ casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}
1697
+ Casting to allow when changing between datetime units.
1698
+
1699
+ Returns
1700
+ -------
1701
+ str_arr : ndarray
1702
+ An array of strings the same shape as `arr`.
1703
+
1704
+ Examples
1705
+ --------
1706
+ >>> import numpy as np
1707
+ >>> from zoneinfo import ZoneInfo
1708
+ >>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]')
1709
+ >>> d
1710
+ array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30',
1711
+ '2002-10-27T07:30'], dtype='datetime64[m]')
1712
+
1713
+ Setting the timezone to UTC shows the same information, but with a Z suffix
1714
+
1715
+ >>> np.datetime_as_string(d, timezone='UTC')
1716
+ array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z',
1717
+ '2002-10-27T07:30Z'], dtype='<U35')
1718
+
1719
+ Note that we picked datetimes that cross a DST boundary. Passing in a
1720
+ ``ZoneInfo`` object will print the appropriate offset
1721
+
1722
+ >>> np.datetime_as_string(d, timezone=ZoneInfo('US/Eastern'))
1723
+ array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400',
1724
+ '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='<U39')
1725
+
1726
+ Passing in a unit will change the precision
1727
+
1728
+ >>> np.datetime_as_string(d, unit='h')
1729
+ array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'],
1730
+ dtype='<U32')
1731
+ >>> np.datetime_as_string(d, unit='s')
1732
+ array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00',
1733
+ '2002-10-27T07:30:00'], dtype='<U38')
1734
+
1735
+ 'casting' can be used to specify whether precision can be changed
1736
+
1737
+ >>> np.datetime_as_string(d, unit='h', casting='safe')
1738
+ Traceback (most recent call last):
1739
+ ...
1740
+ TypeError: Cannot create a datetime string as units 'h' from a NumPy
1741
+ datetime with units 'm' according to the rule 'safe'
1742
+ """
1743
+ return (arr,)