numpy-ts 0.10.0 → 0.12.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 +37 -24
- package/dist/numpy-ts.browser.js +2 -2
- package/dist/numpy-ts.esm.js +2 -2
- package/dist/numpy-ts.node-io.cjs +3 -3
- package/dist/numpy-ts.node-io.cjs.map +4 -4
- package/dist/numpy-ts.node-io.mjs +3 -3
- 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/complex.d.ts +94 -0
- package/dist/types/core/dtype.d.ts +62 -3
- package/dist/types/core/ndarray.d.ts +950 -52
- package/dist/types/core/storage.d.ts +15 -4
- package/dist/types/index.d.ts +6 -5
- package/dist/types/ops/advanced.d.ts +65 -0
- package/dist/types/ops/arithmetic.d.ts +103 -0
- package/dist/types/ops/bitwise.d.ts +30 -0
- package/dist/types/ops/comparison.d.ts +6 -0
- package/dist/types/ops/complex.d.ts +65 -0
- package/dist/types/ops/exponential.d.ts +9 -0
- package/dist/types/ops/hyperbolic.d.ts +6 -0
- package/dist/types/ops/linalg.d.ts +130 -5
- package/dist/types/ops/logic.d.ts +35 -17
- package/dist/types/ops/reduction.d.ts +34 -18
- package/dist/types/ops/rounding.d.ts +3 -0
- package/dist/types/ops/sets.d.ts +49 -0
- package/dist/types/ops/shape.d.ts +13 -0
- package/dist/types/ops/statistics.d.ts +22 -0
- package/dist/types/ops/trig.d.ts +6 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|

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

|
|
6
|
-

