numpy-ts 1.0.0 → 1.2.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 (469) hide show
  1. package/README.md +4 -3
  2. package/dist/esm/common/broadcasting.js +1 -1
  3. package/dist/esm/common/dtype.js +1 -1
  4. package/dist/esm/common/float16-conv.js +1 -0
  5. package/dist/esm/common/internal/compute.js +1 -1
  6. package/dist/esm/common/internal/indexing.js +1 -1
  7. package/dist/esm/common/ndarray-core.js +1 -1
  8. package/dist/esm/common/ops/advanced.js +1 -1
  9. package/dist/esm/common/ops/arithmetic.js +1 -1
  10. package/dist/esm/common/ops/bitwise.js +1 -1
  11. package/dist/esm/common/ops/comparison.js +1 -1
  12. package/dist/esm/common/ops/complex.js +1 -1
  13. package/dist/esm/common/ops/exponential.js +1 -1
  14. package/dist/esm/common/ops/fft.js +1 -1
  15. package/dist/esm/common/ops/formatting.js +1 -1
  16. package/dist/esm/common/ops/gradient.js +1 -1
  17. package/dist/esm/common/ops/hyperbolic.js +1 -1
  18. package/dist/esm/common/ops/linalg.js +2 -2
  19. package/dist/esm/common/ops/logic.js +1 -1
  20. package/dist/esm/common/ops/random.js +1 -1
  21. package/dist/esm/common/ops/reduction.js +1 -1
  22. package/dist/esm/common/ops/rounding.js +1 -1
  23. package/dist/esm/common/ops/sets.js +1 -1
  24. package/dist/esm/common/ops/shape.js +1 -1
  25. package/dist/esm/common/ops/sorting.js +1 -1
  26. package/dist/esm/common/ops/statistics.js +1 -1
  27. package/dist/esm/common/ops/trig.js +1 -1
  28. package/dist/esm/common/storage.js +1 -1
  29. package/dist/esm/common/wasm/abs.js +1 -0
  30. package/dist/esm/common/wasm/add.js +1 -0
  31. package/dist/esm/common/wasm/arccos.js +1 -0
  32. package/dist/esm/common/wasm/arcsin.js +1 -0
  33. package/dist/esm/common/wasm/arctan.js +1 -0
  34. package/dist/esm/common/wasm/argpartition.js +1 -0
  35. package/dist/esm/common/wasm/argsort.js +1 -0
  36. package/dist/esm/common/wasm/bins/abs.wasm.js +1 -0
  37. package/dist/esm/common/wasm/bins/add.wasm.js +1 -0
  38. package/dist/esm/common/wasm/bins/arccos.wasm.js +1 -0
  39. package/dist/esm/common/wasm/bins/arcsin.wasm.js +1 -0
  40. package/dist/esm/common/wasm/bins/arctan.wasm.js +1 -0
  41. package/dist/esm/common/wasm/bins/argpartition.wasm.js +1 -0
  42. package/dist/esm/common/wasm/bins/argsort.wasm.js +1 -0
  43. package/dist/esm/common/wasm/bins/bitwise_and.wasm.js +1 -0
  44. package/dist/esm/common/wasm/bins/bitwise_count.wasm.js +1 -0
  45. package/dist/esm/common/wasm/bins/bitwise_not.wasm.js +1 -0
  46. package/dist/esm/common/wasm/bins/bitwise_or.wasm.js +1 -0
  47. package/dist/esm/common/wasm/bins/bitwise_xor.wasm.js +1 -0
  48. package/dist/esm/common/wasm/bins/cholesky.wasm.js +1 -0
  49. package/dist/esm/common/wasm/bins/clip.wasm.js +1 -0
  50. package/dist/esm/common/wasm/bins/convolve.wasm.js +1 -0
  51. package/dist/esm/common/wasm/bins/copysign.wasm.js +1 -0
  52. package/dist/esm/common/wasm/bins/correlate.wasm.js +1 -0
  53. package/dist/esm/common/wasm/bins/cos.wasm.js +1 -0
  54. package/dist/esm/common/wasm/bins/cosh.wasm.js +1 -0
  55. package/dist/esm/common/wasm/bins/cross.wasm.js +1 -0
  56. package/dist/esm/common/wasm/bins/diff.wasm.js +1 -0
  57. package/dist/esm/common/wasm/bins/divide.wasm.js +1 -0
  58. package/dist/esm/common/wasm/bins/dot.wasm.js +1 -0
  59. package/dist/esm/common/wasm/bins/exp.wasm.js +1 -0
  60. package/dist/esm/common/wasm/bins/exp2.wasm.js +1 -0
  61. package/dist/esm/common/wasm/bins/fft.wasm.js +1 -0
  62. package/dist/esm/common/wasm/bins/flip.wasm.js +1 -0
  63. package/dist/esm/common/wasm/bins/frexp.wasm.js +1 -0
  64. package/dist/esm/common/wasm/bins/gather.wasm.js +1 -0
  65. package/dist/esm/common/wasm/bins/gcd.wasm.js +1 -0
  66. package/dist/esm/common/wasm/bins/gradient.wasm.js +1 -0
  67. package/dist/esm/common/wasm/bins/heaviside.wasm.js +1 -0
  68. package/dist/esm/common/wasm/bins/hypot.wasm.js +1 -0
  69. package/dist/esm/common/wasm/bins/indices.wasm.js +1 -0
  70. package/dist/esm/common/wasm/bins/inner.wasm.js +1 -0
  71. package/dist/esm/common/wasm/bins/kron.wasm.js +1 -0
  72. package/dist/esm/common/wasm/bins/ldexp.wasm.js +1 -0
  73. package/dist/esm/common/wasm/bins/left_shift.wasm.js +1 -0
  74. package/dist/esm/common/wasm/bins/lexsort.wasm.js +1 -0
  75. package/dist/esm/common/wasm/bins/logaddexp.wasm.js +1 -0
  76. package/dist/esm/common/wasm/bins/logical_and.wasm.js +1 -0
  77. package/dist/esm/common/wasm/bins/logical_not.wasm.js +1 -0
  78. package/dist/esm/common/wasm/bins/logical_or.wasm.js +1 -0
  79. package/dist/esm/common/wasm/bins/logical_xor.wasm.js +1 -0
  80. package/dist/esm/common/wasm/bins/matmul.wasm.js +1 -0
  81. package/dist/esm/common/wasm/bins/matvec.wasm.js +1 -0
  82. package/dist/esm/common/wasm/bins/max.wasm.js +1 -0
  83. package/dist/esm/common/wasm/bins/min.wasm.js +1 -0
  84. package/dist/esm/common/wasm/bins/mul.wasm.js +1 -0
  85. package/dist/esm/common/wasm/bins/neg.wasm.js +1 -0
  86. package/dist/esm/common/wasm/bins/outer.wasm.js +1 -0
  87. package/dist/esm/common/wasm/bins/pad.wasm.js +1 -0
  88. package/dist/esm/common/wasm/bins/partition.wasm.js +1 -0
  89. package/dist/esm/common/wasm/bins/power.wasm.js +1 -0
  90. package/dist/esm/common/wasm/bins/qr.wasm.js +1 -0
  91. package/dist/esm/common/wasm/bins/reciprocal.wasm.js +1 -0
  92. package/dist/esm/common/wasm/bins/reduce_all.wasm.js +1 -0
  93. package/dist/esm/common/wasm/bins/reduce_any.wasm.js +1 -0
  94. package/dist/esm/common/wasm/bins/reduce_argmax.wasm.js +1 -0
  95. package/dist/esm/common/wasm/bins/reduce_argmin.wasm.js +1 -0
  96. package/dist/esm/common/wasm/bins/reduce_count_nz.wasm.js +1 -0
  97. package/dist/esm/common/wasm/bins/reduce_max.wasm.js +1 -0
  98. package/dist/esm/common/wasm/bins/reduce_mean.wasm.js +1 -0
  99. package/dist/esm/common/wasm/bins/reduce_min.wasm.js +1 -0
  100. package/dist/esm/common/wasm/bins/reduce_nanmax.wasm.js +1 -0
  101. package/dist/esm/common/wasm/bins/reduce_nanmin.wasm.js +1 -0
  102. package/dist/esm/common/wasm/bins/reduce_nansum.wasm.js +1 -0
  103. package/dist/esm/common/wasm/bins/reduce_prod.wasm.js +1 -0
  104. package/dist/esm/common/wasm/bins/reduce_quantile.wasm.js +1 -0
  105. package/dist/esm/common/wasm/bins/reduce_std.wasm.js +1 -0
  106. package/dist/esm/common/wasm/bins/reduce_sum.wasm.js +1 -0
  107. package/dist/esm/common/wasm/bins/reduce_var.wasm.js +1 -0
  108. package/dist/esm/common/wasm/bins/repeat.wasm.js +1 -0
  109. package/dist/esm/common/wasm/bins/right_shift.wasm.js +1 -0
  110. package/dist/esm/common/wasm/bins/rng.wasm.js +1 -0
  111. package/dist/esm/common/wasm/bins/roll.wasm.js +1 -0
  112. package/dist/esm/common/wasm/bins/rot90.wasm.js +1 -0
  113. package/dist/esm/common/wasm/bins/searchsorted.wasm.js +1 -0
  114. package/dist/esm/common/wasm/bins/sign.wasm.js +1 -0
  115. package/dist/esm/common/wasm/bins/sinh.wasm.js +1 -0
  116. package/dist/esm/common/wasm/bins/sort.wasm.js +1 -0
  117. package/dist/esm/common/wasm/bins/sqrt.wasm.js +1 -0
  118. package/dist/esm/common/wasm/bins/square.wasm.js +1 -0
  119. package/dist/esm/common/wasm/bins/sub.wasm.js +1 -0
  120. package/dist/esm/common/wasm/bins/svd.wasm.js +1 -0
  121. package/dist/esm/common/wasm/bins/tan.wasm.js +1 -0
  122. package/dist/esm/common/wasm/bins/tanh.wasm.js +1 -0
  123. package/dist/esm/common/wasm/bins/tile.wasm.js +1 -0
  124. package/dist/esm/common/wasm/bins/vdot.wasm.js +1 -0
  125. package/dist/esm/common/wasm/bins/vecdot.wasm.js +1 -0
  126. package/dist/esm/common/wasm/bins/vecmat.wasm.js +1 -0
  127. package/dist/esm/common/wasm/bitwise_and.js +1 -0
  128. package/dist/esm/common/wasm/bitwise_count.js +1 -0
  129. package/dist/esm/common/wasm/bitwise_not.js +1 -0
  130. package/dist/esm/common/wasm/bitwise_or.js +1 -0
  131. package/dist/esm/common/wasm/bitwise_xor.js +1 -0
  132. package/dist/esm/common/wasm/cholesky.js +1 -0
  133. package/dist/esm/common/wasm/clip.js +1 -0
  134. package/dist/esm/common/wasm/config.js +1 -0
  135. package/dist/esm/common/wasm/convolve.js +1 -0
  136. package/dist/esm/common/wasm/copysign.js +1 -0
  137. package/dist/esm/common/wasm/correlate.js +1 -0
  138. package/dist/esm/common/wasm/cos.js +1 -0
  139. package/dist/esm/common/wasm/cosh.js +1 -0
  140. package/dist/esm/common/wasm/cross.js +1 -0
  141. package/dist/esm/common/wasm/diff.js +1 -0
  142. package/dist/esm/common/wasm/divide.js +1 -0
  143. package/dist/esm/common/wasm/dot.js +1 -0
  144. package/dist/esm/common/wasm/exp.js +1 -0
  145. package/dist/esm/common/wasm/exp2.js +1 -0
  146. package/dist/esm/common/wasm/fft.js +1 -0
  147. package/dist/esm/common/wasm/flip.js +1 -0
  148. package/dist/esm/common/wasm/frexp.js +1 -0
  149. package/dist/esm/common/wasm/gather.js +1 -0
  150. package/dist/esm/common/wasm/gcd.js +1 -0
  151. package/dist/esm/common/wasm/gradient.js +1 -0
  152. package/dist/esm/common/wasm/heaviside.js +1 -0
  153. package/dist/esm/common/wasm/hypot.js +1 -0
  154. package/dist/esm/common/wasm/indices.js +1 -0
  155. package/dist/esm/common/wasm/inner.js +1 -0
  156. package/dist/esm/common/wasm/kron.js +1 -0
  157. package/dist/esm/common/wasm/ldexp.js +1 -0
  158. package/dist/esm/common/wasm/left_shift.js +1 -0
  159. package/dist/esm/common/wasm/lexsort.js +1 -0
  160. package/dist/esm/common/wasm/logaddexp.js +1 -0
  161. package/dist/esm/common/wasm/logical_and.js +1 -0
  162. package/dist/esm/common/wasm/logical_not.js +1 -0
  163. package/dist/esm/common/wasm/logical_or.js +1 -0
  164. package/dist/esm/common/wasm/logical_xor.js +1 -0
  165. package/dist/esm/common/wasm/matmul.js +1 -0
  166. package/dist/esm/common/wasm/matvec.js +1 -0
  167. package/dist/esm/common/wasm/max.js +1 -0
  168. package/dist/esm/common/wasm/min.js +1 -0
  169. package/dist/esm/common/wasm/mul.js +1 -0
  170. package/dist/esm/common/wasm/neg.js +1 -0
  171. package/dist/esm/common/wasm/outer.js +1 -0
  172. package/dist/esm/common/wasm/pad.js +1 -0
  173. package/dist/esm/common/wasm/partition.js +1 -0
  174. package/dist/esm/common/wasm/power.js +1 -0
  175. package/dist/esm/common/wasm/qr.js +1 -0
  176. package/dist/esm/common/wasm/reciprocal.js +1 -0
  177. package/dist/esm/common/wasm/reduce_all.js +1 -0
  178. package/dist/esm/common/wasm/reduce_any.js +1 -0
  179. package/dist/esm/common/wasm/reduce_argmax.js +1 -0
  180. package/dist/esm/common/wasm/reduce_argmin.js +1 -0
  181. package/dist/esm/common/wasm/reduce_count_nz.js +1 -0
  182. package/dist/esm/common/wasm/reduce_max.js +1 -0
  183. package/dist/esm/common/wasm/reduce_mean.js +1 -0
  184. package/dist/esm/common/wasm/reduce_min.js +1 -0
  185. package/dist/esm/common/wasm/reduce_nanmax.js +1 -0
  186. package/dist/esm/common/wasm/reduce_nanmin.js +1 -0
  187. package/dist/esm/common/wasm/reduce_nansum.js +1 -0
  188. package/dist/esm/common/wasm/reduce_prod.js +1 -0
  189. package/dist/esm/common/wasm/reduce_quantile.js +1 -0
  190. package/dist/esm/common/wasm/reduce_std.js +1 -0
  191. package/dist/esm/common/wasm/reduce_sum.js +1 -0
  192. package/dist/esm/common/wasm/reduce_var.js +1 -0
  193. package/dist/esm/common/wasm/repeat.js +1 -0
  194. package/dist/esm/common/wasm/right_shift.js +1 -0
  195. package/dist/esm/common/wasm/rng.js +1 -0
  196. package/dist/esm/common/wasm/roll.js +1 -0
  197. package/dist/esm/common/wasm/rot90.js +1 -0
  198. package/dist/esm/common/wasm/runtime.js +1 -0
  199. package/dist/esm/common/wasm/searchsorted.js +1 -0
  200. package/dist/esm/common/wasm/sign.js +1 -0
  201. package/dist/esm/common/wasm/sinh.js +1 -0
  202. package/dist/esm/common/wasm/sort.js +1 -0
  203. package/dist/esm/common/wasm/sqrt.js +1 -0
  204. package/dist/esm/common/wasm/square.js +1 -0
  205. package/dist/esm/common/wasm/sub.js +1 -0
  206. package/dist/esm/common/wasm/svd.js +1 -0
  207. package/dist/esm/common/wasm/tan.js +1 -0
  208. package/dist/esm/common/wasm/tanh.js +1 -0
  209. package/dist/esm/common/wasm/tile.js +1 -0
  210. package/dist/esm/common/wasm/vdot.js +1 -0
  211. package/dist/esm/common/wasm/vecdot.js +1 -0
  212. package/dist/esm/common/wasm/vecmat.js +1 -0
  213. package/dist/esm/core/advanced.js +1 -1
  214. package/dist/esm/core/arithmetic.js +1 -1
  215. package/dist/esm/core/bitwise.js +1 -1
  216. package/dist/esm/core/complex.js +1 -1
  217. package/dist/esm/core/creation.js +1 -1
  218. package/dist/esm/core/formatting.js +1 -1
  219. package/dist/esm/core/gradient.js +1 -1
  220. package/dist/esm/core/index.js +1 -1
  221. package/dist/esm/core/linalg.js +1 -1
  222. package/dist/esm/core/logic.js +1 -1
  223. package/dist/esm/core/polynomial.js +1 -1
  224. package/dist/esm/core/reduction.js +1 -1
  225. package/dist/esm/core/rounding.js +1 -1
  226. package/dist/esm/core/sets.js +1 -1
  227. package/dist/esm/core/shape-extra.js +1 -1
  228. package/dist/esm/core/shape.js +1 -1
  229. package/dist/esm/core/sorting.js +1 -1
  230. package/dist/esm/core/statistics.js +1 -1
  231. package/dist/esm/core/trig.js +1 -1
  232. package/dist/esm/core/typechecking.js +1 -1
  233. package/dist/esm/core/types.js +1 -1
  234. package/dist/esm/core/utility.js +1 -1
  235. package/dist/esm/core.js +1 -1
  236. package/dist/esm/full/index.js +1 -1
  237. package/dist/esm/full/ndarray.js +1 -1
  238. package/dist/esm/index.js +1 -1
  239. package/dist/esm/io/file-ops.js +1 -0
  240. package/dist/esm/io/filesystem.js +1 -0
  241. package/dist/esm/io/index.js +1 -1
  242. package/dist/esm/io/npy/format.js +1 -1
  243. package/dist/esm/io/npy/index.js +1 -1
  244. package/dist/esm/io/npy/parser.js +1 -1
  245. package/dist/esm/io/npy/serializer.js +2 -2
  246. package/dist/esm/io/npz/index.js +1 -1
  247. package/dist/esm/io/npz/parser.js +1 -1
  248. package/dist/esm/io/npz/serializer.js +1 -1
  249. package/dist/esm/io/txt/index.js +1 -1
  250. package/dist/esm/io/txt/parser.js +1 -1
  251. package/dist/esm/io/zip/index.js +1 -1
  252. package/dist/esm/io/zip/reader.js +1 -1
  253. package/dist/esm/io/zip/types.js +1 -1
  254. package/dist/esm/io/zip/writer.js +1 -1
  255. package/dist/esm/node.js +1 -1
  256. package/dist/numpy-ts.browser.js +6 -6
  257. package/dist/types/common/dtype.d.ts +9 -4
  258. package/dist/types/common/float16-conv.d.ts +27 -0
  259. package/dist/types/common/internal/indexing.d.ts +15 -18
  260. package/dist/types/common/ndarray-core.d.ts +3 -13
  261. package/dist/types/common/ops/linalg.d.ts +13 -12
  262. package/dist/types/common/ops/random.d.ts +10 -5
  263. package/dist/types/common/ops/sets.d.ts +1 -1
  264. package/dist/types/common/ops/shape.d.ts +11 -0
  265. package/dist/types/common/storage.d.ts +4 -0
  266. package/dist/types/common/wasm/abs.d.ts +14 -0
  267. package/dist/types/common/wasm/add.d.ts +19 -0
  268. package/dist/types/common/wasm/arccos.d.ts +15 -0
  269. package/dist/types/common/wasm/arcsin.d.ts +15 -0
  270. package/dist/types/common/wasm/arctan.d.ts +15 -0
  271. package/dist/types/common/wasm/argpartition.d.ts +18 -0
  272. package/dist/types/common/wasm/argsort.d.ts +18 -0
  273. package/dist/types/common/wasm/bins/abs.wasm.d.ts +7 -0
  274. package/dist/types/common/wasm/bins/add.wasm.d.ts +17 -0
  275. package/dist/types/common/wasm/bins/arccos.wasm.d.ts +5 -0
  276. package/dist/types/common/wasm/bins/arcsin.wasm.d.ts +5 -0
  277. package/dist/types/common/wasm/bins/arctan.wasm.d.ts +5 -0
  278. package/dist/types/common/wasm/bins/argpartition.wasm.d.ts +21 -0
  279. package/dist/types/common/wasm/bins/argsort.wasm.d.ts +25 -0
  280. package/dist/types/common/wasm/bins/bitwise_and.wasm.d.ts +5 -0
  281. package/dist/types/common/wasm/bins/bitwise_count.wasm.d.ts +9 -0
  282. package/dist/types/common/wasm/bins/bitwise_not.wasm.d.ts +5 -0
  283. package/dist/types/common/wasm/bins/bitwise_or.wasm.d.ts +5 -0
  284. package/dist/types/common/wasm/bins/bitwise_xor.wasm.d.ts +5 -0
  285. package/dist/types/common/wasm/bins/cholesky.wasm.d.ts +3 -0
  286. package/dist/types/common/wasm/bins/clip.wasm.d.ts +11 -0
  287. package/dist/types/common/wasm/bins/convolve.wasm.d.ts +3 -0
  288. package/dist/types/common/wasm/bins/copysign.wasm.d.ts +21 -0
  289. package/dist/types/common/wasm/bins/correlate.wasm.d.ts +3 -0
  290. package/dist/types/common/wasm/bins/cos.wasm.d.ts +3 -0
  291. package/dist/types/common/wasm/bins/cosh.wasm.d.ts +5 -0
  292. package/dist/types/common/wasm/bins/cross.wasm.d.ts +9 -0
  293. package/dist/types/common/wasm/bins/diff.wasm.d.ts +13 -0
  294. package/dist/types/common/wasm/bins/divide.wasm.d.ts +23 -0
  295. package/dist/types/common/wasm/bins/dot.wasm.d.ts +9 -0
  296. package/dist/types/common/wasm/bins/exp.wasm.d.ts +5 -0
  297. package/dist/types/common/wasm/bins/exp2.wasm.d.ts +5 -0
  298. package/dist/types/common/wasm/bins/fft.wasm.d.ts +22 -0
  299. package/dist/types/common/wasm/bins/flip.wasm.d.ts +7 -0
  300. package/dist/types/common/wasm/bins/frexp.wasm.d.ts +2 -0
  301. package/dist/types/common/wasm/bins/gather.wasm.d.ts +32 -0
  302. package/dist/types/common/wasm/bins/gcd.wasm.d.ts +3 -0
  303. package/dist/types/common/wasm/bins/gradient.wasm.d.ts +11 -0
  304. package/dist/types/common/wasm/bins/heaviside.wasm.d.ts +5 -0
  305. package/dist/types/common/wasm/bins/hypot.wasm.d.ts +13 -0
  306. package/dist/types/common/wasm/bins/indices.wasm.d.ts +3 -0
  307. package/dist/types/common/wasm/bins/inner.wasm.d.ts +9 -0
  308. package/dist/types/common/wasm/bins/kron.wasm.d.ts +9 -0
  309. package/dist/types/common/wasm/bins/ldexp.wasm.d.ts +3 -0
  310. package/dist/types/common/wasm/bins/left_shift.wasm.d.ts +9 -0
  311. package/dist/types/common/wasm/bins/lexsort.wasm.d.ts +11 -0
  312. package/dist/types/common/wasm/bins/logaddexp.wasm.d.ts +21 -0
  313. package/dist/types/common/wasm/bins/logical_and.wasm.d.ts +13 -0
  314. package/dist/types/common/wasm/bins/logical_not.wasm.d.ts +7 -0
  315. package/dist/types/common/wasm/bins/logical_or.wasm.d.ts +13 -0
  316. package/dist/types/common/wasm/bins/logical_xor.wasm.d.ts +13 -0
  317. package/dist/types/common/wasm/bins/matmul.wasm.d.ts +9 -0
  318. package/dist/types/common/wasm/bins/matvec.wasm.d.ts +9 -0
  319. package/dist/types/common/wasm/bins/max.wasm.d.ts +21 -0
  320. package/dist/types/common/wasm/bins/min.wasm.d.ts +21 -0
  321. package/dist/types/common/wasm/bins/mul.wasm.d.ts +17 -0
  322. package/dist/types/common/wasm/bins/neg.wasm.d.ts +9 -0
  323. package/dist/types/common/wasm/bins/outer.wasm.d.ts +9 -0
  324. package/dist/types/common/wasm/bins/pad.wasm.d.ts +7 -0
  325. package/dist/types/common/wasm/bins/partition.wasm.d.ts +21 -0
  326. package/dist/types/common/wasm/bins/power.wasm.d.ts +13 -0
  327. package/dist/types/common/wasm/bins/qr.wasm.d.ts +3 -0
  328. package/dist/types/common/wasm/bins/reciprocal.wasm.d.ts +7 -0
  329. package/dist/types/common/wasm/bins/reduce_all.wasm.d.ts +7 -0
  330. package/dist/types/common/wasm/bins/reduce_any.wasm.d.ts +7 -0
  331. package/dist/types/common/wasm/bins/reduce_argmax.wasm.d.ts +11 -0
  332. package/dist/types/common/wasm/bins/reduce_argmin.wasm.d.ts +11 -0
  333. package/dist/types/common/wasm/bins/reduce_count_nz.wasm.d.ts +7 -0
  334. package/dist/types/common/wasm/bins/reduce_max.wasm.d.ts +20 -0
  335. package/dist/types/common/wasm/bins/reduce_mean.wasm.d.ts +21 -0
  336. package/dist/types/common/wasm/bins/reduce_min.wasm.d.ts +20 -0
  337. package/dist/types/common/wasm/bins/reduce_nanmax.wasm.d.ts +3 -0
  338. package/dist/types/common/wasm/bins/reduce_nanmin.wasm.d.ts +3 -0
  339. package/dist/types/common/wasm/bins/reduce_nansum.wasm.d.ts +3 -0
  340. package/dist/types/common/wasm/bins/reduce_prod.wasm.d.ts +19 -0
  341. package/dist/types/common/wasm/bins/reduce_quantile.wasm.d.ts +2 -0
  342. package/dist/types/common/wasm/bins/reduce_std.wasm.d.ts +11 -0
  343. package/dist/types/common/wasm/bins/reduce_sum.wasm.d.ts +17 -0
  344. package/dist/types/common/wasm/bins/reduce_var.wasm.d.ts +11 -0
  345. package/dist/types/common/wasm/bins/repeat.wasm.d.ts +7 -0
  346. package/dist/types/common/wasm/bins/right_shift.wasm.d.ts +17 -0
  347. package/dist/types/common/wasm/bins/rng.wasm.d.ts +60 -0
  348. package/dist/types/common/wasm/bins/roll.wasm.d.ts +7 -0
  349. package/dist/types/common/wasm/bins/rot90.wasm.d.ts +7 -0
  350. package/dist/types/common/wasm/bins/searchsorted.wasm.d.ts +21 -0
  351. package/dist/types/common/wasm/bins/sign.wasm.d.ts +7 -0
  352. package/dist/types/common/wasm/bins/sinh.wasm.d.ts +5 -0
  353. package/dist/types/common/wasm/bins/sort.wasm.d.ts +27 -0
  354. package/dist/types/common/wasm/bins/sqrt.wasm.d.ts +7 -0
  355. package/dist/types/common/wasm/bins/square.wasm.d.ts +9 -0
  356. package/dist/types/common/wasm/bins/sub.wasm.d.ts +17 -0
  357. package/dist/types/common/wasm/bins/svd.wasm.d.ts +2 -0
  358. package/dist/types/common/wasm/bins/tan.wasm.d.ts +3 -0
  359. package/dist/types/common/wasm/bins/tanh.wasm.d.ts +5 -0
  360. package/dist/types/common/wasm/bins/tile.wasm.d.ts +7 -0
  361. package/dist/types/common/wasm/bins/vdot.wasm.d.ts +3 -0
  362. package/dist/types/common/wasm/bins/vecdot.wasm.d.ts +9 -0
  363. package/dist/types/common/wasm/bins/vecmat.wasm.d.ts +9 -0
  364. package/dist/types/common/wasm/bitwise_and.d.ts +9 -0
  365. package/dist/types/common/wasm/bitwise_count.d.ts +11 -0
  366. package/dist/types/common/wasm/bitwise_not.d.ts +9 -0
  367. package/dist/types/common/wasm/bitwise_or.d.ts +9 -0
  368. package/dist/types/common/wasm/bitwise_xor.d.ts +9 -0
  369. package/dist/types/common/wasm/cholesky.d.ts +20 -0
  370. package/dist/types/common/wasm/clip.d.ts +13 -0
  371. package/dist/types/common/wasm/config.d.ts +21 -0
  372. package/dist/types/common/wasm/convolve.d.ts +14 -0
  373. package/dist/types/common/wasm/copysign.d.ts +19 -0
  374. package/dist/types/common/wasm/correlate.d.ts +14 -0
  375. package/dist/types/common/wasm/cos.d.ts +15 -0
  376. package/dist/types/common/wasm/cosh.d.ts +15 -0
  377. package/dist/types/common/wasm/cross.d.ts +15 -0
  378. package/dist/types/common/wasm/diff.d.ts +15 -0
  379. package/dist/types/common/wasm/divide.d.ts +11 -0
  380. package/dist/types/common/wasm/dot.d.ts +14 -0
  381. package/dist/types/common/wasm/exp.d.ts +15 -0
  382. package/dist/types/common/wasm/exp2.d.ts +15 -0
  383. package/dist/types/common/wasm/fft.d.ts +65 -0
  384. package/dist/types/common/wasm/flip.d.ts +13 -0
  385. package/dist/types/common/wasm/frexp.d.ts +9 -0
  386. package/dist/types/common/wasm/gather.d.ts +23 -0
  387. package/dist/types/common/wasm/gcd.d.ts +11 -0
  388. package/dist/types/common/wasm/gradient.d.ts +13 -0
  389. package/dist/types/common/wasm/heaviside.d.ts +11 -0
  390. package/dist/types/common/wasm/hypot.d.ts +21 -0
  391. package/dist/types/common/wasm/indices.d.ts +10 -0
  392. package/dist/types/common/wasm/inner.d.ts +20 -0
  393. package/dist/types/common/wasm/kron.d.ts +13 -0
  394. package/dist/types/common/wasm/ldexp.d.ts +9 -0
  395. package/dist/types/common/wasm/left_shift.d.ts +11 -0
  396. package/dist/types/common/wasm/lexsort.d.ts +14 -0
  397. package/dist/types/common/wasm/logaddexp.d.ts +21 -0
  398. package/dist/types/common/wasm/logical_and.d.ts +19 -0
  399. package/dist/types/common/wasm/logical_not.d.ts +13 -0
  400. package/dist/types/common/wasm/logical_or.d.ts +19 -0
  401. package/dist/types/common/wasm/logical_xor.d.ts +19 -0
  402. package/dist/types/common/wasm/matmul.d.ts +18 -0
  403. package/dist/types/common/wasm/matvec.d.ts +13 -0
  404. package/dist/types/common/wasm/max.d.ts +11 -0
  405. package/dist/types/common/wasm/min.d.ts +11 -0
  406. package/dist/types/common/wasm/mul.d.ts +19 -0
  407. package/dist/types/common/wasm/neg.d.ts +13 -0
  408. package/dist/types/common/wasm/outer.d.ts +13 -0
  409. package/dist/types/common/wasm/pad.d.ts +14 -0
  410. package/dist/types/common/wasm/partition.d.ts +20 -0
  411. package/dist/types/common/wasm/power.d.ts +19 -0
  412. package/dist/types/common/wasm/qr.d.ts +17 -0
  413. package/dist/types/common/wasm/reciprocal.d.ts +9 -0
  414. package/dist/types/common/wasm/reduce_all.d.ts +14 -0
  415. package/dist/types/common/wasm/reduce_any.d.ts +14 -0
  416. package/dist/types/common/wasm/reduce_argmax.d.ts +14 -0
  417. package/dist/types/common/wasm/reduce_argmin.d.ts +14 -0
  418. package/dist/types/common/wasm/reduce_count_nz.d.ts +14 -0
  419. package/dist/types/common/wasm/reduce_max.d.ts +19 -0
  420. package/dist/types/common/wasm/reduce_mean.d.ts +19 -0
  421. package/dist/types/common/wasm/reduce_min.d.ts +19 -0
  422. package/dist/types/common/wasm/reduce_nanmax.d.ts +14 -0
  423. package/dist/types/common/wasm/reduce_nanmin.d.ts +14 -0
  424. package/dist/types/common/wasm/reduce_nansum.d.ts +14 -0
  425. package/dist/types/common/wasm/reduce_prod.d.ts +20 -0
  426. package/dist/types/common/wasm/reduce_quantile.d.ts +15 -0
  427. package/dist/types/common/wasm/reduce_std.d.ts +14 -0
  428. package/dist/types/common/wasm/reduce_sum.d.ts +20 -0
  429. package/dist/types/common/wasm/reduce_var.d.ts +14 -0
  430. package/dist/types/common/wasm/repeat.d.ts +14 -0
  431. package/dist/types/common/wasm/right_shift.d.ts +11 -0
  432. package/dist/types/common/wasm/rng.d.ts +65 -0
  433. package/dist/types/common/wasm/roll.d.ts +13 -0
  434. package/dist/types/common/wasm/rot90.d.ts +14 -0
  435. package/dist/types/common/wasm/runtime.d.ts +55 -0
  436. package/dist/types/common/wasm/searchsorted.d.ts +12 -0
  437. package/dist/types/common/wasm/sign.d.ts +14 -0
  438. package/dist/types/common/wasm/sinh.d.ts +15 -0
  439. package/dist/types/common/wasm/sort.d.ts +20 -0
  440. package/dist/types/common/wasm/sqrt.d.ts +15 -0
  441. package/dist/types/common/wasm/square.d.ts +13 -0
  442. package/dist/types/common/wasm/sub.d.ts +19 -0
  443. package/dist/types/common/wasm/svd.d.ts +18 -0
  444. package/dist/types/common/wasm/tan.d.ts +15 -0
  445. package/dist/types/common/wasm/tanh.d.ts +15 -0
  446. package/dist/types/common/wasm/tile.d.ts +14 -0
  447. package/dist/types/common/wasm/vdot.d.ts +16 -0
  448. package/dist/types/common/wasm/vecdot.d.ts +15 -0
  449. package/dist/types/common/wasm/vecmat.d.ts +13 -0
  450. package/dist/types/core/index.d.ts +94 -1
  451. package/dist/types/core/linalg.d.ts +10 -10
  452. package/dist/types/core/reduction.d.ts +17 -17
  453. package/dist/types/core/rounding.d.ts +0 -2
  454. package/dist/types/core/sets.d.ts +1 -1
  455. package/dist/types/core/sorting.d.ts +1 -1
  456. package/dist/types/full/index.d.ts +20 -18
  457. package/dist/types/full/ndarray.d.ts +16 -22
  458. package/dist/types/index.d.ts +18 -3
  459. package/dist/types/io/file-ops.d.ts +269 -0
  460. package/dist/types/io/filesystem.d.ts +21 -0
  461. package/dist/types/io/zip/types.d.ts +2 -1
  462. package/dist/types/node.d.ts +3 -275
  463. package/package.json +54 -35
  464. package/dist/numpy-ts.node-io.cjs +0 -8
  465. package/dist/numpy-ts.node-io.cjs.map +0 -7
  466. package/dist/numpy-ts.node-io.mjs +0 -8
  467. package/dist/numpy-ts.node-io.mjs.map +0 -7
  468. package/dist/numpy-ts.node.cjs +0 -8
  469. package/dist/numpy-ts.node.cjs.map +0 -7
