numpy-ts 0.12.0 → 0.13.1

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 (144) hide show
  1. package/README.md +18 -14
  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 +4 -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 +7 -2
  73. package/dist/numpy-ts.node-io.cjs +7 -3
  74. package/dist/numpy-ts.node-io.cjs.map +4 -4
  75. package/dist/numpy-ts.node-io.mjs +7 -3
  76. package/dist/numpy-ts.node-io.mjs.map +4 -4
  77. package/dist/numpy-ts.node.cjs +7 -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 +2 -2
  84. package/dist/types/{ops → common/ops}/arithmetic.d.ts +1 -1
  85. package/dist/types/{ops → common/ops}/bitwise.d.ts +1 -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 +24 -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 +2 -2
  97. package/dist/types/{ops → common/ops}/rounding.d.ts +1 -1
  98. package/dist/types/{ops → common/ops}/sets.d.ts +1 -1
  99. package/dist/types/{ops → common/ops}/shape.d.ts +1 -1
  100. package/dist/types/{ops → common/ops}/sorting.d.ts +1 -1
  101. package/dist/types/{ops → common/ops}/statistics.d.ts +1 -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 +30 -29
  139. package/dist/numpy-ts.esm.js +0 -2
  140. package/dist/types/core/ndarray.d.ts +0 -3923
  141. package/dist/types/ops/random.d.ts +0 -136
  142. /package/dist/types/{core → common}/broadcasting.d.ts +0 -0
  143. /package/dist/types/{core → common}/dtype.d.ts +0 -0
  144. /package/dist/types/{core → common}/slicing.d.ts +0 -0
@@ -4,8 +4,8 @@
4
4
  * Pure functions for reducing arrays along axes.
5
5
  * @module ops/reduction
6
6
  */
7
- import { ArrayStorage } from '../core/storage';
8
- import { Complex } from '../core/complex';
7
+ import { ArrayStorage } from '../storage';
8
+ import { Complex } from '../complex';
9
9
  /**
10
10
  * Sum array elements over a given axis
11
11
  */
@@ -7,7 +7,7 @@
7
7
  * Note: Rounding operations are not defined for complex numbers.
8
8
  * All functions throw TypeError for complex dtypes.
9
9
  */
10
- import { ArrayStorage } from '../core/storage';
10
+ import { ArrayStorage } from '../storage';
11
11
  /**
12
12
  * Round an array to the given number of decimals
13
13
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Set operations
3
3
  */
4
- import { ArrayStorage } from '../core/storage';
4
+ import { ArrayStorage } from '../storage';
5
5
  /**
6
6
  * Find the unique elements of an array
7
7
  */
@@ -4,7 +4,7 @@
4
4
  * Pure functions for reshaping, transposing, and manipulating array dimensions.
5
5
  * @module ops/shape
6
6
  */
7
- import { ArrayStorage } from '../core/storage';
7
+ import { ArrayStorage } from '../storage';
8
8
  /**
9
9
  * Reshape array to a new shape
10
10
  * Returns a view if array is C-contiguous, otherwise copies data
@@ -4,7 +4,7 @@
4
4
  * Functions for sorting arrays, finding sorted indices, and searching.
5
5
  * @module ops/sorting
6
6
  */
7
- import { ArrayStorage } from '../core/storage';
7
+ import { ArrayStorage } from '../storage';
8
8
  /**
9
9
  * Return a sorted copy of an array
10
10
  * @param storage - Input array storage
@@ -4,7 +4,7 @@
4
4
  * Pure functions for statistical analysis.
5
5
  * @module ops/statistics
6
6
  */
7
- import { ArrayStorage } from '../core/storage';
7
+ import { ArrayStorage } from '../storage';
8
8
  /**
9
9
  * Count number of occurrences of each value in array of non-negative ints.
10
10
  *
@@ -7,7 +7,7 @@
7
7
  * These functions are used by NDArray methods but are separated
8
8
  * to keep the codebase modular and testable.
9
9
  */
