numpy-ts 0.3.0 → 0.5.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 +199 -297
- package/dist/numpy-ts.browser.js +2 -397
- package/dist/numpy-ts.esm.js +2 -397
- 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 -412
- package/dist/numpy-ts.node.cjs.map +7 -0
- package/dist/types/core/ndarray.d.ts +477 -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 +34 -0
- package/dist/types/ops/hyperbolic.d.ts +59 -0
- package/dist/types/ops/linalg.d.ts +79 -0
- package/dist/types/ops/shape.d.ts +61 -0
- package/dist/types/ops/trig.d.ts +94 -0
- package/package.json +18 -10
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
//# 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.5.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
|
},
|
|
@@ -57,7 +68,8 @@
|
|
|
57
68
|
"bench:large": "npm run bench:build && node benchmarks/dist/bench.cjs --large",
|
|
58
69
|
"bench:category": "npm run bench:build && node benchmarks/dist/bench.cjs --category",
|
|
59
70
|
"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"
|
|
71
|
+
"bench:large:view": "open benchmarks/results/plots/latest-large.html || xdg-open benchmarks/results/plots/latest-large.html",
|
|
72
|
+
"compare-api": "python3 scripts/compare-api-coverage.py"
|
|
61
73
|
},
|
|
62
74
|
"keywords": [
|
|
63
75
|
"numpy",
|
|
@@ -81,9 +93,8 @@
|
|
|
81
93
|
"bugs": {
|
|
82
94
|
"url": "https://github.com/dupontcyborg/numpy-ts/issues"
|
|
83
95
|
},
|
|
84
|
-
"homepage": "https://github.com/dupontcyborg/numpy-ts
|
|
96
|
+
"homepage": "https://github.com/dupontcyborg/numpy-ts",
|
|
85
97
|
"devDependencies": {
|
|
86
|
-
"@stdlib/types": "^0.4.3",
|
|
87
98
|
"@types/node": "^24.9.1",
|
|
88
99
|
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
89
100
|
"@typescript-eslint/parser": "^8.46.2",
|
|
@@ -105,11 +116,8 @@
|
|
|
105
116
|
"typescript": "^5.3.3",
|
|
106
117
|
"vitest": "^4.0.3"
|
|
107
118
|
},
|
|
108
|
-
"dependencies": {
|
|
109
|
-
"@stdlib/blas": "^0.3.3"
|
|
110
|
-
},
|
|
111
119
|
"engines": {
|
|
112
|
-
"node": ">=
|
|
120
|
+
"node": ">=20.1.0"
|
|
113
121
|
},
|
|
114
122
|
"overrides": {
|
|
115
123
|
"js-yaml": ">=4.1.1"
|