@@ -0,0 +1,269 @@
1
+ /**
2
+ * File IO operations for numpy-ts.
3
+ *
4
+ * These functions read/write files using the runtime fs abstraction from filesystem.ts.
5
+ * They work in Node.js, Bun, and Deno, and throw clear errors in the browser.
6
+ */
7
+ import { NDArray } from '../full/ndarray';
8
+ import type { NpzParseOptions } from './npz/parser';
9
+ import { type NpzSerializeOptions, type NpzArraysInput } from './npz/serializer';
10
+ import { type ParseTxtOptions, type SerializeTxtOptions } from './txt';
11
+ import type { DType } from '../common/dtype';
12
+ interface NpzParseResultNDArray {
13
+ arrays: Map<string, NDArray>;
14
+ skipped: string[];
15
+ errors: Map<string, string>;
16
+ }
17
+ /**
18
+ * Options for loading NPY/NPZ files
19
+ */
20
+ export interface LoadOptions extends NpzParseOptions {
21
+ /**
22
+ * If true, allow loading .npy files.
23
+ * Default: true
24
+ */
25
+ allowNpy?: boolean;
26
+ }
27
+ /**
28
+ * Options for saving NPZ files
29
+ */
30
+ export type SaveNpzOptions = NpzSerializeOptions;
31
+ /**
32
+ * Options for loadtxt
33
+ */
34
+ export type LoadTxtOptions = ParseTxtOptions;
35
+ /**
36
+ * Options for savetxt
37
+ */
38
+ export type SaveTxtOptions = SerializeTxtOptions;
39
+ /**
40
+ * Load an NDArray from a .npy file
41
+ *
42
+ * @param path - Path to the .npy file
43
+ * @returns The loaded NDArray
44
+ */
45
+ export declare function loadNpy(path: string): Promise<NDArray>;
46
+ /**
47
+ * Synchronously load an NDArray from a .npy file
48
+ *
49
+ * @param path - Path to the .npy file
50
+ * @returns The loaded NDArray
51
+ */
52
+ export declare function loadNpySync(path: string): NDArray;
53
+ /**
54
+ * Save an NDArray to a .npy file
55
+ *
56
+ * @param path - Path to save the .npy file
57
+ * @param arr - The NDArray to save
58
+ */
59
+ export declare function saveNpy(path: string, arr: NDArray): Promise<void>;
60
+ /**
61
+ * Synchronously save an NDArray to a .npy file
62
+ *
63
+ * @param path - Path to save the .npy file
64
+ * @param arr - The NDArray to save
65
+ */
66
+ export declare function saveNpySync(path: string, arr: NDArray): void;
67
+ /**
68
+ * Load arrays from a .npz file
69
+ *
70
+ * @param path - Path to the .npz file
71
+ * @param options - Load options
72
+ * @returns Object with array names as keys
73
+ */
74
+ export declare function loadNpzFile(path: string, options?: NpzParseOptions): Promise<NpzParseResultNDArray>;
75
+ /**
76
+ * Synchronously load arrays from a .npz file
77
+ *
78
+ * Note: Only works if the NPZ file is not DEFLATE compressed.
79
+ *
80
+ * @param path - Path to the .npz file
81
+ * @param options - Load options
82
+ * @returns Object with array names as keys
83
+ */
84
+ export declare function loadNpzFileSync(path: string, options?: NpzParseOptions): NpzParseResultNDArray;
85
+ /**
86
+ * Save arrays to a .npz file
87
+ *
88
+ * @param path - Path to save the .npz file
89
+ * @param arrays - Arrays to save:
90
+ * - Array of NDArrays (positional, named arr_0, arr_1, etc.)
91
+ * - Map of names to NDArrays
92
+ * - Object with names as keys
93
+ * @param options - Save options
94
+ */
95
+ export declare function saveNpz(path: string, arrays: NpzArraysInput, options?: SaveNpzOptions): Promise<void>;
96
+ /**
97
+ * Synchronously save arrays to a .npz file (no compression)
98
+ *
99
+ * @param path - Path to save the .npz file
100
+ * @param arrays - Arrays to save (same types as saveNpz)
101
+ */
102
+ export declare function saveNpzSync(path: string, arrays: NpzArraysInput): void;
103
+ /**
104
+ * Load an array or arrays from a .npy or .npz file
105
+ *
106
+ * This is a convenience function that auto-detects the file format based on extension.
107
+ *
108
+ * @param path - Path to the file
109
+ * @param options - Load options
110
+ * @returns NDArray for .npy files, or NpzParseResult for .npz files
111
+ */
112
+ export declare function load(path: string, options?: LoadOptions): Promise<NDArray | NpzParseResultNDArray>;
113
+ /**
114
+ * Synchronously load an array or arrays from a .npy or .npz file
115
+ *
116
+ * @param path - Path to the file
117
+ * @param options - Load options
118
+ * @returns NDArray for .npy files, or NpzParseResult for .npz files
119
+ */
120
+ export declare function loadSync(path: string, options?: LoadOptions): NDArray | NpzParseResultNDArray;
121
+ /**
122
+ * Save an array to a .npy file
123
+ *
124
+ * @param path - Path to save the file (should end with .npy)
125
+ * @param arr - The NDArray to save
126
+ */
127
+ export declare function save(path: string, arr: NDArray): Promise<void>;
128
+ /**
129
+ * Synchronously save an array to a .npy file
130
+ *
131
+ * @param path - Path to save the file (should end with .npy)
132
+ * @param arr - The NDArray to save
133
+ */
134
+ export declare function saveSync(path: string, arr: NDArray): void;
135
+ /**
136
+ * Save multiple arrays to a .npz file (like np.savez)
137
+ *
138
+ * @param path - Path to save the .npz file
139
+ * @param arrays - Arrays to save:
140
+ * - Array of NDArrays: named arr_0, arr_1, etc. (like np.savez positional args)
141
+ * - Object/Map with names as keys (like np.savez keyword args)
142
+ *
143
+ * @example
144
+ * // Positional arrays
145
+ * await savez('data.npz', [arr1, arr2]) // saved as arr_0, arr_1
146
+ *
147
+ * // Named arrays
148
+ * await savez('data.npz', { x: arr1, y: arr2 })
149
+ */
150
+ export declare function savez(path: string, arrays: NpzArraysInput): Promise<void>;
151
+ /**
152
+ * Save multiple arrays to a compressed .npz file (like np.savez_compressed)
153
+ *
154
+ * @param path - Path to save the .npz file
155
+ * @param arrays - Arrays to save (same input types as savez)
156
+ */
157
+ export declare function savez_compressed(path: string, arrays: NpzArraysInput): Promise<void>;
158
+ /**
159
+ * Load data from a text file.
160
+ *
161
+ * Each row in the text file must have the same number of values.
162
+ *
163
+ * @param path - Path to the text file
164
+ * @param options - Load options
165
+ * @returns NDArray with the loaded data
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * // Load a CSV file
170
+ * const arr = await loadtxt('data.csv', { delimiter: ',' });
171
+ *
172
+ * // Load with specific columns
173
+ * const arr = await loadtxt('data.txt', { usecols: [0, 2] });
174
+ *
175
+ * // Skip header rows
176
+ * const arr = await loadtxt('data.txt', { skiprows: 1 });
177
+ * ```
178
+ */
179
+ export declare function loadtxt(path: string, options?: LoadTxtOptions): Promise<NDArray>;
180
+ /**
181
+ * Synchronously load data from a text file.
182
+ *
183
+ * @param path - Path to the text file
184
+ * @param options - Load options
185
+ * @returns NDArray with the loaded data
186
+ */
187
+ export declare function loadtxtSync(path: string, options?: LoadTxtOptions): NDArray;
188
+ /**
189
+ * Save an array to a text file.
190
+ *
191
+ * @param path - Path to save the text file
192
+ * @param arr - The array to save (must be 1D or 2D)
193
+ * @param options - Save options
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * // Save as CSV
198
+ * await savetxt('data.csv', arr, { delimiter: ',' });
199
+ *
200
+ * // Save with custom format
201
+ * await savetxt('data.txt', arr, { fmt: '%.2f', delimiter: '\t' });
202
+ *
203
+ * // Save with header
204
+ * await savetxt('data.txt', arr, { header: 'x y z' });
205
+ * ```
206
+ */
207
+ export declare function savetxt(path: string, arr: NDArray, options?: SaveTxtOptions): Promise<void>;
208
+ /**
209
+ * Synchronously save an array to a text file.
210
+ *
211
+ * @param path - Path to save the text file
212
+ * @param arr - The array to save (must be 1D or 2D)
213
+ * @param options - Save options
214
+ */
215
+ export declare function savetxtSync(path: string, arr: NDArray, options?: SaveTxtOptions): void;
216
+ /**
217
+ * Load data from a text file with more flexible handling.
218
+ *
219
+ * Similar to loadtxt but handles missing values more gracefully.
220
+ *
221
+ * @param path - Path to the text file
222
+ * @param options - Load options
223
+ * @returns NDArray with the loaded data
224
+ *
225
+ * @example
226
+ * ```typescript
227
+ * // Load file with missing values
228
+ * const arr = await genfromtxt('data.csv', {
229
+ * delimiter: ',',
230
+ * missing_values: ['NA', ''],
231
+ * filling_values: 0
232
+ * });
233
+ * ```
234
+ */
235
+ export declare function genfromtxt(path: string, options?: LoadTxtOptions): Promise<NDArray>;
236
+ /**
237
+ * Synchronously load data from a text file with more flexible handling.
238
+ *
239
+ * @param path - Path to the text file
240
+ * @param options - Load options
241
+ * @returns NDArray with the loaded data
242
+ */
243
+ export declare function genfromtxtSync(path: string, options?: LoadTxtOptions): NDArray;
244
+ /**
245
+ * Load data from a text file using regular expressions.
246
+ *
247
+ * @param path - Path to the text file
248
+ * @param regexp - Regular expression with capture groups for extracting values
249
+ * @param dtype - Data type of the resulting array (default: 'float64')
250
+ * @returns NDArray with the extracted data
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * // Extract x,y pairs from "Point: x=1.0, y=2.0" format
255
+ * const arr = await fromregex('points.txt', /x=([\d.]+), y=([\d.]+)/);
256
+ * ```
257
+ */
258
+ export declare function fromregex(path: string, regexp: RegExp | string, dtype?: DType): Promise<NDArray>;
259
+ /**
260
+ * Synchronously load data from a text file using regular expressions.
261
+ *
262
+ * @param path - Path to the text file
263
+ * @param regexp - Regular expression with capture groups for extracting values
264
+ * @param dtype - Data type of the resulting array (default: 'float64')
265
+ * @returns NDArray with the extracted data
266
+ */
267
+ export declare function fromregexSync(path: string, regexp: RegExp | string, dtype?: DType): NDArray;
268
+ export {};
269
+ //# sourceMappingURL=file-ops.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Runtime filesystem abstraction for cross-platform file IO.
3
+ *
4
+ * Pre-loads `node:fs` and `node:fs/promises` asynchronously at module load
5
+ * in Node-like environments. Both getFs() and getFsSync() read from this cache.
6
+ * In browsers, all IO functions throw a helpful error.
7
+ */
8
+ type FsPromises = typeof import('node:fs/promises');
9
+ type FsSync = typeof import('node:fs');
10
+ /**
11
+ * Get the async fs module (`node:fs/promises`).
12
+ * Caches the result after the first successful resolution.
13
+ */
14
+ export declare function getFs(): Promise<FsPromises>;
15
+ /**
16
+ * Get the sync fs module (`node:fs`).
17
+ * Reads from the cache populated at module load time or by a prior getFs() call.
18
+ */
19
+ export declare function getFsSync(): FsSync;
20
+ export {};
21
+ //# sourceMappingURL=filesystem.d.ts.map
@@ -53,7 +53,8 @@ export interface RawZipEntry {
53
53
  uncompressedSize: number;
54
54
  }
