numpy-ts 0.5.0 → 0.7.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.
- package/README.md +36 -38
- package/dist/numpy-ts.browser.js +2 -2
- package/dist/numpy-ts.esm.js +2 -2
- package/dist/numpy-ts.node-io.cjs +2 -2
- package/dist/numpy-ts.node-io.cjs.map +4 -4
- package/dist/numpy-ts.node-io.mjs +2 -2
- package/dist/numpy-ts.node-io.mjs.map +4 -4
- package/dist/numpy-ts.node.cjs +2 -2
- package/dist/numpy-ts.node.cjs.map +4 -4
- package/dist/types/core/broadcasting.d.ts +18 -0
- package/dist/types/core/ndarray.d.ts +989 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/ops/advanced.d.ts +74 -0
- package/dist/types/ops/arithmetic.d.ts +54 -0
- package/dist/types/ops/bitwise.d.ts +91 -0
- package/dist/types/ops/comparison.d.ts +12 -0
- package/dist/types/ops/linalg.d.ts +51 -0
- package/dist/types/ops/reduction.d.ts +76 -0
- package/dist/types/ops/shape.d.ts +44 -0
- package/dist/types/ops/trig.d.ts +16 -0
- package/package.json +5 -4
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module numpy-ts
|
|
5
5
|
*/
|
|
6
|
-
export { NDArray, zeros, ones, array, arange, linspace, logspace, geomspace, eye, empty, full, identity, asarray, copy, zeros_like, ones_like, empty_like, full_like, sqrt, power, absolute, negative, sign, mod, floor_divide, positive, reciprocal, dot, trace, transpose, inner, outer, tensordot, sin, cos, tan, arcsin, arccos, arctan, arctan2, hypot, degrees, radians, sinh, cosh, tanh, arcsinh, arccosh, arctanh, swapaxes, moveaxis, concatenate, stack, vstack, hstack, dstack, split, array_split, vsplit, hsplit, tile, repeat, broadcast_to, broadcast_arrays, take, put, choose, array_equal, } from './core/ndarray';
|
|
6
|
+
export { NDArray, zeros, ones, array, arange, linspace, logspace, geomspace, eye, empty, full, identity, asarray, copy, zeros_like, ones_like, empty_like, full_like, asanyarray, ascontiguousarray, asfortranarray, diag, diagflat, frombuffer, fromfile, fromfunction, fromiter, fromstring, meshgrid, tri, tril, triu, vander, sqrt, power, absolute, negative, sign, mod, floor_divide, positive, reciprocal, cbrt, fabs, divmod, square, remainder, heaviside, dot, trace, diagonal, kron, transpose, inner, outer, tensordot, einsum, sin, cos, tan, arcsin, arccos, arctan, arctan2, hypot, degrees, radians, deg2rad, rad2deg, sinh, cosh, tanh, arcsinh, arccosh, arctanh, swapaxes, moveaxis, concatenate, stack, vstack, hstack, dstack, split, array_split, vsplit, hsplit, tile, repeat, ravel, reshape, squeeze, expand_dims, flip, fliplr, flipud, rot90, roll, rollaxis, atleast_1d, atleast_2d, atleast_3d, dsplit, column_stack, row_stack, resize, append, delete_ as delete, insert, pad, broadcast_to, broadcast_arrays, broadcast_shapes, take, put, choose, array_equal, array_equiv, take_along_axis, put_along_axis, putmask, compress, select, place, diag_indices, diag_indices_from, tril_indices, tril_indices_from, triu_indices, triu_indices_from, mask_indices, indices, ix_, ravel_multi_index, unravel_index, cumsum, cumprod, ptp, median, percentile, quantile, average, nansum, nanprod, nanmean, nanvar, nanstd, nanmin, nanmax, nanargmin, nanargmax, nancumsum, nancumprod, nanmedian, bitwise_and, bitwise_or, bitwise_xor, bitwise_not, invert, left_shift, right_shift, packbits, unpackbits, } from './core/ndarray';
|
|
7
7
|
export { parseNpy, serializeNpy, parseNpyHeader, parseNpyData, UnsupportedDTypeError, InvalidNpyError, SUPPORTED_DTYPES, DTYPE_TO_DESCR, type NpyHeader, type NpyMetadata, type NpyVersion, parseNpz, parseNpzSync, loadNpz, loadNpzSync, serializeNpz, serializeNpzSync, type NpzParseOptions, type NpzParseResult, type NpzSerializeOptions, } from './io';
|
|
8
8
|
export declare const __version__: string;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @module ops/advanced
|
|
6
6
|
*/
|
|
7
7
|
import { ArrayStorage } from '../core/storage';
|
|
8
|
+
import { broadcastShapes } from '../core/broadcasting';
|
|
8
9
|
/**
|
|
9
10
|
* Broadcast an array to a given shape
|
|
10
11
|
* Returns a read-only view on the original array
|
|
@@ -15,6 +16,11 @@ export declare function broadcast_to(storage: ArrayStorage, targetShape: number[
|
|
|
15
16
|
* Returns views on the original arrays
|
|
16
17
|
*/
|
|
17
18
|
export declare function broadcast_arrays(storages: ArrayStorage[]): ArrayStorage[];
|
|
19
|
+
/**
|
|
20
|
+
* Compute the broadcast shape for multiple shapes
|
|
21
|
+
* Re-export from core/broadcasting for convenience
|
|
22
|
+
*/
|
|
23
|
+
export { broadcastShapes as broadcast_shapes };
|
|
18
24
|
/**
|
|
19
25
|
* Take elements from an array along an axis
|
|
20
26
|
*/
|
|
@@ -31,4 +37,72 @@ export declare function choose(indexStorage: ArrayStorage, choices: ArrayStorage
|
|
|
31
37
|
* Check if two arrays are element-wise equal
|
|
32
38
|
*/
|
|
33
39
|
export declare function array_equal(a: ArrayStorage, b: ArrayStorage, equal_nan?: boolean): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Take values along an axis using 1D index array
|
|
42
|
+
*/
|
|
43
|
+
export declare function take_along_axis(storage: ArrayStorage, indices: ArrayStorage, axis: number): ArrayStorage;
|
|
44
|
+
/**
|
|
45
|
+
* Put values into array along an axis using 1D index array
|
|
46
|
+
*/
|
|
47
|
+
export declare function put_along_axis(storage: ArrayStorage, indices: ArrayStorage, values: ArrayStorage, axis: number): void;
|
|
48
|
+
/**
|
|
49
|
+
* Change elements of array based on conditional mask
|
|
50
|
+
*/
|
|
51
|
+
export declare function putmask(storage: ArrayStorage, mask: ArrayStorage, values: ArrayStorage | number | bigint): void;
|
|
52
|
+
/**
|
|
53
|
+
* Return selected slices along given axis based on condition
|
|
54
|
+
*/
|
|
55
|
+
export declare function compress(condition: ArrayStorage, storage: ArrayStorage, axis?: number): ArrayStorage;
|
|
56
|
+
/**
|
|
57
|
+
* Return array drawn from elements in choicelist, depending on conditions
|
|
58
|
+
*/
|
|
59
|
+
export declare function select(condlist: ArrayStorage[], choicelist: ArrayStorage[], defaultValue?: number | bigint): ArrayStorage;
|
|
60
|
+
/**
|
|
61
|
+
* Change elements of array based on conditional and input values
|
|
62
|
+
*/
|
|
63
|
+
export declare function place(storage: ArrayStorage, mask: ArrayStorage, vals: ArrayStorage): void;
|
|
64
|
+
/**
|
|
65
|
+
* Return indices to access main diagonal of array
|
|
66
|
+
*/
|
|
67
|
+
export declare function diag_indices(n: number, ndim?: number): ArrayStorage[];
|
|
68
|
+
/**
|
|
69
|
+
* Return indices to access main diagonal of array from given array
|
|
70
|
+
*/
|
|
71
|
+
export declare function diag_indices_from(storage: ArrayStorage): ArrayStorage[];
|
|
72
|
+
/**
|
|
73
|
+
* Return indices for lower-triangle of an (n, m) array
|
|
74
|
+
*/
|
|
75
|
+
export declare function tril_indices(n: number, k?: number, m?: number): ArrayStorage[];
|
|
76
|
+
/**
|
|
77
|
+
* Return indices for lower-triangle of given array
|
|
78
|
+
*/
|
|
79
|
+
export declare function tril_indices_from(storage: ArrayStorage, k?: number): ArrayStorage[];
|
|
80
|
+
/**
|
|
81
|
+
* Return indices for upper-triangle of an (n, m) array
|
|
82
|
+
*/
|
|
83
|
+
export declare function triu_indices(n: number, k?: number, m?: number): ArrayStorage[];
|
|
84
|
+
/**
|
|
85
|
+
* Return indices for upper-triangle of given array
|
|
86
|
+
*/
|
|
87
|
+
export declare function triu_indices_from(storage: ArrayStorage, k?: number): ArrayStorage[];
|
|
88
|
+
/**
|
|
89
|
+
* Return indices to access elements using mask function
|
|
90
|
+
*/
|
|
91
|
+
export declare function mask_indices(n: number, mask_func: (n: number, k: number) => ArrayStorage, k?: number): ArrayStorage[];
|
|
92
|
+
/**
|
|
93
|
+
* Return array representing indices of a grid
|
|
94
|
+
*/
|
|
95
|
+
export declare function indices(dimensions: number[], dtype?: 'int32' | 'int64' | 'float64'): ArrayStorage;
|
|
96
|
+
/**
|
|
97
|
+
* Construct open mesh from multiple sequences
|
|
98
|
+
*/
|
|
99
|
+
export declare function ix_(...args: ArrayStorage[]): ArrayStorage[];
|
|
100
|
+
/**
|
|
101
|
+
* Convert multi-dimensional index arrays to flat index array
|
|
102
|
+
*/
|
|
103
|
+
export declare function ravel_multi_index(multi_index: ArrayStorage[], dims: number[], mode?: 'raise' | 'wrap' | 'clip'): ArrayStorage;
|
|
104
|
+
/**
|
|
105
|
+
* Convert flat index array to tuple of coordinate arrays
|
|
106
|
+
*/
|
|
107
|
+
export declare function unravel_index(indices: ArrayStorage | number, shape: number[], order?: 'C' | 'F'): ArrayStorage[];
|
|
34
108
|
//# sourceMappingURL=advanced.d.ts.map
|
|
@@ -105,4 +105,58 @@ export declare function positive(a: ArrayStorage): ArrayStorage;
|
|
|
105
105
|
* @returns Result storage with reciprocal values
|
|
106
106
|
*/
|
|
107
107
|
export declare function reciprocal(a: ArrayStorage): ArrayStorage;
|
|
108
|
+
/**
|
|
109
|
+
* Cube root of each element
|
|
110
|
+
* NumPy behavior: Promotes integer types to float64
|
|
111
|
+
*
|
|
112
|
+
* @param a - Input array storage
|
|
113
|
+
* @returns Result storage with cube root values
|
|
114
|
+
*/
|
|
115
|
+
export declare function cbrt(a: ArrayStorage): ArrayStorage;
|
|
116
|
+
/**
|
|
117
|
+
* Absolute value of each element, returning float
|
|
118
|
+
* NumPy behavior: fabs always returns floating point
|
|
119
|
+
*
|
|
120
|
+
* @param a - Input array storage
|
|
121
|
+
* @returns Result storage with absolute values as float
|
|
122
|
+
*/
|
|
123
|
+
export declare function fabs(a: ArrayStorage): ArrayStorage;
|
|
124
|
+
/**
|
|
125
|
+
* Returns both quotient and remainder (floor divide and modulo)
|
|
126
|
+
* NumPy behavior: divmod(a, b) = (floor_divide(a, b), mod(a, b))
|
|
127
|
+
*
|
|
128
|
+
* @param a - Dividend array storage
|
|
129
|
+
* @param b - Divisor (array storage or scalar)
|
|
130
|
+
* @returns Tuple of [quotient, remainder] storages
|
|
131
|
+
*/
|
|
132
|
+
export declare function divmod(a: ArrayStorage, b: ArrayStorage | number): [ArrayStorage, ArrayStorage];
|
|
133
|
+
/**
|
|
134
|
+
* Element-wise square of each element
|
|
135
|
+
* NumPy behavior: x**2
|
|
136
|
+
*
|
|
137
|
+
* @param a - Input array storage
|
|
138
|
+
* @returns Result storage with squared values
|
|
139
|
+
*/
|
|
140
|
+
export declare function square(a: ArrayStorage): ArrayStorage;
|
|
141
|
+
/**
|
|
142
|
+
* Remainder of division (same as mod)
|
|
143
|
+
* NumPy behavior: Same as mod, alias for compatibility
|
|
144
|
+
*
|
|
145
|
+
* @param a - Dividend array storage
|
|
146
|
+
* @param b - Divisor (array storage or scalar)
|
|
147
|
+
* @returns Result storage with remainder values
|
|
148
|
+
*/
|
|
149
|
+
export declare function remainder(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
150
|
+
/**
|
|
151
|
+
* Heaviside step function
|
|
152
|
+
* NumPy behavior:
|
|
153
|
+
* heaviside(x1, x2) = 0 if x1 < 0
|
|
154
|
+
* = x2 if x1 == 0
|
|
155
|
+
* = 1 if x1 > 0
|
|
156
|
+
*
|
|
157
|
+
* @param x1 - Input array storage
|
|
158
|
+
* @param x2 - Value to use when x1 == 0 (array storage or scalar)
|
|
159
|
+
* @returns Result storage with heaviside values
|
|
160
|
+
*/
|
|
161
|
+
export declare function heaviside(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
|
|
108
162
|
//# sourceMappingURL=arithmetic.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitwise operations
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for element-wise bitwise operations:
|
|
5
|
+
* bitwise_and, bitwise_or, bitwise_xor, bitwise_not, invert,
|
|
6
|
+
* left_shift, right_shift, packbits, unpackbits
|
|
7
|
+
*
|
|
8
|
+
* These operations only work on integer types.
|
|
9
|
+
*/
|
|
10
|
+
import { ArrayStorage } from '../core/storage';
|
|
11
|
+
/**
|
|
12
|
+
* Bitwise AND of two arrays or array and scalar
|
|
13
|
+
*
|
|
14
|
+
* @param a - First array storage (must be integer type)
|
|
15
|
+
* @param b - Second array storage or scalar (must be integer type)
|
|
16
|
+
* @returns Result storage
|
|
17
|
+
*/
|
|
18
|
+
export declare function bitwise_and(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
19
|
+
/**
|
|
20
|
+
* Bitwise OR of two arrays or array and scalar
|
|
21
|
+
*
|
|
22
|
+
* @param a - First array storage (must be integer type)
|
|
23
|
+
* @param b - Second array storage or scalar (must be integer type)
|
|
24
|
+
* @returns Result storage
|
|
25
|
+
*/
|
|
26
|
+
export declare function bitwise_or(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
27
|
+
/**
|
|
28
|
+
* Bitwise XOR of two arrays or array and scalar
|
|
29
|
+
*
|
|
30
|
+
* @param a - First array storage (must be integer type)
|
|
31
|
+
* @param b - Second array storage or scalar (must be integer type)
|
|
32
|
+
* @returns Result storage
|
|
33
|
+
*/
|
|
34
|
+
export declare function bitwise_xor(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
35
|
+
/**
|
|
36
|
+
* Bitwise NOT (invert) of each element
|
|
37
|
+
*
|
|
38
|
+
* @param a - Input array storage (must be integer type)
|
|
39
|
+
* @returns Result storage with bitwise NOT values
|
|
40
|
+
*/
|
|
41
|
+
export declare function bitwise_not(a: ArrayStorage): ArrayStorage;
|
|
42
|
+
/**
|
|
43
|
+
* Invert (bitwise NOT) - alias for bitwise_not
|
|
44
|
+
*
|
|
45
|
+
* @param a - Input array storage (must be integer type)
|
|
46
|
+
* @returns Result storage with inverted values
|
|
47
|
+
*/
|
|
48
|
+
export declare function invert(a: ArrayStorage): ArrayStorage;
|
|
49
|
+
/**
|
|
50
|
+
* Left shift of array elements
|
|
51
|
+
*
|
|
52
|
+
* @param a - Input array storage (must be integer type)
|
|
53
|
+
* @param b - Shift amount (array storage or scalar)
|
|
54
|
+
* @returns Result storage with left-shifted values
|
|
55
|
+
*/
|
|
56
|
+
export declare function left_shift(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
57
|
+
/**
|
|
58
|
+
* Right shift of array elements
|
|
59
|
+
*
|
|
60
|
+
* @param a - Input array storage (must be integer type)
|
|
61
|
+
* @param b - Shift amount (array storage or scalar)
|
|
62
|
+
* @returns Result storage with right-shifted values
|
|
63
|
+
*/
|
|
64
|
+
export declare function right_shift(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
65
|
+
/**
|
|
66
|
+
* Pack binary values into uint8 array
|
|
67
|
+
*
|
|
68
|
+
* Packs the elements of a binary-valued array into bits in a uint8 array.
|
|
69
|
+
* The result has the same shape as the input, except for the specified axis
|
|
70
|
+
* which is divided by 8 (rounded up).
|
|
71
|
+
*
|
|
72
|
+
* @param a - Input array (values are interpreted as binary: 0 or non-zero)
|
|
73
|
+
* @param axis - The dimension over which bit-packing is done (default: -1, meaning the last axis)
|
|
74
|
+
* @param bitorder - The order of bits within each packed byte. 'big' means the most significant bit is first. (default: 'big')
|
|
75
|
+
* @returns Packed uint8 array
|
|
76
|
+
*/
|
|
77
|
+
export declare function packbits(a: ArrayStorage, axis?: number, bitorder?: 'big' | 'little'): ArrayStorage;
|
|
78
|
+
/**
|
|
79
|
+
* Unpack uint8 array into binary values
|
|
80
|
+
*
|
|
81
|
+
* Unpacks elements of a uint8 array into a binary-valued output array.
|
|
82
|
+
* Each element of the input array is unpacked into 8 binary values.
|
|
83
|
+
*
|
|
84
|
+
* @param a - Input uint8 array
|
|
85
|
+
* @param axis - The dimension over which bit-unpacking is done (default: -1, meaning the last axis)
|
|
86
|
+
* @param count - The number of elements to unpack along axis, or -1 for all (default: -1)
|
|
87
|
+
* @param bitorder - The order of bits within each packed byte. 'big' means the most significant bit is first. (default: 'big')
|
|
88
|
+
* @returns Unpacked uint8 array of 0s and 1s
|
|
89
|
+
*/
|
|
90
|
+
export declare function unpackbits(a: ArrayStorage, axis?: number, count?: number, bitorder?: 'big' | 'little'): ArrayStorage;
|
|
91
|
+
//# sourceMappingURL=bitwise.d.ts.map
|
|
@@ -40,4 +40,16 @@ export declare function isclose(a: ArrayStorage, b: ArrayStorage | number, rtol?
|
|
|
40
40
|
* Returns true if all elements satisfy isclose condition
|
|
41
41
|
*/
|
|
42
42
|
export declare function allclose(a: ArrayStorage, b: ArrayStorage | number, rtol?: number, atol?: number): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Returns True if two arrays are element-wise equal within a tolerance.
|
|
45
|
+
* Unlike array_equal, this function broadcasts the arrays before comparison.
|
|
46
|
+
*
|
|
47
|
+
* NumPy behavior: Broadcasts arrays before comparing, returns True if shapes
|
|
48
|
+
* are broadcast-compatible and all elements are equal.
|
|
49
|
+
*
|
|
50
|
+
* @param a1 - First input array
|
|
51
|
+
* @param a2 - Second input array
|
|
52
|
+
* @returns True if arrays are equivalent (after broadcasting), False otherwise
|
|
53
|
+
*/
|
|
54
|
+
export declare function arrayEquiv(a1: ArrayStorage, a2: ArrayStorage): boolean;
|
|
43
55
|
//# sourceMappingURL=comparison.d.ts.map
|
|
@@ -92,4 +92,55 @@ export declare function outer(a: ArrayStorage, b: ArrayStorage): ArrayStorage;
|
|
|
92
92
|
* @returns Tensor dot product
|
|
93
93
|
*/
|
|
94
94
|
export declare function tensordot(a: ArrayStorage, b: ArrayStorage, axes: number | [number[], number[]]): ArrayStorage | number | bigint;
|
|
95
|
+
/**
|
|
96
|
+
* Extract a diagonal or construct a diagonal array.
|
|
97
|
+
*
|
|
98
|
+
* NumPy behavior:
|
|
99
|
+
* - For 2D arrays: extract the k-th diagonal
|
|
100
|
+
* - For ND arrays (N >= 2): extract diagonal from the axes specified
|
|
101
|
+
* - Returns a view when possible, copy otherwise
|
|
102
|
+
*
|
|
103
|
+
* @param a - Input array (must be at least 2D)
|
|
104
|
+
* @param offset - Offset of the diagonal from the main diagonal (default: 0)
|
|
105
|
+
* - offset > 0: diagonal above main diagonal
|
|
106
|
+
* - offset < 0: diagonal below main diagonal
|
|
107
|
+
* @param axis1 - First axis for ND arrays (default: 0)
|
|
108
|
+
* @param axis2 - Second axis for ND arrays (default: 1)
|
|
109
|
+
* @returns Array containing the diagonal elements
|
|
110
|
+
*/
|
|
111
|
+
export declare function diagonal(a: ArrayStorage, offset?: number, axis1?: number, axis2?: number): ArrayStorage;
|
|
112
|
+
/**
|
|
113
|
+
* Einstein summation convention
|
|
114
|
+
*
|
|
115
|
+
* Performs tensor contractions and reductions using Einstein summation notation.
|
|
116
|
+
*
|
|
117
|
+
* Examples:
|
|
118
|
+
* - 'ij,jk->ik': matrix multiplication
|
|
119
|
+
* - 'i,i->': dot product (inner product)
|
|
120
|
+
* - 'ij->ji': transpose
|
|
121
|
+
* - 'ii->': trace
|
|
122
|
+
* - 'ij->j': sum over first axis
|
|
123
|
+
* - 'ijk,ikl->ijl': batched matrix multiplication
|
|
124
|
+
*
|
|
125
|
+
* @param subscripts - Einstein summation subscripts (e.g., 'ij,jk->ik')
|
|
126
|
+
* @param operands - Input arrays
|
|
127
|
+
* @returns Result of the Einstein summation
|
|
128
|
+
*/
|
|
129
|
+
export declare function einsum(subscripts: string, ...operands: ArrayStorage[]): ArrayStorage | number | bigint;
|
|
130
|
+
/**
|
|
131
|
+
* Kronecker product of two arrays.
|
|
132
|
+
*
|
|
133
|
+
* Computes the Kronecker product, a composite array made of blocks of the
|
|
134
|
+
* second array scaled by the elements of the first.
|
|
135
|
+
*
|
|
136
|
+
* NumPy behavior:
|
|
137
|
+
* - If both inputs are vectors (1D), output is also a vector
|
|
138
|
+
* - If both inputs are 2D matrices, output shape is (m1*m2, n1*n2)
|
|
139
|
+
* - General case: broadcasts shapes then computes block product
|
|
140
|
+
*
|
|
141
|
+
* @param a - First input array
|
|
142
|
+
* @param b - Second input array
|
|
143
|
+
* @returns Kronecker product of a and b
|
|
144
|
+
*/
|
|
145
|
+
export declare function kron(a: ArrayStorage, b: ArrayStorage): ArrayStorage;
|
|
95
146
|
//# sourceMappingURL=linalg.d.ts.map
|
|
@@ -58,4 +58,80 @@ export declare function all(storage: ArrayStorage, axis?: number, keepdims?: boo
|
|
|
58
58
|
* Test whether any array elements along a given axis evaluate to True
|
|
59
59
|
*/
|
|
60
60
|
export declare function any(storage: ArrayStorage, axis?: number, keepdims?: boolean): ArrayStorage | boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Return cumulative sum of elements along a given axis
|
|
63
|
+
*/
|
|
64
|
+
export declare function cumsum(storage: ArrayStorage, axis?: number): ArrayStorage;
|
|
65
|
+
/**
|
|
66
|
+
* Return cumulative product of elements along a given axis
|
|
67
|
+
*/
|
|
68
|
+
export declare function cumprod(storage: ArrayStorage, axis?: number): ArrayStorage;
|
|
69
|
+
/**
|
|
70
|
+
* Peak to peak (maximum - minimum) value along a given axis
|
|
71
|
+
*/
|
|
72
|
+
export declare function ptp(storage: ArrayStorage, axis?: number, keepdims?: boolean): ArrayStorage | number;
|
|
73
|
+
/**
|
|
74
|
+
* Compute the median along the specified axis
|
|
75
|
+
*/
|
|
76
|
+
export declare function median(storage: ArrayStorage, axis?: number, keepdims?: boolean): ArrayStorage | number;
|
|
77
|
+
/**
|
|
78
|
+
* Compute the q-th percentile of data along specified axis
|
|
79
|
+
*/
|
|
80
|
+
export declare function percentile(storage: ArrayStorage, q: number, axis?: number, keepdims?: boolean): ArrayStorage | number;
|
|
81
|
+
/**
|
|
82
|
+
* Compute the q-th quantile of data along specified axis
|
|
83
|
+
*/
|
|
84
|
+
export declare function quantile(storage: ArrayStorage, q: number, axis?: number, keepdims?: boolean): ArrayStorage | number;
|
|
85
|
+
/**
|
|
86
|
+
* Compute the weighted average along the specified axis
|
|
87
|
+
*/
|
|
88
|
+
export declare function average(storage: ArrayStorage, axis?: number, weights?: ArrayStorage, keepdims?: boolean): ArrayStorage | number;
|
|
89
|
+
/**
|
|
90
|
+
* Return sum of elements, treating NaNs as zero
|
|
91
|
+
*/
|
|
92
|
+
export declare function nansum(storage: ArrayStorage, axis?: number, keepdims?: boolean): ArrayStorage | number;
|
|
93
|
+
/**
|
|
94
|
+
* Return product of elements, treating NaNs as one
|
|
95
|
+
*/
|
|
96
|
+
export declare function nanprod(storage: ArrayStorage, axis?: number, keepdims?: boolean): ArrayStorage | number;
|
|
97
|
+
/**
|
|
98
|
+
* Compute mean ignoring NaN values
|
|
99
|
+
*/
|
|
100
|
+
export declare function nanmean(storage: ArrayStorage, axis?: number, keepdims?: boolean): ArrayStorage | number;
|
|
101
|
+
/**
|
|
102
|
+
* Compute variance ignoring NaN values
|
|
103
|
+
*/
|
|
104
|
+
export declare function nanvar(storage: ArrayStorage, axis?: number, ddof?: number, keepdims?: boolean): ArrayStorage | number;
|
|
105
|
+
/**
|
|
106
|
+
* Compute standard deviation ignoring NaN values
|
|
107
|
+
*/
|
|
108
|
+
export declare function nanstd(storage: ArrayStorage, axis?: number, ddof?: number, keepdims?: boolean): ArrayStorage | number;
|
|
109
|
+
/**
|
|
110
|
+
* Return minimum ignoring NaN values
|
|
111
|
+
*/
|
|
112
|
+
export declare function nanmin(storage: ArrayStorage, axis?: number, keepdims?: boolean): ArrayStorage | number;
|
|
113
|
+
/**
|
|
114
|
+
* Return maximum ignoring NaN values
|
|
115
|
+
*/
|
|
116
|
+
export declare function nanmax(storage: ArrayStorage, axis?: number, keepdims?: boolean): ArrayStorage | number;
|
|
117
|
+
/**
|
|
118
|
+
* Return indices of minimum value, ignoring NaNs
|
|
119
|
+
*/
|
|
120
|
+
export declare function nanargmin(storage: ArrayStorage, axis?: number): ArrayStorage | number;
|
|
121
|
+
/**
|
|
122
|
+
* Return indices of maximum value, ignoring NaNs
|
|
123
|
+
*/
|
|
124
|
+
export declare function nanargmax(storage: ArrayStorage, axis?: number): ArrayStorage | number;
|
|
125
|
+
/**
|
|
126
|
+
* Return cumulative sum, treating NaNs as zero
|
|
127
|
+
*/
|
|
128
|
+
export declare function nancumsum(storage: ArrayStorage, axis?: number): ArrayStorage;
|
|
129
|
+
/**
|
|
130
|
+
* Return cumulative product, treating NaNs as one
|
|
131
|
+
*/
|
|
132
|
+
export declare function nancumprod(storage: ArrayStorage, axis?: number): ArrayStorage;
|
|
133
|
+
/**
|
|
134
|
+
* Compute median ignoring NaN values
|
|
135
|
+
*/
|
|
136
|
+
export declare function nanmedian(storage: ArrayStorage, axis?: number, keepdims?: boolean): ArrayStorage | number;
|
|
61
137
|
//# sourceMappingURL=reduction.d.ts.map
|
|
@@ -97,4 +97,48 @@ export declare function tile(storage: ArrayStorage, reps: number | number[]): Ar
|
|
|
97
97
|
* Repeat elements of an array
|
|
98
98
|
*/
|
|
99
99
|
export declare function repeat(storage: ArrayStorage, repeats: number | number[], axis?: number): ArrayStorage;
|
|
100
|
+
/**
|
|
101
|
+
* Reverse the order of elements in an array along given axis
|
|
102
|
+
*/
|
|
103
|
+
export declare function flip(storage: ArrayStorage, axis?: number | number[]): ArrayStorage;
|
|
104
|
+
/**
|
|
105
|
+
* Rotate array by 90 degrees in the plane specified by axes
|
|
106
|
+
*/
|
|
107
|
+
export declare function rot90(storage: ArrayStorage, k?: number, axes?: [number, number]): ArrayStorage;
|
|
108
|
+
/**
|
|
109
|
+
* Roll array elements along a given axis
|
|
110
|
+
*/
|
|
111
|
+
export declare function roll(storage: ArrayStorage, shift: number | number[], axis?: number | number[]): ArrayStorage;
|
|
112
|
+
/**
|
|
113
|
+
* Roll the specified axis backwards until it lies in a given position
|
|
114
|
+
*/
|
|
115
|
+
export declare function rollaxis(storage: ArrayStorage, axis: number, start?: number): ArrayStorage;
|
|
116
|
+
/**
|
|
117
|
+
* Split array along third axis (depth)
|
|
118
|
+
*/
|
|
119
|
+
export declare function dsplit(storage: ArrayStorage, indicesOrSections: number | number[]): ArrayStorage[];
|
|
120
|
+
/**
|
|
121
|
+
* Stack 1-D arrays as columns into a 2-D array
|
|
122
|
+
*/
|
|
123
|
+
export declare function columnStack(storages: ArrayStorage[]): ArrayStorage;
|
|
124
|
+
/**
|
|
125
|
+
* Stack arrays in sequence vertically (row_stack is an alias for vstack)
|
|
126
|
+
*/
|
|
127
|
+
export declare const rowStack: typeof vstack;
|
|
128
|
+
/**
|
|
129
|
+
* Resize array to new shape (returns new array, may repeat or truncate)
|
|
130
|
+
*/
|
|
131
|
+
export declare function resize(storage: ArrayStorage, newShape: number[]): ArrayStorage;
|
|
132
|
+
/**
|
|
133
|
+
* Convert arrays to at least 1D
|
|
134
|
+
*/
|
|
135
|
+
export declare function atleast1d(storages: ArrayStorage[]): ArrayStorage[];
|
|
136
|
+
/**
|
|
137
|
+
* Convert arrays to at least 2D
|
|
138
|
+
*/
|
|
139
|
+
export declare function atleast2d(storages: ArrayStorage[]): ArrayStorage[];
|
|
140
|
+
/**
|
|
141
|
+
* Convert arrays to at least 3D
|
|
142
|
+
*/
|
|
143
|
+
export declare function atleast3d(storages: ArrayStorage[]): ArrayStorage[];
|
|
100
144
|
//# sourceMappingURL=shape.d.ts.map
|
package/dist/types/ops/trig.d.ts
CHANGED
|
@@ -91,4 +91,20 @@ export declare function degrees(a: ArrayStorage): ArrayStorage;
|
|
|
91
91
|
* @returns Angles in radians
|
|
92
92
|
*/
|
|
93
93
|
export declare function radians(a: ArrayStorage): ArrayStorage;
|
|
94
|
+
/**
|
|
95
|
+
* Convert angles from degrees to radians (alias for radians).
|
|
96
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
97
|
+
*
|
|
98
|
+
* @param a - Input array storage (angles in degrees)
|
|
99
|
+
* @returns Angles in radians
|
|
100
|
+
*/
|
|
101
|
+
export declare function deg2rad(a: ArrayStorage): ArrayStorage;
|
|
102
|
+
/**
|
|
103
|
+
* Convert angles from radians to degrees (alias for degrees).
|
|
104
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
105
|
+
*
|
|
106
|
+
* @param a - Input array storage (angles in radians)
|
|
107
|
+
* @returns Angles in degrees
|
|
108
|
+
*/
|
|
109
|
+
export declare function rad2deg(a: ArrayStorage): ArrayStorage;
|
|
94
110
|
//# sourceMappingURL=trig.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "numpy-ts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Complete NumPy implementation for TypeScript and JavaScript (under construction)",
|
|
5
5
|
"main": "dist/numpy-ts.node.cjs",
|
|
6
6
|
"browser": "dist/numpy-ts.browser.js",
|
|
@@ -54,8 +54,10 @@
|
|
|
54
54
|
"test:ci": "npm run lint && npm run typecheck && npm test && npm run test:bundles",
|
|
55
55
|
"test:summary": "vitest run --reporter=tap | grep -E 'not ok|# tests'",
|
|
56
56
|
"test:watch": "vitest watch",
|
|
57
|
-
"test:coverage": "vitest run
|
|
58
|
-
"test:coverage:view": "vitest run
|
|
57
|
+
"test:coverage": "vitest run --project=unit --coverage",
|
|
58
|
+
"test:coverage:view": "vitest run --project=unit --coverage && open coverage/index.html",
|
|
59
|
+
"test:coverage:validation": "vitest run --project=validation-quick --coverage",
|
|
60
|
+
"test:coverage:validation:view": "vitest run --project=validation-quick --coverage && open coverage/index.html",
|
|
59
61
|
"test:coverage:all": "vitest run --coverage",
|
|
60
62
|
"lint": "eslint src tests --ext .ts",
|
|
61
63
|
"lint:fix": "eslint src tests --ext .ts --fix",
|
|
@@ -111,7 +113,6 @@
|
|
|
111
113
|
"lint-staged": "^16.2.6",
|
|
112
114
|
"playwright": "^1.56.1",
|
|
113
115
|
"prettier": "^3.1.1",
|
|
114
|
-
"ts-node": "^10.9.2",
|
|
115
116
|
"tsx": "^4.20.6",
|
|
116
117
|
"typescript": "^5.3.3",
|
|
117
118
|
"vitest": "^4.0.3"
|