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/README.md
CHANGED
|
@@ -3,22 +3,20 @@
|
|
|
3
3
|

|
|
4
4
|
[](https://www.npmjs.com/package/numpy-ts)
|
|
5
5
|

|
|
6
|
-

|
|
7
7
|
|
|
8
8
|
```
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
███╗ ██╗██╗ ██╗███╗ ███╗██████╗ ██╗ ██╗ ████████╗███████╗
|
|
10
|
+
████╗ ██║██║ ██║████╗ ████║██╔══██╗╚██╗ ██╔╝ ╚══██╔══╝██╔════╝
|
|
11
|
+
██╔██╗ ██║██║ ██║██╔████╔██║██████╔╝ ╚████╔╝█████╗██║ ███████╗
|
|
12
|
+
██║╚██╗██║██║ ██║██║╚██╔╝██║██╔═══╝ ╚██╔╝ ╚════╝██║ ╚════██║
|
|
13
|
+
██║ ╚████║╚██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ███████║
|
|
14
|
+
╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Complete NumPy implementation for TypeScript and JavaScript
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
A faithful NumPy 2.0+ implementation for TypeScript/JavaScript, validated against Python NumPy. **128 of 333 NumPy functions (38.4% complete)** covering array creation, manipulation, linear algebra, reductions, and more.
|
|
19
|
+
**⚠️ Under active development** — API may change before v1.0
|
|
22
20
|
|
|
23
21
|
```bash
|
|
24
22
|
npm install numpy-ts
|
|
@@ -26,8 +24,8 @@ npm install numpy-ts
|
|
|
26
24
|
|
|
27
25
|
## Why numpy-ts?
|
|
28
26
|
|
|
29
|
-
- **📊 Extensive API** —
|
|
30
|
-
- **✅ NumPy-validated** —
|
|
27
|
+
- **📊 Extensive API** — **218 of 333 NumPy functions (65.5% coverage)**
|
|
28
|
+
- **✅ NumPy-validated** — 2000+ test cases cross-validated against Python NumPy
|
|
31
29
|
- **🔒 Type-safe** — Full TypeScript support with shape and dtype inference
|
|
32
30
|
- **🌐 Universal** — Works in Node.js and browsers with .npy/.npz file support
|
|
33
31
|
- **🎯 Zero dependencies** — Pure TypeScript, no heavy external libraries
|
|
@@ -64,17 +62,17 @@ Progress toward complete NumPy API compatibility:
|
|
|
64
62
|
|
|
65
63
|
| Category | Complete | Total | Status |
|
|
66
64
|
|----------|----------|-------|--------|
|
|
65
|
+
| **Arithmetic** | 19/19 | 100% | ✅ |
|
|
66
|
+
| **Array Creation** | 32/32 | 100% | ✅ |
|
|
67
|
+
| **Array Manipulation** | 35/35 | 100% | ✅ |
|
|
68
|
+
| **Bit Operations** | 9/9 | 100% | ✅ |
|
|
69
|
+
| **Broadcasting** | 3/3 | 100% | ✅ |
|
|
70
|
+
| **Comparison** | 10/10 | 100% | ✅ |
|
|
67
71
|
| **Hyperbolic** | 6/6 | 100% | ✅ |
|
|
68
|
-
| **
|
|
69
|
-
| **
|
|
70
|
-
| **
|
|
71
|
-
| **
|
|
72
|
-
| **Linear Algebra** | 6/9 | 67% | 🟡 |
|
|
73
|
-
| **Array Creation** | 17/32 | 53% | 🟡 |
|
|
74
|
-
| **Array Manipulation** | 18/35 | 51% | 🟡 |
|
|
75
|
-
| **Reductions** | 11/30 | 37% | 🔴 |
|
|
76
|
-
| **Indexing** | 3/20 | 15% | 🔴 |
|
|
77
|
-
| **Bit Operations** | 0/9 | 0% | 🔴 |
|
|
72
|
+
| **Indexing** | 20/20 | 100% | ✅ |
|
|
73
|
+
| **Linear Algebra** | 9/9 | 100% | ✅ |
|
|
74
|
+
| **Reductions** | 30/30 | 100% | ✅ |
|
|
75
|
+
| **Trigonometric** | 12/12 | 100% | ✅ |
|
|
78
76
|
| **Exponential** | 0/9 | 0% | 🔴 |
|
|
79
77
|
| **FFT** | 0/18 | 0% | 🔴 |
|
|
80
78
|
| **Gradient** | 0/4 | 0% | 🔴 |
|
|
@@ -89,7 +87,7 @@ Progress toward complete NumPy API compatibility:
|
|
|
89
87
|
| **Sorting** | 0/6 | 0% | 🔴 |
|
|
90
88
|
| **Statistics** | 0/9 | 0% | 🔴 |
|
|
91
89
|
|
|
92
|
-
**Overall:
|
|
90
|
+
**Overall: 218/333 functions (65.5% complete)**
|
|
93
91
|
|
|
94
92
|
See the complete [API Reference](docs/API-REFERENCE.md) for detailed function list.
|
|
95
93
|
|
|
@@ -144,20 +142,20 @@ console.log(arr.flags.C_CONTIGUOUS); // true - row-major layout
|
|
|
144
142
|
## Architecture
|
|
145
143
|
|
|
146
144
|
```
|
|
147
|
-
|
|
148
|
-
│ NumPy-Compatible API
|
|
149
|
-
│ Broadcasting, DType Promotion
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
│ NDArray (Views & Memory Mgmt)
|
|
154
|
-
│ Strided Arrays, Base Tracking
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
│ TypeScript / JavaScript Core
|
|
159
|
-
│ Computational Engine
|
|
160
|
-
|
|
145
|
+
┌─────────────────────────────────┐
|
|
146
|
+
│ NumPy-Compatible API │
|
|
147
|
+
│ Broadcasting, DType Promotion │
|
|
148
|
+
└───────────────┬─────────────────┘
|
|
149
|
+
│
|
|
150
|
+
┌───────────────┴─────────────────┐
|
|
151
|
+
│ NDArray (Views & Memory Mgmt) │
|
|
152
|
+
│ Strided Arrays, Base Tracking │
|
|
153
|
+
└───────────────┬─────────────────┘
|
|
154
|
+
│- - - - - - - - - - - - - - - - - - ┐
|
|
155
|
+
┌───────────────┴─────────────────┐ ┌ ─ ─ ─ ─ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─┐
|
|
156
|
+
│ TypeScript / JavaScript Core │ │ WASM Compute Engine (Future) │
|
|
157
|
+
│ Computational Engine │ │ Optimized BLAS / arithmetic │
|
|
158
|
+
└─────────────────────────────────┘ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─┘
|
|
161
159
|
```
|
|
162
160
|
|
|
163
161
|
Pure TypeScript implementation built from scratch for correctness and NumPy compatibility.
|
|
@@ -239,7 +237,7 @@ arr.sum(); // Type: number
|
|
|
239
237
|
|
|
240
238
|
| Feature | numpy-ts | numjs | ndarray | TensorFlow.js |
|
|
241
239
|
|---------|----------|-------|---------|---------------|
|
|
242
|
-
| NumPy API Coverage |
|
|
240
|
+
| NumPy API Coverage | 218/333 (65%) | ~20% | Different | ML-focused |
|
|
243
241
|
| TypeScript Native | ✅ Full | Partial | ❌ No | ✅ Yes |
|
|
244
242
|
| NumPy Validated | ✅ 1365+ tests | Mostly | ❌ No | ❌ No |
|
|
245
243
|
| .npy/.npz Files | ✅ v1/v2/v3 | ❌ No | ❌ No | ❌ No |
|