numpy-ts 0.4.0 → 0.6.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 +200 -294
- package/dist/numpy-ts.browser.js +2 -2
- package/dist/numpy-ts.esm.js +2 -2
- package/dist/numpy-ts.node-io.cjs +3 -0
- package/dist/numpy-ts.node-io.cjs.map +7 -0
- package/dist/numpy-ts.node-io.mjs +3 -0
- package/dist/numpy-ts.node-io.mjs.map +7 -0
- package/dist/numpy-ts.node.cjs +2 -1
- package/dist/numpy-ts.node.cjs.map +7 -0
- package/dist/types/core/broadcasting.d.ts +18 -0
- package/dist/types/core/ndarray.d.ts +1109 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/io/index.d.ts +17 -0
- package/dist/types/io/npy/format.d.ts +91 -0
- package/dist/types/io/npy/index.d.ts +7 -0
- package/dist/types/io/npy/parser.d.ts +28 -0
- package/dist/types/io/npy/serializer.d.ts +17 -0
- package/dist/types/io/npz/index.d.ts +6 -0
- package/dist/types/io/npz/parser.d.ts +57 -0
- package/dist/types/io/npz/serializer.d.ts +49 -0
- package/dist/types/io/zip/index.d.ts +7 -0
- package/dist/types/io/zip/reader.d.ts +22 -0
- package/dist/types/io/zip/types.d.ts +59 -0
- package/dist/types/io/zip/writer.d.ts +29 -0
- package/dist/types/node.d.ts +154 -0
- package/dist/types/ops/advanced.d.ts +40 -0
- package/dist/types/ops/arithmetic.d.ts +54 -0
- package/dist/types/ops/comparison.d.ts +12 -0
- package/dist/types/ops/hyperbolic.d.ts +59 -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 +105 -0
- package/dist/types/ops/trig.d.ts +110 -0
- package/package.json +22 -9
|
@@ -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
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hyperbolic operations
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for element-wise hyperbolic operations:
|
|
5
|
+
* sinh, cosh, tanh, arcsinh, arccosh, arctanh
|
|
6
|
+
*
|
|
7
|
+
* These functions are used by NDArray methods but are separated
|
|
8
|
+
* to keep the codebase modular and testable.
|
|
9
|
+
*/
|
|
10
|
+
import { ArrayStorage } from '../core/storage';
|
|
11
|
+
/**
|
|
12
|
+
* Hyperbolic sine of each element (element-wise)
|
|
13
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
14
|
+
*
|
|
15
|
+
* @param a - Input array storage
|
|
16
|
+
* @returns Result storage with sinh applied
|
|
17
|
+
*/
|
|
18
|
+
export declare function sinh(a: ArrayStorage): ArrayStorage;
|
|
19
|
+
/**
|
|
20
|
+
* Hyperbolic cosine of each element (element-wise)
|
|
21
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
22
|
+
*
|
|
23
|
+
* @param a - Input array storage
|
|
24
|
+
* @returns Result storage with cosh applied
|
|
25
|
+
*/
|
|
26
|
+
export declare function cosh(a: ArrayStorage): ArrayStorage;
|
|
27
|
+
/**
|
|
28
|
+
* Hyperbolic tangent of each element (element-wise)
|
|
29
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
30
|
+
*
|
|
31
|
+
* @param a - Input array storage
|
|
32
|
+
* @returns Result storage with tanh applied
|
|
33
|
+
*/
|
|
34
|
+
export declare function tanh(a: ArrayStorage): ArrayStorage;
|
|
35
|
+
/**
|
|
36
|
+
* Inverse hyperbolic sine of each element (element-wise)
|
|
37
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
38
|
+
*
|
|
39
|
+
* @param a - Input array storage
|
|
40
|
+
* @returns Result storage with arcsinh applied
|
|
41
|
+
*/
|
|
42
|
+
export declare function arcsinh(a: ArrayStorage): ArrayStorage;
|
|
43
|
+
/**
|
|
44
|
+
* Inverse hyperbolic cosine of each element (element-wise)
|
|
45
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
46
|
+
*
|
|
47
|
+
* @param a - Input array storage (values >= 1)
|
|
48
|
+
* @returns Result storage with arccosh applied
|
|
49
|
+
*/
|
|
50
|
+
export declare function arccosh(a: ArrayStorage): ArrayStorage;
|
|
51
|
+
/**
|
|
52
|
+
* Inverse hyperbolic tangent of each element (element-wise)
|
|
53
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
54
|
+
*
|
|
55
|
+
* @param a - Input array storage (values in range (-1, 1))
|
|
56
|
+
* @returns Result storage with arctanh applied
|
|
57
|
+
*/
|
|
58
|
+
export declare function arctanh(a: ArrayStorage): ArrayStorage;
|
|
59
|
+
//# sourceMappingURL=hyperbolic.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
|
|
@@ -36,4 +36,109 @@ export declare function squeeze(storage: ArrayStorage, axis?: number): ArrayStor
|
|
|
36
36
|
* Returns a view with additional dimension
|
|
37
37
|
*/
|
|
38
38
|
export declare function expandDims(storage: ArrayStorage, axis: number): ArrayStorage;
|
|
39
|
+
/**
|
|
40
|
+
* Swap two axes of an array
|
|
41
|
+
* Returns a view with axes swapped
|
|
42
|
+
*/
|
|
43
|
+
export declare function swapaxes(storage: ArrayStorage, axis1: number, axis2: number): ArrayStorage;
|
|
44
|
+
/**
|
|
45
|
+
* Move axes to new positions
|
|
46
|
+
* Returns a view with axes moved
|
|
47
|
+
*/
|
|
48
|
+
export declare function moveaxis(storage: ArrayStorage, source: number | number[], destination: number | number[]): ArrayStorage;
|
|
49
|
+
/**
|
|
50
|
+
* Concatenate arrays along an axis
|
|
51
|
+
*/
|
|
52
|
+
export declare function concatenate(storages: ArrayStorage[], axis?: number): ArrayStorage;
|
|
53
|
+
/**
|
|
54
|
+
* Stack arrays along a new axis
|
|
55
|
+
*/
|
|
56
|
+
export declare function stack(storages: ArrayStorage[], axis?: number): ArrayStorage;
|
|
57
|
+
/**
|
|
58
|
+
* Stack arrays vertically (row-wise)
|
|
59
|
+
* vstack is equivalent to concatenation along the first axis after
|
|
60
|
+
* 1-D arrays of shape (N,) have been reshaped to (1,N)
|
|
61
|
+
*/
|
|
62
|
+
export declare function vstack(storages: ArrayStorage[]): ArrayStorage;
|
|
63
|
+
/**
|
|
64
|
+
* Stack arrays horizontally (column-wise)
|
|
65
|
+
* hstack is equivalent to concatenation along the second axis,
|
|
66
|
+
* except for 1-D arrays where it concatenates along the first axis
|
|
67
|
+
*/
|
|
68
|
+
export declare function hstack(storages: ArrayStorage[]): ArrayStorage;
|
|
69
|
+
/**
|
|
70
|
+
* Stack arrays depth-wise (along third axis)
|
|
71
|
+
* dstack is equivalent to concatenation along the third axis after
|
|
72
|
+
* 2-D arrays of shape (M,N) have been reshaped to (M,N,1) and
|
|
73
|
+
* 1-D arrays of shape (N,) have been reshaped to (1,N,1)
|
|
74
|
+
*/
|
|
75
|
+
export declare function dstack(storages: ArrayStorage[]): ArrayStorage;
|
|
76
|
+
/**
|
|
77
|
+
* Split array into sub-arrays
|
|
78
|
+
*/
|
|
79
|
+
export declare function split(storage: ArrayStorage, indicesOrSections: number | number[], axis?: number): ArrayStorage[];
|
|
80
|
+
/**
|
|
81
|
+
* Split array into sub-arrays (allows unequal splits)
|
|
82
|
+
*/
|
|
83
|
+
export declare function arraySplit(storage: ArrayStorage, indicesOrSections: number | number[], axis?: number): ArrayStorage[];
|
|
84
|
+
/**
|
|
85
|
+
* Split array vertically (row-wise)
|
|
86
|
+
*/
|
|
87
|
+
export declare function vsplit(storage: ArrayStorage, indicesOrSections: number | number[]): ArrayStorage[];
|
|
88
|
+
/**
|
|
89
|
+
* Split array horizontally (column-wise)
|
|
90
|
+
*/
|
|
91
|
+
export declare function hsplit(storage: ArrayStorage, indicesOrSections: number | number[]): ArrayStorage[];
|
|
92
|
+
/**
|
|
93
|
+
* Tile array by repeating along each axis
|
|
94
|
+
*/
|
|
95
|
+
export declare function tile(storage: ArrayStorage, reps: number | number[]): ArrayStorage;
|
|
96
|
+
/**
|
|
97
|
+
* Repeat elements of an array
|
|
98
|
+
*/
|
|
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[];
|
|
39
144
|
//# sourceMappingURL=shape.d.ts.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trigonometric operations
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for element-wise trigonometric operations:
|
|
5
|
+
* sin, cos, tan, arcsin, arccos, arctan, arctan2, hypot, degrees, radians
|
|
6
|
+
*
|
|
7
|
+
* These functions are used by NDArray methods but are separated
|
|
8
|
+
* to keep the codebase modular and testable.
|
|
9
|
+
*/
|
|
10
|
+
import { ArrayStorage } from '../core/storage';
|
|
11
|
+
/**
|
|
12
|
+
* Sine of each element (element-wise)
|
|
13
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
14
|
+
*
|
|
15
|
+
* @param a - Input array storage (angles in radians)
|
|
16
|
+
* @returns Result storage with sin applied
|
|
17
|
+
*/
|
|
18
|
+
export declare function sin(a: ArrayStorage): ArrayStorage;
|
|
19
|
+
/**
|
|
20
|
+
* Cosine of each element (element-wise)
|
|
21
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
22
|
+
*
|
|
23
|
+
* @param a - Input array storage (angles in radians)
|
|
24
|
+
* @returns Result storage with cos applied
|
|
25
|
+
*/
|
|
26
|
+
export declare function cos(a: ArrayStorage): ArrayStorage;
|
|
27
|
+
/**
|
|
28
|
+
* Tangent of each element (element-wise)
|
|
29
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
30
|
+
*
|
|
31
|
+
* @param a - Input array storage (angles in radians)
|
|
32
|
+
* @returns Result storage with tan applied
|
|
33
|
+
*/
|
|
34
|
+
export declare function tan(a: ArrayStorage): ArrayStorage;
|
|
35
|
+
/**
|
|
36
|
+
* Inverse sine of each element (element-wise)
|
|
37
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
38
|
+
*
|
|
39
|
+
* @param a - Input array storage (values in range [-1, 1])
|
|
40
|
+
* @returns Result storage with arcsin applied (radians)
|
|
41
|
+
*/
|
|
42
|
+
export declare function arcsin(a: ArrayStorage): ArrayStorage;
|
|
43
|
+
/**
|
|
44
|
+
* Inverse cosine of each element (element-wise)
|
|
45
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
46
|
+
*
|
|
47
|
+
* @param a - Input array storage (values in range [-1, 1])
|
|
48
|
+
* @returns Result storage with arccos applied (radians)
|
|
49
|
+
*/
|
|
50
|
+
export declare function arccos(a: ArrayStorage): ArrayStorage;
|
|
51
|
+
/**
|
|
52
|
+
* Inverse tangent of each element (element-wise)
|
|
53
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
54
|
+
*
|
|
55
|
+
* @param a - Input array storage
|
|
56
|
+
* @returns Result storage with arctan applied (radians)
|
|
57
|
+
*/
|
|
58
|
+
export declare function arctan(a: ArrayStorage): ArrayStorage;
|
|
59
|
+
/**
|
|
60
|
+
* Element-wise arc tangent of x1/x2 choosing the quadrant correctly.
|
|
61
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
62
|
+
*
|
|
63
|
+
* @param x1 - y-coordinates
|
|
64
|
+
* @param x2 - x-coordinates (array storage or scalar)
|
|
65
|
+
* @returns Angle in radians between -π and π
|
|
66
|
+
*/
|
|
67
|
+
export declare function arctan2(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
|
|
68
|
+
/**
|
|
69
|
+
* Given the "legs" of a right triangle, return its hypotenuse.
|
|
70
|
+
* Equivalent to sqrt(x1**2 + x2**2), element-wise.
|
|
71
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
72
|
+
*
|
|
73
|
+
* @param x1 - First leg
|
|
74
|
+
* @param x2 - Second leg (array storage or scalar)
|
|
75
|
+
* @returns Hypotenuse
|
|
76
|
+
*/
|
|
77
|
+
export declare function hypot(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
|
|
78
|
+
/**
|
|
79
|
+
* Convert angles from radians to degrees.
|
|
80
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
81
|
+
*
|
|
82
|
+
* @param a - Input array storage (angles in radians)
|
|
83
|
+
* @returns Angles in degrees
|
|
84
|
+
*/
|
|
85
|
+
export declare function degrees(a: ArrayStorage): ArrayStorage;
|
|
86
|
+
/**
|
|
87
|
+
* Convert angles from degrees to radians.
|
|
88
|
+
* NumPy behavior: Always promotes to float64 for integer types
|
|
89
|
+
*
|
|
90
|
+
* @param a - Input array storage (angles in degrees)
|
|
91
|
+
* @returns Angles in radians
|
|
92
|
+
*/
|
|
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;
|
|
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.6.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",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/**/*.js",
|
|
12
12
|
"dist/**/*.cjs",
|
|
13
|
+
"dist/**/*.mjs",
|
|
14
|
+
"dist/**/*.cjs.map",
|
|
15
|
+
"dist/**/*.mjs.map",
|
|
13
16
|
"dist/types/**/*.d.ts",
|
|
14
17
|
"README.md",
|
|
15
18
|
"LICENSE"
|
|
@@ -23,10 +26,18 @@
|
|
|
23
26
|
},
|
|
24
27
|
"./node": {
|
|
25
28
|
"types": "./dist/types/node.d.ts",
|
|
26
|
-
"
|
|
29
|
+
"import": "./dist/numpy-ts.node-io.mjs",
|
|
30
|
+
"require": "./dist/numpy-ts.node-io.cjs",
|
|
31
|
+
"default": "./dist/numpy-ts.node-io.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./io": {
|
|
34
|
+
"types": "./dist/types/io/index.d.ts",
|
|
35
|
+
"node": "./dist/numpy-ts.node.cjs",
|
|
36
|
+
"browser": "./dist/numpy-ts.browser.js",
|
|
37
|
+
"default": "./dist/numpy-ts.esm.js"
|
|
27
38
|
},
|
|
28
39
|
"./browser": {
|
|
29
|
-
"types": "./dist/types/
|
|
40
|
+
"types": "./dist/types/index.d.ts",
|
|
30
41
|
"default": "./dist/numpy-ts.browser.js"
|
|
31
42
|
}
|
|
32
43
|
},
|
|
@@ -43,8 +54,10 @@
|
|
|
43
54
|
"test:ci": "npm run lint && npm run typecheck && npm test && npm run test:bundles",
|
|
44
55
|
"test:summary": "vitest run --reporter=tap | grep -E 'not ok|# tests'",
|
|
45
56
|
"test:watch": "vitest watch",
|
|
46
|
-
"test:coverage": "vitest run
|
|
47
|
-
"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",
|
|
48
61
|
"test:coverage:all": "vitest run --coverage",
|
|
49
62
|
"lint": "eslint src tests --ext .ts",
|
|
50
63
|
"lint:fix": "eslint src tests --ext .ts --fix",
|
|
@@ -57,7 +70,8 @@
|
|
|
57
70
|
"bench:large": "npm run bench:build && node benchmarks/dist/bench.cjs --large",
|
|
58
71
|
"bench:category": "npm run bench:build && node benchmarks/dist/bench.cjs --category",
|
|
59
72
|
"bench:view": "open benchmarks/results/plots/latest.html || xdg-open benchmarks/results/plots/latest.html",
|
|
60
|
-
"bench:large:view": "open benchmarks/results/plots/latest-large.html || xdg-open benchmarks/results/plots/latest-large.html"
|
|
73
|
+
"bench:large:view": "open benchmarks/results/plots/latest-large.html || xdg-open benchmarks/results/plots/latest-large.html",
|
|
74
|
+
"compare-api": "python3 scripts/compare-api-coverage.py"
|
|
61
75
|
},
|
|
62
76
|
"keywords": [
|
|
63
77
|
"numpy",
|
|
@@ -81,7 +95,7 @@
|
|
|
81
95
|
"bugs": {
|
|
82
96
|
"url": "https://github.com/dupontcyborg/numpy-ts/issues"
|
|
83
97
|
},
|
|
84
|
-
"homepage": "https://github.com/dupontcyborg/numpy-ts
|
|
98
|
+
"homepage": "https://github.com/dupontcyborg/numpy-ts",
|
|
85
99
|
"devDependencies": {
|
|
86
100
|
"@types/node": "^24.9.1",
|
|
87
101
|
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
@@ -99,13 +113,12 @@
|
|
|
99
113
|
"lint-staged": "^16.2.6",
|
|
100
114
|
"playwright": "^1.56.1",
|
|
101
115
|
"prettier": "^3.1.1",
|
|
102
|
-
"ts-node": "^10.9.2",
|
|
103
116
|
"tsx": "^4.20.6",
|
|
104
117
|
"typescript": "^5.3.3",
|
|
105
118
|
"vitest": "^4.0.3"
|
|
106
119
|
},
|
|
107
120
|
"engines": {
|
|
108
|
-
"node": ">=
|
|
121
|
+
"node": ">=20.1.0"
|
|
109
122
|
},
|
|
110
123
|
"overrides": {
|
|
111
124
|
"js-yaml": ">=4.1.1"
|