numbl 0.4.6 → 0.4.7
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/dist-cli/cli.js +2363 -220
- package/dist-graphics/graphics/FigureView.d.ts +6 -0
- package/dist-graphics/graphics/SurfView.d.ts +18 -0
- package/dist-graphics/graphics/axisLimits.d.ts +23 -0
- package/dist-graphics/graphics/drawPlot.d.ts +2 -0
- package/dist-graphics/graphics/exportFigureHdf5.d.ts +21 -0
- package/dist-graphics/graphics/figureHashTransport.d.ts +24 -0
- package/dist-graphics/graphics/figureHdf5Schema.d.ts +19 -0
- package/dist-graphics/graphics/figureUpload.d.ts +45 -0
- package/dist-graphics/graphics/figuresReducer.d.ts +86 -0
- package/dist-graphics/graphics/importFigureHdf5.d.ts +9 -0
- package/dist-graphics/graphics/openInFigureViewer.d.ts +26 -0
- package/dist-graphics/graphics/plotHelpers.d.ts +6 -0
- package/dist-graphics/graphics/plotLegend.d.ts +2 -0
- package/dist-graphics/graphics/plotMarkers.d.ts +2 -0
- package/dist-graphics/graphics/restoreNaNs.d.ts +2 -0
- package/dist-graphics/graphics/surfColormap.d.ts +2 -0
- package/dist-graphics/graphics/types.d.ts +423 -0
- package/dist-graphics/graphics/uihtmlSrcDoc.d.ts +23 -0
- package/dist-graphics/graphics-lib.d.ts +21 -0
- package/dist-graphics/index.js +35334 -0
- package/dist-lib/lib.js +2349 -216
- package/dist-lib/numbl-core/interpreter/builtins/gallery.d.ts +7 -0
- package/dist-lib/numbl-core/interpreter/builtins/geometry.d.ts +3 -3
- package/dist-lib/numbl-core/interpreter/builtins/graph.d.ts +29 -0
- package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +2 -0
- package/dist-lib/numbl-core/interpreter/interpreter.d.ts +5 -0
- package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +14 -1
- package/dist-lib/numbl-core/interpreter/interpreterFunctions.d.ts +6 -0
- package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +4 -0
- package/dist-lib/numbl-core/interpreter/types.d.ts +13 -0
- package/dist-lib/numbl-core/lowering/classInfo.d.ts +19 -2
- package/dist-lib/numbl-core/native/geometry-bridge.d.ts +10 -0
- package/dist-lib/numbl-core/parser/ArgumentsParser.d.ts +6 -1
- package/dist-lib/numbl-core/runtime/constructors.d.ts +2 -1
- package/dist-lib/numbl-core/runtime/runtime.d.ts +2 -1
- package/dist-lib/numbl-core/runtime/runtimeMemberAccess.d.ts +1 -1
- package/dist-lib/numbl-core/version.d.ts +1 -1
- package/dist-plot-viewer/assets/hdf5_hl-C9YUKPMe.js +24296 -0
- package/dist-plot-viewer/assets/index-YeXWXIxH.js +4504 -0
- package/dist-plot-viewer/index.html +1 -1
- package/dist-site-viewer/assets/hdf5_hl-C9YUKPMe.js +24296 -0
- package/dist-site-viewer/assets/index-RucHpf4b.js +4826 -0
- package/dist-site-viewer/assets/numbl-worker-IO39kohI.js +5228 -0
- package/dist-site-viewer/index.html +1 -1
- package/native/lapack_svd.cpp +50 -0
- package/package.json +21 -2
- package/dist-plot-viewer/assets/index-D4grNz8m.js +0 -4504
- package/dist-site-viewer/assets/index-B2mCFC55.js +0 -4826
- package/dist-site-viewer/assets/numbl-worker-DWZE29ck.js +0 -5116
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<title>numbl project</title>
|
|
8
8
|
<!-- numbl:base -->
|
|
9
9
|
<script src="./coi-serviceworker.js"></script>
|
|
10
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
+
<script type="module" crossorigin src="./assets/index-RucHpf4b.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="./assets/index-D5YY8PKx.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
package/native/lapack_svd.cpp
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
#include "numbl_addon_common.h"
|
|
17
17
|
#include <string>
|
|
18
|
+
#include <cmath>
|
|
19
|
+
#include <limits>
|
|
18
20
|
|
|
19
21
|
// ── svd() ─────────────────────────────────────────────────────────────────────
|
|
20
22
|
|
|
@@ -83,6 +85,28 @@ Napi::Value Svd(const Napi::CallbackInfo& info) {
|
|
|
83
85
|
double* u_ptr = (jobz == 'N') ? nullptr : u_vec.data();
|
|
84
86
|
double* vt_ptr = (jobz == 'N') ? nullptr : vt_vec.data();
|
|
85
87
|
|
|
88
|
+
// MATLAB's svd/norm return NaN for non-finite input rather than erroring.
|
|
89
|
+
// LAPACK's dgesdd instead reports an illegal argument (and OpenBLAS prints
|
|
90
|
+
// xerbla noise to stderr), so short-circuit here with NaN-filled outputs.
|
|
91
|
+
{
|
|
92
|
+
bool finite = true;
|
|
93
|
+
for (int i = 0; i < m * n; i++)
|
|
94
|
+
if (!std::isfinite(a[i])) { finite = false; break; }
|
|
95
|
+
if (!finite) {
|
|
96
|
+
const double qnan = std::numeric_limits<double>::quiet_NaN();
|
|
97
|
+
std::fill(s.begin(), s.end(), qnan);
|
|
98
|
+
auto result = Napi::Object::New(env);
|
|
99
|
+
result.Set("S", vecToF64(env, s));
|
|
100
|
+
if (computeUV) {
|
|
101
|
+
std::fill(u_vec.begin(), u_vec.end(), qnan);
|
|
102
|
+
result.Set("U", vecToF64(env, u_vec));
|
|
103
|
+
std::vector<double> v_nan(vt_vec.size(), qnan);
|
|
104
|
+
result.Set("V", vecToF64(env, v_nan));
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
86
110
|
int lwork = -1;
|
|
87
111
|
double work_query = 0.0;
|
|
88
112
|
std::vector<int> iwork(8 * k);
|
|
@@ -192,6 +216,32 @@ Napi::Value SvdComplex(const Napi::CallbackInfo& info) {
|
|
|
192
216
|
lapack_complex_double* u_ptr = (jobz == 'N') ? nullptr : u_vec.data();
|
|
193
217
|
lapack_complex_double* vt_ptr = (jobz == 'N') ? nullptr : vt_vec.data();
|
|
194
218
|
|
|
219
|
+
// Match MATLAB: non-finite input yields NaN outputs rather than a LAPACK
|
|
220
|
+
// illegal-argument error (and OpenBLAS xerbla noise on stderr).
|
|
221
|
+
{
|
|
222
|
+
bool finite = true;
|
|
223
|
+
for (int i = 0; i < m * n; i++)
|
|
224
|
+
if (!std::isfinite(a[i].real) || !std::isfinite(a[i].imag)) {
|
|
225
|
+
finite = false; break;
|
|
226
|
+
}
|
|
227
|
+
if (!finite) {
|
|
228
|
+
const double qnan = std::numeric_limits<double>::quiet_NaN();
|
|
229
|
+
std::vector<double> s_nan(k, qnan);
|
|
230
|
+
auto result = Napi::Object::New(env);
|
|
231
|
+
result.Set("S", vecToF64(env, s_nan));
|
|
232
|
+
if (computeUV) {
|
|
233
|
+
int u_size = (jobz == 'S') ? m * k : m * m;
|
|
234
|
+
int v_size = (jobz == 'S') ? k * n : n * n;
|
|
235
|
+
std::vector<double> u_nan(u_size, qnan), v_nan(v_size, qnan);
|
|
236
|
+
result.Set("URe", vecToF64(env, u_nan));
|
|
237
|
+
result.Set("UIm", vecToF64(env, u_nan));
|
|
238
|
+
result.Set("VRe", vecToF64(env, v_nan));
|
|
239
|
+
result.Set("VIm", vecToF64(env, v_nan));
|
|
240
|
+
}
|
|
241
|
+
return result;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
195
245
|
// rwork size for zgesdd
|
|
196
246
|
int rwork_size;
|
|
197
247
|
if (jobz == 'N') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "numbl",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Run .m source files in the browser and on the command line by compiling to JavaScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
".": {
|
|
25
25
|
"types": "./dist-lib/lib.d.ts",
|
|
26
26
|
"import": "./dist-lib/lib.js"
|
|
27
|
+
},
|
|
28
|
+
"./graphics": {
|
|
29
|
+
"types": "./dist-graphics/graphics-lib.d.ts",
|
|
30
|
+
"import": "./dist-graphics/index.js"
|
|
27
31
|
}
|
|
28
32
|
},
|
|
29
33
|
"bin": {
|
|
@@ -31,6 +35,7 @@
|
|
|
31
35
|
},
|
|
32
36
|
"files": [
|
|
33
37
|
"dist-lib/",
|
|
38
|
+
"dist-graphics/",
|
|
34
39
|
"dist-cli/",
|
|
35
40
|
"dist-plot-viewer/",
|
|
36
41
|
"dist-site-viewer/",
|
|
@@ -52,6 +57,7 @@
|
|
|
52
57
|
"build:web": "npm run build:snippets && npm run bundle:stdlib && tsc -b && vite build",
|
|
53
58
|
"build:lib": "npm run build:snippets && npm run bundle:stdlib && esbuild src/lib.ts --bundle --platform=node --format=esm --outfile=dist-lib/lib.js --packages=external --loader:.wasm=file && tsc -p tsconfig.lib.json",
|
|
54
59
|
"build:cli": "npm run build:snippets && npm run bundle:stdlib && esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist-cli/cli.js --packages=external --loader:.wasm=file",
|
|
60
|
+
"build:graphics": "esbuild src/graphics-lib.ts --bundle --platform=browser --format=esm --outfile=dist-graphics/index.js --external:react --external:react-dom --external:react/jsx-runtime --external:h5wasm --jsx=automatic && tsc -p tsconfig.graphics.json",
|
|
55
61
|
"install": "true",
|
|
56
62
|
"build:addon": "node-gyp rebuild",
|
|
57
63
|
"format": "prettier --write .",
|
|
@@ -69,11 +75,12 @@
|
|
|
69
75
|
"update-readme": "tsx scripts/update-readme-usage.ts",
|
|
70
76
|
"check-readme": "tsx scripts/update-readme-usage.ts --check",
|
|
71
77
|
"bump": "tsx scripts/bump-version.ts",
|
|
72
|
-
"prepublishOnly": "npm run build:lib && npm run build:cli && npm run build:plot-viewer && npm run build:site-viewer",
|
|
78
|
+
"prepublishOnly": "npm run build:lib && npm run build:graphics && npm run build:cli && npm run build:plot-viewer && npm run build:site-viewer",
|
|
73
79
|
"prepare": "husky"
|
|
74
80
|
},
|
|
75
81
|
"dependencies": {
|
|
76
82
|
"fflate": "^0.8.2",
|
|
83
|
+
"h5wasm": "^0.10.3",
|
|
77
84
|
"node-addon-api": "^8.3.0",
|
|
78
85
|
"pako": "^2.1.0",
|
|
79
86
|
"qhull-wasm": "^0.0.1",
|
|
@@ -82,6 +89,18 @@
|
|
|
82
89
|
"remark-gfm": "^4.0.1",
|
|
83
90
|
"three": "^0.183.2"
|
|
84
91
|
},
|
|
92
|
+
"peerDependencies": {
|
|
93
|
+
"react": ">=18",
|
|
94
|
+
"react-dom": ">=18"
|
|
95
|
+
},
|
|
96
|
+
"peerDependenciesMeta": {
|
|
97
|
+
"react": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"react-dom": {
|
|
101
|
+
"optional": true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
85
104
|
"devDependencies": {
|
|
86
105
|
"@emotion/react": "^11.14.0",
|
|
87
106
|
"@emotion/styled": "^11.14.1",
|