55
55
  /**
56
- * Calculate CRC-32 checksum
56
+ * Calculate CRC-32 checksum using slice-by-8.
57
+ * Processes 8 bytes per iteration, then finishes byte-at-a-time.
57
58
  */
58
59
  export declare function crc32(data: Uint8Array): number;
59
60
  //# sourceMappingURL=types.d.ts.map
@@ -1,280 +1,8 @@
1
1
  /**
2
- * Node.js-specific entry point for numpy-ts
2
+ * Deprecated: use `import from 'numpy-ts'` instead.
3
3
  *
4
- * This module provides file system operations for saving and loading NPY/NPZ files,
5
- * plus all core numpy-ts functionality in a single import.
6
- *
7
- * Usage:
8
- * import * as np from 'numpy-ts/node';
9
- * // Has everything from numpy-ts + file I/O
10
- * const arr = await np.loadNpy('data.npy');
11
- * await np.saveNpz('output.npz', { x: arr });
12
- *
13
- * For browser usage, use the main entry point (no file I/O).
4
+ * This module re-exports everything from the main entry point.
5
+ * File IO functions (loadNpy, saveNpy, etc.) are now available directly from 'numpy-ts'.
14
6
  */
15
- import { NDArray } from './full/ndarray';
16
- import type { NpzParseOptions } from './io/npz/parser';
17
- import { type NpzSerializeOptions, type NpzArraysInput } from './io/npz/serializer';
18
- import { type ParseTxtOptions, type SerializeTxtOptions } from './io/txt';
19
- import type { DType } from './common/dtype';
20
- interface NpzParseResultNDArray {
21
- arrays: Map<string, NDArray>;
22
- skipped: string[];
23
- errors: Map<string, string>;
24
- }
25
7
  export * from './index';
