numpy-ts 0.9.0 → 0.11.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 +45 -26
- 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 +663 -37
- package/dist/types/core/storage.d.ts +15 -4
- package/dist/types/index.d.ts +41 -1
- package/dist/types/ops/advanced.d.ts +7 -0
- package/dist/types/ops/arithmetic.d.ts +53 -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 +6 -5
- package/dist/types/ops/logic.d.ts +219 -0
- package/dist/types/ops/random.d.ts +136 -0
- package/dist/types/ops/reduction.d.ts +26 -18
- package/dist/types/ops/rounding.d.ts +3 -0
- package/dist/types/ops/sorting.d.ts +8 -0
- package/dist/types/ops/statistics.d.ts +108 -0
- package/dist/types/ops/trig.d.ts +6 -0
- package/package.json +2 -2
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,8 +24,8 @@ npm install numpy-ts
|
|
|
24
24
|
|
|
25
25
|
## Why numpy-ts?
|
|
26
26
|
|
|
27
|
-
- **📊 Extensive API** — **
|
|
28
|
-
- **✅ NumPy-validated** —
|
|
27
|
+
- **📊 Extensive API** — **336 of 507 NumPy functions (66.3% coverage)**
|
|
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
|
|
31
31
|
- **🎯 Zero dependencies** — Pure TypeScript, no heavy external libraries
|
|
@@ -62,32 +62,38 @@ Progress toward complete NumPy API compatibility:
|
|
|
62
62
|
|
|
63
63
|
| Category | Complete | Total | Status |
|
|
64
64
|
|----------|----------|-------|--------|
|
|
65
|
-
| **Arithmetic** |
|
|
66
|
-
| **Array Creation** | 32/32 | 100% | ✅ |
|
|
67
|
-
| **Array Manipulation** | 35/35 | 100% | ✅ |
|
|
68
|
-
| **Bit Operations** | 9/9 | 100% | ✅ |
|
|
65
|
+
| **Arithmetic** | 29/29 | 100% | ✅ |
|
|
69
66
|
| **Broadcasting** | 3/3 | 100% | ✅ |
|
|
70
67
|
| **Comparison** | 10/10 | 100% | ✅ |
|
|
71
68
|
| **Exponential** | 9/9 | 100% | ✅ |
|
|
72
69
|
| **Gradient** | 4/4 | 100% | ✅ |
|
|
73
|
-
| **Hyperbolic** |
|
|
70
|
+
| **Hyperbolic** | 9/9 | 100% | ✅ |
|
|
74
71
|
| **I/O** | 8/8 | 100% | ✅ |
|
|
75
|
-
| **Indexing** |
|
|
76
|
-
| **
|
|
77
|
-
| **Linear Algebra (linalg)** | 19/19 | 100% | ✅ |
|
|
78
|
-
| **Reductions** | 30/30 | 100% | ✅ |
|
|
72
|
+
| **Indexing** | 21/21 | 100% | ✅ |
|
|
73
|
+
| **Logic** | 24/24 | 100% | ✅ |
|
|
79
74
|
| **Rounding** | 7/7 | 100% | ✅ |
|
|
80
|
-
| **Searching** |
|
|
81
|
-
| **Set Operations** | 7/7 | 100% | ✅ |
|
|
75
|
+
| **Searching** | 7/7 | 100% | ✅ |
|
|
82
76
|
| **Sorting** | 6/6 | 100% | ✅ |
|
|
83
|
-
| **Trigonometric** |
|
|
77
|
+
| **Trigonometric** | 16/16 | 100% | ✅ |
|
|
78
|
+
| **Reductions** | 34/36 | 94% | 🟡 |
|
|
79
|
+
| **Array Creation** | 33/35 | 94% | 🟡 |
|
|
80
|
+
| **Array Manipulation** | 37/46 | 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% | 🟡 |
|
|
87
|
+
| **Other Math** | 5/15 | 33% | 🔴 |
|
|
88
|
+
| **Random** | 17/53 | 32% | 🔴 |
|
|
89
|
+
| **Utilities** | 4/16 | 25% | 🔴 |
|
|
84
90
|
| **FFT** | 0/18 | 0% | 🔴 |
|
|
85
|
-
| **
|
|
86
|
-
| **
|
|
87
|
-
| **
|
|
88
|
-
| **
|
|
91
|
+
| **Polynomials** | 0/10 | 0% | 🔴 |
|
|
92
|
+
| **String/Formatting** | 0/10 | 0% | 🔴 |
|
|
93
|
+
| **Type Checking** | 0/7 | 0% | 🔴 |
|
|
94
|
+
| **Unplanned** | 0/25 | 0% | 🔴 |
|
|
89
95
|
|
|
90
|
-
**Overall:
|
|
96
|
+
**Overall: 336/507 functions (66.3% complete)**
|
|
91
97
|
|
|
92
98
|
See the complete [API Reference](docs/API-REFERENCE.md) for detailed function list.
|
|
93
99
|
|
|
@@ -113,16 +119,29 @@ NumPy-compatible type system with automatic promotion:
|
|
|
113
119
|
| `uint8` | ✅ | ✅ | |
|
|
114
120
|
| **Other Numeric** ||||
|
|
115
121
|
| `bool` | ✅ | ✅ | Stored as uint8 |
|
|
116
|
-
| `complex64` | ✅ |
|
|
117
|
-
| `complex128` | ✅ |
|
|
122
|
+
| `complex64` | ✅ | ✅ | |
|
|
123
|
+
| `complex128` | ✅ | ✅ | |
|
|
118
124
|
| **Non-Numeric** ||||
|
|
119
125
|
| `str_` | ✅ | ❌ | Not planned |
|
|
120
126
|
| `bytes_` | ✅ | ❌ | Not planned |
|
|
121
127
|
| `object_` | ✅ | ❌ | Not planned |
|
|
122
|
-
| `datetime64` | ✅ | ❌ |
|
|
123
|
-
| `timedelta64` | ✅ | ❌ |
|
|
128
|
+
| `datetime64` | ✅ | ❌ | Not planned |
|
|
129
|
+
| `timedelta64` | ✅ | ❌ | Not planned |
|
|
124
130
|
|
|
125
|
-
**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.
|
|
126
145
|
|
|
127
146
|
### NumPy Memory Model
|
|
128
147
|
|
|
@@ -237,7 +256,7 @@ arr.sum(); // Type: number
|
|
|
237
256
|
|
|
238
257
|
| Feature | numpy-ts | numjs | ndarray | TensorFlow.js |
|
|
239
258
|
|---------|----------|-------|---------|---------------|
|
|
240
|
-
| NumPy API Coverage |
|
|
259
|
+
| NumPy API Coverage | 336/507 (66%) | ~20% | Different | ML-focused |
|
|
241
260
|
| TypeScript Native | ✅ Full | Partial | ❌ No | ✅ Yes |
|
|
242
261
|
| NumPy Validated | ✅ 1365+ tests | Mostly | ❌ No | ❌ No |
|
|
243
262
|
| .npy/.npz Files | ✅ v1/v2/v3 | ❌ No | ❌ No | ❌ No |
|