10
- import { ArrayStorage } from '../core/storage';
10
+ import { ArrayStorage } from '../storage';
11
11
  /**
12
12
  * Sine of each element (element-wise)
13
13
  * NumPy behavior: Always promotes to float64 for integer types
@@ -17,6 +17,7 @@ export declare class ArrayStorage {
17
17
  private _strides;
18
18
  private _offset;
19
19
  private _dtype;
20
+ private _isCContiguous;
20
21
  constructor(data: TypedArray, shape: readonly number[], strides: readonly number[], offset: number, dtype: DType);
21
22
  /**
22
23
  * Shape of the array
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Advanced indexing and data manipulation functions
3
+ *
4
+ * Tree-shakeable standalone functions that wrap the underlying ops.
5
+ */
6
+ import { NDArrayCore } from '../common/ndarray-core';
7
+ import * as advancedOps from '../common/ops/advanced';
8
+ /** Broadcast array to a new shape - returns a view */
9
+ export declare function broadcast_to(a: NDArrayCore, shape: number[]): NDArrayCore;
10
+ export declare function broadcast_arrays(...arrays: NDArrayCore[]): NDArrayCore[];
11
+ export declare function broadcast_shapes(...shapes: number[][]): number[];
12
+ export declare function take(a: NDArrayCore, indices: number[], axis?: number): NDArrayCore;
13
+ export declare function put(a: NDArrayCore, indices: number[], values: NDArrayCore | number[]): void;
14
+ export declare function take_along_axis(arr: NDArrayCore, indices: NDArrayCore, axis: number): NDArrayCore;
15
+ export declare function put_along_axis(arr: NDArrayCore, indices: NDArrayCore, values: NDArrayCore, axis: number): void;
16
+ export declare function choose(a: NDArrayCore, choices: NDArrayCore[]): NDArrayCore;
17
+ export declare function compress(condition: NDArrayCore, a: NDArrayCore, axis?: number): NDArrayCore;
18
+ /**
19
+ * Integer array indexing (fancy indexing)
20
+ *
21
+ * Select elements using an array of indices.
22
+ */
23
+ export declare function iindex(a: NDArrayCore, indices: NDArrayCore | number[] | number[][], axis?: number): NDArrayCore;
24
+ /**
25
+ * Boolean array indexing (fancy indexing with mask)
26
+ *
27
+ * Select elements where a boolean mask is true.
28
+ */
29
+ export declare function bindex(a: NDArrayCore, mask: NDArrayCore, axis?: number): NDArrayCore;
30
+ export declare function select(condlist: NDArrayCore[], choicelist: NDArrayCore[], defaultVal?: number): NDArrayCore;
31
+ export declare function place(a: NDArrayCore, mask: NDArrayCore, vals: NDArrayCore): void;
32
+ export declare function putmask(a: NDArrayCore, mask: NDArrayCore, values: NDArrayCore): void;
33
+ export declare function copyto(dst: NDArrayCore, src: NDArrayCore | number | bigint): void;
34
+ export declare function indices(dimensions: number[], dtype?: 'int32' | 'int64' | 'float64'): NDArrayCore;
35
+ export declare function ix_(...args: NDArrayCore[]): NDArrayCore[];
36
+ export declare function ravel_multi_index(multi_index: NDArrayCore[], dims: number[], mode?: 'raise' | 'wrap' | 'clip'): NDArrayCore;
37
+ export declare function unravel_index(indices: NDArrayCore | number, shape: number[]): NDArrayCore[];
38
+ export declare function diag_indices(n: number, ndim?: number): NDArrayCore[];
39
+ export declare function diag_indices_from(a: NDArrayCore): NDArrayCore[];
40
+ export declare function fill_diagonal(a: NDArrayCore, val: number, wrap?: boolean): void;
41
+ export declare function tril_indices(n: number, k?: number, m?: number): NDArrayCore[];
42
+ export declare function tril_indices_from(a: NDArrayCore, k?: number): NDArrayCore[];
43
+ export declare function triu_indices(n: number, k?: number, m?: number): NDArrayCore[];
44
+ export declare function triu_indices_from(a: NDArrayCore, k?: number): NDArrayCore[];
45
+ export declare function mask_indices(n: number, mask_func: (n: number, k: number) => NDArrayCore, k?: number): NDArrayCore[];
46
+ export declare function array_equal(a: NDArrayCore, b: NDArrayCore, equal_nan?: boolean): boolean;
47
+ export declare function array_equiv(a: NDArrayCore, b: NDArrayCore): boolean;
48
+ export declare function apply_along_axis(func1d: (arr: NDArrayCore) => NDArrayCore | number, axis: number, arr: NDArrayCore): NDArrayCore;
49
+ export declare function apply_over_axes(func: (arr: NDArrayCore, axis: number) => NDArrayCore, a: NDArrayCore, axes: number[]): NDArrayCore;
50
+ export declare function may_share_memory(a: NDArrayCore, b: NDArrayCore): boolean;
51
+ export declare function shares_memory(a: NDArrayCore, b: NDArrayCore): boolean;
52
+ export declare const geterr: typeof advancedOps.geterr;
53
+ export declare const seterr: typeof advancedOps.seterr;
54
+ //# sourceMappingURL=advanced.d.ts.map
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Arithmetic Functions - Tree-shakeable standalone functions
3
+ *
4
+ * This module provides arithmetic and mathematical functions that can be
5
+ * imported independently for optimal tree-shaking.
6
+ *
7
+ * Import from here for minimal bundle size:
8
+ * import { sqrt, exp, abs } from 'numpy-ts/functions/arithmetic';
9
+ *
10
+ * Or import from main entry point (also tree-shakeable):
11
+ * import { sqrt, exp, abs } from 'numpy-ts';
12
+ */
13
+ import { NDArrayCore } from './types';
14
+ /** Add arguments element-wise */
15
+ export declare function add(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
16
+ /** Subtract arguments element-wise */
17
+ export declare function subtract(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
18
+ /** Multiply arguments element-wise */
19
+ export declare function multiply(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
20
+ /** Square root of array elements */
21
+ export declare function sqrt(x: NDArrayCore): NDArrayCore;
22
+ /** Element-wise power */
23
+ export declare function power(x: NDArrayCore, exponent: NDArrayCore | number): NDArrayCore;
24
+ /** Alias for power */
25
+ export declare const pow: typeof power;
26
+ /** Exponential (e^x) */
27
+ export declare function exp(x: NDArrayCore): NDArrayCore;
28
+ /** 2^x */
29
+ export declare function exp2(x: NDArrayCore): NDArrayCore;
30
+ /** exp(x) - 1 */
31
+ export declare function expm1(x: NDArrayCore): NDArrayCore;
32
+ /** Natural logarithm */
33
+ export declare function log(x: NDArrayCore): NDArrayCore;
34
+ /** Base-2 logarithm */
35
+ export declare function log2(x: NDArrayCore): NDArrayCore;
36
+ /** Base-10 logarithm */
37
+ export declare function log10(x: NDArrayCore): NDArrayCore;
38
+ /** log(1 + x) */
39
+ export declare function log1p(x: NDArrayCore): NDArrayCore;
40
+ /** log(exp(x1) + exp(x2)) */
41
+ export declare function logaddexp(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
42
+ /** log2(2^x1 + 2^x2) */
43
+ export declare function logaddexp2(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
44
+ /** Absolute value */
45
+ export declare function absolute(x: NDArrayCore): NDArrayCore;
46
+ /** Alias for absolute */
47
+ export declare const abs: typeof absolute;
48
+ /** Numerical negative */
49
+ export declare function negative(x: NDArrayCore): NDArrayCore;
50
+ /** Element-wise sign */
51
+ export declare function sign(x: NDArrayCore): NDArrayCore;
52
+ /** Element-wise modulo */
53
+ export declare function mod(x: NDArrayCore, divisor: NDArrayCore | number): NDArrayCore;
54
+ /** Element-wise division */
55
+ export declare function divide(x: NDArrayCore, divisor: NDArrayCore | number): NDArrayCore;
56
+ /** Alias for divide */
57
+ export declare const true_divide: typeof divide;
58
+ /** Element-wise floor division */
59
+ export declare function floor_divide(x: NDArrayCore, divisor: NDArrayCore | number): NDArrayCore;
60
+ /** Numerical positive (returns copy) */
61
+ export declare function positive(x: NDArrayCore): NDArrayCore;
62
+ /** Reciprocal (1/x) */
63
+ export declare function reciprocal(x: NDArrayCore): NDArrayCore;
64
+ /** Cube root */
65
+ export declare function cbrt(x: NDArrayCore): NDArrayCore;
66
+ /** Absolute value (float) */
67
+ export declare function fabs(x: NDArrayCore): NDArrayCore;
68
+ /** Element-wise divmod (quotient and remainder) */
69
+ export declare function divmod(x: NDArrayCore, y: NDArrayCore | number): [NDArrayCore, NDArrayCore];
70
+ /** Element-wise square */
71
+ export declare function square(x: NDArrayCore): NDArrayCore;
72
+ /** Element-wise remainder */
73
+ export declare function remainder(x: NDArrayCore, y: NDArrayCore | number): NDArrayCore;
74
+ /** Heaviside step function */
75
+ export declare function heaviside(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
76
+ /** Float power (always returns float) */
77
+ export declare function float_power(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
78
+ /** C-style fmod */
79
+ export declare function fmod(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
80
+ /** Decompose into mantissa and exponent */
81
+ export declare function frexp(x: NDArrayCore): [NDArrayCore, NDArrayCore];
82
+ /** Greatest common divisor */
83
+ export declare function gcd(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
84
+ /** Least common multiple */
85
+ export declare function lcm(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
86
+ /** Compose from mantissa and exponent */
87
+ export declare function ldexp(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
88
+ /** Decompose into fractional and integer parts */
89
+ export declare function modf(x: NDArrayCore): [NDArrayCore, NDArrayCore];
90
+ /** Clip values to a range */
91
+ export declare function clip(a: NDArrayCore, a_min: NDArrayCore | number | null, a_max: NDArrayCore | number | null): NDArrayCore;
92
+ /** Element-wise maximum */
93
+ export declare function maximum(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
94
+ /** Element-wise minimum */
95
+ export declare function minimum(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
96
+ /** Element-wise maximum (ignores NaN) */
97
+ export declare function fmax(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
98
+ /** Element-wise minimum (ignores NaN) */
99
+ export declare function fmin(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
100
+ /** Replace NaN/Inf with numbers */
101
+ export declare function nan_to_num(x: NDArrayCore, nan?: number, posinf?: number, neginf?: number): NDArrayCore;
102
+ /** 1D linear interpolation */
103
+ export declare function interp(x: NDArrayCore, xp: NDArrayCore, fp: NDArrayCore, left?: number, right?: number): NDArrayCore;
104
+ /** Unwrap phase angles */
105
+ export declare function unwrap(p: NDArrayCore, discont?: number, axis?: number, period?: number): NDArrayCore;
106
+ /** Sinc function */
107
+ export declare function sinc(x: NDArrayCore): NDArrayCore;
108
+ /** Modified Bessel function of the first kind, order 0 */
109
+ export declare function i0(x: NDArrayCore): NDArrayCore;
110
+ //# sourceMappingURL=arithmetic.d.ts.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Bitwise Functions - Tree-shakeable standalone functions
3
+ *
4
+ * This module provides bitwise operations that can be
5
+ * imported independently for optimal tree-shaking.
6
+ */
7
+ import { NDArrayCore } from './types';
8
+ /** Bitwise AND */
9
+ export declare function bitwise_and(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
10
+ /** Bitwise OR */
11
+ export declare function bitwise_or(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
12
+ /** Bitwise XOR */
13
+ export declare function bitwise_xor(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
14
+ /** Bitwise NOT */
15
+ export declare function bitwise_not(x: NDArrayCore): NDArrayCore;
16
+ /** Bitwise inversion (alias for bitwise_not) */
17
+ export declare function invert(x: NDArrayCore): NDArrayCore;
18
+ /** Left shift */
19
+ export declare function left_shift(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
20
+ /** Right shift */
21
+ export declare function right_shift(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
22
+ /** Pack bits into bytes */
23
+ export declare function packbits(a: NDArrayCore, axis?: number, bitorder?: 'big' | 'little'): NDArrayCore;
24
+ /** Unpack bytes into bits */
25
+ export declare function unpackbits(a: NDArrayCore, axis?: number, count?: number, bitorder?: 'big' | 'little'): NDArrayCore;
26
+ /** Count number of 1 bits */
27
+ export declare function bitwise_count(x: NDArrayCore): NDArrayCore;
28
+ /** Alias for bitwise_not */
29
+ export declare function bitwise_invert(x: NDArrayCore): NDArrayCore;
30
+ /** Alias for left_shift */
31
+ export declare function bitwise_left_shift(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
32
+ /** Alias for right_shift */
33
+ export declare function bitwise_right_shift(x1: NDArrayCore, x2: NDArrayCore | number): NDArrayCore;
34
+ //# sourceMappingURL=bitwise.d.ts.map
@@ -1,94 +1,19 @@
1
1
  /**
2
- * Complex number class for numpy-ts
2
+ * Complex Number Functions - Tree-shakeable standalone functions
3
3
  *
4
- * Represents complex numbers in JavaScript, similar to Python's complex type.
5
- * Used when converting complex arrays to JavaScript values via toArray().
4
+ * This module provides complex number operations that can be
5
+ * imported independently for optimal tree-shaking.
6
6
  */
7
- /**
8
- * Represents a complex number with real and imaginary parts.
9
- *
10
- * @example
11
- * ```typescript
12
- * const z = new Complex(1, 2); // 1 + 2i
13
- * console.log(z.re); // 1
14
- * console.log(z.im); // 2
15
- * console.log(z.toString()); // "(1+2j)"
16
- * ```
17
- */
18
- export declare class Complex {
19
- /** Real part */
20
- readonly re: number;
21
- /** Imaginary part */
22
- readonly im: number;
23
- constructor(re: number, im?: number);
24
- /**
25
- * Returns the magnitude (absolute value) of the complex number.
26
- * |z| = sqrt(re² + im²)
27
- */
28
- abs(): number;
29
- /**
30
- * Returns the phase angle (argument) of the complex number in radians.
31
- * arg(z) = atan2(im, re)
32
- */
33
- angle(): number;
34
- /**
35
- * Returns the complex conjugate.
36
- * conj(a + bi) = a - bi
37
- */
38
- conj(): Complex;
39
- /**
40
- * Add another complex number or real number.
41
- */
42
- add(other: Complex | number): Complex;
43
- /**
44
- * Subtract another complex number or real number.
45
- */
46
- sub(other: Complex | number): Complex;
47
- /**
48
- * Multiply by another complex number or real number.
49
- * (a + bi)(c + di) = (ac - bd) + (ad + bc)i
50
- */
51
- mul(other: Complex | number): Complex;
52
- /**
53
- * Divide by another complex number or real number.
54
- * (a + bi) / (c + di) = ((ac + bd) + (bc - ad)i) / (c² + d²)
55
- */
56
- div(other: Complex | number): Complex;
57
- /**
58
- * Returns the negation of this complex number.
59
- */
60
- neg(): Complex;
61
- /**
62
- * Check equality with another complex number.
63
- */
64
- equals(other: Complex): boolean;
65
- /**
66
- * String representation matching NumPy/Python format: "(a+bj)"
67
- */
68
- toString(): string;
69
- /**
70
- * Create a Complex from various input formats.
71
- * Accepts:
72
- * - Complex instance
73
- * - {re, im} object
74
- * - [re, im] array
75
- * - number (creates re + 0i)
76
- */
77
- static from(value: ComplexInput): Complex;
78
- /**
79
- * Check if a value is a complex number representation.
80
- */
81
- static isComplex(value: unknown): value is ComplexInput;
82
- }
83
- /**
84
- * Input types that can be converted to Complex.
85
- */
86
- export type ComplexInput = Complex | {
87
- re: number;
88
- im?: number;
89
- } | [number, number] | number;
90
- /**
91
- * Helper to check if a value looks like a complex number input.
92
- */
93
- export declare function isComplexLike(value: unknown): value is ComplexInput;
7
+ import { NDArrayCore } from './types';
8
+ export { Complex } from '../common/complex';
9
+ /** Extract real part of array */
10
+ export declare function real(x: NDArrayCore): NDArrayCore;
11
+ /** Extract imaginary part of array */
12
+ export declare function imag(x: NDArrayCore): NDArrayCore;
13
+ /** Complex conjugate */
14
+ export declare function conj(x: NDArrayCore): NDArrayCore;
15
+ /** Alias for conj */
16
+ export declare const conjugate: typeof conj;
17
+ /** Phase angle */
18
+ export declare function angle(x: NDArrayCore, deg?: boolean): NDArrayCore;
94
19
  //# sourceMappingURL=complex.d.ts.map
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Array Creation Functions - Tree-shakeable standalone module
3
+ *
4
+ * This module provides all array creation functions including:
5
+ * - Basic: zeros, ones, empty, full, array, arange, linspace, etc.
6
+ * - Advanced: diag, tri, meshgrid, vander, etc.
7
+ *
8
+ * All functions return NDArrayCore for optimal tree-shaking.
9
+ */
10
+ import { NDArrayCore, type DType } from '../common/ndarray-core';
11
+ import { type TypedArray } from '../common/dtype';
12
+ export type { DType, TypedArray } from '../common/dtype';
13
+ /**
14
+ * Create array of zeros
15
+ */
16
+ export declare function zeros(shape: number[], dtype?: DType): NDArrayCore;
17
+ /**
18
+ * Create array of ones
19
+ */
20
+ export declare function ones(shape: number[], dtype?: DType): NDArrayCore;
21
+ /**
22
+ * Create an uninitialized array (zeros in JS)
23
+ */
24
+ export declare function empty(shape: number[], dtype?: DType): NDArrayCore;
25
+ /**
26
+ * Create array filled with a constant value
27
+ */
28
+ export declare function full(shape: number[], fill_value: number | bigint | boolean, dtype?: DType): NDArrayCore;
29
+ /**
30
+ * Create array from nested JavaScript arrays
31
+ */
32
+ export declare function array(data: unknown, dtype?: DType): NDArrayCore;
33
+ /**
34
+ * Create array with evenly spaced values within a given interval
35
+ */
36
+ export declare function arange(start: number, stop?: number, step?: number, dtype?: DType): NDArrayCore;
37
+ /**
38
+ * Create array with evenly spaced values over a specified interval
39
+ */
40
+ export declare function linspace(start: number, stop: number, num?: number, dtype?: DType): NDArrayCore;
41
+ /**
42
+ * Create array with logarithmically spaced values
43
+ */
44
+ export declare function logspace(start: number, stop: number, num?: number, base?: number, dtype?: DType): NDArrayCore;
45
+ /**
46
+ * Create array with geometrically spaced values
47
+ */
48
+ export declare function geomspace(start: number, stop: number, num?: number, dtype?: DType): NDArrayCore;
49
+ /**
50
+ * Create identity matrix
51
+ */
52
+ export declare function eye(n: number, m?: number, k?: number, dtype?: DType): NDArrayCore;
53
+ /**
54
+ * Create a square identity matrix
55
+ */
56
+ export declare function identity(n: number, dtype?: DType): NDArrayCore;
57
+ /**
58
+ * Convert input to an ndarray
59
+ */
60
+ export declare function asarray(a: NDArrayCore | unknown, dtype?: DType): NDArrayCore;
61
+ /**
62
+ * Return array of zeros with the same shape and dtype as input
63
+ */
64
+ export declare function zeros_like(a: NDArrayCore, dtype?: DType): NDArrayCore;
65
+ /**
66
+ * Return array of ones with the same shape and dtype as input
67
+ */
68
+ export declare function ones_like(a: NDArrayCore, dtype?: DType): NDArrayCore;
69
+ /**
70
+ * Return empty array with the same shape and dtype as input
71
+ */
72
+ export declare function empty_like(a: NDArrayCore, dtype?: DType): NDArrayCore;
73
+ /**
74
+ * Return array filled with value, same shape and dtype as input
75
+ */
76
+ export declare function full_like(a: NDArrayCore, fill_value: number | bigint | boolean, dtype?: DType): NDArrayCore;
77
+ /**
78
+ * Deep copy of array
79
+ */
80
+ export declare function copy(a: NDArrayCore): NDArrayCore;
81
+ export declare function asanyarray(a: NDArrayCore | unknown, dtype?: DType): NDArrayCore;
82
+ export declare function ascontiguousarray(a: NDArrayCore | unknown, dtype?: DType): NDArrayCore;
83
+ export declare function asfortranarray(a: NDArrayCore | unknown, dtype?: DType): NDArrayCore;
84
+ export declare function asarray_chkfinite(a: NDArrayCore | unknown, dtype?: DType): NDArrayCore;
85
+ export declare function require(a: NDArrayCore, dtype?: DType, _requirements?: string | string[]): NDArrayCore;
86
+ export declare function diag(v: NDArrayCore, k?: number): NDArrayCore;
87
+ export declare function diagflat(v: NDArrayCore, k?: number): NDArrayCore;
88
+ export declare function tri(N: number, M?: number, k?: number, dtype?: DType): NDArrayCore;
89
+ export declare function tril(m: NDArrayCore, k?: number): NDArrayCore;
90
+ export declare function triu(m: NDArrayCore, k?: number): NDArrayCore;
91
+ export declare function vander(x: NDArrayCore, N?: number, increasing?: boolean): NDArrayCore;
92
+ export declare function frombuffer(buffer: ArrayBuffer | TypedArray, dtype?: DType, count?: number, offset?: number): NDArrayCore;
93
+ export declare function fromfunction(func: (...indices: number[]) => number, shape: number[], dtype?: DType): NDArrayCore;
94
+ export declare function fromiter(iter: Iterable<number>, dtype?: DType, count?: number): NDArrayCore;
95
+ export declare function fromstring(string: string, dtype?: DType, count?: number, sep?: string): NDArrayCore;
96
+ export declare function fromfile(_file: string, _dtype?: DType, _count?: number, _sep?: string): NDArrayCore;
97
+ export declare function meshgrid(...arrays: NDArrayCore[]): NDArrayCore[];
98
+ //# sourceMappingURL=creation.d.ts.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Formatting and printing functions
3
+ *
4
+ * Tree-shakeable standalone functions that wrap the underlying ops.
5
+ */
6
+ import { NDArrayCore } from '../common/ndarray-core';
7
+ import * as formattingOps from '../common/ops/formatting';
8
+ export declare const set_printoptions: typeof formattingOps.set_printoptions;
9
+ export declare const get_printoptions: typeof formattingOps.get_printoptions;
10
+ export declare const printoptions: typeof formattingOps.printoptions;
11
+ export declare const format_float_positional: typeof formattingOps.format_float_positional;
12
+ export declare const format_float_scientific: typeof formattingOps.format_float_scientific;
13
+ export declare const base_repr: typeof formattingOps.base_repr;
14
+ export declare const binary_repr: typeof formattingOps.binary_repr;
15
+ export declare function array2string(a: NDArrayCore, options?: {
16
+ max_line_width?: number;
17
+ precision?: number;
18
+ suppress_small?: boolean;
19
+ separator?: string;
20
+ prefix?: string;
21
+ suffix?: string;
22
+ threshold?: number;
23
+ edgeitems?: number;
24
+ sign?: ' ' | '+' | '-';
25
+ floatmode?: 'fixed' | 'unique' | 'maxprec' | 'maxprec_equal';
26
+ }): string;
27
+ export declare function array_repr(a: NDArrayCore, max_line_width?: number, precision?: number, suppress_small?: boolean): string;
28
+ export declare function array_str(a: NDArrayCore, max_line_width?: number, precision?: number): string;
29
+ //# sourceMappingURL=formatting.d.ts.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Gradient and Differentiation Functions - Tree-shakeable standalone functions
3
+ *
4
+ * This module provides differentiation operations that can be
5
+ * imported independently for optimal tree-shaking.
6
+ */
7
+ import { NDArrayCore } from './types';
8
+ /** Calculate n-th discrete difference */
9
+ export declare function diff(a: NDArrayCore, n?: number, axis?: number): NDArrayCore;
10
+ /** Difference between consecutive elements in 1D array */
11
+ export declare function ediff1d(a: NDArrayCore, to_end?: number[] | null, to_begin?: number[] | null): NDArrayCore;
12
+ /** Return gradient of N-dimensional array */
13
+ export declare function gradient(f: NDArrayCore, varargs?: number | number[], axis?: number | number[] | null): NDArrayCore | NDArrayCore[];
14
+ //# sourceMappingURL=gradient.d.ts.map
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Core Module - Tree-shakeable standalone functions
3
+ *
4
+ * This module re-exports all standalone functions from the various
5
+ * function modules. All functions return NDArrayCore for optimal tree-shaking.
6
+ *
7
+ * For optimal tree-shaking, you can also import from specific submodules:
8
+ * import { sin, cos } from 'numpy-ts/core/trig';
9
+ * import { dot, inv } from 'numpy-ts/core/linalg';
10
+ */
11
+ export type { DType, TypedArray } from './types';
12
+ export { NDArrayCore, Complex, ArrayStorage } from './types';
13
+ export { zeros, ones, empty, full, array, arange, linspace, logspace, geomspace, eye, identity, asarray, zeros_like, ones_like, empty_like, full_like, copy, asanyarray, ascontiguousarray, asfortranarray, asarray_chkfinite, require, diag, diagflat, tri, tril, triu, vander, frombuffer, fromfunction, fromiter, fromstring, fromfile, meshgrid, } from './creation';
14
+ export { add, subtract, multiply, sqrt, power, pow, exp, exp2, expm1, log, log2, log10, log1p, logaddexp, logaddexp2, absolute, abs, negative, sign, mod, divide, true_divide, floor_divide, positive, reciprocal, cbrt, fabs, divmod, square, remainder, heaviside, float_power, fmod, frexp, gcd, lcm, ldexp, modf, clip, maximum, minimum, fmax, fmin, nan_to_num, interp, unwrap, sinc, i0, } from './arithmetic';
15
+ export { sin, cos, tan, arcsin, asin, arccos, acos, arctan, atan, arctan2, atan2, hypot, degrees, radians, deg2rad, rad2deg, sinh, cosh, tanh, arcsinh, asinh, arccosh, acosh, arctanh, atanh, } from './trig';
16
+ export { dot, matmul, trace, diagonal, kron, transpose, inner, outer, tensordot, einsum, einsum_path, vdot, vecdot, matrix_transpose, permute_dims, matvec, vecmat, cross, linalg, } from './linalg';
17
+ export { reshape, flatten, ravel, squeeze, expand_dims, swapaxes, moveaxis, rollaxis, concatenate, stack, vstack, hstack, dstack, concat, column_stack, row_stack, block, split, array_split, vsplit, hsplit, dsplit, unstack, tile, repeat, flip, fliplr, flipud, rot90, roll, resize, atleast_1d, atleast_2d, atleast_3d, } from './shape';
18
+ export { sum, mean, prod, max, amax, min, amin, ptp, argmin, argmax, variance, var_, variance as var, std, median, percentile, quantile, average, all, any, cumsum, cumulative_sum, cumprod, cumulative_prod, nansum, nanprod, nanmean, nanvar, nanstd, nanmin, nanmax, nanargmin, nanargmax, nancumsum, nancumprod, nanmedian, nanquantile, nanpercentile, } from './reduction';
19
+ export { logical_and, logical_or, logical_not, logical_xor, isfinite, isinf, isnan, isnat, isneginf, isposinf, iscomplex, iscomplexobj, isreal, isrealobj, real_if_close, isfortran, isscalar, iterable, isdtype, promote_types, copysign, signbit, nextafter, spacing, greater, greater_equal, less, less_equal, equal, not_equal, isclose, allclose, } from './logic';
20
+ export { sort, argsort, lexsort, partition, argpartition, sort_complex, nonzero, argwhere, flatnonzero, where, searchsorted, extract, count_nonzero, } from './sorting';
21
+ export { bitwise_and, bitwise_or, bitwise_xor, bitwise_not, invert, left_shift, right_shift, packbits, unpackbits, bitwise_count, bitwise_invert, bitwise_left_shift, bitwise_right_shift, } from './bitwise';
22
+ export { around, round_, round, ceil, fix, floor, rint, trunc } from './rounding';
23
+ export { unique, in1d, intersect1d, isin, setdiff1d, setxor1d, union1d, trim_zeros, unique_all, unique_counts, unique_inverse, unique_values, } from './sets';
24
+ export { bincount, digitize, histogram, histogram2d, histogramdd, correlate, convolve, cov, corrcoef, histogram_bin_edges, trapezoid, } from './statistics';
25
+ export { diff, ediff1d, gradient } from './gradient';
26
+ export { real, imag, conj, conjugate, angle } from './complex';
27
+ export { broadcast_to, broadcast_arrays, broadcast_shapes, take, put, take_along_axis, put_along_axis, choose, compress, select, place, putmask, copyto, indices, ix_, ravel_multi_index, unravel_index, diag_indices, diag_indices_from, fill_diagonal, tril_indices, tril_indices_from, triu_indices, triu_indices_from, mask_indices, array_equal, array_equiv, apply_along_axis, apply_over_axes, may_share_memory, shares_memory, geterr, seterr, iindex, bindex, } from './advanced';
28
+ export { set_printoptions, get_printoptions, printoptions, format_float_positional, format_float_scientific, base_repr, binary_repr, array2string, array_repr, array_str, } from './formatting';
29
+ export { ndim, shape, size, item, tolist, tobytes, byteswap, view, tofile, fill } from './utility';
30
+ export { append, delete_, delete_ as delete, insert, pad } from './shape-extra';
31
+ export { can_cast, common_type, result_type, min_scalar_type, issubdtype, typename, mintypecode, } from './typechecking';
32
+ export { poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub, polyval, roots, } from './polynomial';
33
+ export { parseNpy, parseNpyHeader, parseNpyData } from '../io/npy/parser';
34
+ export { serializeNpy } from '../io/npy/serializer';
35
+ export { UnsupportedDTypeError, InvalidNpyError, SUPPORTED_DTYPES, DTYPE_TO_DESCR, type NpyHeader, type NpyMetadata, type NpyVersion, } from '../io/npy/format';
36
+ export { parseNpz, parseNpzSync, loadNpz, loadNpzSync, type NpzParseOptions, type NpzParseResult, } from '../io/npz/parser';
37
+ export { serializeNpz, serializeNpzSync, type NpzArraysInput, type NpzSerializeOptions, } from '../io/npz/serializer';
38
+ export { parseTxt, genfromtxt, fromregex, type ParseTxtOptions } from '../io/txt/parser';
39
+ export { serializeTxt, type SerializeTxtOptions } from '../io/txt/serializer';
40
+ //# sourceMappingURL=index.d.ts.map