26
- /**
27
- * Options for loading NPY/NPZ files
28
- */
29
- export interface LoadOptions extends NpzParseOptions {
30
- /**
31
- * If true, allow loading .npy files.
32
- * Default: true
33
- */
34
- allowNpy?: boolean;
35
- }
36
- /**
37
- * Options for saving NPZ files
38
- */
39
- export interface SaveNpzOptions extends NpzSerializeOptions {
40
- }
41
- /**
42
- * Load an NDArray from a .npy file
43
- *
44
- * @param path - Path to the .npy file
45
- * @returns The loaded NDArray
46
- */
47
- export declare function loadNpy(path: string): Promise<NDArray>;
48
- /**
49
- * Synchronously load an NDArray from a .npy file
50
- *
51
- * @param path - Path to the .npy file
52
- * @returns The loaded NDArray
53
- */
54
- export declare function loadNpySync(path: string): NDArray;
55
- /**
56
- * Save an NDArray to a .npy file
57
- *
58
- * @param path - Path to save the .npy file
59
- * @param arr - The NDArray to save
60
- */
61
- export declare function saveNpy(path: string, arr: NDArray): Promise<void>;
62
- /**
63
- * Synchronously save an NDArray to a .npy file
64
- *
65
- * @param path - Path to save the .npy file
66
- * @param arr - The NDArray to save
67
- */
68
- export declare function saveNpySync(path: string, arr: NDArray): void;
69
- /**
70
- * Load arrays from a .npz file
71
- *
72
- * @param path - Path to the .npz file
73
- * @param options - Load options
74
- * @returns Object with array names as keys
75
- */
76
- export declare function loadNpzFile(path: string, options?: NpzParseOptions): Promise<NpzParseResultNDArray>;
77
- /**
78
- * Synchronously load arrays from a .npz file
79
- *
80
- * Note: Only works if the NPZ file is not DEFLATE compressed.
81
- *
82
- * @param path - Path to the .npz file
83
- * @param options - Load options
84
- * @returns Object with array names as keys
85
- */
86
- export declare function loadNpzFileSync(path: string, options?: NpzParseOptions): NpzParseResultNDArray;
87
- /**
88
- * Save arrays to a .npz file
89
- *
90
- * @param path - Path to save the .npz file
91
- * @param arrays - Arrays to save:
92
- * - Array of NDArrays (positional, named arr_0, arr_1, etc.)
93
- * - Map of names to NDArrays
94
- * - Object with names as keys
95
- * @param options - Save options
96
- */
97
- export declare function saveNpz(path: string, arrays: NpzArraysInput, options?: SaveNpzOptions): Promise<void>;
98
- /**
99
- * Synchronously save arrays to a .npz file (no compression)
100
- *
101
- * @param path - Path to save the .npz file
102
- * @param arrays - Arrays to save (same types as saveNpz)
103
- */
104
- export declare function saveNpzSync(path: string, arrays: NpzArraysInput): void;
105
- /**
106
- * Load an array or arrays from a .npy or .npz file
107
- *
108
- * This is a convenience function that auto-detects the file format based on extension.
109
- *
110
- * @param path - Path to the file
111
- * @param options - Load options
112
- * @returns NDArray for .npy files, or NpzParseResult for .npz files
113
- */
114
- export declare function load(path: string, options?: LoadOptions): Promise<NDArray | NpzParseResultNDArray>;
115
- /**
116
- * Synchronously load an array or arrays from a .npy or .npz file
117
- *
118
- * @param path - Path to the file
119
- * @param options - Load options
120
- * @returns NDArray for .npy files, or NpzParseResult for .npz files
121
- */
122
- export declare function loadSync(path: string, options?: LoadOptions): NDArray | NpzParseResultNDArray;
123
- /**
124
- * Save an array to a .npy file
125
- *
126
- * @param path - Path to save the file (should end with .npy)
127
- * @param arr - The NDArray to save
128
- */
129
- export declare function save(path: string, arr: NDArray): Promise<void>;
130
- /**
131
- * Synchronously save an array to a .npy file
132
- *
133
- * @param path - Path to save the file (should end with .npy)
134
- * @param arr - The NDArray to save
135
- */
136
- export declare function saveSync(path: string, arr: NDArray): void;
137
- /**
138
- * Save multiple arrays to a .npz file (like np.savez)
139
- *
140
- * @param path - Path to save the .npz file
141
- * @param arrays - Arrays to save:
142
- * - Array of NDArrays: named arr_0, arr_1, etc. (like np.savez positional args)
143
- * - Object/Map with names as keys (like np.savez keyword args)
144
- *
145
- * @example
146
- * // Positional arrays
147
- * await savez('data.npz', [arr1, arr2]) // saved as arr_0, arr_1
148
- *
149
- * // Named arrays
150
- * await savez('data.npz', { x: arr1, y: arr2 })
151
- */
152
- export declare function savez(path: string, arrays: NpzArraysInput): Promise<void>;
153
- /**
154
- * Save multiple arrays to a compressed .npz file (like np.savez_compressed)
155
- *
156
- * @param path - Path to save the .npz file
157
- * @param arrays - Arrays to save (same input types as savez)
158
- */
159
- export declare function savez_compressed(path: string, arrays: NpzArraysInput): Promise<void>;
160
- /**
161
- * Options for loadtxt
162
- */
163
- export interface LoadTxtOptions extends ParseTxtOptions {
164
- }
165
- /**
166
- * Options for savetxt
167
- */
168
- export interface SaveTxtOptions extends SerializeTxtOptions {
169
- }
170
- /**
171
- * Load data from a text file.
172
- *
173
- * Each row in the text file must have the same number of values.
174
- *
175
- * @param path - Path to the text file
176
- * @param options - Load options
177
- * @returns NDArray with the loaded data
178
- *
179
- * @example
180
- * ```typescript
181
- * // Load a CSV file
182
- * const arr = await loadtxt('data.csv', { delimiter: ',' });
183
- *
184
- * // Load with specific columns
185
- * const arr = await loadtxt('data.txt', { usecols: [0, 2] });
186
- *
187
- * // Skip header rows
188
- * const arr = await loadtxt('data.txt', { skiprows: 1 });
189
- * ```
190
- */
191
- export declare function loadtxt(path: string, options?: LoadTxtOptions): Promise<NDArray>;
192
- /**
193
- * Synchronously load data from a text file.
194
- *
195
- * @param path - Path to the text file
196
- * @param options - Load options
197
- * @returns NDArray with the loaded data
198
- */
199
- export declare function loadtxtSync(path: string, options?: LoadTxtOptions): NDArray;
200
- /**
201
- * Save an array to a text file.
202
- *
203
- * @param path - Path to save the text file
204
- * @param arr - The array to save (must be 1D or 2D)
205
- * @param options - Save options
206
- *
207
- * @example
208
- * ```typescript
209
- * // Save as CSV
210
- * await savetxt('data.csv', arr, { delimiter: ',' });
211
- *
212
- * // Save with custom format
213
- * await savetxt('data.txt', arr, { fmt: '%.2f', delimiter: '\t' });
214
- *
215
- * // Save with header
216
- * await savetxt('data.txt', arr, { header: 'x y z' });
217
- * ```
218
- */
219
- export declare function savetxt(path: string, arr: NDArray, options?: SaveTxtOptions): Promise<void>;
220
- /**
221
- * Synchronously save an array to a text file.
222
- *
223
- * @param path - Path to save the text file
224
- * @param arr - The array to save (must be 1D or 2D)
225
- * @param options - Save options
226
- */
227
- export declare function savetxtSync(path: string, arr: NDArray, options?: SaveTxtOptions): void;
228
- /**
229
- * Load data from a text file with more flexible handling.
230
- *
231
- * Similar to loadtxt but handles missing values more gracefully.
232
- *
233
- * @param path - Path to the text file
234
- * @param options - Load options
235
- * @returns NDArray with the loaded data
236
- *
237
- * @example
238
- * ```typescript
239
- * // Load file with missing values
240
- * const arr = await genfromtxt('data.csv', {
241
- * delimiter: ',',
242
- * missing_values: ['NA', ''],
243
- * filling_values: 0
244
- * });
245
- * ```
246
- */
247
- export declare function genfromtxt(path: string, options?: LoadTxtOptions): Promise<NDArray>;
248
- /**
249
- * Synchronously load data from a text file with more flexible handling.
250
- *
251
- * @param path - Path to the text file
252
- * @param options - Load options
253
- * @returns NDArray with the loaded data
254
- */
255
- export declare function genfromtxtSync(path: string, options?: LoadTxtOptions): NDArray;
256
- /**
257
- * Load data from a text file using regular expressions.
258
- *
259
- * @param path - Path to the text file
260
- * @param regexp - Regular expression with capture groups for extracting values
261
- * @param dtype - Data type of the resulting array (default: 'float64')
262
- * @returns NDArray with the extracted data
263
- *
264
- * @example
265
- * ```typescript
266
- * // Extract x,y pairs from "Point: x=1.0, y=2.0" format
267
- * const arr = await fromregex('points.txt', /x=([\d.]+), y=([\d.]+)/);
268
- * ```
269
- */
270
- export declare function fromregex(path: string, regexp: RegExp | string, dtype?: DType): Promise<NDArray>;
271
- /**
272
- * Synchronously load data from a text file using regular expressions.
273
- *
274
- * @param path - Path to the text file
275
- * @param regexp - Regular expression with capture groups for extracting values
276
- * @param dtype - Data type of the resulting array (default: 'float64')
277
- * @returns NDArray with the extracted data
278
- */
279
- export declare function fromregexSync(path: string, regexp: RegExp | string, dtype?: DType): NDArray;
280
8
  //# sourceMappingURL=node.d.ts.map