numpy-ts 1.2.0 → 1.3.0

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 (408) hide show
  1. package/README.md +3 -11
  2. package/dist/esm/common/dtype.js +1 -1
  3. package/dist/esm/common/internal/compute.js +1 -1
  4. package/dist/esm/common/internal/indexing.js +1 -1
  5. package/dist/esm/common/ndarray-core.js +1 -1
  6. package/dist/esm/common/ops/advanced.js +1 -1
  7. package/dist/esm/common/ops/arithmetic.js +1 -1
  8. package/dist/esm/common/ops/bitwise.js +1 -1
  9. package/dist/esm/common/ops/comparison.js +1 -1
  10. package/dist/esm/common/ops/complex.js +1 -1
  11. package/dist/esm/common/ops/exponential.js +1 -1
  12. package/dist/esm/common/ops/fft.js +1 -1
  13. package/dist/esm/common/ops/gradient.js +1 -1
  14. package/dist/esm/common/ops/hyperbolic.js +1 -1
  15. package/dist/esm/common/ops/linalg.js +2 -2
  16. package/dist/esm/common/ops/logic.js +1 -1
  17. package/dist/esm/common/ops/random.js +1 -1
  18. package/dist/esm/common/ops/reduction.js +1 -1
  19. package/dist/esm/common/ops/rounding.js +1 -1
  20. package/dist/esm/common/ops/shape.js +1 -1
  21. package/dist/esm/common/ops/sorting.js +1 -1
  22. package/dist/esm/common/ops/statistics.js +1 -1
  23. package/dist/esm/common/ops/trig.js +1 -1
  24. package/dist/esm/common/storage.js +1 -1
  25. package/dist/esm/common/wasm/abs.js +1 -1
  26. package/dist/esm/common/wasm/add.js +1 -1
  27. package/dist/esm/common/wasm/all_finite.js +1 -0
  28. package/dist/esm/common/wasm/arccos.js +1 -1
  29. package/dist/esm/common/wasm/arcsin.js +1 -1
  30. package/dist/esm/common/wasm/arctan.js +1 -1
  31. package/dist/esm/common/wasm/arctan2.js +1 -0
  32. package/dist/esm/common/wasm/argpartition.js +1 -1
  33. package/dist/esm/common/wasm/argsort.js +1 -1
  34. package/dist/esm/common/wasm/bins/abs.wasm.js +1 -1
  35. package/dist/esm/common/wasm/bins/add.wasm.js +1 -1
  36. package/dist/esm/common/wasm/bins/all_finite.wasm.js +1 -0
  37. package/dist/esm/common/wasm/bins/alloc.wasm.js +1 -0
  38. package/dist/esm/common/wasm/bins/arccos.wasm.js +1 -1
  39. package/dist/esm/common/wasm/bins/arcsin.wasm.js +1 -1
  40. package/dist/esm/common/wasm/bins/arctan.wasm.js +1 -1
  41. package/dist/esm/common/wasm/bins/arctan2.wasm.js +1 -0
  42. package/dist/esm/common/wasm/bins/argpartition.wasm.js +1 -1
  43. package/dist/esm/common/wasm/bins/argsort.wasm.js +1 -1
  44. package/dist/esm/common/wasm/bins/bitwise_and.wasm.js +1 -1
  45. package/dist/esm/common/wasm/bins/bitwise_count.wasm.js +1 -1
  46. package/dist/esm/common/wasm/bins/bitwise_not.wasm.js +1 -1
  47. package/dist/esm/common/wasm/bins/bitwise_or.wasm.js +1 -1
  48. package/dist/esm/common/wasm/bins/bitwise_xor.wasm.js +1 -1
  49. package/dist/esm/common/wasm/bins/cholesky.wasm.js +1 -1
  50. package/dist/esm/common/wasm/bins/clip.wasm.js +1 -1
  51. package/dist/esm/common/wasm/bins/convolve.wasm.js +1 -1
  52. package/dist/esm/common/wasm/bins/copysign.wasm.js +1 -1
  53. package/dist/esm/common/wasm/bins/correlate.wasm.js +1 -1
  54. package/dist/esm/common/wasm/bins/cos.wasm.js +1 -1
  55. package/dist/esm/common/wasm/bins/cosh.wasm.js +1 -1
  56. package/dist/esm/common/wasm/bins/cross.wasm.js +1 -1
  57. package/dist/esm/common/wasm/bins/diff.wasm.js +1 -1
  58. package/dist/esm/common/wasm/bins/divide.wasm.js +1 -1
  59. package/dist/esm/common/wasm/bins/divmod.wasm.js +1 -0
  60. package/dist/esm/common/wasm/bins/dot_float-relaxed.wasm.js +1 -0
  61. package/dist/esm/common/wasm/bins/dot_float.wasm.js +1 -0
  62. package/dist/esm/common/wasm/bins/dot_int.wasm.js +1 -0
  63. package/dist/esm/common/wasm/bins/exp.wasm.js +1 -1
  64. package/dist/esm/common/wasm/bins/exp2.wasm.js +1 -1
  65. package/dist/esm/common/wasm/bins/fft.wasm.js +1 -1
  66. package/dist/esm/common/wasm/bins/frexp.wasm.js +1 -1
  67. package/dist/esm/common/wasm/bins/gather.wasm.js +1 -1
  68. package/dist/esm/common/wasm/bins/gcd.wasm.js +1 -1
  69. package/dist/esm/common/wasm/bins/gradient.wasm.js +1 -1
  70. package/dist/esm/common/wasm/bins/heaviside.wasm.js +1 -1
  71. package/dist/esm/common/wasm/bins/hypot.wasm.js +1 -1
  72. package/dist/esm/common/wasm/bins/indices.wasm.js +1 -1
  73. package/dist/esm/common/wasm/bins/inner_float-relaxed.wasm.js +1 -0
  74. package/dist/esm/common/wasm/bins/inner_float.wasm.js +1 -0
  75. package/dist/esm/common/wasm/bins/inner_int.wasm.js +1 -0
  76. package/dist/esm/common/wasm/bins/isfinite.wasm.js +1 -0
  77. package/dist/esm/common/wasm/bins/isnan.wasm.js +1 -0
  78. package/dist/esm/common/wasm/bins/kron.wasm.js +1 -1
  79. package/dist/esm/common/wasm/bins/ldexp.wasm.js +1 -1
  80. package/dist/esm/common/wasm/bins/left_shift.wasm.js +1 -1
  81. package/dist/esm/common/wasm/bins/lexsort.wasm.js +1 -1
  82. package/dist/esm/common/wasm/bins/logaddexp.wasm.js +1 -1
  83. package/dist/esm/common/wasm/bins/logical_and.wasm.js +1 -1
  84. package/dist/esm/common/wasm/bins/logical_not.wasm.js +1 -1
  85. package/dist/esm/common/wasm/bins/logical_or.wasm.js +1 -1
  86. package/dist/esm/common/wasm/bins/logical_xor.wasm.js +1 -1
  87. package/dist/esm/common/wasm/bins/lu.wasm.js +1 -0
  88. package/dist/esm/common/wasm/bins/matmul_float-relaxed.wasm.js +1 -0
  89. package/dist/esm/common/wasm/bins/matmul_float.wasm.js +1 -0
  90. package/dist/esm/common/wasm/bins/matmul_int.wasm.js +1 -0
  91. package/dist/esm/common/wasm/bins/matvec_float-relaxed.wasm.js +1 -0
  92. package/dist/esm/common/wasm/bins/matvec_float.wasm.js +1 -0
  93. package/dist/esm/common/wasm/bins/matvec_int.wasm.js +1 -0
  94. package/dist/esm/common/wasm/bins/max.wasm.js +1 -1
  95. package/dist/esm/common/wasm/bins/min.wasm.js +1 -1
  96. package/dist/esm/common/wasm/bins/mul.wasm.js +1 -1
  97. package/dist/esm/common/wasm/bins/neg.wasm.js +1 -1
  98. package/dist/esm/common/wasm/bins/outer.wasm.js +1 -1
  99. package/dist/esm/common/wasm/bins/pad.wasm.js +1 -1
  100. package/dist/esm/common/wasm/bins/partition.wasm.js +1 -1
  101. package/dist/esm/common/wasm/bins/power.wasm.js +1 -1
  102. package/dist/esm/common/wasm/bins/qr.wasm.js +1 -1
  103. package/dist/esm/common/wasm/bins/reciprocal.wasm.js +1 -1
  104. package/dist/esm/common/wasm/bins/reduce_all.wasm.js +1 -1
  105. package/dist/esm/common/wasm/bins/reduce_any.wasm.js +1 -1
  106. package/dist/esm/common/wasm/bins/reduce_argmax.wasm.js +1 -1
  107. package/dist/esm/common/wasm/bins/reduce_argmin.wasm.js +1 -1
  108. package/dist/esm/common/wasm/bins/reduce_count_nz.wasm.js +1 -1
  109. package/dist/esm/common/wasm/bins/reduce_max.wasm.js +1 -1
  110. package/dist/esm/common/wasm/bins/reduce_mean.wasm.js +1 -1
  111. package/dist/esm/common/wasm/bins/reduce_min.wasm.js +1 -1
  112. package/dist/esm/common/wasm/bins/reduce_nanmax.wasm.js +1 -1
  113. package/dist/esm/common/wasm/bins/reduce_nanmin.wasm.js +1 -1
  114. package/dist/esm/common/wasm/bins/reduce_nansum.wasm.js +1 -1
  115. package/dist/esm/common/wasm/bins/reduce_prod.wasm.js +1 -1
  116. package/dist/esm/common/wasm/bins/reduce_std.wasm.js +1 -1
  117. package/dist/esm/common/wasm/bins/reduce_sum.wasm.js +1 -1
  118. package/dist/esm/common/wasm/bins/reduce_var.wasm.js +1 -1
  119. package/dist/esm/common/wasm/bins/repeat.wasm.js +1 -1
  120. package/dist/esm/common/wasm/bins/right_shift.wasm.js +1 -1
  121. package/dist/esm/common/wasm/bins/rng.wasm.js +1 -1
  122. package/dist/esm/common/wasm/bins/roll.wasm.js +1 -1
  123. package/dist/esm/common/wasm/bins/searchsorted.wasm.js +1 -1
  124. package/dist/esm/common/wasm/bins/sign.wasm.js +1 -1
  125. package/dist/esm/common/wasm/bins/signbit.wasm.js +1 -0
  126. package/dist/esm/common/wasm/bins/sin.wasm.js +1 -0
  127. package/dist/esm/common/wasm/bins/sinh.wasm.js +1 -1
  128. package/dist/esm/common/wasm/bins/sort.wasm.js +1 -1
  129. package/dist/esm/common/wasm/bins/sqrt.wasm.js +1 -1
  130. package/dist/esm/common/wasm/bins/square.wasm.js +1 -1
  131. package/dist/esm/common/wasm/bins/sub.wasm.js +1 -1
  132. package/dist/esm/common/wasm/bins/svd.wasm.js +1 -1
  133. package/dist/esm/common/wasm/bins/tan.wasm.js +1 -1
  134. package/dist/esm/common/wasm/bins/tanh.wasm.js +1 -1
  135. package/dist/esm/common/wasm/bins/tile.wasm.js +1 -1
  136. package/dist/esm/common/wasm/bins/unravel_index.wasm.js +1 -0
  137. package/dist/esm/common/wasm/bins/vdot.wasm.js +1 -1
  138. package/dist/esm/common/wasm/bins/vecdot_float-relaxed.wasm.js +1 -0
  139. package/dist/esm/common/wasm/bins/vecdot_float.wasm.js +1 -0
  140. package/dist/esm/common/wasm/bins/vecdot_int.wasm.js +1 -0
  141. package/dist/esm/common/wasm/bins/vecmat_float-relaxed.wasm.js +1 -0
  142. package/dist/esm/common/wasm/bins/vecmat_float.wasm.js +1 -0
  143. package/dist/esm/common/wasm/bins/vecmat_int.wasm.js +1 -0
  144. package/dist/esm/common/wasm/bins/vector_norm-relaxed.wasm.js +1 -0
  145. package/dist/esm/common/wasm/bins/vector_norm.wasm.js +1 -0
  146. package/dist/esm/common/wasm/bitwise_and.js +1 -1
  147. package/dist/esm/common/wasm/bitwise_count.js +1 -1
  148. package/dist/esm/common/wasm/bitwise_not.js +1 -1
  149. package/dist/esm/common/wasm/bitwise_or.js +1 -1
  150. package/dist/esm/common/wasm/bitwise_xor.js +1 -1
  151. package/dist/esm/common/wasm/cholesky.js +1 -1
  152. package/dist/esm/common/wasm/clip.js +1 -1
  153. package/dist/esm/common/wasm/config.js +1 -1
  154. package/dist/esm/common/wasm/convolve.js +1 -1
  155. package/dist/esm/common/wasm/copysign.js +1 -1
  156. package/dist/esm/common/wasm/correlate.js +1 -1
  157. package/dist/esm/common/wasm/cos.js +1 -1
  158. package/dist/esm/common/wasm/cosh.js +1 -1
  159. package/dist/esm/common/wasm/cross.js +1 -1
  160. package/dist/esm/common/wasm/detect.js +1 -0
  161. package/dist/esm/common/wasm/diff.js +1 -1
  162. package/dist/esm/common/wasm/divide.js +1 -1
  163. package/dist/esm/common/wasm/divmod.js +1 -0
  164. package/dist/esm/common/wasm/dot.js +1 -1
  165. package/dist/esm/common/wasm/exp.js +1 -1
  166. package/dist/esm/common/wasm/exp2.js +1 -1
  167. package/dist/esm/common/wasm/fft.js +1 -1
  168. package/dist/esm/common/wasm/frexp.js +1 -1
  169. package/dist/esm/common/wasm/gather.js +1 -1
  170. package/dist/esm/common/wasm/gcd.js +1 -1
  171. package/dist/esm/common/wasm/gradient.js +1 -1
  172. package/dist/esm/common/wasm/heaviside.js +1 -1
  173. package/dist/esm/common/wasm/hypot.js +1 -1
  174. package/dist/esm/common/wasm/indices.js +1 -1
  175. package/dist/esm/common/wasm/inner.js +1 -1
  176. package/dist/esm/common/wasm/isfinite.js +1 -0
  177. package/dist/esm/common/wasm/isnan.js +1 -0
  178. package/dist/esm/common/wasm/kron.js +1 -1
  179. package/dist/esm/common/wasm/ldexp.js +1 -1
  180. package/dist/esm/common/wasm/left_shift.js +1 -1
  181. package/dist/esm/common/wasm/lexsort.js +1 -1
  182. package/dist/esm/common/wasm/logaddexp.js +1 -1
  183. package/dist/esm/common/wasm/logical_and.js +1 -1
  184. package/dist/esm/common/wasm/logical_not.js +1 -1
  185. package/dist/esm/common/wasm/logical_or.js +1 -1
  186. package/dist/esm/common/wasm/logical_xor.js +1 -1
  187. package/dist/esm/common/wasm/lu.js +1 -0
  188. package/dist/esm/common/wasm/matmul.js +1 -1
  189. package/dist/esm/common/wasm/matvec.js +1 -1
  190. package/dist/esm/common/wasm/max.js +1 -1
  191. package/dist/esm/common/wasm/min.js +1 -1
  192. package/dist/esm/common/wasm/mul.js +1 -1
  193. package/dist/esm/common/wasm/neg.js +1 -1
  194. package/dist/esm/common/wasm/outer.js +1 -1
  195. package/dist/esm/common/wasm/pad.js +1 -1
  196. package/dist/esm/common/wasm/partition.js +1 -1
  197. package/dist/esm/common/wasm/power.js +1 -1
  198. package/dist/esm/common/wasm/qr.js +1 -1
  199. package/dist/esm/common/wasm/reciprocal.js +1 -1
  200. package/dist/esm/common/wasm/reduce_all.js +1 -1
  201. package/dist/esm/common/wasm/reduce_any.js +1 -1
  202. package/dist/esm/common/wasm/reduce_argmax.js +1 -1
  203. package/dist/esm/common/wasm/reduce_argmin.js +1 -1
  204. package/dist/esm/common/wasm/reduce_count_nz.js +1 -1
  205. package/dist/esm/common/wasm/reduce_max.js +1 -1
  206. package/dist/esm/common/wasm/reduce_mean.js +1 -1
  207. package/dist/esm/common/wasm/reduce_min.js +1 -1
  208. package/dist/esm/common/wasm/reduce_nanmax.js +1 -1
  209. package/dist/esm/common/wasm/reduce_nanmin.js +1 -1
  210. package/dist/esm/common/wasm/reduce_nansum.js +1 -1
  211. package/dist/esm/common/wasm/reduce_prod.js +1 -1
  212. package/dist/esm/common/wasm/reduce_quantile.js +1 -1
  213. package/dist/esm/common/wasm/reduce_std.js +1 -1
  214. package/dist/esm/common/wasm/reduce_sum.js +1 -1
  215. package/dist/esm/common/wasm/reduce_var.js +1 -1
  216. package/dist/esm/common/wasm/repeat.js +1 -1
  217. package/dist/esm/common/wasm/right_shift.js +1 -1
  218. package/dist/esm/common/wasm/rng.js +1 -1
  219. package/dist/esm/common/wasm/roll.js +1 -1
  220. package/dist/esm/common/wasm/runtime.js +1 -1
  221. package/dist/esm/common/wasm/searchsorted.js +1 -1
  222. package/dist/esm/common/wasm/sign.js +1 -1
  223. package/dist/esm/common/wasm/signbit.js +1 -0
  224. package/dist/esm/common/wasm/sin.js +1 -0
  225. package/dist/esm/common/wasm/sinh.js +1 -1
  226. package/dist/esm/common/wasm/sort.js +1 -1
  227. package/dist/esm/common/wasm/sqrt.js +1 -1
  228. package/dist/esm/common/wasm/square.js +1 -1
  229. package/dist/esm/common/wasm/sub.js +1 -1
  230. package/dist/esm/common/wasm/svd.js +1 -1
  231. package/dist/esm/common/wasm/tan.js +1 -1
  232. package/dist/esm/common/wasm/tanh.js +1 -1
  233. package/dist/esm/common/wasm/tile.js +1 -1
  234. package/dist/esm/common/wasm/unravel_index.js +1 -0
  235. package/dist/esm/common/wasm/vdot.js +1 -1
  236. package/dist/esm/common/wasm/vecdot.js +1 -1
  237. package/dist/esm/common/wasm/vecmat.js +1 -1
  238. package/dist/esm/common/wasm/vector_norm.js +1 -0
  239. package/dist/esm/core/advanced.js +1 -1
  240. package/dist/esm/core/creation.js +1 -1
  241. package/dist/esm/core/index.js +1 -1
  242. package/dist/esm/core/linalg.js +1 -1
  243. package/dist/esm/core/polynomial.js +1 -1
  244. package/dist/esm/core/reduction.js +1 -1
  245. package/dist/esm/core/shape-extra.js +1 -1
  246. package/dist/esm/core/statistics.js +1 -1
  247. package/dist/esm/full/index.js +1 -1
  248. package/dist/esm/full/ndarray.js +1 -1
  249. package/dist/esm/index.js +1 -1
  250. package/dist/esm/io/npy/parser.js +1 -1
  251. package/dist/esm/io/zip/reader.js +1 -1
  252. package/dist/numpy-ts.browser.js +6 -6
  253. package/dist/types/common/dtype.d.ts +46 -0
  254. package/dist/types/common/internal/indexing.d.ts +9 -0
  255. package/dist/types/common/ndarray-core.d.ts +20 -0
  256. package/dist/types/common/ops/advanced.d.ts +17 -2
  257. package/dist/types/common/ops/complex.d.ts +19 -1
  258. package/dist/types/common/ops/linalg.d.ts +1 -1
  259. package/dist/types/common/ops/reduction.d.ts +2 -2
  260. package/dist/types/common/ops/sets.d.ts +2 -1
  261. package/dist/types/common/ops/shape.d.ts +2 -2
  262. package/dist/types/common/ops/statistics.d.ts +2 -1
  263. package/dist/types/common/storage.d.ts +54 -2
  264. package/dist/types/common/wasm/all_finite.d.ts +8 -0
  265. package/dist/types/common/wasm/arccos.d.ts +4 -2
  266. package/dist/types/common/wasm/arcsin.d.ts +4 -2
  267. package/dist/types/common/wasm/arctan.d.ts +4 -2
  268. package/dist/types/common/wasm/arctan2.d.ts +17 -0
  269. package/dist/types/common/wasm/argpartition.d.ts +8 -3
  270. package/dist/types/common/wasm/argsort.d.ts +8 -3
  271. package/dist/types/common/wasm/bins/abs.wasm.d.ts +1 -0
  272. package/dist/types/common/wasm/bins/all_finite.wasm.d.ts +4 -0
  273. package/dist/types/common/wasm/bins/alloc.wasm.d.ts +6 -0
  274. package/dist/types/common/wasm/bins/arccos.wasm.d.ts +8 -2
  275. package/dist/types/common/wasm/bins/arcsin.wasm.d.ts +8 -2
  276. package/dist/types/common/wasm/bins/arctan.wasm.d.ts +8 -2
  277. package/dist/types/common/wasm/bins/arctan2.wasm.d.ts +11 -0
  278. package/dist/types/common/wasm/bins/convolve.wasm.d.ts +6 -0
  279. package/dist/types/common/wasm/bins/copysign.wasm.d.ts +2 -0
  280. package/dist/types/common/wasm/bins/correlate.wasm.d.ts +6 -0
  281. package/dist/types/common/wasm/bins/cos.wasm.d.ts +8 -0
  282. package/dist/types/common/wasm/bins/cosh.wasm.d.ts +8 -2
  283. package/dist/types/common/wasm/bins/divmod.wasm.d.ts +11 -0
  284. package/dist/types/common/wasm/bins/dot_float-relaxed.wasm.d.ts +5 -0
  285. package/dist/types/common/wasm/bins/dot_float.wasm.d.ts +5 -0
  286. package/dist/types/common/wasm/bins/dot_int.wasm.d.ts +5 -0
  287. package/dist/types/common/wasm/bins/exp.wasm.d.ts +8 -2
  288. package/dist/types/common/wasm/bins/exp2.wasm.d.ts +8 -2
  289. package/dist/types/common/wasm/bins/fft.wasm.d.ts +6 -0
  290. package/dist/types/common/wasm/bins/frexp.wasm.d.ts +1 -0
  291. package/dist/types/common/wasm/bins/gather.wasm.d.ts +0 -1
  292. package/dist/types/common/wasm/bins/gcd.wasm.d.ts +8 -0
  293. package/dist/types/common/wasm/bins/indices.wasm.d.ts +6 -2
  294. package/dist/types/common/wasm/bins/inner_float-relaxed.wasm.d.ts +5 -0
  295. package/dist/types/common/wasm/bins/inner_float.wasm.d.ts +5 -0
  296. package/dist/types/common/wasm/bins/inner_int.wasm.d.ts +5 -0
  297. package/dist/types/common/wasm/bins/isfinite.wasm.d.ts +4 -0
  298. package/dist/types/common/wasm/bins/isnan.wasm.d.ts +4 -0
  299. package/dist/types/common/wasm/bins/lexsort.wasm.d.ts +4 -4
  300. package/dist/types/common/wasm/bins/logical_and.wasm.d.ts +2 -0
  301. package/dist/types/common/wasm/bins/logical_not.wasm.d.ts +1 -0
  302. package/dist/types/common/wasm/bins/logical_or.wasm.d.ts +2 -0
  303. package/dist/types/common/wasm/bins/logical_xor.wasm.d.ts +2 -0
  304. package/dist/types/common/wasm/bins/lu.wasm.d.ts +7 -0
  305. package/dist/types/common/wasm/bins/matmul_float-relaxed.wasm.d.ts +5 -0
  306. package/dist/types/common/wasm/bins/matmul_float.wasm.d.ts +5 -0
  307. package/dist/types/common/wasm/bins/matmul_int.wasm.d.ts +5 -0
  308. package/dist/types/common/wasm/bins/matvec_float-relaxed.wasm.d.ts +5 -0
  309. package/dist/types/common/wasm/bins/matvec_float.wasm.d.ts +5 -0
  310. package/dist/types/common/wasm/bins/matvec_int.wasm.d.ts +5 -0
  311. package/dist/types/common/wasm/bins/neg.wasm.d.ts +1 -0
  312. package/dist/types/common/wasm/bins/qr.wasm.d.ts +0 -1
  313. package/dist/types/common/wasm/bins/reciprocal.wasm.d.ts +8 -4
  314. package/dist/types/common/wasm/bins/reduce_argmax.wasm.d.ts +8 -0
  315. package/dist/types/common/wasm/bins/reduce_argmin.wasm.d.ts +8 -0
  316. package/dist/types/common/wasm/bins/reduce_max.wasm.d.ts +1 -0
  317. package/dist/types/common/wasm/bins/reduce_min.wasm.d.ts +1 -0
  318. package/dist/types/common/wasm/bins/reduce_prod.wasm.d.ts +2 -0
  319. package/dist/types/common/wasm/bins/reduce_sum.wasm.d.ts +8 -2
  320. package/dist/types/common/wasm/bins/rng.wasm.d.ts +0 -3
  321. package/dist/types/common/wasm/bins/sign.wasm.d.ts +1 -0
  322. package/dist/types/common/wasm/bins/signbit.wasm.d.ts +8 -0
  323. package/dist/types/common/wasm/bins/sin.wasm.d.ts +11 -0
  324. package/dist/types/common/wasm/bins/sinh.wasm.d.ts +8 -2
  325. package/dist/types/common/wasm/bins/sort.wasm.d.ts +4 -4
  326. package/dist/types/common/wasm/bins/sqrt.wasm.d.ts +2 -2
  327. package/dist/types/common/wasm/bins/svd.wasm.d.ts +1 -0
  328. package/dist/types/common/wasm/bins/tan.wasm.d.ts +8 -0
  329. package/dist/types/common/wasm/bins/tanh.wasm.d.ts +8 -2
  330. package/dist/types/common/wasm/bins/unravel_index.wasm.d.ts +4 -0
  331. package/dist/types/common/wasm/bins/vecdot_float-relaxed.wasm.d.ts +5 -0
  332. package/dist/types/common/wasm/bins/vecdot_float.wasm.d.ts +5 -0
  333. package/dist/types/common/wasm/bins/vecdot_int.wasm.d.ts +5 -0
  334. package/dist/types/common/wasm/bins/vecmat_float-relaxed.wasm.d.ts +5 -0
  335. package/dist/types/common/wasm/bins/vecmat_float.wasm.d.ts +5 -0
  336. package/dist/types/common/wasm/bins/vecmat_int.wasm.d.ts +5 -0
  337. package/dist/types/common/wasm/bins/vector_norm-relaxed.wasm.d.ts +3 -0
  338. package/dist/types/common/wasm/bins/vector_norm.wasm.d.ts +3 -0
  339. package/dist/types/common/wasm/config.d.ts +25 -0
  340. package/dist/types/common/wasm/convolve.d.ts +1 -1
  341. package/dist/types/common/wasm/cos.d.ts +4 -2
  342. package/dist/types/common/wasm/cosh.d.ts +4 -2
  343. package/dist/types/common/wasm/detect.d.ts +17 -0
  344. package/dist/types/common/wasm/divide.d.ts +4 -0
  345. package/dist/types/common/wasm/divmod.d.ts +13 -0
  346. package/dist/types/common/wasm/exp.d.ts +4 -2
  347. package/dist/types/common/wasm/exp2.d.ts +4 -2
  348. package/dist/types/common/wasm/fft.d.ts +5 -5
  349. package/dist/types/common/wasm/frexp.d.ts +1 -0
  350. package/dist/types/common/wasm/gather.d.ts +4 -0
  351. package/dist/types/common/wasm/gcd.d.ts +1 -0
  352. package/dist/types/common/wasm/hypot.d.ts +4 -2
  353. package/dist/types/common/wasm/indices.d.ts +2 -1
  354. package/dist/types/common/wasm/isfinite.d.ts +7 -0
  355. package/dist/types/common/wasm/isnan.d.ts +7 -0
  356. package/dist/types/common/wasm/lexsort.d.ts +3 -1
  357. package/dist/types/common/wasm/logaddexp.d.ts +4 -2
  358. package/dist/types/common/wasm/lu.d.ts +27 -0
  359. package/dist/types/common/wasm/partition.d.ts +3 -1
  360. package/dist/types/common/wasm/reduce_argmax.d.ts +5 -0
  361. package/dist/types/common/wasm/reduce_argmin.d.ts +5 -0
  362. package/dist/types/common/wasm/reduce_prod.d.ts +4 -0
  363. package/dist/types/common/wasm/reduce_quantile.d.ts +11 -3
  364. package/dist/types/common/wasm/reduce_sum.d.ts +10 -0
  365. package/dist/types/common/wasm/rng.d.ts +10 -0
  366. package/dist/types/common/wasm/runtime.d.ts +113 -30
  367. package/dist/types/common/wasm/searchsorted.d.ts +3 -1
  368. package/dist/types/common/wasm/signbit.d.ts +14 -0
  369. package/dist/types/common/wasm/sin.d.ts +17 -0
  370. package/dist/types/common/wasm/sinh.d.ts +4 -2
  371. package/dist/types/common/wasm/sort.d.ts +4 -1
  372. package/dist/types/common/wasm/sqrt.d.ts +4 -2
  373. package/dist/types/common/wasm/svd.d.ts +6 -0
  374. package/dist/types/common/wasm/tan.d.ts +4 -2
  375. package/dist/types/common/wasm/tanh.d.ts +4 -2
  376. package/dist/types/common/wasm/unravel_index.d.ts +12 -0
  377. package/dist/types/common/wasm/vector_norm.d.ts +11 -0
  378. package/dist/types/core/advanced.d.ts +10 -2
  379. package/dist/types/core/creation.d.ts +1 -1
  380. package/dist/types/core/index.d.ts +2 -1
  381. package/dist/types/core/linalg.d.ts +1 -1
  382. package/dist/types/core/sets.d.ts +4 -1
  383. package/dist/types/core/statistics.d.ts +2 -1
  384. package/dist/types/full/index.d.ts +18 -5
  385. package/dist/types/index.d.ts +3 -1
  386. package/package.json +36 -43
  387. package/dist/esm/common/wasm/bins/dot.wasm.js +0 -1
  388. package/dist/esm/common/wasm/bins/flip.wasm.js +0 -1
  389. package/dist/esm/common/wasm/bins/inner.wasm.js +0 -1
  390. package/dist/esm/common/wasm/bins/matmul.wasm.js +0 -1
  391. package/dist/esm/common/wasm/bins/matvec.wasm.js +0 -1
  392. package/dist/esm/common/wasm/bins/reduce_quantile.wasm.js +0 -1
  393. package/dist/esm/common/wasm/bins/rot90.wasm.js +0 -1
  394. package/dist/esm/common/wasm/bins/vecdot.wasm.js +0 -1
  395. package/dist/esm/common/wasm/bins/vecmat.wasm.js +0 -1
  396. package/dist/esm/common/wasm/flip.js +0 -1
  397. package/dist/esm/common/wasm/rot90.js +0 -1
  398. package/dist/types/common/wasm/bins/dot.wasm.d.ts +0 -9
  399. package/dist/types/common/wasm/bins/flip.wasm.d.ts +0 -7
  400. package/dist/types/common/wasm/bins/inner.wasm.d.ts +0 -9
  401. package/dist/types/common/wasm/bins/matmul.wasm.d.ts +0 -9
  402. package/dist/types/common/wasm/bins/matvec.wasm.d.ts +0 -9
  403. package/dist/types/common/wasm/bins/reduce_quantile.wasm.d.ts +0 -2
  404. package/dist/types/common/wasm/bins/rot90.wasm.d.ts +0 -7
  405. package/dist/types/common/wasm/bins/vecdot.wasm.d.ts +0 -9
  406. package/dist/types/common/wasm/bins/vecmat.wasm.d.ts +0 -9
  407. package/dist/types/common/wasm/flip.d.ts +0 -13
  408. package/dist/types/common/wasm/rot90.d.ts +0 -14
