numpy-ts 0.11.0 → 0.13.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 (145) hide show
  1. package/README.md +29 -25
  2. package/dist/esm/common/broadcasting.js +1 -0
  3. package/dist/esm/common/complex.js +1 -0
  4. package/dist/esm/common/dtype.js +1 -0
  5. package/dist/esm/common/internal/compute.js +1 -0
  6. package/dist/esm/common/internal/indexing.js +1 -0
  7. package/dist/esm/common/ndarray-core.js +1 -0
  8. package/dist/esm/common/ops/advanced.js +1 -0
  9. package/dist/esm/common/ops/arithmetic.js +1 -0
  10. package/dist/esm/common/ops/bitwise.js +1 -0
  11. package/dist/esm/common/ops/comparison.js +1 -0
  12. package/dist/esm/common/ops/complex.js +1 -0
  13. package/dist/esm/common/ops/exponential.js +1 -0
  14. package/dist/esm/common/ops/fft.js +1 -0
  15. package/dist/esm/common/ops/formatting.js +2 -0
  16. package/dist/esm/common/ops/gradient.js +1 -0
  17. package/dist/esm/common/ops/hyperbolic.js +1 -0
  18. package/dist/esm/common/ops/linalg.js +2 -0
  19. package/dist/esm/common/ops/logic.js +1 -0
  20. package/dist/esm/common/ops/random.js +1 -0
  21. package/dist/esm/common/ops/reduction.js +1 -0
  22. package/dist/esm/common/ops/rounding.js +1 -0
  23. package/dist/esm/common/ops/sets.js +1 -0
  24. package/dist/esm/common/ops/shape.js +1 -0
  25. package/dist/esm/common/ops/sorting.js +1 -0
  26. package/dist/esm/common/ops/statistics.js +1 -0
  27. package/dist/esm/common/ops/trig.js +1 -0
  28. package/dist/esm/common/slicing.js +1 -0
  29. package/dist/esm/common/storage.js +1 -0
  30. package/dist/esm/core/advanced.js +1 -0
  31. package/dist/esm/core/arithmetic.js +1 -0
  32. package/dist/esm/core/bitwise.js +1 -0
  33. package/dist/esm/core/complex.js +1 -0
  34. package/dist/esm/core/creation.js +1 -0
  35. package/dist/esm/core/formatting.js +1 -0
  36. package/dist/esm/core/gradient.js +1 -0
  37. package/dist/esm/core/index.js +1 -0
  38. package/dist/esm/core/linalg.js +1 -0
  39. package/dist/esm/core/logic.js +1 -0
  40. package/dist/esm/core/polynomial.js +1 -0
  41. package/dist/esm/core/reduction.js +1 -0
  42. package/dist/esm/core/rounding.js +1 -0
  43. package/dist/esm/core/sets.js +1 -0
  44. package/dist/esm/core/shape-extra.js +1 -0
  45. package/dist/esm/core/shape.js +1 -0
  46. package/dist/esm/core/sorting.js +1 -0
  47. package/dist/esm/core/statistics.js +1 -0
  48. package/dist/esm/core/trig.js +1 -0
  49. package/dist/esm/core/typechecking.js +1 -0
  50. package/dist/esm/core/types.js +1 -0
  51. package/dist/esm/core/utility.js +1 -0
  52. package/dist/esm/core.js +1 -0
  53. package/dist/esm/full/index.js +1 -0
  54. package/dist/esm/full/ndarray.js +1 -0
  55. package/dist/esm/index.js +1 -0
  56. package/dist/esm/io/index.js +1 -0
  57. package/dist/esm/io/npy/format.js +1 -0
  58. package/dist/esm/io/npy/index.js +1 -0
  59. package/dist/esm/io/npy/parser.js +1 -0
  60. package/dist/esm/io/npy/serializer.js +2 -0
  61. package/dist/esm/io/npz/index.js +1 -0
  62. package/dist/esm/io/npz/parser.js +1 -0
  63. package/dist/esm/io/npz/serializer.js +1 -0
  64. package/dist/esm/io/txt/index.js +1 -0
  65. package/dist/esm/io/txt/parser.js +1 -0
  66. package/dist/esm/io/txt/serializer.js +2 -0
  67. package/dist/esm/io/zip/index.js +1 -0
  68. package/dist/esm/io/zip/reader.js +1 -0
  69. package/dist/esm/io/zip/types.js +1 -0
  70. package/dist/esm/io/zip/writer.js +1 -0
  71. package/dist/esm/node.js +1 -0
  72. package/dist/numpy-ts.browser.js +5 -2
  73. package/dist/numpy-ts.node-io.cjs +5 -3
  74. package/dist/numpy-ts.node-io.cjs.map +4 -4
  75. package/dist/numpy-ts.node-io.mjs +5 -3
  76. package/dist/numpy-ts.node-io.mjs.map +4 -4
  77. package/dist/numpy-ts.node.cjs +5 -2
  78. package/dist/numpy-ts.node.cjs.map +4 -4
  79. package/dist/types/common/complex.d.ts +94 -0
  80. package/dist/types/{internal → common/internal}/compute.d.ts +1 -1
  81. package/dist/types/{internal → common/internal}/indexing.d.ts +6 -0
  82. package/dist/types/common/ndarray-core.d.ts +126 -0
  83. package/dist/types/{ops → common/ops}/advanced.d.ts +67 -2
  84. package/dist/types/{ops → common/ops}/arithmetic.d.ts +100 -1
  85. package/dist/types/{ops → common/ops}/bitwise.d.ts +31 -1
  86. package/dist/types/{ops → common/ops}/comparison.d.ts +1 -1
  87. package/dist/types/{ops → common/ops}/complex.d.ts +1 -1
  88. package/dist/types/{ops → common/ops}/exponential.d.ts +1 -1
  89. package/dist/types/common/ops/fft.d.ts +166 -0
  90. package/dist/types/common/ops/formatting.d.ts +229 -0
  91. package/dist/types/{ops → common/ops}/gradient.d.ts +1 -1
  92. package/dist/types/{ops → common/ops}/hyperbolic.d.ts +1 -1
  93. package/dist/types/{ops → common/ops}/linalg.d.ts +148 -3
  94. package/dist/types/{ops → common/ops}/logic.d.ts +2 -2
  95. package/dist/types/common/ops/random.d.ts +376 -0
  96. package/dist/types/{ops → common/ops}/reduction.d.ts +10 -2
  97. package/dist/types/{ops → common/ops}/rounding.d.ts +1 -1
  98. package/dist/types/common/ops/sets.d.ts +87 -0
  99. package/dist/types/{ops → common/ops}/shape.d.ts +14 -1
  100. package/dist/types/{ops → common/ops}/sorting.d.ts +1 -1
  101. package/dist/types/{ops → common/ops}/statistics.d.ts +23 -1
  102. package/dist/types/{ops → common/ops}/trig.d.ts +1 -1
  103. package/dist/types/{core → common}/storage.d.ts +1 -0
  104. package/dist/types/core/advanced.d.ts +54 -0
  105. package/dist/types/core/arithmetic.d.ts +110 -0
  106. package/dist/types/core/bitwise.d.ts +34 -0
  107. package/dist/types/core/complex.d.ts +15 -90
  108. package/dist/types/core/creation.d.ts +98 -0
  109. package/dist/types/core/formatting.d.ts +29 -0
  110. package/dist/types/core/gradient.d.ts +14 -0
  111. package/dist/types/core/index.d.ts +40 -0
  112. package/dist/types/core/linalg.d.ts +141 -0
  113. package/dist/types/core/logic.d.ts +72 -0
  114. package/dist/types/core/polynomial.d.ts +50 -0
  115. package/dist/types/core/reduction.d.ts +82 -0
  116. package/dist/types/core/rounding.d.ts +24 -0
  117. package/dist/types/core/sets.d.ts +48 -0
  118. package/dist/types/core/shape-extra.d.ts +24 -0
  119. package/dist/types/core/shape.d.ts +77 -0
  120. package/dist/types/core/sorting.d.ts +34 -0
  121. package/dist/types/core/statistics.d.ts +32 -0
  122. package/dist/types/core/trig.d.ts +58 -0
  123. package/dist/types/core/typechecking.d.ts +50 -0
  124. package/dist/types/core/types.d.ts +43 -0
  125. package/dist/types/core/utility.d.ts +30 -0
  126. package/dist/types/core.d.ts +30 -0
  127. package/dist/types/full/index.d.ts +603 -0
  128. package/dist/types/full/ndarray.d.ts +880 -0
  129. package/dist/types/index.d.ts +140 -26
  130. package/dist/types/io/npy/format.d.ts +1 -1
  131. package/dist/types/io/npy/parser.d.ts +3 -3
  132. package/dist/types/io/npy/serializer.d.ts +2 -2
  133. package/dist/types/io/npz/parser.d.ts +4 -4
  134. package/dist/types/io/npz/serializer.d.ts +6 -6
  135. package/dist/types/io/txt/parser.d.ts +5 -5
  136. package/dist/types/io/txt/serializer.d.ts +2 -2
  137. package/dist/types/node.d.ts +12 -8
  138. package/package.json +31 -30
  139. package/dist/numpy-ts.esm.js +0 -2
  140. package/dist/types/core/ndarray.d.ts +0 -3166
  141. package/dist/types/ops/random.d.ts +0 -136
  142. package/dist/types/ops/sets.d.ts +0 -38
  143. /package/dist/types/{core → common}/broadcasting.d.ts +0 -0
  144. /package/dist/types/{core → common}/dtype.d.ts +0 -0
  145. /package/dist/types/{core → common}/slicing.d.ts +0 -0
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Polynomial functions
3
+ *
4
+ * Tree-shakeable standalone functions for polynomial operations.
5
+ */
6
+ import { NDArrayCore } from '../common/ndarray-core';
7
+ /**
8
+ * Find the coefficients of a polynomial with given roots
9
+ */
10
+ export declare function poly(seq_of_zeros: NDArrayCore | number[]): NDArrayCore;
11
+ /**
12
+ * Add two polynomials
13
+ */
14
+ export declare function polyadd(a1: NDArrayCore | number[], a2: NDArrayCore | number[]): NDArrayCore;
15
+ /**
16
+ * Differentiate a polynomial
17
+ */
18
+ export declare function polyder(p: NDArrayCore | number[], m?: number): NDArrayCore;
19
+ /**
20
+ * Divide two polynomials
21
+ */
22
+ export declare function polydiv(u: NDArrayCore | number[], v: NDArrayCore | number[]): [NDArrayCore, NDArrayCore];
23
+ /**
24
+ * Least squares polynomial fit
25
+ */
26
+ export declare function polyfit(x: NDArrayCore, y: NDArrayCore, deg: number): NDArrayCore;
27
+ /**
28
+ * Integrate a polynomial
29
+ */
30
+ export declare function polyint(p: NDArrayCore | number[], m?: number, k?: number | number[]): NDArrayCore;
31
+ /**
32
+ * Multiply two polynomials
33
+ */
34
+ export declare function polymul(a1: NDArrayCore | number[], a2: NDArrayCore | number[]): NDArrayCore;
35
+ /**
36
+ * Subtract two polynomials
37
+ */
38
+ export declare function polysub(a1: NDArrayCore | number[], a2: NDArrayCore | number[]): NDArrayCore;
39
+ /**
40
+ * Evaluate a polynomial at given points
41
+ */
42
+ export declare function polyval(p: NDArrayCore | number[], x: NDArrayCore | number | number[]): NDArrayCore | number;
43
+ /**
44
+ * Find the roots of a polynomial.
45
+ *
46
+ * Uses the companion matrix eigenvalue method (same as NumPy).
47
+ * Always returns a complex128 NDArrayCore.
48
+ */
49
+ export declare function roots(p: NDArrayCore | number[]): NDArrayCore;
50
+ //# sourceMappingURL=polynomial.d.ts.map
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Reduction Functions - Tree-shakeable standalone functions
3
+ *
4
+ * This module provides array reduction and aggregation functions that can be
5
+ * imported independently for optimal tree-shaking.
6
+ */
7
+ import { NDArrayCore, Complex } from './types';
8
+ /** Sum of array elements */
9
+ export declare function sum(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | bigint | Complex;
10
+ /** Mean of array elements */
11
+ export declare function mean(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | Complex;
12
+ /** Product of array elements */
13
+ export declare function prod(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | bigint | Complex;
14
+ /** Maximum of array elements */
15
+ export declare function max(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | Complex;
16
+ /** Alias for max */
17
+ export declare const amax: typeof max;
18
+ /** Minimum of array elements */
19
+ export declare function min(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | Complex;
20
+ /** Alias for min */
21
+ export declare const amin: typeof min;
22
+ /** Peak-to-peak (max - min) */
23
+ export declare function ptp(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | Complex;
24
+ /** Index of minimum value */
25
+ export declare function argmin(a: NDArrayCore, axis?: number): NDArrayCore | number;
26
+ /** Index of maximum value */
27
+ export declare function argmax(a: NDArrayCore, axis?: number): NDArrayCore | number;
28
+ /** Variance of array elements */
29
+ export declare function variance(a: NDArrayCore, axis?: number, ddof?: number, keepdims?: boolean): NDArrayCore | number;
30
+ /** Alias for variance */
31
+ export declare const var_: typeof variance;
32
+ /** Standard deviation of array elements */
33
+ export declare function std(a: NDArrayCore, axis?: number, ddof?: number, keepdims?: boolean): NDArrayCore | number;
34
+ /** Median of array elements */
35
+ export declare function median(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number;
36
+ /** Percentile of array elements */
37
+ export declare function percentile(a: NDArrayCore, q: number, axis?: number, keepdims?: boolean): NDArrayCore | number;
38
+ /** Quantile of array elements */
39
+ export declare function quantile(a: NDArrayCore, q: number, axis?: number, keepdims?: boolean): NDArrayCore | number;
40
+ /** Weighted average */
41
+ export declare function average(a: NDArrayCore, axis?: number, weights?: NDArrayCore, keepdims?: boolean): NDArrayCore | number | Complex;
42
+ /** Test if all elements are true */
43
+ export declare function all(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | boolean;
44
+ /** Test if any element is true */
45
+ export declare function any(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | boolean;
46
+ /** Cumulative sum */
47
+ export declare function cumsum(a: NDArrayCore, axis?: number): NDArrayCore;
48
+ /** Alias for cumsum */
49
+ export declare const cumulative_sum: typeof cumsum;
50
+ /** Cumulative product */
51
+ export declare function cumprod(a: NDArrayCore, axis?: number): NDArrayCore;
52
+ /** Alias for cumprod */
53
+ export declare const cumulative_prod: typeof cumprod;
54
+ /** Sum ignoring NaN */
55
+ export declare function nansum(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | Complex;
56
+ /** Product ignoring NaN */
57
+ export declare function nanprod(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | Complex;
58
+ /** Mean ignoring NaN */
59
+ export declare function nanmean(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | Complex;
60
+ /** Variance ignoring NaN */
61
+ export declare function nanvar(a: NDArrayCore, axis?: number, ddof?: number, keepdims?: boolean): NDArrayCore | number;
62
+ /** Standard deviation ignoring NaN */
63
+ export declare function nanstd(a: NDArrayCore, axis?: number, ddof?: number, keepdims?: boolean): NDArrayCore | number;
64
+ /** Minimum ignoring NaN */
65
+ export declare function nanmin(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | Complex;
66
+ /** Maximum ignoring NaN */
67
+ export declare function nanmax(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number | Complex;
68
+ /** Index of minimum ignoring NaN */
69
+ export declare function nanargmin(a: NDArrayCore, axis?: number): NDArrayCore | number;
70
+ /** Index of maximum ignoring NaN */
71
+ export declare function nanargmax(a: NDArrayCore, axis?: number): NDArrayCore | number;
72
+ /** Cumulative sum ignoring NaN */
73
+ export declare function nancumsum(a: NDArrayCore, axis?: number): NDArrayCore;
74
+ /** Cumulative product ignoring NaN */
75
+ export declare function nancumprod(a: NDArrayCore, axis?: number): NDArrayCore;
76
+ /** Median ignoring NaN */
77
+ export declare function nanmedian(a: NDArrayCore, axis?: number, keepdims?: boolean): NDArrayCore | number;
78
+ /** Quantile ignoring NaN */
79
+ export declare function nanquantile(a: NDArrayCore, q: number, axis?: number, keepdims?: boolean): NDArrayCore | number;
80
+ /** Percentile ignoring NaN */
81
+ export declare function nanpercentile(a: NDArrayCore, q: number, axis?: number, keepdims?: boolean): NDArrayCore | number;
82
+ //# sourceMappingURL=reduction.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Rounding Functions - Tree-shakeable standalone functions
3
+ *
4
+ * This module provides rounding operations that can be
5
+ * imported independently for optimal tree-shaking.
6
+ */
7
+ import { NDArrayCore } from './types';
8
+ /** Round to given decimals */
9
+ export declare function around(a: NDArrayCore, decimals?: number): NDArrayCore;
10
+ /** Alias for around */
11
+ export declare const round_: typeof around;
12
+ /** Round (same as around) */
13
+ export declare function round(a: NDArrayCore, decimals?: number): NDArrayCore;
14
+ /** Ceiling */
15
+ export declare function ceil(x: NDArrayCore): NDArrayCore;
16
+ /** Round toward zero */
17
+ export declare function fix(x: NDArrayCore): NDArrayCore;
18
+ /** Floor */
19
+ export declare function floor(x: NDArrayCore): NDArrayCore;
20
+ /** Round to nearest integer */
21
+ export declare function rint(x: NDArrayCore): NDArrayCore;
22
+ /** Truncate toward zero */
23
+ export declare function trunc(x: NDArrayCore): NDArrayCore;
24
+ //# sourceMappingURL=rounding.d.ts.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Set Operations - Tree-shakeable standalone functions
3
+ *
4
+ * This module provides set operations that can be
5
+ * imported independently for optimal tree-shaking.
6
+ */
7
+ import { NDArrayCore } from './types';
8
+ /** Find unique elements */
9
+ export declare function unique(ar: NDArrayCore, returnIndex?: boolean, returnInverse?: boolean, returnCounts?: boolean): NDArrayCore | {
10
+ values: NDArrayCore;
11
+ indices?: NDArrayCore;
12
+ inverse?: NDArrayCore;
13
+ counts?: NDArrayCore;
14
+ };
15
+ /** Test if elements in ar1 are in ar2 (deprecated, use isin) */
16
+ export declare function in1d(ar1: NDArrayCore, ar2: NDArrayCore): NDArrayCore;
17
+ /** Find intersection of two arrays */
18
+ export declare function intersect1d(ar1: NDArrayCore, ar2: NDArrayCore): NDArrayCore;
19
+ /** Test if elements are in test elements */
20
+ export declare function isin(element: NDArrayCore, testElements: NDArrayCore): NDArrayCore;
21
+ /** Find set difference (elements in ar1 not in ar2) */
22
+ export declare function setdiff1d(ar1: NDArrayCore, ar2: NDArrayCore): NDArrayCore;
23
+ /** Find symmetric difference (elements in either but not both) */
24
+ export declare function setxor1d(ar1: NDArrayCore, ar2: NDArrayCore): NDArrayCore;
25
+ /** Find union of two arrays */
26
+ export declare function union1d(ar1: NDArrayCore, ar2: NDArrayCore): NDArrayCore;
27
+ /** Trim leading/trailing zeros */
28
+ export declare function trim_zeros(filt: NDArrayCore, trim?: 'f' | 'b' | 'fb'): NDArrayCore;
29
+ /** Return all unique values and metadata (Array API) */
30
+ export declare function unique_all(x: NDArrayCore): {
31
+ values: NDArrayCore;
32
+ indices: NDArrayCore;
33
+ inverse_indices: NDArrayCore;
34
+ counts: NDArrayCore;
35
+ };
36
+ /** Return unique values and counts (Array API) */
37
+ export declare function unique_counts(x: NDArrayCore): {
38
+ values: NDArrayCore;
39
+ counts: NDArrayCore;
40
+ };
41
+ /** Return unique values and inverse indices (Array API) */
42
+ export declare function unique_inverse(x: NDArrayCore): {
43
+ values: NDArrayCore;
44
+ inverse_indices: NDArrayCore;
45
+ };
46
+ /** Return unique values (Array API) */
47
+ export declare function unique_values(x: NDArrayCore): NDArrayCore;
48
+ //# sourceMappingURL=sets.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Additional shape manipulation functions
3
+ *
4
+ * Tree-shakeable standalone functions for array manipulation.
5
+ */
6
+ import { NDArrayCore } from '../common/ndarray-core';
7
+ /**
8
+ * Append values to the end of an array
9
+ */
10
+ export declare function append(arr: NDArrayCore, values: NDArrayCore | number | number[], axis?: number): NDArrayCore;
11
+ /**
12
+ * Delete elements from an array
13
+ */
14
+ export declare function delete_(arr: NDArrayCore, obj: number | number[], axis?: number): NDArrayCore;
15
+ export { delete_ as delete };
16
+ /**
17
+ * Insert values along an axis
18
+ */
19
+ export declare function insert(arr: NDArrayCore, obj: number | number[], values: NDArrayCore | number | number[], axis?: number): NDArrayCore;
20
+ /**
21
+ * Pad an array
22
+ */
23
+ export declare function pad(arr: NDArrayCore, pad_width: number | [number, number] | [number, number][], mode?: 'constant' | 'edge' | 'linear_ramp' | 'maximum' | 'mean' | 'median' | 'minimum' | 'reflect' | 'symmetric' | 'wrap' | 'empty', constant_values?: number): NDArrayCore;
24
+ //# sourceMappingURL=shape-extra.d.ts.map
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Shape Manipulation Functions - Tree-shakeable standalone functions
3
+ *
4
+ * This module provides array shape manipulation functions that can be
5
+ * imported independently for optimal tree-shaking.
6
+ */
7
+ import { NDArrayCore } from './types';
8
+ /** Reshape array without changing data */
9
+ export declare function reshape(a: NDArrayCore, newShape: number[]): NDArrayCore;
10
+ /** Flatten array to 1D */
11
+ export declare function flatten(a: NDArrayCore): NDArrayCore;
12
+ /** Return contiguous flattened array */
13
+ export declare function ravel(a: NDArrayCore): NDArrayCore;
14
+ /** Remove single-dimensional entries from shape - returns a view */
15
+ export declare function squeeze(a: NDArrayCore, axis?: number): NDArrayCore;
16
+ /** Expand array dimensions - returns a view */
17
+ export declare function expand_dims(a: NDArrayCore, axis: number): NDArrayCore;
18
+ /** Interchange two axes - returns a view */
19
+ export declare function swapaxes(a: NDArrayCore, axis1: number, axis2: number): NDArrayCore;
20
+ /** Move axis to new position - returns a view */
21
+ export declare function moveaxis(a: NDArrayCore, source: number | number[], destination: number | number[]): NDArrayCore;
22
+ /** Roll axis to given position - returns a view */
23
+ export declare function rollaxis(a: NDArrayCore, axis: number, start?: number): NDArrayCore;
24
+ /** Join arrays along an existing axis */
25
+ export declare function concatenate(arrays: NDArrayCore[], axis?: number): NDArrayCore;
26
+ /** Join arrays along a new axis */
27
+ export declare function stack(arrays: NDArrayCore[], axis?: number): NDArrayCore;
28
+ /** Stack arrays vertically (row-wise) */
29
+ export declare function vstack(arrays: NDArrayCore[]): NDArrayCore;
30
+ /** Stack arrays horizontally (column-wise) */
31
+ export declare function hstack(arrays: NDArrayCore[]): NDArrayCore;
32
+ /** Stack arrays along third axis (depth-wise) */
33
+ export declare function dstack(arrays: NDArrayCore[]): NDArrayCore;
34
+ /** Concatenate (alias) */
35
+ export declare function concat(arrays: NDArrayCore[], axis?: number): NDArrayCore;
36
+ /** Stack 1D arrays as columns */
37
+ export declare function column_stack(arrays: NDArrayCore[]): NDArrayCore;
38
+ /** vstack alias */
39
+ export declare const row_stack: typeof vstack;
40
+ /** Assemble arrays from nested sequences of blocks */
41
+ export declare function block(arrays: NDArrayCore[]): NDArrayCore;
42
+ /** Split array into multiple sub-arrays - returns views */
43
+ export declare function split(a: NDArrayCore, indicesOrSections: number | number[], axis?: number): NDArrayCore[];
44
+ /** Split array into multiple sub-arrays (may have unequal sizes) - returns views */
45
+ export declare function array_split(a: NDArrayCore, indicesOrSections: number | number[], axis?: number): NDArrayCore[];
46
+ /** Split array vertically - returns views */
47
+ export declare function vsplit(a: NDArrayCore, indicesOrSections: number | number[]): NDArrayCore[];
48
+ /** Split array horizontally - returns views */
49
+ export declare function hsplit(a: NDArrayCore, indicesOrSections: number | number[]): NDArrayCore[];
50
+ /** Split array along third axis */
51
+ /** Split array along depth axis - returns views */
52
+ export declare function dsplit(ary: NDArrayCore, indices_or_sections: number | number[]): NDArrayCore[];
53
+ /** Unstack array into list of arrays */
54
+ export declare function unstack(a: NDArrayCore, axis?: number): NDArrayCore[];
55
+ /** Tile array by given repetitions */
56
+ export declare function tile(a: NDArrayCore, reps: number | number[]): NDArrayCore;
57
+ /** Repeat elements of array */
58
+ export declare function repeat(a: NDArrayCore, repeats: number | number[], axis?: number): NDArrayCore;
59
+ /** Reverse order of elements along axis */
60
+ export declare function flip(m: NDArrayCore, axis?: number | number[]): NDArrayCore;
61
+ /** Flip array left/right */
62
+ export declare function fliplr(m: NDArrayCore): NDArrayCore;
63
+ /** Flip array up/down */
64
+ export declare function flipud(m: NDArrayCore): NDArrayCore;
65
+ /** Rotate array by 90 degrees */
66
+ export declare function rot90(m: NDArrayCore, k?: number, axes?: [number, number]): NDArrayCore;
67
+ /** Roll array elements along axis */
68
+ export declare function roll(a: NDArrayCore, shift: number | number[], axis?: number | number[]): NDArrayCore;
69
+ /** Resize array to new shape */
70
+ export declare function resize(a: NDArrayCore, new_shape: number[]): NDArrayCore;
71
+ /** Ensure array has at least 1 dimension */
72
+ export declare function atleast_1d(...arrays: NDArrayCore[]): NDArrayCore | NDArrayCore[];
73
+ /** Ensure array has at least 2 dimensions */
74
+ export declare function atleast_2d(...arrays: NDArrayCore[]): NDArrayCore | NDArrayCore[];
75
+ /** Ensure array has at least 3 dimensions */
76
+ export declare function atleast_3d(...arrays: NDArrayCore[]): NDArrayCore | NDArrayCore[];
77
+ //# sourceMappingURL=shape.d.ts.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Sorting and Searching Functions - Tree-shakeable standalone functions
3
+ *
4
+ * This module provides sorting, searching, and counting functions that can be
5
+ * imported independently for optimal tree-shaking.
6
+ */
7
+ import { NDArrayCore } from './types';
8
+ /** Sort array along axis */
9
+ export declare function sort(a: NDArrayCore, axis?: number): NDArrayCore;
10
+ /** Indices that would sort array */
11
+ export declare function argsort(a: NDArrayCore, axis?: number): NDArrayCore;
12
+ /** Indirect stable sort on multiple keys */
13
+ export declare function lexsort(keys: NDArrayCore[]): NDArrayCore;
14
+ /** Partially sort array */
15
+ export declare function partition(a: NDArrayCore, kth: number, axis?: number): NDArrayCore;
16
+ /** Indices that would partially sort array */
17
+ export declare function argpartition(a: NDArrayCore, kth: number, axis?: number): NDArrayCore;
18
+ /** Sort complex array */
19
+ export declare function sort_complex(a: NDArrayCore): NDArrayCore;
20
+ /** Indices of non-zero elements */
21
+ export declare function nonzero(a: NDArrayCore): NDArrayCore[];
22
+ /** Indices where condition is True */
23
+ export declare function argwhere(a: NDArrayCore): NDArrayCore;
24
+ /** Indices of non-zero elements in flattened array */
25
+ export declare function flatnonzero(a: NDArrayCore): NDArrayCore;
26
+ /** Return elements from x or y based on condition */
27
+ export declare function where(condition: NDArrayCore, x?: NDArrayCore, y?: NDArrayCore): NDArrayCore | NDArrayCore[];
28
+ /** Find indices for inserting elements to maintain order */
29
+ export declare function searchsorted(a: NDArrayCore, v: NDArrayCore, side?: 'left' | 'right'): NDArrayCore;
30
+ /** Extract elements where condition is True */
31
+ export declare function extract(condition: NDArrayCore, a: NDArrayCore): NDArrayCore;
32
+ /** Count non-zero elements */
33
+ export declare function count_nonzero(a: NDArrayCore, axis?: number): NDArrayCore | number;
34
+ //# sourceMappingURL=sorting.d.ts.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Statistics Functions - Tree-shakeable standalone functions
3
+ *
4
+ * This module provides statistical operations that can be
5
+ * imported independently for optimal tree-shaking.
6
+ */
7
+ import { NDArrayCore } from './types';
8
+ type BinStrategyString = 'auto' | 'fd' | 'doane' | 'scott' | 'stone' | 'rice' | 'sturges' | 'sqrt';
9
+ /** Count occurrences of values */
10
+ export declare function bincount(x: NDArrayCore, weights?: NDArrayCore, minlength?: number): NDArrayCore;
11
+ /** Digitize values into bins */
12
+ export declare function digitize(x: NDArrayCore, bins: NDArrayCore, right?: boolean): NDArrayCore;
13
+ /** Compute histogram */
14
+ export declare function histogram(a: NDArrayCore, bins?: number | NDArrayCore | BinStrategyString, range?: [number, number], density?: boolean, weights?: NDArrayCore): [NDArrayCore, NDArrayCore];
15
+ /** Compute 2D histogram */
16
+ export declare function histogram2d(x: NDArrayCore, y: NDArrayCore, bins?: number | [number, number] | [NDArrayCore, NDArrayCore], range?: [[number, number], [number, number]], density?: boolean, weights?: NDArrayCore): [NDArrayCore, NDArrayCore, NDArrayCore];
17
+ /** Compute N-dimensional histogram */
18
+ export declare function histogramdd(sample: NDArrayCore, bins?: number | number[], range?: [number, number][], density?: boolean, weights?: NDArrayCore): [NDArrayCore, NDArrayCore[]];
19
+ /** Cross-correlation */
20
+ export declare function correlate(a: NDArrayCore, v: NDArrayCore, mode?: 'valid' | 'same' | 'full'): NDArrayCore;
21
+ /** Convolution */
22
+ export declare function convolve(a: NDArrayCore, v: NDArrayCore, mode?: 'valid' | 'same' | 'full'): NDArrayCore;
23
+ /** Covariance matrix */
24
+ export declare function cov(m: NDArrayCore, y?: NDArrayCore, rowvar?: boolean, bias?: boolean, ddof?: number): NDArrayCore;
25
+ /** Correlation coefficients */
26
+ export declare function corrcoef(x: NDArrayCore, y?: NDArrayCore, rowvar?: boolean): NDArrayCore;
27
+ /** Compute histogram bin edges */
28
+ export declare function histogram_bin_edges(a: NDArrayCore, bins?: number | BinStrategyString, range?: [number, number], weights?: NDArrayCore): NDArrayCore;
29
+ /** Integrate using trapezoidal rule */
30
+ export declare function trapezoid(y: NDArrayCore, x?: NDArrayCore, dx?: number, axis?: number): NDArrayCore | number;
31
+ export {};
32
+ //# sourceMappingURL=statistics.d.ts.map
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Trigonometric Functions - Tree-shakeable standalone functions
3
+ *
4
+ * This module provides trigonometric and hyperbolic functions that can be
5
+ * imported independently for optimal tree-shaking.
6
+ */
7
+ import { NDArrayCore } from './types';
8
+ /** Sine of array elements */
9
+ export declare function sin(x: NDArrayCore): NDArrayCore;
10
+ /** Cosine of array elements */
11
+ export declare function cos(x: NDArrayCore): NDArrayCore;
12
+ /** Tangent of array elements */
13
+ export declare function tan(x: NDArrayCore): NDArrayCore;
14
+ /** Inverse sine */
15
+ export declare function arcsin(x: NDArrayCore): NDArrayCore;
16
+ /** Alias for arcsin */
17
+ export declare const asin: typeof arcsin;
18
+ /** Inverse cosine */
19
+ export declare function arccos(x: NDArrayCore): NDArrayCore;
20
+ /** Alias for arccos */
21
+ export declare const acos: typeof arccos;
22
+ /** Inverse tangent */
23
+ export declare function arctan(x: NDArrayCore): NDArrayCore;
24
+ /** Alias for arctan */
25
+ export declare const atan: typeof arctan;
26
+ /** Two-argument inverse tangent */
27
+ export declare function arctan2(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
28
+ /** Alias for arctan2 */
29
+ export declare const atan2: typeof arctan2;
30
+ /** Hypotenuse (sqrt(x1^2 + x2^2)) */
31
+ export declare function hypot(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
32
+ /** Convert radians to degrees */
33
+ export declare function degrees(x: NDArrayCore): NDArrayCore;
34
+ /** Convert degrees to radians */
35
+ export declare function radians(x: NDArrayCore): NDArrayCore;
36
+ /** Convert degrees to radians (alias) */
37
+ export declare function deg2rad(x: NDArrayCore): NDArrayCore;
38
+ /** Convert radians to degrees (alias) */
39
+ export declare function rad2deg(x: NDArrayCore): NDArrayCore;
40
+ /** Hyperbolic sine */
41
+ export declare function sinh(x: NDArrayCore): NDArrayCore;
42
+ /** Hyperbolic cosine */
43
+ export declare function cosh(x: NDArrayCore): NDArrayCore;
44
+ /** Hyperbolic tangent */
45
+ export declare function tanh(x: NDArrayCore): NDArrayCore;
46
+ /** Inverse hyperbolic sine */
47
+ export declare function arcsinh(x: NDArrayCore): NDArrayCore;
48
+ /** Alias for arcsinh */
49
+ export declare const asinh: typeof arcsinh;
50
+ /** Inverse hyperbolic cosine */
51
+ export declare function arccosh(x: NDArrayCore): NDArrayCore;
52
+ /** Alias for arccosh */
53
+ export declare const acosh: typeof arccosh;
54
+ /** Inverse hyperbolic tangent */
55
+ export declare function arctanh(x: NDArrayCore): NDArrayCore;
56
+ /** Alias for arctanh */
57
+ export declare const atanh: typeof arctanh;
58
+ //# sourceMappingURL=trig.d.ts.map
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Type checking and dtype utility functions
3
+ *
4
+ * Tree-shakeable standalone functions for dtype operations.
5
+ */
6
+ import { NDArrayCore, type DType } from '../common/ndarray-core';
7
+ /**
8
+ * Check if a cast between dtypes is possible according to the casting rule
9
+ */
10
+ export declare function can_cast(from_: DType | NDArrayCore, to: DType, casting?: 'no' | 'equiv' | 'safe' | 'same_kind' | 'unsafe'): boolean;
11
+ /**
12
+ * Return a scalar type common to input arrays
13
+ *
14
+ * This returns a floating-point type that can represent all input types.
15
+ * Integers are promoted to floats that can hold their full range.
16
+ */
17
+ export declare function common_type(...arrays: NDArrayCore[]): DType;
18
+ /**
19
+ * Return the type that results from applying promotion rules
20
+ *
21
+ * NumPy-compatible type promotion:
22
+ * - Integers promote to larger integers that can hold both ranges
23
+ * - int32 + uint32 -> int64 (needs signed type that fits both)
24
+ * - Integer + float -> float64 if integer is 32+ bits
25
+ * - float32 + complex64 -> complex64
26
+ * - float64 + complex64 -> complex128
27
+ */
28
+ export declare function result_type(...arrays_and_dtypes: (NDArrayCore | DType)[]): DType;
29
+ /**
30
+ * Return the minimum scalar type needed to represent a value
31
+ */
32
+ export declare function min_scalar_type(val: number | bigint | boolean): DType;
33
+ /**
34
+ * Check if dtype1 is a subtype of dtype2
35
+ */
36
+ export declare function issubdtype(dtype1: DType | NDArrayCore, dtype2: DType | string): boolean;
37
+ /**
38
+ * Return a description for the given dtype
39
+ *
40
+ * Returns the dtype name directly (NumPy compatible).
41
+ */
42
+ export declare function typename(dtype: DType): string;
43
+ /**
44
+ * Return the character code of the minimum-size type needed
45
+ *
46
+ * Returns the minimum type from typeset that can safely represent all input types.
47
+ * Uses safe casting rules to ensure no precision loss.
48
+ */
49
+ export declare function mintypecode(typechars: string, typeset?: string, default_?: string): string;
50
+ //# sourceMappingURL=typechecking.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Shared types for standalone function modules
3
+ *
4
+ * This module provides type definitions and helper functions used by
5
+ * standalone function wrappers for tree-shaking support.
6
+ */
7
+ import { NDArrayCore } from '../common/ndarray-core';
8
+ import { ArrayStorage } from '../common/storage';
9
+ import { Complex } from '../common/complex';
10
+ export type { DType, TypedArray } from '../common/dtype';
11
+ export { NDArrayCore, ArrayStorage, Complex };
12
+ /**
13
+ * Input type for functions that accept arrays
14
+ * Can be an NDArrayCore instance or nested arrays
15
+ */
16
+ export type ArrayLike = NDArrayCore | number[] | number[][] | number[][][] | number | bigint;
17
+ /**
18
+ * Convert input to ArrayStorage
19
+ * Handles both NDArrayCore and NDArray (which has _storage property)
20
+ */
21
+ export declare function toStorage(a: NDArrayCore | ArrayStorage): ArrayStorage;
22
+ /**
23
+ * Wrap ArrayStorage result in NDArrayCore
24
+ */
25
+ export declare function fromStorage(storage: ArrayStorage, base?: NDArrayCore): NDArrayCore;
26
+ /**
27
+ * Wrap ArrayStorage result in NDArrayCore as a view of the input array
28
+ * Sets the base to track the view relationship
29
+ */
30
+ export declare function fromStorageView(storage: ArrayStorage, original: NDArrayCore): NDArrayCore;
31
+ /**
32
+ * Wrap multiple ArrayStorage results
33
+ */
34
+ export declare function fromStorageArray(storages: ArrayStorage[]): NDArrayCore[];
35
+ /**
36
+ * Wrap multiple ArrayStorage results as views of the original array
37
+ */
38
+ export declare function fromStorageViewArray(storages: ArrayStorage[], original: NDArrayCore): NDArrayCore[];
39
+ /**
40
+ * Wrap a tuple of ArrayStorage results
41
+ */
42
+ export declare function fromStorageTuple(tuple: [ArrayStorage, ArrayStorage]): [NDArrayCore, NDArrayCore];
43
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Utility functions
3
+ *
4
+ * Tree-shakeable standalone functions for array introspection.
5
+ */
6
+ import { NDArrayCore, type DType } from '../common/ndarray-core';
7
+ import { Complex } from '../common/complex';
8
+ /**
9
+ * Return the number of dimensions of an array.
10
+ * Works with NDArrayCore, scalars, and nested arrays.
11
+ */
12
+ export declare function ndim(a: NDArrayCore | number | bigint | boolean | unknown[] | unknown): number;
13
+ /**
14
+ * Return the shape of an array.
15
+ * Works with NDArrayCore, scalars, and nested arrays.
16
+ */
17
+ export declare function shape(a: NDArrayCore | number | bigint | boolean | unknown[] | unknown): readonly number[] | number[];
18
+ /**
19
+ * Return the number of elements in an array.
20
+ * Works with NDArrayCore, scalars, and nested arrays.
21
+ */
22
+ export declare function size(a: NDArrayCore | number | bigint | boolean | unknown[] | unknown): number;
23
+ export declare function item(a: NDArrayCore, ...args: number[]): number | bigint | boolean | Complex;
24
+ export declare function tolist(a: NDArrayCore): unknown;
25
+ export declare function tobytes(a: NDArrayCore, order?: 'C' | 'F'): Uint8Array;
26
+ export declare function byteswap(a: NDArrayCore, inplace?: boolean): NDArrayCore;
27
+ export declare function view(a: NDArrayCore, dtype?: DType): NDArrayCore;
28
+ export declare function tofile(_a: NDArrayCore, _file: string, _sep?: string, _format?: string): void;
29
+ export declare function fill(a: NDArrayCore, value: number | bigint | boolean | Complex): void;
30
+ //# sourceMappingURL=utility.d.ts.map
@@ -0,0 +1,30 @@
1
+ /**
2
+ * numpy-ts/core - Tree-shakeable entry point
3
+ *
4
+ * This module provides standalone functions that return NDArrayCore.
5
+ * Use this entry point when bundle size is critical and you don't need method chaining.
6
+ *
7
+ * All functions in this module are designed for optimal tree-shaking.
8
+ * Import only what you need to get minimal bundle sizes.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { array, add, reshape } from 'numpy-ts/core';
13
+ *
14
+ * const a = array([1, 2, 3, 4]);
15
+ * const b = add(a, 10); // Standalone function
16
+ * const c = reshape(b, [2, 2]); // Standalone function
17
+ * console.log(c.shape); // [2, 2]
18
+ * ```
19
+ *
20
+ * For method chaining, use the main entry point instead:
21
+ * ```typescript
22
+ * import { array } from 'numpy-ts';
23
+ *
24
+ * const c = array([1, 2, 3, 4]).add(10).reshape([2, 2]);
25
+ * ```
26
+ *
27
+ * @module numpy-ts/core
28
+ */
29
+ export * from './core/index';
30
+ //# sourceMappingURL=core.d.ts.map