|
|
7
7
|
|
|
8
8
|
```
|
|
9
9
|
███╗ ██╗██╗ ██╗███╗ ███╗██████╗ ██╗ ██╗ ████████╗███████╗
|
|
@@ -24,7 +24,7 @@ npm install numpy-ts
|
|
|
24
24
|
|
|
25
25
|
## Why numpy-ts?
|
|
26
26
|
|
|
27
|
-
- **📊 Extensive API** — **
|
|
27
|
+
- **📊 Extensive API** — **411 of 507 NumPy functions (81.1% coverage)**
|
|
28
28
|
- **✅ NumPy-validated** — 3000+ test cases cross-validated against Python NumPy
|
|
29
29
|
- **🔒 Type-safe** — Full TypeScript support with shape and dtype inference
|
|
30
30
|
- **🌐 Universal** — Works in Node.js and browsers with .npy/.npz file support
|
|
@@ -63,6 +63,9 @@ Progress toward complete NumPy API compatibility:
|
|
|
63
63
|
| Category | Complete | Total | Status |
|
|
64
64
|
|----------|----------|-------|--------|
|
|
65
65
|
| **Arithmetic** | 29/29 | 100% | ✅ |
|
|
66
|
+
| **Array Creation** | 35/35 | 100% | ✅ |
|
|
67
|
+
| **Array Manipulation** | 46/46 | 100% | ✅ |
|
|
68
|
+
| **Bit Operations** | 13/13 | 100% | ✅ |
|
|
66
69
|
| **Broadcasting** | 3/3 | 100% | ✅ |
|
|
67
70
|
| **Comparison** | 10/10 | 100% | ✅ |
|
|
68
71
|
| **Exponential** | 9/9 | 100% | ✅ |
|
|
@@ -70,30 +73,27 @@ Progress toward complete NumPy API compatibility:
|
|
|
70
73
|
| **Hyperbolic** | 9/9 | 100% | ✅ |
|
|
71
74
|
| **I/O** | 8/8 | 100% | ✅ |
|
|
72
75
|
| **Indexing** | 21/21 | 100% | ✅ |
|
|
76
|
+
| **Linear Algebra** | 15/15 | 100% | ✅ |
|
|
77
|
+
| **Linear Algebra (linalg)** | 31/31 | 100% | ✅ |
|
|
73
78
|
| **Logic** | 24/24 | 100% | ✅ |
|
|
79
|
+
| **Other Math** | 15/15 | 100% | ✅ |
|
|
80
|
+
| **Polynomials** | 10/10 | 100% | ✅ |
|
|
81
|
+
| **Reductions** | 36/36 | 100% | ✅ |
|
|
74
82
|
| **Rounding** | 7/7 | 100% | ✅ |
|
|
75
83
|
| **Searching** | 7/7 | 100% | ✅ |
|
|
84
|
+
| **Set Operations** | 12/12 | 100% | ✅ |
|
|
76
85
|
| **Sorting** | 6/6 | 100% | ✅ |
|
|
86
|
+
| **Statistics** | 11/11 | 100% | ✅ |
|
|
77
87
|
| **Trigonometric** | 16/16 | 100% | ✅ |
|
|
78
|
-
| **
|
|
79
|
-
| **
|
|
80
|
-
| **
|
|
81
|
-
| **Statistics** | 9/12 | 75% | 🟡 |
|
|
82
|
-
| **Bit Operations** | 9/13 | 69% | 🟡 |
|
|
83
|
-
| **NDArray Methods** | 34/53 | 64% | 🟡 |
|
|
84
|
-
| **Linear Algebra (linalg)** | 19/31 | 61% | 🟡 |
|
|
85
|
-
| **Linear Algebra** | 9/15 | 60% | 🟡 |
|
|
86
|
-
| **Set Operations** | 7/12 | 58% | 🟡 |
|
|
88
|
+
| **Type Checking** | 7/7 | 100% | ✅ |
|
|
89
|
+
| **NDArray Methods** | 40/53 | 75% | 🟡 |
|
|
90
|
+
| **Utilities** | 10/16 | 62% | 🟡 |
|
|
87
91
|
| **Random** | 17/53 | 32% | 🔴 |
|
|
88
|
-
| **Utilities** | 4/16 | 25% | 🔴 |
|
|
89
92
|
| **FFT** | 0/18 | 0% | 🔴 |
|
|
90
|
-
| **Other Math** | 0/15 | 0% | 🔴 |
|
|
91
|
-
| **Polynomials** | 0/10 | 0% | 🔴 |
|
|
92
93
|
| **String/Formatting** | 0/10 | 0% | 🔴 |
|
|
93
|
-
| **
|
|
94
|
-
| **Unplanned** | 0/25 | 0% | 🔴 |
|
|
94
|
+
| **Unplanned** | 0/26 | 0% | 🔴 |
|
|
95
95
|
|
|
96
|
-
**Overall:
|
|
96
|
+
**Overall: 411/507 functions (81.1% complete)**
|
|
97
97
|
|
|
98
98
|
See the complete [API Reference](docs/API-REFERENCE.md) for detailed function list.
|
|
99
99
|
|
|
@@ -119,16 +119,29 @@ NumPy-compatible type system with automatic promotion:
|
|
|
119
119
|
| `uint8` | ✅ | ✅ | |
|
|
120
120
|
| **Other Numeric** ||||
|
|
121
121
|
| `bool` | ✅ | ✅ | Stored as uint8 |
|
|
122
|
-
| `complex64` | ✅ |
|
|
123
|
-
| `complex128` | ✅ |
|
|
122
|
+
| `complex64` | ✅ | ✅ | |
|
|
123
|
+
| `complex128` | ✅ | ✅ | |
|
|
124
124
|
| **Non-Numeric** ||||
|
|
125
125
|
| `str_` | ✅ | ❌ | Not planned |
|
|
126
126
|
| `bytes_` | ✅ | ❌ | Not planned |
|
|
127
127
|
| `object_` | ✅ | ❌ | Not planned |
|
|
128
|
-
| `datetime64` | ✅ | ❌ |
|
|
129
|
-
| `timedelta64` | ✅ | ❌ |
|
|
128
|
+
| `datetime64` | ✅ | ❌ | Not planned |
|
|
129
|
+
| `timedelta64` | ✅ | ❌ | Not planned |
|
|
130
130
|
|
|
131
|
-
**Supported:
|
|
131
|
+
**Supported: 13/20 numeric dtypes**
|
|
132
|
+
|
|
133
|
+
### Intentional Divergences from NumPy
|
|
134
|
+
|
|
135
|
+
numpy-ts focuses on numeric array computing. The following NumPy features are **not planned**:
|
|
136
|
+
|
|
137
|
+
| Feature | Why Not Included |
|
|
138
|
+
|---------|------------------|
|
|
139
|
+
| **Datetime/Timedelta** (`datetime64`, `timedelta64`) | JS has native `Date`; libraries like [date-fns](https://date-fns.org/) handle time math better |
|
|
140
|
+
| **F-order memory layout** | Exists in NumPy for Fortran/BLAS interop, which doesn't exist in JS |
|
|
141
|
+
| **Object dtype** (`object_`) | Defeats the purpose of typed arrays; use regular JS arrays instead |
|
|
142
|
+
| **String/Bytes dtypes** (`str_`, `bytes_`, `U`, `S`) | JS strings are first-class; no need for fixed-width string arrays |
|
|
143
|
+
|
|
144
|
+
These omissions keep the library focused and the bundle small. For string manipulation, datetime math, or heterogeneous data, use native JS/TS constructs alongside numpy-ts.
|
|
132
145
|
|
|
133
146
|
### NumPy Memory Model
|
|
134
147
|
|
|
@@ -243,9 +256,9 @@ arr.sum(); // Type: number
|
|
|
243
256
|
|
|
244
257
|
| Feature | numpy-ts | numjs | ndarray | TensorFlow.js |
|
|
245
258
|
|---------|----------|-------|---------|---------------|
|
|
246
|
-
| NumPy API Coverage |
|
|
259
|
+
| NumPy API Coverage | 411/507 (81%) | ~20% | Different | ML-focused |
|
|
247
260
|
| TypeScript Native | ✅ Full | Partial | ❌ No | ✅ Yes |
|
|
248
|
-
| NumPy Validated | ✅
|
|
261
|
+
| NumPy Validated | ✅ 4500+ tests | Mostly | ❌ No | ❌ No |
|
|
249
262
|
| .npy/.npz Files | ✅ v1/v2/v3 | ❌ No | ❌ No | ❌ No |
|
|
250
263
|
| Broadcasting | ✅ Full | Limited | Limited | ✅ Full |
|
|
251
264
|
| Bundle Size | <50kb | ~60kb | ~5kb | >100kb |
|