@@ -3,8 +3,10 @@
3
3
  *
4
4
  * Unary: out[i] = cos(a[i])
5
5
  * Returns null if WASM can't handle this case.
6
- * Float types use native kernels; integer types are converted to float64
7
- * in JS and run through the f64 SIMD kernel (matches NumPy's promotion).
6
+ * Float types use native kernels; integer types use type-appropriate output:
7
+ * i8/u8 f32 (then downcast to f16 if available)
8
+ * i16/u16 → f32
9
+ * i32/u32/i64/u64 → f64
8
10
  */
9
11
  import { ArrayStorage } from '../storage';
10
12
  /**
@@ -3,8 +3,10 @@
3
3
  *
4
4
  * Unary: out[i] = cosh(a[i])
5
5
  * Returns null if WASM can't handle this case.
6
- * Float types use native kernels; integer types are converted to float64
7
- * in JS and run through the f64 SIMD kernel (matches NumPy's promotion).
6
+ * Float types use native kernels; integer types use type-appropriate output:
7
+ * i8/u8 f32 (then downcast to f16 if available)
8
+ * i16/u16 → f32
9
+ * i32/u32/i64/u64 → f64
8
10
  */
9
11
  import { ArrayStorage } from '../storage';
10
12
  /**
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Relaxed SIMD feature detection.
3
+ *
4
+ * Probes for relaxed SIMD support using WebAssembly.validate() with a
5
+ * minimal module containing f32x4.relaxed_madd. Sync, cached, zero cost
6
+ * after first call.
7
+ */
8
+ /** Returns true if the runtime supports WASM relaxed SIMD. Cached after first call. */
9
+ export declare function supportsRelaxedSimd(): boolean;
10
+ /**
11
+ * Returns true if relaxed SIMD kernels should be used, respecting config override.
12
+ * - 'auto' (default): detect via probe
13
+ * - true: force relaxed (will fail instantiation on unsupported runtimes)
14
+ * - false: force baseline
15
+ */
16
+ export declare function useRelaxedKernels(): boolean;
17
+ //# sourceMappingURL=detect.d.ts.map
@@ -4,6 +4,10 @@
4
4
  * Binary: out[i] = a[i] / b[i]
5
5
  * Scalar: out[i] = a[i] / scalar
6
6
  * Returns null if WASM can't handle this case.
7
+ * Integer types use type-appropriate output:
8
+ * i8/u8 → f32 (then downcast to f16 if available)
9
+ * i16/u16 → f32
10
+ * i32/u32/i64/u64 → f64
7
11
  */
8
12
  import { ArrayStorage } from '../storage';
9
13
  export declare function wasmDiv(a: ArrayStorage, b: ArrayStorage): ArrayStorage | null;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * WASM-accelerated fused divmod (scalar divisor).
3
+ *
4
+ * Computes floor quotient and floor remainder in a single pass.
5
+ * Returns [quotient, remainder] or null if WASM can't handle.
6
+ */
7
+ import { ArrayStorage } from '../storage';
8
+ /**
9
+ * Fused divmod with scalar divisor.
10
+ * Returns [quotient, remainder] or null if WASM can't handle.
11
+ */
12
+ export declare function wasmDivmodScalar(a: ArrayStorage, scalar: number): [ArrayStorage, ArrayStorage] | null;
13
+ //# sourceMappingURL=divmod.d.ts.map
@@ -3,8 +3,10 @@
3
3
  *
4
4
  * Unary: out[i] = exp(a[i])
5
5
  * Returns null if WASM can't handle this case.
6
- * Float types use native kernels; integer types are converted to float64
7
- * in JS and run through the f64 SIMD kernel (matches NumPy's promotion).
6
+ * Float types use native kernels; integer types use type-appropriate output:
7
+ * i8/u8 f32 (then downcast to f16 if available)
8
+ * i16/u16 → f32
9
+ * i32/u32/i64/u64 → f64
8
10
  */
9
11
  import { ArrayStorage } from '../storage';
10
12
  /**
@@ -3,8 +3,10 @@
3
3
  *
4
4
  * Unary: out[i] = exp2(a[i])
5
5
  * Returns null if WASM can't handle this case.
6
- * Float types use native kernels; integer types are converted to float64
7
- * in JS and run through the f64 SIMD kernel (matches NumPy's promotion).
6
+ * Float types use native kernels; integer types use type-appropriate output:
7
+ * i8/u8 f32 (then downcast to f16 if available)
8
+ * i16/u16 → f32
9
+ * i32/u32/i64/u64 → f64
8
10
  */
9
11
  import { ArrayStorage } from '../storage';
10
12
  /**
@@ -31,22 +31,22 @@ export declare function wasmIrfft(a: ArrayStorage, nOut: number): ArrayStorage |
31
31
  * WASM-accelerated 2D complex FFT or IFFT.
32
32
  * Input: contiguous complex128 2D array (rows × cols).
33
33
  */
34
- export declare function wasmFft2(data: Float64Array, rows: number, cols: number, inverse: boolean): Float64Array | null;
34
+ export declare function wasmFft2(data: Float64Array | Float32Array, rows: number, cols: number, inverse: boolean): Float64Array | Float32Array | null;
35
35
  /**
36
36
  * WASM-accelerated batch 1D complex FFT or IFFT.
37
37
  * Processes `batch` contiguous rows of `n` complex elements each.
38
38
  */
39
- export declare function wasmFftBatch(data: Float64Array, n: number, batch: number, inverse: boolean): Float64Array | null;
39
+ export declare function wasmFftBatch(data: Float64Array | Float32Array, n: number, batch: number, inverse: boolean): Float64Array | Float32Array | null;
40
40
  /**
41
41
  * WASM-accelerated batch real→complex rfft.
42
42
  * Input: real f64 data with `batch` rows of `n` elements.
43
43
  */
44
- export declare function wasmRfftBatch(srcData: Float64Array, n: number, batch: number, inStride: number, outStride: number): Float64Array | null;
44
+ export declare function wasmRfftBatch(srcData: Float64Array | Float32Array, n: number, batch: number, inStride: number, outStride: number): Float64Array | Float32Array | null;
45
45
  /**
46
46
  * WASM-accelerated batch complex→real irfft.
47
47
  * Input: complex128 data with `batch` rows of `nHalf` complex elements.
48
48
  */
49
- export declare function wasmIrfftBatch(srcData: Float64Array, nHalf: number, nOut: number, batch: number, inStride: number, outStride: number): Float64Array | null;
49
+ export declare function wasmIrfftBatch(srcData: Float64Array | Float32Array, nHalf: number, nOut: number, batch: number, inStride: number, outStride: number): Float64Array | Float32Array | null;
50
50
  /**
51
51
  * WASM-accelerated 2D real→complex rfft2.
52
52
  * Input: real f64 (rows × cols). Output: complex128 (rows × halfCols).
@@ -56,7 +56,7 @@ export declare function wasmRfft2(inputData: Float64Array | TypedArray, rows: nu
56
56
  * WASM-accelerated 2D inverse real FFT (irfft2).
57
57
  * Input: complex128 (rows × colsHalf). Output: real f64 (rows × outCols).
58
58
  */
59
- export declare function wasmIrfft2(inputData: Float64Array, rows: number, colsHalf: number, outCols: number): Float64Array | null;
59
+ export declare function wasmIrfft2(inputData: Float64Array | Float32Array, rows: number, colsHalf: number, outCols: number): Float64Array | Float32Array | null;
60
60
  /**
61
61
  * WASM-accelerated 3D inverse real FFT (irfftn for 3D).
62
62
  * Input: complex128 (d0 × d1 × d2Half). Output: real f64 (d0 × d1 × d2Out).
@@ -2,6 +2,7 @@
2
2
  * WASM-accelerated element-wise frexp (decompose into mantissa + exponent).
3
3
  *
4
4
  * Returns [mantissa, exponent] where x = mantissa * 2^exponent.
5
+ * Mantissa preserves input dtype (f64→f64, f32→f32, f16→f16).
5
6
  * Returns null if WASM can't handle this case.
6
7
  */
7
8
  import { ArrayStorage } from '../storage';
@@ -6,6 +6,10 @@ import { ArrayStorage } from '../storage';
6
6
  * WASM-accelerated extract (conditional gather).
7
7
  * condition must be flattened int32, data must be contiguous.
8
8
  * Returns ArrayStorage or null.
9
+ *
10
+ * Note: extract output size is unknown until kernel runs, so we use
11
+ * wasmMalloc for worst-case, then trim. For the actual result we need
12
+ * to know the count, so we read from the persistent region.
9
13
  */
10
14
  export declare function wasmExtract(condition: ArrayStorage, storage: ArrayStorage): ArrayStorage | null;
11
15
  /**
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * Scalar: out[i] = gcd(a[i], scalar)
5
5
  * Binary: out[i] = gcd(a[i], b[i])
6
+ * Preserves the promoted integer dtype (NumPy behavior).
6
7
  * Returns null if WASM can't handle this case.
7
8
  */
8
9
  import { ArrayStorage } from '../storage';
@@ -4,8 +4,10 @@
4
4
  * Binary: out[i] = hypot(a[i], b[i]) (same-shape contiguous arrays)
5
5
  * Scalar: out[i] = hypot(a[i], scalar)
6
6
  * Returns null if WASM can't handle this case.
7
- * Float types use native kernels; int64/uint64 use native i64 kernels
8
- * that convert to f64 in WASM (avoiding JS BigInt→Number overhead).
7
+ * Float types use native kernels; integer types use type-appropriate output:
8
+ * i8/u8 f32 (then downcast to f16 if available)
9
+ * i16/u16 → f32
10
+ * i32/u32/i64/u64 → f64
9
11
  */
10
12
  import { ArrayStorage } from '../storage';
11
13
  /**
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * WASM-accelerated np.indices() for 2D and 3D grids.
3
+ * Supports int32, int64, and float64 output dtypes.
3
4
  */
4
5
  import { ArrayStorage } from '../storage';
5
6
  /**
6
- * WASM-accelerated indices for 2D/3D grids with int32 dtype.
7
+ * WASM-accelerated indices for 2D/3D grids.
7
8
  * Returns null if WASM can't handle this case.
8
9
  */
9
10
  export declare function wasmIndices(dimensions: number[], dtype: string): ArrayStorage | null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * WASM-accelerated isfinite: out[i] = 1 if a[i] is finite, else 0.
3
+ * Returns null if WASM can't handle this case.
4
+ */
5
+ import { ArrayStorage } from '../storage';
6
+ export declare function wasmIsfinite(a: ArrayStorage): ArrayStorage | null;
7
+ //# sourceMappingURL=isfinite.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * WASM-accelerated isnan: out[i] = 1 if a[i] is NaN, else 0.
3
+ * Returns null if WASM can't handle this case.
4
+ */
5
+ import { ArrayStorage } from '../storage';
6
+ export declare function wasmIsnan(a: ArrayStorage): ArrayStorage | null;
7
+ //# sourceMappingURL=isnan.d.ts.map
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * WASM-accelerated lexsort (indirect stable sort on multiple keys).
3
3
  *
4
+ * Output is float64 indices for JS ergonomics (no BigInt).
5
+ * WASM sorts u32 internally and converts to f64 before returning.
4
6
  * All keys must be the same dtype and contiguous.
5
7
  * Returns null if WASM can't handle this case.
6
8
  */
@@ -8,7 +10,7 @@ import { ArrayStorage } from '../storage';
8
10
  /**
9
11
  * WASM-accelerated lexsort.
10
12
  * All keys must be the same dtype and 1D contiguous.
11
- * Returns ArrayStorage of int32 indices or null if WASM can't handle it.
13
+ * Returns ArrayStorage of float64 indices or null if WASM can't handle it.
12
14
  */
13
15
  export declare function wasmLexsort(keys: ArrayStorage[]): ArrayStorage | null;
14
16
  //# sourceMappingURL=lexsort.d.ts.map
@@ -4,8 +4,10 @@
4
4
  * Binary: out[i] = log(exp(a[i]) + exp(b[i])) (same-shape contiguous arrays)
5
5
  * Scalar: out[i] = log(exp(a[i]) + exp(scalar))
6
6
  * Returns null if WASM can't handle this case.
7
- * Float types use native kernels; int64/uint64 use native i64 kernels
8
- * that convert to f64 in WASM (avoiding JS BigInt→Number overhead).
7
+ * Float types use native kernels; integer types use type-appropriate output:
8
+ * i8/u8 f32 (then downcast to f16 if available)
9
+ * i16/u16 → f32
10
+ * i32/u32/i64/u64 → f64
9
11
  */
10
12
  import { ArrayStorage } from '../storage';
11
13
  /**
@@ -0,0 +1,27 @@
1
+ /**
2
+ * WASM-accelerated LU decomposition with partial pivoting.
3
+ *
4
+ * Provides lu_factor, lu_solve, and lu_inv for f64 and f32 square matrices.
5
+ */
6
+ import { ArrayStorage } from '../storage';
7
+ import type { DType } from '../dtype';
8
+ /**
9
+ * WASM LU factorization. Returns { lu, piv, sign } or null.
10
+ * lu: n×n f64 ArrayStorage with L (below diag) and U (on+above diag).
11
+ * piv: Int32Array of pivot indices.
12
+ * sign: +1 or -1 (permutation sign for determinant).
13
+ */
14
+ export declare function wasmLuFactor(a: ArrayStorage): {
15
+ lu: ArrayStorage;
16
+ piv: Int32Array;
17
+ sign: number;
18
+ } | null;
19
+ /**
20
+ * WASM LU inverse. Takes pre-computed LU + piv, returns n×n inverse.
21
+ */
22
+ export declare function wasmLuInv(lu: ArrayStorage, piv: Int32Array, dtype: DType): ArrayStorage | null;
23
+ /**
24
+ * WASM LU solve. Solves LU @ x = b for a single RHS vector.
25
+ */
26
+ export declare function wasmLuSolve(lu: ArrayStorage, piv: Int32Array, b: ArrayStorage, dtype: DType): ArrayStorage | null;
27
+ //# sourceMappingURL=lu.d.ts.map
@@ -6,10 +6,12 @@
6
6
  * Returns null if WASM can't handle this case.
7
7
  */
8
8
  import { ArrayStorage } from '../storage';
9
- import type { DType, TypedArray } from '../dtype';
9
+ import { type DType, TypedArray } from '../dtype';
10
10
  /**
11
11
  * WASM-accelerated partition of contiguous slices.
12
12
  * Uses batch kernel when slices are packed contiguously.
13
+ *
14
+ * Note: operates on pre-existing JS buffers, uses scratch.
13
15
  */
14
16
  export declare function wasmPartitionSlices(resultData: TypedArray, sliceOffsets: Int32Array | number[], axisSize: number, outerSize: number, kth: number, dtype: DType): boolean;
15
17
  /**
@@ -11,4 +11,9 @@ import { ArrayStorage } from '../storage';
11
11
  * Returns null if WASM can't handle (complex types, non-contiguous, too small).
12
12
  */
13
13
  export declare function wasmReduceArgmax(a: ArrayStorage): number | null;
14
+ /**
15
+ * WASM-accelerated strided argmax along an axis.
16
+ * Output dtype is always int32 (indices). Returns output ArrayStorage, or null if WASM can't handle.
17
+ */
18
+ export declare function wasmReduceArgmaxStrided(a: ArrayStorage, outerSize: number, axisSize: number, innerSize: number): ArrayStorage | null;
14
19
  //# sourceMappingURL=reduce_argmax.d.ts.map
@@ -11,4 +11,9 @@ import { ArrayStorage } from '../storage';
11
11
  * Returns null if WASM can't handle (complex types, non-contiguous, too small).
12
12
  */
13
13
  export declare function wasmReduceArgmin(a: ArrayStorage): number | null;
14
+ /**
15
+ * WASM-accelerated strided argmin along an axis.
16
+ * Output dtype is always int32 (indices). Returns output ArrayStorage, or null if WASM can't handle.
17
+ */
18
+ export declare function wasmReduceArgminStrided(a: ArrayStorage, outerSize: number, axisSize: number, innerSize: number): ArrayStorage | null;
14
19
  //# sourceMappingURL=reduce_argmin.d.ts.map
@@ -17,4 +17,8 @@ export declare function wasmReduceProd(a: ArrayStorage): number | null;
17
17
  * Returns output ArrayStorage, or null if WASM can't handle.
18
18
  */
19
19
  export declare function wasmReduceProdStrided(a: ArrayStorage, outerSize: number, axisSize: number, innerSize: number): ArrayStorage | null;
20
+ /**
21
+ * WASM-accelerated strided product for complex types.
22
+ */
23
+ export declare function wasmReduceProdStridedComplex(a: ArrayStorage, outerSize: number, axisSize: number, innerSize: number): ArrayStorage | null;
20
24
  //# sourceMappingURL=reduce_prod.d.ts.map
@@ -1,15 +1,23 @@
1
1
  /**
2
2
  * WASM-accelerated quantile computation.
3
3
  *
4
- * Sorts a copy of the data in WASM, then interpolates.
5
- * All dtypes are converted to f64 before passing to WASM.
4
+ * Sorts a copy of the data in-place using native-dtype sort kernels (same as
5
+ * wasmSort), then interpolates. No f64 conversion operates on the original
6
+ * dtype for both sort and readback.
7
+ *
6
8
  * Returns null if WASM can't handle this case.
7
9
  */
8
10
  import { ArrayStorage } from '../storage';
9
11
  /**
10
12
  * WASM-accelerated quantile (no axis, full array).
11
- * Converts all data to f64, sorts in WASM, interpolates.
13
+ * Sorts a scratch copy in the native dtype, then interpolates.
12
14
  * Returns null if WASM can't handle (complex, non-contiguous, too small).
13
15
  */
14
16
  export declare function wasmReduceQuantile(a: ArrayStorage, q: number): number | null;
17
+ /**
18
+ * WASM-accelerated strided quantile along an axis.
19
+ * For shape [outer, axisSize, inner], sorts each column and interpolates.
20
+ * Output is [outer * inner] f64, or null if WASM can't handle.
21
+ */
22
+ export declare function wasmReduceQuantileStrided(storage: ArrayStorage, outer: number, axisSize: number, inner: number, q: number): ArrayStorage | null;
15
23
  //# sourceMappingURL=reduce_quantile.d.ts.map
@@ -11,10 +11,20 @@ import { ArrayStorage } from '../storage';
11
11
  * Returns null if WASM can't handle (complex types, non-contiguous, too small).
12
12
  */
13
13
  export declare function wasmReduceSum(a: ArrayStorage): number | null;
14
+ /**
15
+ * WASM-accelerated global sum for complex types.
16
+ * Returns [re, im] tuple or null.
17
+ */
18
+ export declare function wasmReduceSumComplex(a: ArrayStorage): [number, number] | null;
14
19
  /**
15
20
  * WASM-accelerated strided sum along an axis.
16
21
  * Output is always f64 (the JS caller converts to the correct output dtype).
17
22
  * Returns f64 ArrayStorage, or null if WASM can't handle.
18
23
  */
19
24
  export declare function wasmReduceSumStrided(a: ArrayStorage, outerSize: number, axisSize: number, innerSize: number): ArrayStorage | null;
25
+ /**
26
+ * WASM-accelerated strided sum for complex types.
27
+ * Returns ArrayStorage of complex output, or null.
28
+ */
29
+ export declare function wasmReduceSumStridedComplex(a: ArrayStorage, outerSize: number, axisSize: number, innerSize: number): ArrayStorage | null;
20
30
  //# sourceMappingURL=reduce_sum.d.ts.map
@@ -4,6 +4,15 @@
4
4
  * Unlike other WASM wrappers, this is always used (no JS fallback).
5
5
  * State persists in WASM globals across calls.
6
6
  */
7
+ import { fill_uniform_f64_mt, fill_uniform_f64_pcg, fill_standard_normal_pcg, fill_standard_exponential_pcg, fill_legacy_gauss, fill_legacy_standard_exponential, fill_rk_interval, fill_legacy_standard_gamma, fill_legacy_chisquare, fill_pareto, fill_power, fill_weibull, fill_logistic, fill_gumbel, fill_laplace, fill_rayleigh, fill_triangular, fill_standard_cauchy, fill_lognormal, fill_wald, fill_standard_t, fill_beta, fill_f, fill_noncentral_chisquare, fill_noncentral_f, fill_geometric, fill_poisson, fill_binomial, fill_negative_binomial, fill_hypergeometric, fill_logseries, fill_zipf, fill_vonmises, fill_randint_i64, fill_randint_u8, fill_randint_u16, fill_permutation, fill_permutation_pcg, fill_bounded_uint64_pcg } from './bins/rng.wasm';
8
+ /**
9
+ * Fill directly into a WASM pointer — zero-copy path for callers that already
10
+ * have a persistent WASM allocation (e.g., ArrayStorage.empty()).
11
+ * @param ptr - byte offset into WASM memory to write to
12
+ * @param n - number of elements
13
+ * @param fn - the raw WASM fill kernel
14
+ */
15
+ export declare function directFill(ptr: number, n: number, fn: (outPtr: number, n: number) => void): void;
7
16
  export declare function initMT19937(seed: number): void;
8
17
  export declare function mt19937Uint32(): number;
9
18
  export declare function mt19937Float64(): number;
@@ -23,6 +32,7 @@ export declare const legacyGauss: () => number;
23
32
  export declare const legacyStandardExponential: () => number;
24
33
  export declare const legacyGaussReset: () => void;
25
34
  export declare const wasmLegacyStandardGamma: (shape: number) => number;
35
+ export { fill_uniform_f64_mt as rawFillUniformF64MT, fill_uniform_f64_pcg as rawFillUniformF64PCG, fill_standard_normal_pcg as rawFillStandardNormalPCG, fill_standard_exponential_pcg as rawFillStandardExponentialPCG, fill_legacy_gauss as rawFillLegacyGauss, fill_legacy_standard_exponential as rawFillLegacyStandardExponential, fill_standard_cauchy as rawFillStandardCauchy, fill_permutation as rawFillPermutation, fill_permutation_pcg as rawFillPermutationPCG, fill_legacy_standard_gamma as rawFillLegacyStandardGamma, fill_legacy_chisquare as rawFillLegacyChisquare, fill_pareto as rawFillPareto, fill_power as rawFillPower, fill_weibull as rawFillWeibull, fill_logistic as rawFillLogistic, fill_gumbel as rawFillGumbel, fill_laplace as rawFillLaplace, fill_rayleigh as rawFillRayleigh, fill_triangular as rawFillTriangular, fill_lognormal as rawFillLognormal, fill_wald as rawFillWald, fill_standard_t as rawFillStandardT, fill_beta as rawFillBeta, fill_f as rawFillF, fill_noncentral_chisquare as rawFillNoncentralChisquare, fill_noncentral_f as rawFillNoncentralF, fill_vonmises as rawFillVonmises, fill_geometric as rawFillGeometric, fill_poisson as rawFillPoisson, fill_binomial as rawFillBinomial, fill_negative_binomial as rawFillNegativeBinomial, fill_hypergeometric as rawFillHypergeometric, fill_logseries as rawFillLogseries, fill_zipf as rawFillZipf, fill_rk_interval as rawFillRkInterval, fill_randint_i64 as rawFillRandintI64, fill_randint_u8 as rawFillRandintU8, fill_randint_u16 as rawFillRandintU16, fill_bounded_uint64_pcg as rawFillBoundedUint64PCG, };
26
36
  export declare const fillUniformF64MT: (n: number) => Float64Array<ArrayBuffer>;
27
37
  export declare const fillUniformF64PCG: (n: number) => Float64Array<ArrayBuffer>;
28
38
  export declare const fillStandardNormalPCG: (n: number) => Float64Array<ArrayBuffer>;
@@ -1,55 +1,138 @@
1
1
  /**
2
- * WASM Runtime — shared memory management for all WASM kernels.
2
+ * WASM Runtime — zero-copy memory management for all WASM kernels.
3
3
  *
4
- * All kernel modules share a single WebAssembly.Memory instance.
5
- * Uses a bump allocator that resets on every kernel call (no fragmentation).
6
- * Memory grows monotonically (high-water-mark pattern).
4
+ * All array data lives in a single fixed-size WebAssembly.Memory instance.
5
+ * A persistent free-list allocator (alloc.zig) manages long-lived ArrayStorage
6
+ * data. A scratch bump allocator handles temporary copy-ins for JS-fallback
7
+ * arrays during kernel calls.
8
+ *
9
+ * Memory layout:
10
+ * [WASM statics][--- persistent heap (free-list) ---][--- scratch (bump) ---]
11
+ * 0 heapBase scratchBase maxBytes
12
+ *
13
+ * Because initial === maximum pages, memory.buffer is never detached by grow().
14
+ * All TypedArray views into it remain valid for the program lifetime.
7
15
  */
8
16
  import type { TypedArray } from '../dtype';
17
+ import { type ConfigureWasmOptions } from './config';
9
18
  /**
10
19
  * Get the shared WebAssembly.Memory instance.
11
- * All WASM kernel modules import this same memory.
12
- * Starts with 17 pages (~1.1MB) — enough for debug (ReleaseSmall/Safe) WASM builds
13
- * which have larger binaries and declare higher minimum memory.
20
+ * Allocated once with initial === maximum pages so the buffer never detaches.
14
21
  */
15
22
  export declare function getSharedMemory(): WebAssembly.Memory;
16
23
  /**
17
- * Ensure the shared memory has at least `bytes` of usable space
18
- * (above heapBase). Grows if necessary.
24
+ * Set the heap base offset. Called by each WASM module on first init
25
+ * (reads __heap_base from exports). The highest value wins.
19
26
  */
20
- export declare function ensureMemory(bytes: number): void;
27
+ export declare function setHeapBase(base: number): void;
21
28
  /**
22
- * Reset the bump allocator. Call before each kernel invocation.
23
- * Also increments wasmCallCount so callers can detect WASM execution.
29
+ * Configure WASM memory settings. Must be called before any array operations
30
+ * (i.e. before the WASM memory is initialized on first use).
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * import { configureWasm } from 'numpy-ts';
35
+ * configureWasm({ maxMemory: 512 * 1024 * 1024 }); // 512 MiB
36
+ * ```
24
37
  */
25
- export declare function resetAllocator(base?: number): void;
38
+ export declare function configureWasm(options: ConfigureWasmOptions): void;
39
+ export declare class WasmRegion {
40
+ readonly ptr: number;
41
+ readonly byteLength: number;
42
+ private _refCount;
43
+ constructor(ptr: number, byteLength: number);
44
+ retain(): void;
45
+ release(): void;
46
+ get refCount(): number;
47
+ }
26
48
  /**
27
- * Set the heap base offset. Called once when the first WASM instance
28
- * is initialized (reads __heap_base from the WASM exports).
49
+ * Register an object (typically ArrayStorage) so that when it is garbage
50
+ * collected, the associated WasmRegion's refcount is decremented.
51
+ * The instance itself is used as the unregister token, allowing
52
+ * eager cleanup via unregisterCleanup() to prevent double-free.
29
53
  */
30
- export declare function setHeapBase(base: number): void;
54
+ export declare function registerForCleanup(instance: object, region: WasmRegion): void;
55
+ /**
56
+ * Unregister an object from the FinalizationRegistry.
57
+ * Must be called when eagerly releasing WASM memory to prevent
58
+ * the GC callback from double-freeing the region.
59
+ */
60
+ export declare function unregisterCleanup(instance: object): void;
61
+ /**
62
+ * Allocate `bytes` from the persistent WASM heap.
63
+ * Returns a WasmRegion, or null if out of memory (caller should fall back to JS).
64
+ */
65
+ export declare function wasmMalloc(bytes: number): WasmRegion | null;
66
+ /**
67
+ * Total free bytes in the persistent heap.
68
+ */
69
+ export declare function wasmFreeBytes(): number;
70
+ /**
71
+ * Reset the scratch bump allocator. Call before each kernel invocation
72
+ * that may need to copy JS-fallback inputs into WASM memory.
73
+ * Also frees any temp heap allocations from the previous kernel call.
74
+ */
75
+ export declare function resetScratchAllocator(): void;
76
+ /**
77
+ * Bump-allocate `bytes` from the scratch region. Returns byte offset.
78
+ * Always 8-byte aligned. Falls back to heap if scratch space is exhausted.
79
+ */
80
+ export declare function scratchAlloc(bytes: number): number;
31
81
  /**
32
- * Bump-allocate `bytes` from WASM memory. Returns the byte offset.
33
- * Always 8-byte aligned for TypedArray compatibility.
82
+ * Copy a JS TypedArray into the scratch region. Returns byte offset.
34
83
  */
35
- export declare function alloc(bytes: number): number;
84
+ export declare function scratchCopyIn(src: TypedArray): number;
36
85
  /**
37
- * Copy a JS TypedArray into WASM memory. Returns the byte offset.
86
+ * Resolve an ArrayStorage input to a WASM pointer for kernel use.
87
+ * If the storage is WASM-backed, returns its direct pointer (zero-copy).
88
+ * If JS-backed, copies data into the scratch region.
89
+ *
90
+ * @param data - The TypedArray from storage.data
91
+ * @param isWasmBacked - Whether the storage is backed by WASM memory
92
+ * @param wasmPtr - The WASM pointer (only valid if isWasmBacked)
93
+ * @param offset - Element offset into the data
94
+ * @param elementCount - Number of elements to resolve
95
+ * @param bpe - Bytes per element
38
96
  */
39
- export declare function copyIn(src: TypedArray): number;
97
+ export declare function resolveInputPtr(data: TypedArray, isWasmBacked: boolean, wasmPtr: number, offset: number, elementCount: number, bpe: number): number;
40
98
  /**
41
- * Copy data from WASM memory into a new JS TypedArray.
99
+ * Resolve a TypedArray to a WASM pointer. If the array is already a view
100
+ * into WASM memory, returns its byte offset directly (zero-copy).
101
+ * Otherwise copies to scratch. Useful when you have a TypedArray but
102
+ * don't know if it's WASM-backed (e.g. from getContiguousData).
42
103
  */
43
- export declare function copyOut<T extends TypedArray>(ptr: number, length: number, Ctor: new (buffer: ArrayBuffer, byteOffset: number, length: number) => T): T;
104
+ export declare function resolveTypedArrayPtr(data: TypedArray): number;
44
105
  /**
45
- * Convert Float16Array data to Float32Array for WASM kernel input.
46
- * WASM kernels operate on f32 for float16 data (no native f16 SIMD).
47
- * Returns the original data unchanged if not float16.
106
+ * Convert f16 input to f32 in the scratch region using .set() — no JS allocation.
107
+ * Creates Float32Array view on WASM scratch memory and uses .set(f16Data) which
108
+ * converts f16→f32 in-place. 1.2x–3x faster than f16ToF32Input + scratchCopyIn.
109
+ *
110
+ * @param a - The ArrayStorage with f16 data
111
+ * @param size - Number of elements
112
+ * @returns WASM byte offset of the f32 scratch data
113
+ */
114
+ export declare function f16InputToScratchF32(a: {
115
+ data: TypedArray;
116
+ isWasmBacked: boolean;
117
+ wasmPtr: number;
118
+ offset: number;
119
+ }, size: number): number;
120
+ /**
121
+ * Convert f32 kernel output to f16 in a new WASM region using .set() — no JS round-trip.
122
+ * Allocates a persistent f16 WasmRegion, creates Float16Array + Float32Array views
123
+ * on WASM memory, and uses .set() to convert in-place.
124
+ * Replaces: copyOut + f32ToF16Output + fromData (saves 2 copies).
125
+ *
126
+ * @param outRegion - The WasmRegion containing f32 output from the kernel
127
+ * @param size - Number of elements
128
+ * @returns New WasmRegion with f16 data, or null on OOM. Caller must release outRegion.
48
129
  */
49
- export declare function f16ToF32Input(data: TypedArray, dtype: string): TypedArray;
130
+ export declare function f32OutputToF16Region(outRegion: WasmRegion, size: number): WasmRegion | null;
50
131
  /**
51
- * Convert Float32Array WASM output back to Float16Array.
52
- * Call after copyOut when the operation's dtype is float16.
132
+ * Convert f32 WASM output to f16 in-place within the same region.
133
+ * Safe because f16[i] at byte 2i never reaches unread f32[j>i] at byte 4j.
134
+ * Avoids extra wasmMalloc + release overhead of f32OutputToF16Region.
135
+ * The region retains its original (f32-sized) allocation; the extra bytes are unused.
53
136
  */
54
- export declare function f32ToF16Output(data: TypedArray, dtype: string): TypedArray;
137
+ export declare function f32ToF16InPlace(outRegion: WasmRegion, size: number): void;
55
138
  //# sourceMappingURL=runtime.d.ts.map
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * WASM-accelerated searchsorted (binary search for insertion indices).
3
3
  *
4
+ * Output is float64 indices for JS ergonomics (no BigInt).
5
+ * WASM searches u32 internally and converts to f64 before returning.
4
6
  * Returns null if WASM can't handle this case.
5
7
  */
6
8
  import { ArrayStorage } from '../storage';
7
9
  /**
8
10
  * WASM-accelerated searchsorted.
9
- * Returns ArrayStorage of int32 insertion indices or null if WASM can't handle it.
11
+ * Returns ArrayStorage of float64 insertion indices or null if WASM can't handle it.
10
12
  */
11
13
  export declare function wasmSearchsorted(sorted: ArrayStorage, values: ArrayStorage, side: 'left' | 'right'): ArrayStorage | null;
12
14
  //# sourceMappingURL=searchsorted.d.ts.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * WASM-accelerated element-wise signbit with SIMD.
3
+ *
4
+ * Unary: out[i] = 1 if a[i] has negative sign bit, 0 otherwise
5
+ * Returns a boolean (uint8) array.
6
+ * For unsigned types, signbit is always 0 — returns zeros directly.
7
+ */
8
+ import { ArrayStorage } from '../storage';
9
+ /**
10
+ * WASM-accelerated element-wise signbit.
11
+ * Returns null if WASM can't handle (complex, non-contiguous, too small).
12
+ */
13
+ export declare function wasmSignbit(a: ArrayStorage): ArrayStorage | null;
14
+ //# sourceMappingURL=signbit.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * WASM-accelerated element-wise sine.
3
+ *
4
+ * Unary: out[i] = sin(a[i])
5
+ * Returns null if WASM can't handle this case.
6
+ * Float types use native kernels; integer types use type-appropriate output:
7
+ * i8/u8 → f32 (then downcast to f16 if available)
8
+ * i16/u16 → f32
9
+ * i32/u32/i64/u64 → f64
10
+ */
11
+ import { ArrayStorage } from '../storage';
12
+ /**
13
+ * WASM-accelerated element-wise sine.
14
+ * Returns null if WASM can't handle (complex, non-contiguous, too small).
15
+ */
16
+ export declare function wasmSin(a: ArrayStorage): ArrayStorage | null;
17
+ //# sourceMappingURL=sin.d.ts.map