@danielsimonjr/mathts-functions 0.39.0 → 0.40.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/dist/geometry/geometry-extra.d.ts +30 -0
- package/dist/geometry/geometry-extra.d.ts.map +1 -1
- package/dist/geometry/intersect3d.d.ts +57 -0
- package/dist/geometry/intersect3d.d.ts.map +1 -0
- package/dist/graph/community-coloring.d.ts +129 -0
- package/dist/graph/community-coloring.d.ts.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +600 -221
- package/dist/typed/graph.d.ts +12 -2
- package/dist/typed/graph.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3402,10 +3402,10 @@ async function fftGpuDispatchImpl(real, imag, inverse, options) {
|
|
|
3402
3402
|
staging.unmap();
|
|
3403
3403
|
const outRe = new Float64Array(n);
|
|
3404
3404
|
const outIm = new Float64Array(n);
|
|
3405
|
-
const
|
|
3405
|
+
const scale4 = inverse ? 1 / n : 1;
|
|
3406
3406
|
for (let i = 0; i < n; i++) {
|
|
3407
|
-
outRe[i] = packed[i * 2] *
|
|
3408
|
-
outIm[i] = packed[i * 2 + 1] *
|
|
3407
|
+
outRe[i] = packed[i * 2] * scale4;
|
|
3408
|
+
outIm[i] = packed[i * 2 + 1] * scale4;
|
|
3409
3409
|
}
|
|
3410
3410
|
return { real: outRe, imag: outIm };
|
|
3411
3411
|
} catch {
|
|
@@ -7014,7 +7014,7 @@ function digammaScalar(x) {
|
|
|
7014
7014
|
return result;
|
|
7015
7015
|
}
|
|
7016
7016
|
function besselK01(x) {
|
|
7017
|
-
const
|
|
7017
|
+
const EPS5 = 1e-16;
|
|
7018
7018
|
const xi = 1 / x;
|
|
7019
7019
|
const xi2 = 2 * xi;
|
|
7020
7020
|
let rkmu;
|
|
@@ -7037,7 +7037,7 @@ function besselK01(x) {
|
|
|
7037
7037
|
const del = c * ff;
|
|
7038
7038
|
sum3 += del;
|
|
7039
7039
|
sum1 += c * (p - i * ff);
|
|
7040
|
-
if (Math.abs(del) < Math.abs(sum3) *
|
|
7040
|
+
if (Math.abs(del) < Math.abs(sum3) * EPS5) break;
|
|
7041
7041
|
}
|
|
7042
7042
|
rkmu = sum3;
|
|
7043
7043
|
rk1 = sum1 * xi2;
|
|
@@ -7066,7 +7066,7 @@ function besselK01(x) {
|
|
|
7066
7066
|
h += delh;
|
|
7067
7067
|
const dels = q * delh;
|
|
7068
7068
|
s += dels;
|
|
7069
|
-
if (Math.abs(dels / s) <
|
|
7069
|
+
if (Math.abs(dels / s) < EPS5) break;
|
|
7070
7070
|
}
|
|
7071
7071
|
h = a1 * h;
|
|
7072
7072
|
rkmu = Math.sqrt(Math.PI / (2 * x)) * Math.exp(-x) / s;
|
|
@@ -8403,26 +8403,26 @@ var betaPDF = mathTyped11("betaPDF", {
|
|
|
8403
8403
|
return Promise.resolve(out);
|
|
8404
8404
|
}
|
|
8405
8405
|
});
|
|
8406
|
-
function gammaPDFScalar(x, shape,
|
|
8407
|
-
if (shape <= 0 ||
|
|
8406
|
+
function gammaPDFScalar(x, shape, scale4) {
|
|
8407
|
+
if (shape <= 0 || scale4 <= 0) return NaN;
|
|
8408
8408
|
if (x <= 0) return 0;
|
|
8409
8409
|
return Math.exp(
|
|
8410
|
-
(shape - 1) * Math.log(x) - x /
|
|
8410
|
+
(shape - 1) * Math.log(x) - x / scale4 - _lgammaD(shape) - shape * Math.log(scale4)
|
|
8411
8411
|
);
|
|
8412
8412
|
}
|
|
8413
8413
|
var gammaPDF = mathTyped11("gammaPDF", {
|
|
8414
|
-
"number, number, number": (x, shape,
|
|
8415
|
-
"Float64Array, number, number": (x, shape,
|
|
8414
|
+
"number, number, number": (x, shape, scale4) => gammaPDFScalar(x, shape, scale4),
|
|
8415
|
+
"Float64Array, number, number": (x, shape, scale4) => {
|
|
8416
8416
|
const out = new Float64Array(x.length);
|
|
8417
8417
|
const lgShape = _lgammaD(shape);
|
|
8418
|
-
const logScale = Math.log(
|
|
8418
|
+
const logScale = Math.log(scale4);
|
|
8419
8419
|
const logConstant = lgShape + shape * logScale;
|
|
8420
8420
|
for (let i = 0; i < x.length; i++) {
|
|
8421
8421
|
const xi = x[i];
|
|
8422
8422
|
if (xi <= 0) {
|
|
8423
8423
|
out[i] = 0;
|
|
8424
8424
|
} else {
|
|
8425
|
-
out[i] = Math.exp((shape - 1) * Math.log(xi) - xi /
|
|
8425
|
+
out[i] = Math.exp((shape - 1) * Math.log(xi) - xi / scale4 - logConstant);
|
|
8426
8426
|
}
|
|
8427
8427
|
}
|
|
8428
8428
|
return Promise.resolve(out);
|
|
@@ -8528,18 +8528,18 @@ import { computePool as computePool7 } from "@danielsimonjr/mathts-parallel";
|
|
|
8528
8528
|
var GEOMETRY_WASM_THRESHOLD = 32;
|
|
8529
8529
|
var HULL3D_WASM_THRESHOLD = 1024;
|
|
8530
8530
|
function angle2D(v1, v2) {
|
|
8531
|
-
const
|
|
8531
|
+
const dot8 = v1[0] * v2[0] + v1[1] * v2[1];
|
|
8532
8532
|
const mag1 = Math.sqrt(v1[0] ** 2 + v1[1] ** 2);
|
|
8533
8533
|
const mag2 = Math.sqrt(v2[0] ** 2 + v2[1] ** 2);
|
|
8534
8534
|
if (mag1 === 0 || mag2 === 0) return NaN;
|
|
8535
|
-
return Math.acos(Math.max(-1, Math.min(1,
|
|
8535
|
+
return Math.acos(Math.max(-1, Math.min(1, dot8 / (mag1 * mag2))));
|
|
8536
8536
|
}
|
|
8537
8537
|
function angle3D(v1, v2) {
|
|
8538
|
-
const
|
|
8538
|
+
const dot8 = v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
|
|
8539
8539
|
const mag1 = Math.sqrt(v1[0] ** 2 + v1[1] ** 2 + v1[2] ** 2);
|
|
8540
8540
|
const mag2 = Math.sqrt(v2[0] ** 2 + v2[1] ** 2 + v2[2] ** 2);
|
|
8541
8541
|
if (mag1 === 0 || mag2 === 0) return NaN;
|
|
8542
|
-
return Math.acos(Math.max(-1, Math.min(1,
|
|
8542
|
+
return Math.acos(Math.max(-1, Math.min(1, dot8 / (mag1 * mag2))));
|
|
8543
8543
|
}
|
|
8544
8544
|
function cross3D(a, b) {
|
|
8545
8545
|
return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
|
|
@@ -8583,12 +8583,12 @@ function convexHull(points) {
|
|
|
8583
8583
|
} else {
|
|
8584
8584
|
sorted = points.slice().sort((a, b) => a[0] - b[0] || a[1] - b[1]);
|
|
8585
8585
|
}
|
|
8586
|
-
function
|
|
8586
|
+
function cross3(o, a, b) {
|
|
8587
8587
|
return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
|
8588
8588
|
}
|
|
8589
8589
|
const lower = [];
|
|
8590
8590
|
for (const p of sorted) {
|
|
8591
|
-
while (lower.length >= 2 &&
|
|
8591
|
+
while (lower.length >= 2 && cross3(lower[lower.length - 2], lower[lower.length - 1], p) <= 0) {
|
|
8592
8592
|
lower.pop();
|
|
8593
8593
|
}
|
|
8594
8594
|
lower.push(p);
|
|
@@ -8596,7 +8596,7 @@ function convexHull(points) {
|
|
|
8596
8596
|
const upper = [];
|
|
8597
8597
|
for (let i = sorted.length - 1; i >= 0; i--) {
|
|
8598
8598
|
const p = sorted[i];
|
|
8599
|
-
while (upper.length >= 2 &&
|
|
8599
|
+
while (upper.length >= 2 && cross3(upper[upper.length - 2], upper[upper.length - 1], p) <= 0) {
|
|
8600
8600
|
upper.pop();
|
|
8601
8601
|
}
|
|
8602
8602
|
upper.push(p);
|
|
@@ -8644,15 +8644,15 @@ function reflectVector(v, normal) {
|
|
|
8644
8644
|
const mag = Math.sqrt(normal.reduce((s, c) => s + c * c, 0));
|
|
8645
8645
|
if (mag === 0) return v.slice();
|
|
8646
8646
|
const n = normal.map((c) => c / mag);
|
|
8647
|
-
const
|
|
8648
|
-
return v.map((c, i) => c - 2 *
|
|
8647
|
+
const dot8 = v.reduce((s, c, i) => s + c * n[i], 0);
|
|
8648
|
+
return v.map((c, i) => c - 2 * dot8 * n[i]);
|
|
8649
8649
|
}
|
|
8650
8650
|
function projectVector(v, onto) {
|
|
8651
|
-
const
|
|
8651
|
+
const dot8 = v.reduce((s, c, i) => s + c * onto[i], 0);
|
|
8652
8652
|
const magSq = onto.reduce((s, c) => s + c * c, 0);
|
|
8653
8653
|
if (magSq === 0) return onto.map(() => 0);
|
|
8654
|
-
const
|
|
8655
|
-
return onto.map((c) => c *
|
|
8654
|
+
const scale4 = dot8 / magSq;
|
|
8655
|
+
return onto.map((c) => c * scale4);
|
|
8656
8656
|
}
|
|
8657
8657
|
function distance2D(a, b) {
|
|
8658
8658
|
return Math.sqrt((b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2);
|
|
@@ -8727,10 +8727,10 @@ function centroid(vertices) {
|
|
|
8727
8727
|
let cy = 0;
|
|
8728
8728
|
for (let i = 0; i < n; i++) {
|
|
8729
8729
|
const j = (i + 1) % n;
|
|
8730
|
-
const
|
|
8731
|
-
signedArea +=
|
|
8732
|
-
cx += (vertices[i][0] + vertices[j][0]) *
|
|
8733
|
-
cy += (vertices[i][1] + vertices[j][1]) *
|
|
8730
|
+
const cross3 = vertices[i][0] * vertices[j][1] - vertices[j][0] * vertices[i][1];
|
|
8731
|
+
signedArea += cross3;
|
|
8732
|
+
cx += (vertices[i][0] + vertices[j][0]) * cross3;
|
|
8733
|
+
cy += (vertices[i][1] + vertices[j][1]) * cross3;
|
|
8734
8734
|
}
|
|
8735
8735
|
signedArea /= 2;
|
|
8736
8736
|
cx /= 6 * signedArea;
|
|
@@ -11899,7 +11899,7 @@ var createSolveODE = /* @__PURE__ */ factory(
|
|
|
11899
11899
|
dependencies,
|
|
11900
11900
|
({
|
|
11901
11901
|
typed: typed3,
|
|
11902
|
-
add:
|
|
11902
|
+
add: add4,
|
|
11903
11903
|
subtract: subtract3,
|
|
11904
11904
|
multiply: multiply2,
|
|
11905
11905
|
divide: divide2,
|
|
@@ -12118,7 +12118,7 @@ var createSolveODE = /* @__PURE__ */ factory(
|
|
|
12118
12118
|
const m = Math.min(coeffs.length, stages.length);
|
|
12119
12119
|
let acc = multiply2(coeffs[0], stages[0]);
|
|
12120
12120
|
for (let j = 1; j < m; j++) {
|
|
12121
|
-
acc =
|
|
12121
|
+
acc = add4(acc, multiply2(coeffs[j], stages[j]));
|
|
12122
12122
|
}
|
|
12123
12123
|
return acc;
|
|
12124
12124
|
}
|
|
@@ -12131,14 +12131,14 @@ var createSolveODE = /* @__PURE__ */ factory(
|
|
|
12131
12131
|
h = trimStep(t[n], tf, h);
|
|
12132
12132
|
k.push(f(t[n], y[n]));
|
|
12133
12133
|
for (let i = 1; i < c.length; ++i) {
|
|
12134
|
-
k.push(f(
|
|
12134
|
+
k.push(f(add4(t[n], multiply2(c[i], h)), add4(y[n], multiply2(h, stageCombo(a[i], k)))));
|
|
12135
12135
|
}
|
|
12136
12136
|
const errComb = stageCombo(deltaB, k);
|
|
12137
12137
|
const errArr = Array.isArray(errComb) ? errComb : [errComb];
|
|
12138
12138
|
const TE = max2(abs2(map2(errArr, (X) => isUnit(X) ? X.value : X)));
|
|
12139
12139
|
if (TE < tol && tol / TE > 1 / 4) {
|
|
12140
|
-
t.push(
|
|
12141
|
-
y.push(
|
|
12140
|
+
t.push(add4(t[n], h));
|
|
12141
|
+
y.push(add4(y[n], multiply2(h, stageCombo(b, k))));
|
|
12142
12142
|
n++;
|
|
12143
12143
|
}
|
|
12144
12144
|
let delta = 0.84 * (tol / TE) ** (1 / 5);
|
|
@@ -12219,7 +12219,7 @@ var createSolveODE = /* @__PURE__ */ factory(
|
|
|
12219
12219
|
function _createTrimStep(isForwards) {
|
|
12220
12220
|
const outOfBounds = isForwards ? larger2 : smaller2;
|
|
12221
12221
|
return function(t, tf, h) {
|
|
12222
|
-
const next =
|
|
12222
|
+
const next = add4(t, h);
|
|
12223
12223
|
return outOfBounds(next, tf) ? subtract3(tf, t) : h;
|
|
12224
12224
|
};
|
|
12225
12225
|
}
|
|
@@ -13508,8 +13508,8 @@ function quadprog(H, f, A, b) {
|
|
|
13508
13508
|
let aNorm = 0;
|
|
13509
13509
|
for (let j = 0; j < n; j++) aNorm += A[c][j] * A[c][j];
|
|
13510
13510
|
if (aNorm > 1e-15) {
|
|
13511
|
-
const
|
|
13512
|
-
for (let j = 0; j < n; j++) xNew[j] -=
|
|
13511
|
+
const scale4 = (ax - b[c]) / aNorm;
|
|
13512
|
+
for (let j = 0; j < n; j++) xNew[j] -= scale4 * A[c][j];
|
|
13513
13513
|
}
|
|
13514
13514
|
}
|
|
13515
13515
|
}
|
|
@@ -14716,7 +14716,7 @@ function _betweennessOnce(adj, directed, normalise, seed) {
|
|
|
14716
14716
|
for (let i = 0; i < n; i++) cb[i] *= scaleFactor;
|
|
14717
14717
|
}
|
|
14718
14718
|
if (normalise) {
|
|
14719
|
-
const denom =
|
|
14719
|
+
const denom = (n - 1) * (n - 2);
|
|
14720
14720
|
if (denom > 0) {
|
|
14721
14721
|
for (let i = 0; i < n; i++) cb[i] /= denom;
|
|
14722
14722
|
}
|
|
@@ -14750,7 +14750,7 @@ function _aggregateBetweenness(vectors, aggregation) {
|
|
|
14750
14750
|
}
|
|
14751
14751
|
async function betweennessCentrality(adj, opts) {
|
|
14752
14752
|
const directed = opts?.directed ?? false;
|
|
14753
|
-
const normalise = opts?.normalise ?? true;
|
|
14753
|
+
const normalise = opts?.normalized ?? opts?.normalise ?? true;
|
|
14754
14754
|
const restarts = opts?.restarts ?? 1;
|
|
14755
14755
|
const baseSeed = opts?.restartSeed ?? 0;
|
|
14756
14756
|
const aggregation = opts?.aggregation ?? "mean";
|
|
@@ -14809,9 +14809,9 @@ function _aggregateEigenvector(vectors, aggregation) {
|
|
|
14809
14809
|
const count2 = vectors.length;
|
|
14810
14810
|
const ref = vectors[0];
|
|
14811
14811
|
const aligned = vectors.map((v) => {
|
|
14812
|
-
let
|
|
14813
|
-
for (let i = 0; i < n; i++)
|
|
14814
|
-
if (
|
|
14812
|
+
let dot8 = 0;
|
|
14813
|
+
for (let i = 0; i < n; i++) dot8 += v[i] * ref[i];
|
|
14814
|
+
if (dot8 < 0) {
|
|
14815
14815
|
const flipped = new Float64Array(n);
|
|
14816
14816
|
for (let i = 0; i < n; i++) flipped[i] = -v[i];
|
|
14817
14817
|
return flipped;
|
|
@@ -15347,7 +15347,7 @@ function fDist(d1, d2) {
|
|
|
15347
15347
|
}
|
|
15348
15348
|
function gammaDist(shape, rate = 1) {
|
|
15349
15349
|
if (shape <= 0 || rate <= 0) throw new Error("gammaDist: shape and rate must be positive");
|
|
15350
|
-
const
|
|
15350
|
+
const scale4 = 1 / rate;
|
|
15351
15351
|
return {
|
|
15352
15352
|
pdf: (x) => {
|
|
15353
15353
|
if (x < 0) return 0;
|
|
@@ -15368,7 +15368,7 @@ function gammaDist(shape, rate = 1) {
|
|
|
15368
15368
|
if (p <= 0) return 0;
|
|
15369
15369
|
if (p >= 1) return Infinity;
|
|
15370
15370
|
let lo = 0;
|
|
15371
|
-
let hi = shape *
|
|
15371
|
+
let hi = shape * scale4 * 20;
|
|
15372
15372
|
while (_gammainc(shape, hi * rate) < p) hi *= 2;
|
|
15373
15373
|
for (let i = 0; i < 100; i++) {
|
|
15374
15374
|
const mid = (lo + hi) / 2;
|
|
@@ -15378,13 +15378,13 @@ function gammaDist(shape, rate = 1) {
|
|
|
15378
15378
|
}
|
|
15379
15379
|
return (lo + hi) / 2;
|
|
15380
15380
|
},
|
|
15381
|
-
mean: shape *
|
|
15382
|
-
variance: shape *
|
|
15383
|
-
sample: () => _gammaRandom(shape) *
|
|
15384
|
-
sampleN: (n, opts) => _sampleNDispatch("gamma", [shape,
|
|
15381
|
+
mean: shape * scale4,
|
|
15382
|
+
variance: shape * scale4 * scale4,
|
|
15383
|
+
sample: () => _gammaRandom(shape) * scale4,
|
|
15384
|
+
sampleN: (n, opts) => _sampleNDispatch("gamma", [shape, scale4], n, opts, (count2, rng) => {
|
|
15385
15385
|
const out = new Float64Array(count2);
|
|
15386
15386
|
for (let i = 0; i < count2; i++) {
|
|
15387
|
-
out[i] = _gammaRandomRng(shape, rng) *
|
|
15387
|
+
out[i] = _gammaRandomRng(shape, rng) * scale4;
|
|
15388
15388
|
}
|
|
15389
15389
|
return out;
|
|
15390
15390
|
})
|
|
@@ -16775,9 +16775,9 @@ function principalComponentAnalysis(data, k) {
|
|
|
16775
16775
|
const explained = eigenvalues.map((ev) => totalVar > 0 ? Math.abs(ev) / totalVar : 0);
|
|
16776
16776
|
const scores = centered.map((row2) => {
|
|
16777
16777
|
return eigenvectors.map((ev) => {
|
|
16778
|
-
let
|
|
16779
|
-
for (let j = 0; j < p; j++)
|
|
16780
|
-
return
|
|
16778
|
+
let dot8 = 0;
|
|
16779
|
+
for (let j = 0; j < p; j++) dot8 += row2[j] * ev[j];
|
|
16780
|
+
return dot8;
|
|
16781
16781
|
});
|
|
16782
16782
|
});
|
|
16783
16783
|
return { components: eigenvectors, explained, scores };
|
|
@@ -17304,9 +17304,9 @@ function rowReduce(A, tol = 1e-10) {
|
|
|
17304
17304
|
if (maxRow !== pivotRow) {
|
|
17305
17305
|
[M[pivotRow], M[maxRow]] = [M[maxRow], M[pivotRow]];
|
|
17306
17306
|
}
|
|
17307
|
-
const
|
|
17307
|
+
const scale4 = M[pivotRow][col];
|
|
17308
17308
|
for (let j = col; j < n; j++) {
|
|
17309
|
-
M[pivotRow][j] /=
|
|
17309
|
+
M[pivotRow][j] /= scale4;
|
|
17310
17310
|
}
|
|
17311
17311
|
for (let row2 = 0; row2 < m; row2++) {
|
|
17312
17312
|
if (row2 === pivotRow) continue;
|
|
@@ -17392,30 +17392,30 @@ function hessenbergForm(A) {
|
|
|
17392
17392
|
if (normV < 1e-30) continue;
|
|
17393
17393
|
const beta2 = 2 / normV;
|
|
17394
17394
|
for (let j = k; j < n; j++) {
|
|
17395
|
-
let
|
|
17395
|
+
let dot8 = 0;
|
|
17396
17396
|
for (let i = 0; i < len; i++) {
|
|
17397
|
-
|
|
17397
|
+
dot8 += v[i] * H[k + 1 + i][j];
|
|
17398
17398
|
}
|
|
17399
17399
|
for (let i = 0; i < len; i++) {
|
|
17400
|
-
H[k + 1 + i][j] -= beta2 * v[i] *
|
|
17400
|
+
H[k + 1 + i][j] -= beta2 * v[i] * dot8;
|
|
17401
17401
|
}
|
|
17402
17402
|
}
|
|
17403
17403
|
for (let i = 0; i < n; i++) {
|
|
17404
|
-
let
|
|
17404
|
+
let dot8 = 0;
|
|
17405
17405
|
for (let j = 0; j < len; j++) {
|
|
17406
|
-
|
|
17406
|
+
dot8 += H[i][k + 1 + j] * v[j];
|
|
17407
17407
|
}
|
|
17408
17408
|
for (let j = 0; j < len; j++) {
|
|
17409
|
-
H[i][k + 1 + j] -= beta2 *
|
|
17409
|
+
H[i][k + 1 + j] -= beta2 * dot8 * v[j];
|
|
17410
17410
|
}
|
|
17411
17411
|
}
|
|
17412
17412
|
for (let i = 0; i < n; i++) {
|
|
17413
|
-
let
|
|
17413
|
+
let dot8 = 0;
|
|
17414
17414
|
for (let j = 0; j < len; j++) {
|
|
17415
|
-
|
|
17415
|
+
dot8 += Q2[i][k + 1 + j] * v[j];
|
|
17416
17416
|
}
|
|
17417
17417
|
for (let j = 0; j < len; j++) {
|
|
17418
|
-
Q2[i][k + 1 + j] -= beta2 *
|
|
17418
|
+
Q2[i][k + 1 + j] -= beta2 * dot8 * v[j];
|
|
17419
17419
|
}
|
|
17420
17420
|
}
|
|
17421
17421
|
}
|
|
@@ -17474,8 +17474,8 @@ function matrixInverse(A) {
|
|
|
17474
17474
|
}
|
|
17475
17475
|
if (maxVal < 1e-15) throw new Error("matrixPower: singular matrix cannot be inverted");
|
|
17476
17476
|
if (maxRow !== col) [M[col], M[maxRow]] = [M[maxRow], M[col]];
|
|
17477
|
-
const
|
|
17478
|
-
for (let j = 0; j < 2 * n; j++) M[col][j] /=
|
|
17477
|
+
const scale4 = M[col][col];
|
|
17478
|
+
for (let j = 0; j < 2 * n; j++) M[col][j] /= scale4;
|
|
17479
17479
|
for (let row2 = 0; row2 < n; row2++) {
|
|
17480
17480
|
if (row2 === col) continue;
|
|
17481
17481
|
const factor2 = M[row2][col];
|
|
@@ -17549,10 +17549,10 @@ async function matLogScalingSquaring(A) {
|
|
|
17549
17549
|
}
|
|
17550
17550
|
}
|
|
17551
17551
|
}
|
|
17552
|
-
const
|
|
17552
|
+
const scale4 = Math.pow(2, numSquares);
|
|
17553
17553
|
for (let i = 0; i < n; i++) {
|
|
17554
17554
|
for (let j = 0; j < n; j++) {
|
|
17555
|
-
logM[i][j] *=
|
|
17555
|
+
logM[i][j] *= scale4;
|
|
17556
17556
|
}
|
|
17557
17557
|
}
|
|
17558
17558
|
return logM;
|
|
@@ -17815,9 +17815,9 @@ async function solveApprox(A, b, n) {
|
|
|
17815
17815
|
}
|
|
17816
17816
|
}
|
|
17817
17817
|
if (maxRow !== col) [M[col], M[maxRow]] = [M[maxRow], M[col]];
|
|
17818
|
-
const
|
|
17819
|
-
if (Math.abs(
|
|
17820
|
-
for (let j = 0; j <= n; j++) M[col][j] /=
|
|
17818
|
+
const scale4 = M[col][col];
|
|
17819
|
+
if (Math.abs(scale4) < 1e-30) continue;
|
|
17820
|
+
for (let j = 0; j <= n; j++) M[col][j] /= scale4;
|
|
17821
17821
|
for (let row2 = 0; row2 < n; row2++) {
|
|
17822
17822
|
if (row2 === col) continue;
|
|
17823
17823
|
const factor2 = M[row2][col];
|
|
@@ -22628,41 +22628,41 @@ var createDot = /* @__PURE__ */ factory(
|
|
|
22628
22628
|
const bdt = isMatrix(b) ? b._datatype || b.getDataType() : void 0;
|
|
22629
22629
|
const aIsColumn = _size(a).length === 2;
|
|
22630
22630
|
const bIsColumn = _size(b).length === 2;
|
|
22631
|
-
let
|
|
22631
|
+
let add4 = addScalar2;
|
|
22632
22632
|
let mul = multiplyScalar2;
|
|
22633
22633
|
if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") {
|
|
22634
22634
|
const dt = adt;
|
|
22635
|
-
|
|
22635
|
+
add4 = typed3.find(addScalar2, [dt, dt]);
|
|
22636
22636
|
mul = typed3.find(multiplyScalar2, [dt, dt]);
|
|
22637
22637
|
}
|
|
22638
|
-
if (!aIsColumn && !bIsColumn &&
|
|
22638
|
+
if (!aIsColumn && !bIsColumn && add4 === addScalar2 && mul === multiplyScalar2 && _isFlatNumbers(adata) && _isFlatNumbers(bdata)) {
|
|
22639
22639
|
return pairwiseDot2(adata, bdata);
|
|
22640
22640
|
}
|
|
22641
22641
|
if (!aIsColumn && !bIsColumn) {
|
|
22642
22642
|
let c = mul(conj3(adata[0]), bdata[0]);
|
|
22643
22643
|
for (let i = 1; i < N; i++) {
|
|
22644
|
-
c =
|
|
22644
|
+
c = add4(c, mul(conj3(adata[i]), bdata[i]));
|
|
22645
22645
|
}
|
|
22646
22646
|
return c;
|
|
22647
22647
|
}
|
|
22648
22648
|
if (!aIsColumn && bIsColumn) {
|
|
22649
22649
|
let c = mul(conj3(adata[0]), bdata[0][0]);
|
|
22650
22650
|
for (let i = 1; i < N; i++) {
|
|
22651
|
-
c =
|
|
22651
|
+
c = add4(c, mul(conj3(adata[i]), bdata[i][0]));
|
|
22652
22652
|
}
|
|
22653
22653
|
return c;
|
|
22654
22654
|
}
|
|
22655
22655
|
if (aIsColumn && !bIsColumn) {
|
|
22656
22656
|
let c = mul(conj3(adata[0][0]), bdata[0]);
|
|
22657
22657
|
for (let i = 1; i < N; i++) {
|
|
22658
|
-
c =
|
|
22658
|
+
c = add4(c, mul(conj3(adata[i][0]), bdata[i]));
|
|
22659
22659
|
}
|
|
22660
22660
|
return c;
|
|
22661
22661
|
}
|
|
22662
22662
|
{
|
|
22663
22663
|
let c = mul(conj3(adata[0][0]), bdata[0][0]);
|
|
22664
22664
|
for (let i = 1; i < N; i++) {
|
|
22665
|
-
c =
|
|
22665
|
+
c = add4(c, mul(conj3(adata[i][0]), bdata[i][0]));
|
|
22666
22666
|
}
|
|
22667
22667
|
return c;
|
|
22668
22668
|
}
|
|
@@ -22674,7 +22674,7 @@ var createDot = /* @__PURE__ */ factory(
|
|
|
22674
22674
|
const yindex = y._index;
|
|
22675
22675
|
const yvalues = y._values;
|
|
22676
22676
|
let c = 0;
|
|
22677
|
-
const
|
|
22677
|
+
const add4 = addScalar2;
|
|
22678
22678
|
const mul = multiplyScalar2;
|
|
22679
22679
|
let i = 0;
|
|
22680
22680
|
let j = 0;
|
|
@@ -22690,7 +22690,7 @@ var createDot = /* @__PURE__ */ factory(
|
|
|
22690
22690
|
continue;
|
|
22691
22691
|
}
|
|
22692
22692
|
if (I2 === J) {
|
|
22693
|
-
c =
|
|
22693
|
+
c = add4(c, mul(xvalues[i], yvalues[j]));
|
|
22694
22694
|
i++;
|
|
22695
22695
|
j++;
|
|
22696
22696
|
}
|
|
@@ -23782,7 +23782,7 @@ var dependencies95 = ["typed", "matrix", "add"];
|
|
|
23782
23782
|
var createTrace = /* @__PURE__ */ factory(
|
|
23783
23783
|
name95,
|
|
23784
23784
|
dependencies95,
|
|
23785
|
-
({ typed: typed3, matrix: matrix2, add:
|
|
23785
|
+
({ typed: typed3, matrix: matrix2, add: add4 }) => {
|
|
23786
23786
|
return typed3("trace", {
|
|
23787
23787
|
Array: function _arrayTrace(x) {
|
|
23788
23788
|
return _denseTrace(matrix2(x));
|
|
@@ -23806,7 +23806,7 @@ var createTrace = /* @__PURE__ */ factory(
|
|
|
23806
23806
|
if (rows === cols) {
|
|
23807
23807
|
let sum3 = 0;
|
|
23808
23808
|
for (let i = 0; i < rows; i++) {
|
|
23809
|
-
sum3 =
|
|
23809
|
+
sum3 = add4(sum3, data[i][i]);
|
|
23810
23810
|
}
|
|
23811
23811
|
return sum3;
|
|
23812
23812
|
} else {
|
|
@@ -23833,7 +23833,7 @@ var createTrace = /* @__PURE__ */ factory(
|
|
|
23833
23833
|
for (let k = k0; k < k1; k++) {
|
|
23834
23834
|
const i = index[k];
|
|
23835
23835
|
if (i === j) {
|
|
23836
|
-
sum3 =
|
|
23836
|
+
sum3 = add4(sum3, values[k]);
|
|
23837
23837
|
break;
|
|
23838
23838
|
}
|
|
23839
23839
|
if (i > j) {
|
|
@@ -24200,7 +24200,7 @@ var dependencies98 = ["add", "multiply", "transpose"];
|
|
|
24200
24200
|
var createCsAmd = /* @__PURE__ */ factory(
|
|
24201
24201
|
name98,
|
|
24202
24202
|
dependencies98,
|
|
24203
|
-
({ add:
|
|
24203
|
+
({ add: add4, multiply: multiply2, transpose: transpose5 }) => {
|
|
24204
24204
|
function _tryWasmAmd(a, n) {
|
|
24205
24205
|
const wasm = wasmLoader.getModule();
|
|
24206
24206
|
if (!wasm || !a._ptr || !a._index) return null;
|
|
@@ -24496,7 +24496,7 @@ var createCsAmd = /* @__PURE__ */ factory(
|
|
|
24496
24496
|
function _createTargetMatrix(order, a, m, n, dense) {
|
|
24497
24497
|
const at = transpose5(a);
|
|
24498
24498
|
if (order === 1 && n === m) {
|
|
24499
|
-
return
|
|
24499
|
+
return add4(a, at);
|
|
24500
24500
|
}
|
|
24501
24501
|
if (order === 2) {
|
|
24502
24502
|
const tindex = at._index;
|
|
@@ -24845,8 +24845,8 @@ var dependencies100 = ["add", "multiply", "transpose"];
|
|
|
24845
24845
|
var createCsSqr = /* @__PURE__ */ factory(
|
|
24846
24846
|
name100,
|
|
24847
24847
|
dependencies100,
|
|
24848
|
-
({ add:
|
|
24849
|
-
const csAmd2 = createCsAmd({ add:
|
|
24848
|
+
({ add: add4, multiply: multiply2, transpose: transpose5 }) => {
|
|
24849
|
+
const csAmd2 = createCsAmd({ add: add4, multiply: multiply2, transpose: transpose5 });
|
|
24850
24850
|
const csCounts2 = createCsCounts({ transpose: transpose5 });
|
|
24851
24851
|
return function csSqr2(order, a, qr2) {
|
|
24852
24852
|
const aptr = a._ptr;
|
|
@@ -26852,7 +26852,7 @@ var createSubset = /* @__PURE__ */ factory(
|
|
|
26852
26852
|
typed: typed3,
|
|
26853
26853
|
matrix: matrix2,
|
|
26854
26854
|
zeros: zeros4,
|
|
26855
|
-
add:
|
|
26855
|
+
add: add4
|
|
26856
26856
|
}) => {
|
|
26857
26857
|
const referTo = typed3.referTo;
|
|
26858
26858
|
return typed3(name119, {
|
|
@@ -26911,7 +26911,7 @@ var createSubset = /* @__PURE__ */ factory(
|
|
|
26911
26911
|
const indexSize = index.size();
|
|
26912
26912
|
if (indexSize.every((d) => d > 0)) {
|
|
26913
26913
|
try {
|
|
26914
|
-
return
|
|
26914
|
+
return add4(replacement, zeros4(indexSize));
|
|
26915
26915
|
} catch {
|
|
26916
26916
|
return replacement;
|
|
26917
26917
|
}
|
|
@@ -27584,7 +27584,7 @@ var dependencies127 = ["typed", "add", "multiply", "Complex", "number"];
|
|
|
27584
27584
|
var createZpk2tf = /* @__PURE__ */ factory(
|
|
27585
27585
|
name127,
|
|
27586
27586
|
dependencies127,
|
|
27587
|
-
({ typed: typed3, add:
|
|
27587
|
+
({ typed: typed3, add: add4, multiply: multiply2, Complex: Complex13, number: number2 }) => {
|
|
27588
27588
|
return typed3(name127, {
|
|
27589
27589
|
"Array,Array,number": function(z, p, k) {
|
|
27590
27590
|
return _zpk2tf(z, p, k);
|
|
@@ -27629,7 +27629,7 @@ var createZpk2tf = /* @__PURE__ */ factory(
|
|
|
27629
27629
|
c[i] = Complex13(0, 0);
|
|
27630
27630
|
for (let j = 0; j < a.length; j++) {
|
|
27631
27631
|
if (i - j >= 0 && i - j < b.length) {
|
|
27632
|
-
c[i] =
|
|
27632
|
+
c[i] = add4(c[i], multiply2(a[j], b[i - j]));
|
|
27633
27633
|
}
|
|
27634
27634
|
}
|
|
27635
27635
|
}
|
|
@@ -27653,7 +27653,7 @@ var dependencies128 = ["typed", "add", "unaryPlus"];
|
|
|
27653
27653
|
var createCumSum = /* @__PURE__ */ factory(
|
|
27654
27654
|
name128,
|
|
27655
27655
|
dependencies128,
|
|
27656
|
-
({ typed: typed3, add:
|
|
27656
|
+
({ typed: typed3, add: add4, unaryPlus: unaryPlus2 }) => {
|
|
27657
27657
|
return typed3(name128, {
|
|
27658
27658
|
// sum([a, b, c, d, ...])
|
|
27659
27659
|
Array: _cumsum,
|
|
@@ -27694,7 +27694,7 @@ var createCumSum = /* @__PURE__ */ factory(
|
|
|
27694
27694
|
}
|
|
27695
27695
|
const sums = [unaryPlus2(array[0])];
|
|
27696
27696
|
for (let i = 1; i < array.length; ++i) {
|
|
27697
|
-
sums.push(
|
|
27697
|
+
sums.push(add4(sums[i - 1], array[i]));
|
|
27698
27698
|
}
|
|
27699
27699
|
return sums;
|
|
27700
27700
|
}
|
|
@@ -27752,7 +27752,7 @@ var dependencies129 = ["typed", "config", "add", "numeric", "parseNumberWithConf
|
|
|
27752
27752
|
var createSum = /* @__PURE__ */ factory(
|
|
27753
27753
|
name129,
|
|
27754
27754
|
dependencies129,
|
|
27755
|
-
({ typed: typed3, config: config2, add:
|
|
27755
|
+
({ typed: typed3, config: config2, add: add4, numeric: numeric2, parseNumberWithConfig: parseNumberWithConfig2 }) => {
|
|
27756
27756
|
return typed3(name129, {
|
|
27757
27757
|
// sum(string) - single string input
|
|
27758
27758
|
string: function(x) {
|
|
@@ -27778,7 +27778,7 @@ var createSum = /* @__PURE__ */ factory(
|
|
|
27778
27778
|
deepForEach2(array, function(value) {
|
|
27779
27779
|
try {
|
|
27780
27780
|
const converted = typeof value === "string" ? parseNumberWithConfig2(value) : value;
|
|
27781
|
-
sum3 = sum3 === void 0 ? converted :
|
|
27781
|
+
sum3 = sum3 === void 0 ? converted : add4(sum3, converted);
|
|
27782
27782
|
} catch (err) {
|
|
27783
27783
|
throw improveErrorMessage(err, "sum", value);
|
|
27784
27784
|
}
|
|
@@ -27791,7 +27791,7 @@ var createSum = /* @__PURE__ */ factory(
|
|
|
27791
27791
|
function _nsumDim(array, dim) {
|
|
27792
27792
|
try {
|
|
27793
27793
|
const dimValue = typeof dim === "number" ? dim : dim.valueOf();
|
|
27794
|
-
const sum3 = reduce2(array, dimValue,
|
|
27794
|
+
const sum3 = reduce2(array, dimValue, add4);
|
|
27795
27795
|
return sum3;
|
|
27796
27796
|
} catch (err) {
|
|
27797
27797
|
throw improveErrorMessage(err, "sum", void 0);
|
|
@@ -30453,7 +30453,7 @@ var createInvmod = /* @__PURE__ */ factory(
|
|
|
30453
30453
|
equal: equal2,
|
|
30454
30454
|
smaller: smaller2,
|
|
30455
30455
|
mod: mod3,
|
|
30456
|
-
add:
|
|
30456
|
+
add: add4,
|
|
30457
30457
|
isInteger: isInteger3
|
|
30458
30458
|
}) => {
|
|
30459
30459
|
return typed3(name168, {
|
|
@@ -30470,7 +30470,7 @@ var createInvmod = /* @__PURE__ */ factory(
|
|
|
30470
30470
|
const [gcd2, invValue] = resVal;
|
|
30471
30471
|
if (!equal2(gcd2, 1)) return NaN;
|
|
30472
30472
|
let inv3 = mod3(invValue, b);
|
|
30473
|
-
if (smaller2(inv3, 0)) inv3 =
|
|
30473
|
+
if (smaller2(inv3, 0)) inv3 = add4(inv3, b);
|
|
30474
30474
|
return inv3;
|
|
30475
30475
|
}
|
|
30476
30476
|
}
|
|
@@ -30727,11 +30727,11 @@ var createPinv = /* @__PURE__ */ factory(
|
|
|
30727
30727
|
deepEqual: deepEqual3,
|
|
30728
30728
|
equal: equal2,
|
|
30729
30729
|
dotDivide: dotDivide2,
|
|
30730
|
-
dot:
|
|
30730
|
+
dot: dot8,
|
|
30731
30731
|
ctranspose: ctranspose2,
|
|
30732
30732
|
divideScalar: divideScalar2,
|
|
30733
30733
|
multiply: multiply2,
|
|
30734
|
-
add:
|
|
30734
|
+
add: add4,
|
|
30735
30735
|
Complex: Complex13
|
|
30736
30736
|
}) => {
|
|
30737
30737
|
return typed3(name172, {
|
|
@@ -30743,7 +30743,7 @@ var createPinv = /* @__PURE__ */ factory(
|
|
|
30743
30743
|
if (size2[0] === 1) {
|
|
30744
30744
|
return inv3(x);
|
|
30745
30745
|
} else {
|
|
30746
|
-
return dotDivide2(ctranspose2(x),
|
|
30746
|
+
return dotDivide2(ctranspose2(x), dot8(x, x));
|
|
30747
30747
|
}
|
|
30748
30748
|
case 2: {
|
|
30749
30749
|
if (_isZeros(x)) return ctranspose2(x);
|
|
@@ -30813,7 +30813,7 @@ var createPinv = /* @__PURE__ */ factory(
|
|
|
30813
30813
|
if (i2 === r) continue;
|
|
30814
30814
|
val = M[i2][lead];
|
|
30815
30815
|
for (let j = 0; j < cols; j++) {
|
|
30816
|
-
M[i2][j] =
|
|
30816
|
+
M[i2][j] = add4(M[i2][j], multiply2(-1, multiply2(val, M[r][j])));
|
|
30817
30817
|
}
|
|
30818
30818
|
}
|
|
30819
30819
|
lead++;
|
|
@@ -30822,17 +30822,17 @@ var createPinv = /* @__PURE__ */ factory(
|
|
|
30822
30822
|
}
|
|
30823
30823
|
function _rankFact(mat, rows, cols) {
|
|
30824
30824
|
const rref = _rref(mat, rows, cols);
|
|
30825
|
-
const C = mat.map((row2) => row2.filter((_, j) => j < rows && !_isZero(
|
|
30826
|
-
const F = rref.filter((_, i) => !_isZero(
|
|
30825
|
+
const C = mat.map((row2) => row2.filter((_, j) => j < rows && !_isZero(dot8(rref[j], rref[j]))));
|
|
30826
|
+
const F = rref.filter((_, i) => !_isZero(dot8(rref[i], rref[i])));
|
|
30827
30827
|
return { C, F };
|
|
30828
30828
|
}
|
|
30829
30829
|
function _isZero(x) {
|
|
30830
|
-
return equal2(
|
|
30830
|
+
return equal2(add4(x, Complex13(1, 1)), add4(0, Complex13(1, 1)));
|
|
30831
30831
|
}
|
|
30832
30832
|
function _isZeros(arr10) {
|
|
30833
30833
|
return deepEqual3(
|
|
30834
|
-
|
|
30835
|
-
|
|
30834
|
+
add4(arr10, Complex13(1, 1)),
|
|
30835
|
+
add4(multiply2(arr10, 0), Complex13(1, 1))
|
|
30836
30836
|
);
|
|
30837
30837
|
}
|
|
30838
30838
|
}
|
|
@@ -31063,7 +31063,7 @@ var createRange = /* @__PURE__ */ factory(
|
|
|
31063
31063
|
smallerEq: smallerEq2,
|
|
31064
31064
|
larger: larger2,
|
|
31065
31065
|
largerEq: largerEq2,
|
|
31066
|
-
add:
|
|
31066
|
+
add: add4,
|
|
31067
31067
|
isZero: isZero2,
|
|
31068
31068
|
isPositive: isPositive2
|
|
31069
31069
|
}) => {
|
|
@@ -31176,7 +31176,7 @@ var createRange = /* @__PURE__ */ factory(
|
|
|
31176
31176
|
let x = start;
|
|
31177
31177
|
while (ongoing(x, end)) {
|
|
31178
31178
|
array.push(x);
|
|
31179
|
-
x =
|
|
31179
|
+
x = add4(x, step);
|
|
31180
31180
|
}
|
|
31181
31181
|
return array;
|
|
31182
31182
|
}
|
|
@@ -34849,7 +34849,7 @@ var dependencies211 = [
|
|
|
34849
34849
|
var createSqrtm = /* @__PURE__ */ factory(
|
|
34850
34850
|
name211,
|
|
34851
34851
|
dependencies211,
|
|
34852
|
-
({ typed: typed3, abs: abs2, add:
|
|
34852
|
+
({ typed: typed3, abs: abs2, add: add4, multiply: multiply2, map: map2, sqrt: sqrt2, subtract: subtract3, inv: inv3, size: size2, max: max2, identity: identity2 }) => {
|
|
34853
34853
|
const _maxIterations = 1e3;
|
|
34854
34854
|
const _tolerance = 1e-6;
|
|
34855
34855
|
function _tryWasmSqrtm(A, n) {
|
|
@@ -34915,8 +34915,8 @@ var createSqrtm = /* @__PURE__ */ factory(
|
|
|
34915
34915
|
let Z = identity2(size2(A));
|
|
34916
34916
|
do {
|
|
34917
34917
|
const Yk = Y;
|
|
34918
|
-
Y = multiply2(0.5,
|
|
34919
|
-
Z = multiply2(0.5,
|
|
34918
|
+
Y = multiply2(0.5, add4(Yk, inv3(Z)));
|
|
34919
|
+
Z = multiply2(0.5, add4(Z, inv3(Yk)));
|
|
34920
34920
|
error = max2(abs2(subtract3(Y, Yk)));
|
|
34921
34921
|
if (error > _tolerance && ++iterations > _maxIterations) {
|
|
34922
34922
|
throw new Error("computing square root of matrix: iterative method could not converge");
|
|
@@ -35554,7 +35554,7 @@ var createSlu = /* @__PURE__ */ factory(
|
|
|
35554
35554
|
({
|
|
35555
35555
|
typed: typed3,
|
|
35556
35556
|
abs: abs2,
|
|
35557
|
-
add:
|
|
35557
|
+
add: add4,
|
|
35558
35558
|
multiply: multiply2,
|
|
35559
35559
|
transpose: transpose5,
|
|
35560
35560
|
divideScalar: divideScalar2,
|
|
@@ -35563,7 +35563,7 @@ var createSlu = /* @__PURE__ */ factory(
|
|
|
35563
35563
|
largerEq: largerEq2,
|
|
35564
35564
|
SparseMatrix
|
|
35565
35565
|
}) => {
|
|
35566
|
-
const csSqr2 = createCsSqr({ add:
|
|
35566
|
+
const csSqr2 = createCsSqr({ add: add4, multiply: multiply2, transpose: transpose5 });
|
|
35567
35567
|
const csLu2 = createCsLu({
|
|
35568
35568
|
abs: abs2,
|
|
35569
35569
|
divideScalar: divideScalar2,
|
|
@@ -35868,7 +35868,7 @@ var createIntersect = /* @__PURE__ */ factory(
|
|
|
35868
35868
|
typed: typed3,
|
|
35869
35869
|
config: config2,
|
|
35870
35870
|
abs: abs2,
|
|
35871
|
-
add:
|
|
35871
|
+
add: add4,
|
|
35872
35872
|
addScalar: addScalar2,
|
|
35873
35873
|
matrix: matrix2,
|
|
35874
35874
|
multiply: multiply2,
|
|
@@ -36008,7 +36008,7 @@ var createIntersect = /* @__PURE__ */ factory(
|
|
|
36008
36008
|
),
|
|
36009
36009
|
det2
|
|
36010
36010
|
);
|
|
36011
|
-
return
|
|
36011
|
+
return add4(multiply2(d1, t), o1);
|
|
36012
36012
|
}
|
|
36013
36013
|
function _tryWasmIntersect2d(p1a, p1b, p2a, p2b) {
|
|
36014
36014
|
const wasm = wasmLoader.getModule();
|
|
@@ -36124,7 +36124,7 @@ var dependencies219 = ["typed", "add", "divide"];
|
|
|
36124
36124
|
var createMean = /* @__PURE__ */ factory(
|
|
36125
36125
|
name219,
|
|
36126
36126
|
dependencies219,
|
|
36127
|
-
({ typed: typed3, add:
|
|
36127
|
+
({ typed: typed3, add: add4, divide: divide2 }) => {
|
|
36128
36128
|
return typed3(name219, {
|
|
36129
36129
|
// mean([a, b, c, d, ...])
|
|
36130
36130
|
"Array | Matrix": _mean2,
|
|
@@ -36141,7 +36141,7 @@ var createMean = /* @__PURE__ */ factory(
|
|
|
36141
36141
|
function _nmeanDim(array, dim) {
|
|
36142
36142
|
try {
|
|
36143
36143
|
const dimValue = typeof dim === "number" ? dim : dim.valueOf();
|
|
36144
|
-
const sum3 = reduce2(array, dimValue,
|
|
36144
|
+
const sum3 = reduce2(array, dimValue, add4);
|
|
36145
36145
|
const s = Array.isArray(array) ? arraySize(array) : array.size();
|
|
36146
36146
|
return divide2(sum3, s[dimValue]);
|
|
36147
36147
|
} catch (err) {
|
|
@@ -36169,7 +36169,7 @@ var createMean = /* @__PURE__ */ factory(
|
|
|
36169
36169
|
let num2 = 0;
|
|
36170
36170
|
deepForEach2(array, function(value) {
|
|
36171
36171
|
try {
|
|
36172
|
-
sum3 = sum3 === void 0 ? value :
|
|
36172
|
+
sum3 = sum3 === void 0 ? value : add4(sum3, value);
|
|
36173
36173
|
num2++;
|
|
36174
36174
|
} catch (err) {
|
|
36175
36175
|
throw improveErrorMessage(err, "mean", value);
|
|
@@ -36189,7 +36189,7 @@ var dependencies220 = ["typed", "add", "divide", "compare", "partitionSelect"];
|
|
|
36189
36189
|
var createMedian = /* @__PURE__ */ factory(
|
|
36190
36190
|
name220,
|
|
36191
36191
|
dependencies220,
|
|
36192
|
-
({ typed: typed3, add:
|
|
36192
|
+
({ typed: typed3, add: add4, divide: divide2, compare: compare2, partitionSelect: partitionSelect2 }) => {
|
|
36193
36193
|
function _median2(array) {
|
|
36194
36194
|
try {
|
|
36195
36195
|
const flat = flatten2(array.valueOf());
|
|
@@ -36222,7 +36222,7 @@ var createMedian = /* @__PURE__ */ factory(
|
|
|
36222
36222
|
});
|
|
36223
36223
|
const middle2 = typed3({
|
|
36224
36224
|
"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit": function(left, right) {
|
|
36225
|
-
return divide2(
|
|
36225
|
+
return divide2(add4(left, right), 2);
|
|
36226
36226
|
}
|
|
36227
36227
|
});
|
|
36228
36228
|
return typed3(name220, {
|
|
@@ -36261,7 +36261,7 @@ var createVariance = /* @__PURE__ */ factory(
|
|
|
36261
36261
|
dependencies221,
|
|
36262
36262
|
({
|
|
36263
36263
|
typed: typed3,
|
|
36264
|
-
add:
|
|
36264
|
+
add: add4,
|
|
36265
36265
|
subtract: subtract3,
|
|
36266
36266
|
multiply: multiply2,
|
|
36267
36267
|
divide: divide2,
|
|
@@ -36310,7 +36310,7 @@ var createVariance = /* @__PURE__ */ factory(
|
|
|
36310
36310
|
let num2 = 0;
|
|
36311
36311
|
deepForEach2(array, function(value) {
|
|
36312
36312
|
try {
|
|
36313
|
-
sum3 = sum3 === void 0 ? value :
|
|
36313
|
+
sum3 = sum3 === void 0 ? value : add4(sum3, value);
|
|
36314
36314
|
num2++;
|
|
36315
36315
|
} catch (err) {
|
|
36316
36316
|
throw improveErrorMessage(err, "variance", value);
|
|
@@ -36321,7 +36321,7 @@ var createVariance = /* @__PURE__ */ factory(
|
|
|
36321
36321
|
sum3 = void 0;
|
|
36322
36322
|
deepForEach2(array, function(value) {
|
|
36323
36323
|
const diff2 = subtract3(value, mean7);
|
|
36324
|
-
sum3 = sum3 === void 0 ? multiply2(diff2, diff2) :
|
|
36324
|
+
sum3 = sum3 === void 0 ? multiply2(diff2, diff2) : add4(sum3, multiply2(diff2, diff2));
|
|
36325
36325
|
});
|
|
36326
36326
|
if (mathIsNaN(sum3)) {
|
|
36327
36327
|
return sum3;
|
|
@@ -36396,7 +36396,7 @@ var createQuantileSeq = /* @__PURE__ */ factory(
|
|
|
36396
36396
|
({
|
|
36397
36397
|
typed: typed3,
|
|
36398
36398
|
bignumber: bignumber2,
|
|
36399
|
-
add:
|
|
36399
|
+
add: add4,
|
|
36400
36400
|
subtract: subtract3,
|
|
36401
36401
|
divide: divide2,
|
|
36402
36402
|
multiply: multiply2,
|
|
@@ -36444,7 +36444,7 @@ var createQuantileSeq = /* @__PURE__ */ factory(
|
|
|
36444
36444
|
"N must be less than or equal to 2^32-1, as that is the maximum length of an Array"
|
|
36445
36445
|
);
|
|
36446
36446
|
}
|
|
36447
|
-
const nPlusOne =
|
|
36447
|
+
const nPlusOne = add4(probOrN, 1);
|
|
36448
36448
|
probArr = [];
|
|
36449
36449
|
for (let i = 0; smaller2(i, probOrN); i++) {
|
|
36450
36450
|
const prob = divide2(i + 1, nPlusOne);
|
|
@@ -36501,11 +36501,11 @@ var createQuantileSeq = /* @__PURE__ */ factory(
|
|
|
36501
36501
|
return integerPart % 2 === 0 ? left : right;
|
|
36502
36502
|
}
|
|
36503
36503
|
case "midpoint":
|
|
36504
|
-
return divide2(
|
|
36504
|
+
return divide2(add4(left, right), 2);
|
|
36505
36505
|
case "linear":
|
|
36506
36506
|
default: {
|
|
36507
36507
|
const fracPartConverted = isBigNumber(left) && isNumber(fracPart) ? bignumber2(fracPart) : fracPart;
|
|
36508
|
-
return
|
|
36508
|
+
return add4(
|
|
36509
36509
|
multiply2(left, subtract3(1, fracPartConverted)),
|
|
36510
36510
|
multiply2(right, fracPartConverted)
|
|
36511
36511
|
);
|
|
@@ -36599,7 +36599,7 @@ var dependencies224 = ["typed", "add", "divide", "multiply", "factorial", "isInt
|
|
|
36599
36599
|
var createMultinomial = /* @__PURE__ */ factory(
|
|
36600
36600
|
name224,
|
|
36601
36601
|
dependencies224,
|
|
36602
|
-
({ typed: typed3, add:
|
|
36602
|
+
({ typed: typed3, add: add4, divide: divide2, multiply: multiply2, factorial: factorial5, isInteger: isInteger3, isPositive: isPositive2 }) => {
|
|
36603
36603
|
return typed3(name224, {
|
|
36604
36604
|
"Array | Matrix": function(a) {
|
|
36605
36605
|
let sum3 = 0;
|
|
@@ -36608,7 +36608,7 @@ var createMultinomial = /* @__PURE__ */ factory(
|
|
|
36608
36608
|
if (!isInteger3(ai) || !isPositive2(ai)) {
|
|
36609
36609
|
throw new TypeError("Positive integer value expected in function multinomial");
|
|
36610
36610
|
}
|
|
36611
|
-
sum3 =
|
|
36611
|
+
sum3 = add4(sum3, ai);
|
|
36612
36612
|
denom = multiply2(denom, factorial5(ai));
|
|
36613
36613
|
});
|
|
36614
36614
|
return divide2(factorial5(sum3), denom);
|
|
@@ -36624,7 +36624,7 @@ var dependencies225 = ["typed", "add", "multiply", "Complex", "divide", "matrix"
|
|
|
36624
36624
|
var createFreqz = /* @__PURE__ */ factory(
|
|
36625
36625
|
name225,
|
|
36626
36626
|
dependencies225,
|
|
36627
|
-
({ typed: typed3, add:
|
|
36627
|
+
({ typed: typed3, add: add4, multiply: multiply2, Complex: Complex13, divide: divide2, matrix: matrix2 }) => {
|
|
36628
36628
|
return typed3(name225, {
|
|
36629
36629
|
"Array, Array": function(b, a) {
|
|
36630
36630
|
const w = createBins(512);
|
|
@@ -36718,13 +36718,13 @@ var createFreqz = /* @__PURE__ */ factory(
|
|
|
36718
36718
|
let sumNum = Complex13(0, 0);
|
|
36719
36719
|
let sumDen = Complex13(0, 0);
|
|
36720
36720
|
for (let j = 0; j < b.length; j++) {
|
|
36721
|
-
sumNum =
|
|
36721
|
+
sumNum = add4(
|
|
36722
36722
|
sumNum,
|
|
36723
36723
|
multiply2(b[j], Complex13(Math.cos(-j * w[i]), Math.sin(-j * w[i])))
|
|
36724
36724
|
);
|
|
36725
36725
|
}
|
|
36726
36726
|
for (let j = 0; j < a.length; j++) {
|
|
36727
|
-
sumDen =
|
|
36727
|
+
sumDen = add4(
|
|
36728
36728
|
sumDen,
|
|
36729
36729
|
multiply2(a[j], Complex13(Math.cos(-j * w[i]), Math.sin(-j * w[i])))
|
|
36730
36730
|
);
|
|
@@ -37541,7 +37541,7 @@ var createPolynomialRoot = /* @__PURE__ */ factory(
|
|
|
37541
37541
|
typed: typed3,
|
|
37542
37542
|
isZero: isZero2,
|
|
37543
37543
|
equalScalar: equalScalar3,
|
|
37544
|
-
add:
|
|
37544
|
+
add: add4,
|
|
37545
37545
|
subtract: subtract3,
|
|
37546
37546
|
multiply: multiply2,
|
|
37547
37547
|
divide: divide2,
|
|
@@ -37583,15 +37583,15 @@ var createPolynomialRoot = /* @__PURE__ */ factory(
|
|
|
37583
37583
|
const denom = unaryMinus2(multiply2(3, a));
|
|
37584
37584
|
const D0_1 = multiply2(b, b);
|
|
37585
37585
|
const D0_2 = multiply2(3, a, c);
|
|
37586
|
-
const D1_1 =
|
|
37586
|
+
const D1_1 = add4(multiply2(2, b, b, b), multiply2(27, a, a, d));
|
|
37587
37587
|
const D1_2 = multiply2(9, a, b, c);
|
|
37588
37588
|
if (equalScalar3(D0_1, D0_2) && equalScalar3(D1_1, D1_2)) {
|
|
37589
37589
|
return [divide2(b, denom)];
|
|
37590
37590
|
}
|
|
37591
37591
|
const Delta0 = subtract3(D0_1, D0_2);
|
|
37592
37592
|
const Delta1 = subtract3(D1_1, D1_2);
|
|
37593
|
-
const discriminant1 =
|
|
37594
|
-
const discriminant2 =
|
|
37593
|
+
const discriminant1 = add4(multiply2(18, a, b, c, d), multiply2(b, b, c, c));
|
|
37594
|
+
const discriminant2 = add4(
|
|
37595
37595
|
multiply2(4, b, b, b, d),
|
|
37596
37596
|
multiply2(4, a, c, c, c),
|
|
37597
37597
|
multiply2(27, a, a, d, d)
|
|
@@ -37599,7 +37599,7 @@ var createPolynomialRoot = /* @__PURE__ */ factory(
|
|
|
37599
37599
|
if (equalScalar3(discriminant1, discriminant2)) {
|
|
37600
37600
|
return [
|
|
37601
37601
|
divide2(
|
|
37602
|
-
subtract3(multiply2(4, a, b, c),
|
|
37602
|
+
subtract3(multiply2(4, a, b, c), add4(multiply2(9, a, a, d), multiply2(b, b, b))),
|
|
37603
37603
|
multiply2(a, Delta0)
|
|
37604
37604
|
),
|
|
37605
37605
|
// simple root
|
|
@@ -37612,7 +37612,7 @@ var createPolynomialRoot = /* @__PURE__ */ factory(
|
|
|
37612
37612
|
Ccubed = Delta1;
|
|
37613
37613
|
} else {
|
|
37614
37614
|
Ccubed = divide2(
|
|
37615
|
-
|
|
37615
|
+
add4(
|
|
37616
37616
|
Delta1,
|
|
37617
37617
|
sqrt2(subtract3(multiply2(Delta1, Delta1), multiply2(4, Delta0, Delta0, Delta0)))
|
|
37618
37618
|
),
|
|
@@ -37620,7 +37620,7 @@ var createPolynomialRoot = /* @__PURE__ */ factory(
|
|
|
37620
37620
|
);
|
|
37621
37621
|
}
|
|
37622
37622
|
const allRoots = true;
|
|
37623
|
-
const rawRoots = cbrt3(Ccubed, allRoots).toArray().map((C) => divide2(
|
|
37623
|
+
const rawRoots = cbrt3(Ccubed, allRoots).toArray().map((C) => divide2(add4(b, C, divide2(Delta0, C)), denom));
|
|
37624
37624
|
return rawRoots.map((r) => {
|
|
37625
37625
|
if (typeOf3(r) === "Complex" && equalScalar3(re3(r), re3(r) + im3(r))) {
|
|
37626
37626
|
return re3(r);
|
|
@@ -37676,7 +37676,7 @@ var createZeta = /* @__PURE__ */ factory(
|
|
|
37676
37676
|
gamma: gamma2,
|
|
37677
37677
|
sin: sin2,
|
|
37678
37678
|
subtract: subtract3,
|
|
37679
|
-
add:
|
|
37679
|
+
add: add4,
|
|
37680
37680
|
Complex: Complex13,
|
|
37681
37681
|
BigNumber: BigNumber9,
|
|
37682
37682
|
pi
|
|
@@ -37744,20 +37744,20 @@ var createZeta = /* @__PURE__ */ factory(
|
|
|
37744
37744
|
}
|
|
37745
37745
|
function d(k, n) {
|
|
37746
37746
|
let S = k;
|
|
37747
|
-
for (let j = k; smallerEq2(j, n); j =
|
|
37747
|
+
for (let j = k; smallerEq2(j, n); j = add4(j, 1)) {
|
|
37748
37748
|
const factor2 = divide2(
|
|
37749
|
-
multiply2(factorial5(
|
|
37749
|
+
multiply2(factorial5(add4(n, subtract3(j, 1))), pow2(4, j)),
|
|
37750
37750
|
multiply2(factorial5(subtract3(n, j)), factorial5(multiply2(2, j)))
|
|
37751
37751
|
);
|
|
37752
|
-
S =
|
|
37752
|
+
S = add4(S, factor2);
|
|
37753
37753
|
}
|
|
37754
37754
|
return multiply2(n, S);
|
|
37755
37755
|
}
|
|
37756
37756
|
function f(s, n, createValue) {
|
|
37757
37757
|
const c = divide2(1, multiply2(d(createValue(0), n), subtract3(1, pow2(2, subtract3(1, s)))));
|
|
37758
37758
|
let S = createValue(0);
|
|
37759
|
-
for (let k = createValue(1); smallerEq2(k, n); k =
|
|
37760
|
-
S =
|
|
37759
|
+
for (let k = createValue(1); smallerEq2(k, n); k = add4(k, 1)) {
|
|
37760
|
+
S = add4(S, divide2(multiply2((-1) ** (k - 1), d(k, n)), pow2(k, s)));
|
|
37761
37761
|
}
|
|
37762
37762
|
return multiply2(c, S);
|
|
37763
37763
|
}
|
|
@@ -37823,7 +37823,7 @@ function createComplexEigs({
|
|
|
37823
37823
|
larger: larger2,
|
|
37824
37824
|
smaller: smaller2,
|
|
37825
37825
|
matrixFromColumns: _matrixFromColumns,
|
|
37826
|
-
dot:
|
|
37826
|
+
dot: dot8
|
|
37827
37827
|
}) {
|
|
37828
37828
|
function complexEigs(arr10, N, prec, type, findVectors = true) {
|
|
37829
37829
|
if (!findVectors && type === "number" && N * N >= WASM_EIGS_THRESHOLD) {
|
|
@@ -38194,11 +38194,11 @@ function createComplexEigs({
|
|
|
38194
38194
|
M[i] = Array(N).fill(0);
|
|
38195
38195
|
}
|
|
38196
38196
|
let I2 = 0;
|
|
38197
|
-
for (const
|
|
38198
|
-
const n =
|
|
38197
|
+
for (const sub2 of arr10) {
|
|
38198
|
+
const n = sub2.length;
|
|
38199
38199
|
for (let i = 0; i < n; i++) {
|
|
38200
38200
|
for (let j = 0; j < n; j++) {
|
|
38201
|
-
M[I2 + i][I2 + j] =
|
|
38201
|
+
M[I2 + i][I2 + j] = sub2[i][j];
|
|
38202
38202
|
}
|
|
38203
38203
|
}
|
|
38204
38204
|
I2 += n;
|
|
@@ -38264,7 +38264,7 @@ function createComplexEigs({
|
|
|
38264
38264
|
v = subtract3(
|
|
38265
38265
|
v,
|
|
38266
38266
|
multiply2(
|
|
38267
|
-
divideScalar2(
|
|
38267
|
+
divideScalar2(dot8(w, v), dot8(w, w)),
|
|
38268
38268
|
w
|
|
38269
38269
|
)
|
|
38270
38270
|
);
|
|
@@ -38272,7 +38272,7 @@ function createComplexEigs({
|
|
|
38272
38272
|
return v;
|
|
38273
38273
|
}
|
|
38274
38274
|
function norm4(v) {
|
|
38275
|
-
return abs2(sqrt2(
|
|
38275
|
+
return abs2(sqrt2(dot8(v, v)));
|
|
38276
38276
|
}
|
|
38277
38277
|
function normalize2(v, type) {
|
|
38278
38278
|
const big = type === "BigNumber";
|
|
@@ -38306,7 +38306,7 @@ function createRealSymmetric({
|
|
|
38306
38306
|
inv: inv3,
|
|
38307
38307
|
bignumber: bignumber2,
|
|
38308
38308
|
multiply: multiply2,
|
|
38309
|
-
add:
|
|
38309
|
+
add: add4
|
|
38310
38310
|
}) {
|
|
38311
38311
|
function bigGte(a, b) {
|
|
38312
38312
|
if (typeof a === "number" && typeof b === "number") return a >= b;
|
|
@@ -38503,7 +38503,7 @@ function createRealSymmetric({
|
|
|
38503
38503
|
subtract3(multiplyScalar2(c2, Hij[i][i]), csHij),
|
|
38504
38504
|
multiplyScalar2(s2, Hij[j][j])
|
|
38505
38505
|
);
|
|
38506
|
-
const Ajj =
|
|
38506
|
+
const Ajj = add4(
|
|
38507
38507
|
multiplyScalar2(s2, Hij[i][i]),
|
|
38508
38508
|
csHij,
|
|
38509
38509
|
multiplyScalar2(c2, Hij[j][j])
|
|
@@ -38675,7 +38675,7 @@ var createEigs = /* @__PURE__ */ factory(
|
|
|
38675
38675
|
inv: inv3,
|
|
38676
38676
|
bignumber: bignumber2,
|
|
38677
38677
|
multiply: multiply2,
|
|
38678
|
-
add:
|
|
38678
|
+
add: add4,
|
|
38679
38679
|
larger: larger2,
|
|
38680
38680
|
column: _column,
|
|
38681
38681
|
flatten: flatten5,
|
|
@@ -38692,7 +38692,7 @@ var createEigs = /* @__PURE__ */ factory(
|
|
|
38692
38692
|
re: re3,
|
|
38693
38693
|
smaller: smaller2,
|
|
38694
38694
|
matrixFromColumns: matrixFromColumns2,
|
|
38695
|
-
dot:
|
|
38695
|
+
dot: dot8
|
|
38696
38696
|
}) => {
|
|
38697
38697
|
const doRealSymmetric = createRealSymmetric({
|
|
38698
38698
|
config: config2,
|
|
@@ -38707,7 +38707,7 @@ var createEigs = /* @__PURE__ */ factory(
|
|
|
38707
38707
|
bignumber: bignumber2,
|
|
38708
38708
|
complex: complex3,
|
|
38709
38709
|
multiply: multiply2,
|
|
38710
|
-
add:
|
|
38710
|
+
add: add4
|
|
38711
38711
|
});
|
|
38712
38712
|
const doComplexEigs = createComplexEigs({
|
|
38713
38713
|
addScalar: addScalar2,
|
|
@@ -38731,7 +38731,7 @@ var createEigs = /* @__PURE__ */ factory(
|
|
|
38731
38731
|
larger: larger2,
|
|
38732
38732
|
smaller: smaller2,
|
|
38733
38733
|
matrixFromColumns: matrixFromColumns2,
|
|
38734
|
-
dot:
|
|
38734
|
+
dot: dot8
|
|
38735
38735
|
});
|
|
38736
38736
|
return typed3("eigs", {
|
|
38737
38737
|
// The conversion to matrix in the first two implementations,
|
|
@@ -40733,7 +40733,7 @@ var createNorm = /* @__PURE__ */ factory(
|
|
|
40733
40733
|
({
|
|
40734
40734
|
typed: typed3,
|
|
40735
40735
|
abs: abs2,
|
|
40736
|
-
add:
|
|
40736
|
+
add: add4,
|
|
40737
40737
|
pow: pow2,
|
|
40738
40738
|
conj: conj3,
|
|
40739
40739
|
sqrt: sqrt2,
|
|
@@ -40838,7 +40838,7 @@ var createNorm = /* @__PURE__ */ factory(
|
|
|
40838
40838
|
if (!equalScalar3(p, 0)) {
|
|
40839
40839
|
let n = 0;
|
|
40840
40840
|
x.forEach(function(value) {
|
|
40841
|
-
n =
|
|
40841
|
+
n = add4(pow2(abs2(value), p), n);
|
|
40842
40842
|
}, true);
|
|
40843
40843
|
return pow2(n, 1 / p);
|
|
40844
40844
|
}
|
|
@@ -40849,7 +40849,7 @@ var createNorm = /* @__PURE__ */ factory(
|
|
|
40849
40849
|
function _matrixNormFrobenius(x) {
|
|
40850
40850
|
let fro = 0;
|
|
40851
40851
|
x.forEach(function(value) {
|
|
40852
|
-
fro =
|
|
40852
|
+
fro = add4(fro, multiply2(value, conj3(value)));
|
|
40853
40853
|
});
|
|
40854
40854
|
return abs2(sqrt2(fro));
|
|
40855
40855
|
}
|
|
@@ -40858,7 +40858,7 @@ var createNorm = /* @__PURE__ */ factory(
|
|
|
40858
40858
|
let maxc = 0;
|
|
40859
40859
|
x.forEach(function(value, index) {
|
|
40860
40860
|
const j = index[1];
|
|
40861
|
-
const cj =
|
|
40861
|
+
const cj = add4(c[j] || 0, abs2(value));
|
|
40862
40862
|
if (larger2(cj, maxc)) {
|
|
40863
40863
|
maxc = cj;
|
|
40864
40864
|
}
|
|
@@ -40882,7 +40882,7 @@ var createNorm = /* @__PURE__ */ factory(
|
|
|
40882
40882
|
let maxr = 0;
|
|
40883
40883
|
x.forEach(function(value, index) {
|
|
40884
40884
|
const i = index[0];
|
|
40885
|
-
const ri =
|
|
40885
|
+
const ri = add4(r[i] || 0, abs2(value));
|
|
40886
40886
|
if (larger2(ri, maxr)) {
|
|
40887
40887
|
maxr = ri;
|
|
40888
40888
|
}
|
|
@@ -41716,7 +41716,7 @@ var createSylvester = /* @__PURE__ */ factory(
|
|
|
41716
41716
|
transpose: transpose5,
|
|
41717
41717
|
index,
|
|
41718
41718
|
subset: subset2,
|
|
41719
|
-
add:
|
|
41719
|
+
add: add4,
|
|
41720
41720
|
subtract: subtract3,
|
|
41721
41721
|
identity: identity2,
|
|
41722
41722
|
lusolve: lusolve2,
|
|
@@ -41764,7 +41764,7 @@ var createSylvester = /* @__PURE__ */ factory(
|
|
|
41764
41764
|
if (k < n - 1 && abs2(subset2(G, index(k + 1, k))) > 1e-5) {
|
|
41765
41765
|
let RHS = vc(subset2(D, index(all, [k])), subset2(D, index(all, [k + 1])));
|
|
41766
41766
|
for (let j = 0; j < k; j++) {
|
|
41767
|
-
RHS =
|
|
41767
|
+
RHS = add4(
|
|
41768
41768
|
RHS,
|
|
41769
41769
|
vc(multiply2(y[j], subset2(G, index(j, k))), multiply2(y[j], subset2(G, index(j, k + 1))))
|
|
41770
41770
|
);
|
|
@@ -41773,7 +41773,7 @@ var createSylvester = /* @__PURE__ */ factory(
|
|
|
41773
41773
|
const gmk = multiply2(identity2(m), multiply2(-1, subset2(G, index(k + 1, k))));
|
|
41774
41774
|
const gkm = multiply2(identity2(m), multiply2(-1, subset2(G, index(k, k + 1))));
|
|
41775
41775
|
const gmm = multiply2(identity2(m), multiply2(-1, subset2(G, index(k + 1, k + 1))));
|
|
41776
|
-
const LHS = vc(hc(
|
|
41776
|
+
const LHS = vc(hc(add4(F, gkk), gmk), hc(gkm, add4(F, gmm)));
|
|
41777
41777
|
const yAux = lusolve2(LHS, RHS);
|
|
41778
41778
|
y[k] = yAux.subset(index(range2(0, m), [0]));
|
|
41779
41779
|
y[k + 1] = yAux.subset(index(range2(m, 2 * m), [0]));
|
|
@@ -41781,7 +41781,7 @@ var createSylvester = /* @__PURE__ */ factory(
|
|
|
41781
41781
|
} else {
|
|
41782
41782
|
let RHS = subset2(D, index(all, [k]));
|
|
41783
41783
|
for (let j = 0; j < k; j++) {
|
|
41784
|
-
RHS =
|
|
41784
|
+
RHS = add4(RHS, multiply2(y[j], subset2(G, index(j, k))));
|
|
41785
41785
|
}
|
|
41786
41786
|
const gkk = subset2(G, index(k, k));
|
|
41787
41787
|
const LHS = subtract3(F, multiply2(gkk, identity2(m)));
|
|
@@ -43589,11 +43589,11 @@ function multivariateTaylor(expr, vars, x0, n = 1) {
|
|
|
43589
43589
|
const fmp = evalWith(expr, s);
|
|
43590
43590
|
s[vars[j]] = x0[j] - h;
|
|
43591
43591
|
const fmm = evalWith(expr, s);
|
|
43592
|
-
const
|
|
43593
|
-
if (Math.abs(
|
|
43592
|
+
const cross3 = (fpp - fpm - fmp + fmm) / (4 * h * h);
|
|
43593
|
+
if (Math.abs(cross3) < 1e-12) continue;
|
|
43594
43594
|
const xi = x0[i] === 0 ? vars[i] : `(${vars[i]} - ${formatCoeff(x0[i])})`;
|
|
43595
43595
|
const xj = x0[j] === 0 ? vars[j] : `(${vars[j]} - ${formatCoeff(x0[j])})`;
|
|
43596
|
-
terms.push(`${formatCoeff(
|
|
43596
|
+
terms.push(`${formatCoeff(cross3)}*${xi}*${xj}`);
|
|
43597
43597
|
}
|
|
43598
43598
|
}
|
|
43599
43599
|
}
|
|
@@ -43620,8 +43620,8 @@ function polyCoeffsDeg3(expr, varName) {
|
|
|
43620
43620
|
const d2 = f[2] - 2 * f[1] + f[0];
|
|
43621
43621
|
const d3 = f[3] - 3 * f[2] + 3 * f[1] - f[0];
|
|
43622
43622
|
const d4 = f[4] - 4 * f[3] + 6 * f[2] - 4 * f[1] + f[0];
|
|
43623
|
-
const
|
|
43624
|
-
if (Math.abs(d4) > 1e-7 *
|
|
43623
|
+
const scale4 = Math.max(1, ...f.map(Math.abs));
|
|
43624
|
+
if (Math.abs(d4) > 1e-7 * scale4) return null;
|
|
43625
43625
|
const c3 = d3 / 6;
|
|
43626
43626
|
const c2 = d2 / 2 - d3 / 2;
|
|
43627
43627
|
const c1 = d1 - d2 / 2 + d3 / 3;
|
|
@@ -46621,12 +46621,12 @@ function eigsh(a, k = 1, opts) {
|
|
|
46621
46621
|
}
|
|
46622
46622
|
|
|
46623
46623
|
// src/numeric/structured-solvers.ts
|
|
46624
|
-
function thomasSolve(
|
|
46624
|
+
function thomasSolve(sub2, diag2, sup, d) {
|
|
46625
46625
|
const n = diag2.length;
|
|
46626
46626
|
if (n === 0) return [];
|
|
46627
|
-
if (
|
|
46627
|
+
if (sub2.length !== n - 1 || sup.length !== n - 1 || d.length !== n) {
|
|
46628
46628
|
throw new Error(
|
|
46629
|
-
`thomasSolve: expected sub/sup of length ${n - 1} and d of length ${n}, got sub=${
|
|
46629
|
+
`thomasSolve: expected sub/sup of length ${n - 1} and d of length ${n}, got sub=${sub2.length}, sup=${sup.length}, d=${d.length}`
|
|
46630
46630
|
);
|
|
46631
46631
|
}
|
|
46632
46632
|
const cp = new Array(n).fill(0);
|
|
@@ -46635,12 +46635,12 @@ function thomasSolve(sub, diag2, sup, d) {
|
|
|
46635
46635
|
cp[0] = n > 1 ? sup[0] / diag2[0] : 0;
|
|
46636
46636
|
dp[0] = d[0] / diag2[0];
|
|
46637
46637
|
for (let i = 1; i < n; i++) {
|
|
46638
|
-
const m = diag2[i] -
|
|
46638
|
+
const m = diag2[i] - sub2[i - 1] * cp[i - 1];
|
|
46639
46639
|
if (m === 0) {
|
|
46640
46640
|
throw new Error(`thomasSolve: zero pivot at row ${i} (no pivoting is performed)`);
|
|
46641
46641
|
}
|
|
46642
46642
|
cp[i] = i < n - 1 ? sup[i] / m : 0;
|
|
46643
|
-
dp[i] = (d[i] -
|
|
46643
|
+
dp[i] = (d[i] - sub2[i - 1] * dp[i - 1]) / m;
|
|
46644
46644
|
}
|
|
46645
46645
|
const x = new Array(n);
|
|
46646
46646
|
x[n - 1] = dp[n - 1];
|
|
@@ -47837,15 +47837,15 @@ function ridge(X, y, alpha, opts) {
|
|
|
47837
47837
|
return { coefficients, intercept };
|
|
47838
47838
|
}
|
|
47839
47839
|
function standardize(Xc, n, p) {
|
|
47840
|
-
const
|
|
47840
|
+
const scale4 = new Array(p);
|
|
47841
47841
|
for (let j = 0; j < p; j++) {
|
|
47842
47842
|
let ss = 0;
|
|
47843
47843
|
for (let i = 0; i < n; i++) ss += Xc[i][j] * Xc[i][j];
|
|
47844
47844
|
const meanSq = ss / n;
|
|
47845
|
-
|
|
47845
|
+
scale4[j] = meanSq > 1e-15 ? Math.sqrt(meanSq) : 1;
|
|
47846
47846
|
}
|
|
47847
|
-
const Xs = Xc.map((row2) => row2.map((v, j) => v /
|
|
47848
|
-
return { Xs, scale:
|
|
47847
|
+
const Xs = Xc.map((row2) => row2.map((v, j) => v / scale4[j]));
|
|
47848
|
+
return { Xs, scale: scale4 };
|
|
47849
47849
|
}
|
|
47850
47850
|
function coordinateDescent(Xs, yc, n, p, l1, l2, maxIter, tol) {
|
|
47851
47851
|
const beta2 = new Array(p).fill(0);
|
|
@@ -47877,9 +47877,9 @@ function lasso(X, y, alpha, opts) {
|
|
|
47877
47877
|
const maxIter = opts?.maxIter ?? 1e3;
|
|
47878
47878
|
const tol = opts?.tol ?? 1e-7;
|
|
47879
47879
|
const { Xc, yc, xMean, yMean } = center(X, y, n, p, useIntercept);
|
|
47880
|
-
const { Xs, scale:
|
|
47880
|
+
const { Xs, scale: scale4 } = standardize(Xc, n, p);
|
|
47881
47881
|
const betaStd = coordinateDescent(Xs, yc, n, p, alpha, 0, maxIter, tol);
|
|
47882
|
-
const coefficients = betaStd.map((b, j) => b /
|
|
47882
|
+
const coefficients = betaStd.map((b, j) => b / scale4[j]);
|
|
47883
47883
|
const intercept = useIntercept ? yMean - dot4(xMean, coefficients) : 0;
|
|
47884
47884
|
return { coefficients, intercept };
|
|
47885
47885
|
}
|
|
@@ -47891,11 +47891,11 @@ function elasticNet(X, y, alpha, l1Ratio, opts) {
|
|
|
47891
47891
|
const maxIter = opts?.maxIter ?? 1e3;
|
|
47892
47892
|
const tol = opts?.tol ?? 1e-7;
|
|
47893
47893
|
const { Xc, yc, xMean, yMean } = center(X, y, n, p, useIntercept);
|
|
47894
|
-
const { Xs, scale:
|
|
47894
|
+
const { Xs, scale: scale4 } = standardize(Xc, n, p);
|
|
47895
47895
|
const l1 = alpha * l1Ratio;
|
|
47896
47896
|
const l2 = alpha * (1 - l1Ratio);
|
|
47897
47897
|
const betaStd = coordinateDescent(Xs, yc, n, p, l1, l2, maxIter, tol);
|
|
47898
|
-
const coefficients = betaStd.map((b, j) => b /
|
|
47898
|
+
const coefficients = betaStd.map((b, j) => b / scale4[j]);
|
|
47899
47899
|
const intercept = useIntercept ? yMean - dot4(xMean, coefficients) : 0;
|
|
47900
47900
|
return { coefficients, intercept };
|
|
47901
47901
|
}
|
|
@@ -47963,8 +47963,8 @@ function logisticRegression(X, y, opts) {
|
|
|
47963
47963
|
let stepNorm = 0;
|
|
47964
47964
|
for (const d of delta) stepNorm = Math.max(stepNorm, Math.abs(d));
|
|
47965
47965
|
if (stepNorm > MAX_STEP_NORM) {
|
|
47966
|
-
const
|
|
47967
|
-
delta = delta.map((d) => d *
|
|
47966
|
+
const scale4 = MAX_STEP_NORM / stepNorm;
|
|
47967
|
+
delta = delta.map((d) => d * scale4);
|
|
47968
47968
|
stepNorm = MAX_STEP_NORM;
|
|
47969
47969
|
}
|
|
47970
47970
|
beta2 = beta2.map((b, j) => b + delta[j]);
|
|
@@ -48002,18 +48002,18 @@ function nelderMead(f, x0, opts = {}) {
|
|
|
48002
48002
|
for (let i = 0; i < n; i++) for (let j = 0; j < n; j++) c[j] += pts[i][j] / n;
|
|
48003
48003
|
return c;
|
|
48004
48004
|
};
|
|
48005
|
-
const
|
|
48006
|
-
const
|
|
48005
|
+
const add4 = (a, b, s) => a.map((v, i) => v + s * b[i]);
|
|
48006
|
+
const sub2 = (a, b) => a.map((v, i) => v - b[i]);
|
|
48007
48007
|
for (; iter < maxIter; iter++) {
|
|
48008
48008
|
const order = fv.map((_, i) => i).sort((i, j) => fv[i] - fv[j]);
|
|
48009
48009
|
simplex = order.map((i) => simplex[i]);
|
|
48010
48010
|
fv = order.map((i) => fv[i]);
|
|
48011
48011
|
if (Math.abs(fv[n] - fv[0]) <= tol * (Math.abs(fv[0]) + tol)) break;
|
|
48012
48012
|
const c = centroid2(simplex.slice(0, n));
|
|
48013
|
-
const xr =
|
|
48013
|
+
const xr = add4(c, sub2(c, simplex[n]), alpha);
|
|
48014
48014
|
const fr = f(xr);
|
|
48015
48015
|
if (fr < fv[0]) {
|
|
48016
|
-
const xe =
|
|
48016
|
+
const xe = add4(c, sub2(c, simplex[n]), gamma2);
|
|
48017
48017
|
const fe = f(xe);
|
|
48018
48018
|
if (fe < fr) {
|
|
48019
48019
|
simplex[n] = xe;
|
|
@@ -48026,14 +48026,14 @@ function nelderMead(f, x0, opts = {}) {
|
|
|
48026
48026
|
simplex[n] = xr;
|
|
48027
48027
|
fv[n] = fr;
|
|
48028
48028
|
} else {
|
|
48029
|
-
const xc =
|
|
48029
|
+
const xc = add4(c, sub2(simplex[n], c), rho);
|
|
48030
48030
|
const fc = f(xc);
|
|
48031
48031
|
if (fc < fv[n]) {
|
|
48032
48032
|
simplex[n] = xc;
|
|
48033
48033
|
fv[n] = fc;
|
|
48034
48034
|
} else {
|
|
48035
48035
|
for (let i = 1; i <= n; i++) {
|
|
48036
|
-
simplex[i] =
|
|
48036
|
+
simplex[i] = add4(simplex[0], sub2(simplex[i], simplex[0]), sigma);
|
|
48037
48037
|
fv[i] = f(simplex[i]);
|
|
48038
48038
|
}
|
|
48039
48039
|
}
|
|
@@ -48406,8 +48406,8 @@ function fitPoisson(data) {
|
|
|
48406
48406
|
for (const k of data) logLikelihood += -lambda + k * Math.log(lambda) - logFactorial(k);
|
|
48407
48407
|
return { params: { lambda }, logLikelihood };
|
|
48408
48408
|
}
|
|
48409
|
-
function gammaLogPdf(x, shape,
|
|
48410
|
-
return (shape - 1) * Math.log(x) - x /
|
|
48409
|
+
function gammaLogPdf(x, shape, scale4) {
|
|
48410
|
+
return (shape - 1) * Math.log(x) - x / scale4 - lgamma(shape) - shape * Math.log(scale4);
|
|
48411
48411
|
}
|
|
48412
48412
|
function fitGamma(data) {
|
|
48413
48413
|
for (const x of data) {
|
|
@@ -48424,10 +48424,10 @@ function fitGamma(data) {
|
|
|
48424
48424
|
const k0 = (3 - s + Math.sqrt((s - 3) * (s - 3) + 24 * s)) / (12 * s);
|
|
48425
48425
|
const f = (k) => Math.log(k) - digamma(k) - s;
|
|
48426
48426
|
const shape = secant(f, k0, k0 * 1.1, { tol: 1e-12, maxIter: 200 });
|
|
48427
|
-
const
|
|
48427
|
+
const scale4 = xbar / shape;
|
|
48428
48428
|
let logLikelihood = 0;
|
|
48429
|
-
for (const x of data) logLikelihood += gammaLogPdf(x, shape,
|
|
48430
|
-
return { params: { shape, scale:
|
|
48429
|
+
for (const x of data) logLikelihood += gammaLogPdf(x, shape, scale4);
|
|
48430
|
+
return { params: { shape, scale: scale4 }, logLikelihood };
|
|
48431
48431
|
}
|
|
48432
48432
|
function fitDistribution(name254, data) {
|
|
48433
48433
|
if (data.length === 0) {
|
|
@@ -49858,23 +49858,23 @@ function waverec(coeffs, wavelet = "haar") {
|
|
|
49858
49858
|
}
|
|
49859
49859
|
return approx;
|
|
49860
49860
|
}
|
|
49861
|
-
function rickerWavelet(points,
|
|
49862
|
-
const amplitude = 2 / (Math.sqrt(3 *
|
|
49861
|
+
function rickerWavelet(points, scale4) {
|
|
49862
|
+
const amplitude = 2 / (Math.sqrt(3 * scale4) * Math.pow(Math.PI, 0.25));
|
|
49863
49863
|
const out = new Array(points);
|
|
49864
49864
|
const center3 = (points - 1) / 2;
|
|
49865
49865
|
for (let i = 0; i < points; i++) {
|
|
49866
|
-
const t = (i - center3) /
|
|
49866
|
+
const t = (i - center3) / scale4;
|
|
49867
49867
|
const t2 = t * t;
|
|
49868
49868
|
out[i] = amplitude * (1 - t2) * Math.exp(-t2 / 2);
|
|
49869
49869
|
}
|
|
49870
49870
|
return out;
|
|
49871
49871
|
}
|
|
49872
|
-
function morletWavelet(points,
|
|
49873
|
-
const norm4 = 1 / (Math.sqrt(
|
|
49872
|
+
function morletWavelet(points, scale4) {
|
|
49873
|
+
const norm4 = 1 / (Math.sqrt(scale4) * Math.pow(Math.PI, 0.25));
|
|
49874
49874
|
const out = new Array(points);
|
|
49875
49875
|
const center3 = (points - 1) / 2;
|
|
49876
49876
|
for (let i = 0; i < points; i++) {
|
|
49877
|
-
const t = (i - center3) /
|
|
49877
|
+
const t = (i - center3) / scale4;
|
|
49878
49878
|
out[i] = norm4 * Math.cos(5 * t) * Math.exp(-(t * t) / 2);
|
|
49879
49879
|
}
|
|
49880
49880
|
return out;
|
|
@@ -49884,10 +49884,10 @@ function cwt(x, scales, wavelet = "ricker") {
|
|
|
49884
49884
|
throw new Error(`cwt: unsupported wavelet "${wavelet}"`);
|
|
49885
49885
|
}
|
|
49886
49886
|
const n = x.length;
|
|
49887
|
-
return scales.map((
|
|
49888
|
-
if (
|
|
49889
|
-
const points = Math.max(1, Math.min(Math.round(10 *
|
|
49890
|
-
const psi = wavelet === "ricker" ? rickerWavelet(points,
|
|
49887
|
+
return scales.map((scale4) => {
|
|
49888
|
+
if (scale4 <= 0) throw new Error("cwt: scales must be positive");
|
|
49889
|
+
const points = Math.max(1, Math.min(Math.round(10 * scale4), n));
|
|
49890
|
+
const psi = wavelet === "ricker" ? rickerWavelet(points, scale4) : morletWavelet(points, scale4);
|
|
49891
49891
|
return convDirect(x, psi, "same");
|
|
49892
49892
|
});
|
|
49893
49893
|
}
|
|
@@ -50005,10 +50005,10 @@ function crossPower(x, y, opts) {
|
|
|
50005
50005
|
im3[k] += X.im * Y.re - X.re * Y.im;
|
|
50006
50006
|
}
|
|
50007
50007
|
}
|
|
50008
|
-
const
|
|
50008
|
+
const scale4 = 1 / (fs * winSum2 * nSeg);
|
|
50009
50009
|
for (let k = 0; k < half; k++) {
|
|
50010
|
-
re3[k] *=
|
|
50011
|
-
im3[k] *=
|
|
50010
|
+
re3[k] *= scale4;
|
|
50011
|
+
im3[k] *= scale4;
|
|
50012
50012
|
}
|
|
50013
50013
|
const frequencies = Array.from({ length: half }, (_, k) => k * fs / nfft);
|
|
50014
50014
|
return { frequencies, re: re3, im: im3 };
|
|
@@ -50195,6 +50195,27 @@ function quaternionToEuler(q) {
|
|
|
50195
50195
|
const yaw = Math.atan2(2 * (w * z + x * y), 1 - 2 * (y * y + z * z));
|
|
50196
50196
|
return [roll, pitch, yaw];
|
|
50197
50197
|
}
|
|
50198
|
+
var QUAT_VECTOR_EPS = 1e-15;
|
|
50199
|
+
function quaternionLog(q) {
|
|
50200
|
+
const [w, x, y, z] = q;
|
|
50201
|
+
const vNorm = Math.sqrt(x * x + y * y + z * z);
|
|
50202
|
+
if (vNorm < QUAT_VECTOR_EPS) return [0, 0, 0, 0];
|
|
50203
|
+
const theta = Math.atan2(vNorm, w);
|
|
50204
|
+
const s = theta / vNorm;
|
|
50205
|
+
return [0, x * s, y * s, z * s];
|
|
50206
|
+
}
|
|
50207
|
+
function quaternionExp(q) {
|
|
50208
|
+
const [w, x, y, z] = q;
|
|
50209
|
+
const vNorm = Math.sqrt(x * x + y * y + z * z);
|
|
50210
|
+
const ew = Math.exp(w);
|
|
50211
|
+
if (vNorm < QUAT_VECTOR_EPS) return [ew, 0, 0, 0];
|
|
50212
|
+
const s = ew * Math.sin(vNorm) / vNorm;
|
|
50213
|
+
return [ew * Math.cos(vNorm), x * s, y * s, z * s];
|
|
50214
|
+
}
|
|
50215
|
+
function quaternionPow(q, t) {
|
|
50216
|
+
const logQ = quaternionLog(q);
|
|
50217
|
+
return quaternionExp(logQ.map((v) => v * t));
|
|
50218
|
+
}
|
|
50198
50219
|
function boundingBox(points) {
|
|
50199
50220
|
if (points.length === 0) throw new Error("boundingBox: requires at least one point");
|
|
50200
50221
|
const dims = points[0].length;
|
|
@@ -50260,8 +50281,8 @@ function procrustes(A, B) {
|
|
|
50260
50281
|
const M = matMul2(matTranspose(A0), B0);
|
|
50261
50282
|
const { U, S, V } = svd3(M);
|
|
50262
50283
|
const R = matMul2(V, matTranspose(U));
|
|
50263
|
-
const
|
|
50264
|
-
const transformed = matMul2(B0, R).map((row2) => row2.map((v) => v *
|
|
50284
|
+
const scale4 = S.reduce((s, v) => s + v, 0);
|
|
50285
|
+
const transformed = matMul2(B0, R).map((row2) => row2.map((v) => v * scale4));
|
|
50265
50286
|
let disparity = 0;
|
|
50266
50287
|
for (let i = 0; i < A0.length; i++) {
|
|
50267
50288
|
for (let j = 0; j < A0[i].length; j++) {
|
|
@@ -50269,7 +50290,7 @@ function procrustes(A, B) {
|
|
|
50269
50290
|
disparity += diff2 * diff2;
|
|
50270
50291
|
}
|
|
50271
50292
|
}
|
|
50272
|
-
return { R, scale:
|
|
50293
|
+
return { R, scale: scale4, disparity };
|
|
50273
50294
|
}
|
|
50274
50295
|
function euclideanDist(a, b) {
|
|
50275
50296
|
let sum3 = 0;
|
|
@@ -50318,6 +50339,89 @@ function setDisjoint(a, b) {
|
|
|
50318
50339
|
return true;
|
|
50319
50340
|
}
|
|
50320
50341
|
|
|
50342
|
+
// src/geometry/intersect3d.ts
|
|
50343
|
+
var EPS3 = 1e-12;
|
|
50344
|
+
function sub(a, b) {
|
|
50345
|
+
return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
|
50346
|
+
}
|
|
50347
|
+
function add3(a, b) {
|
|
50348
|
+
return [a[0] + b[0], a[1] + b[1], a[2] + b[2]];
|
|
50349
|
+
}
|
|
50350
|
+
function scale3(a, s) {
|
|
50351
|
+
return [a[0] * s, a[1] * s, a[2] * s];
|
|
50352
|
+
}
|
|
50353
|
+
function dot7(a, b) {
|
|
50354
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
50355
|
+
}
|
|
50356
|
+
function cross2(a, b) {
|
|
50357
|
+
return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
|
|
50358
|
+
}
|
|
50359
|
+
function rayTriangleIntersect(origin, dir, v0, v1, v2) {
|
|
50360
|
+
const e1 = sub(v1, v0);
|
|
50361
|
+
const e2 = sub(v2, v0);
|
|
50362
|
+
const pvec = cross2(dir, e2);
|
|
50363
|
+
const det2 = dot7(e1, pvec);
|
|
50364
|
+
if (Math.abs(det2) < EPS3) return null;
|
|
50365
|
+
const invDet = 1 / det2;
|
|
50366
|
+
const tvec = sub(origin, v0);
|
|
50367
|
+
const u = dot7(tvec, pvec) * invDet;
|
|
50368
|
+
if (u < 0 || u > 1) return null;
|
|
50369
|
+
const qvec = cross2(tvec, e1);
|
|
50370
|
+
const v = dot7(dir, qvec) * invDet;
|
|
50371
|
+
if (v < 0 || u + v > 1) return null;
|
|
50372
|
+
const t = dot7(e2, qvec) * invDet;
|
|
50373
|
+
if (t < 0) return null;
|
|
50374
|
+
return { point: add3(origin, scale3(dir, t)), t };
|
|
50375
|
+
}
|
|
50376
|
+
function rayPlaneIntersect(origin, dir, planePoint, planeNormal) {
|
|
50377
|
+
const denom = dot7(dir, planeNormal);
|
|
50378
|
+
if (Math.abs(denom) < EPS3) return null;
|
|
50379
|
+
const t = dot7(sub(planePoint, origin), planeNormal) / denom;
|
|
50380
|
+
return { point: add3(origin, scale3(dir, t)), t };
|
|
50381
|
+
}
|
|
50382
|
+
function clamp01(x) {
|
|
50383
|
+
return x < 0 ? 0 : x > 1 ? 1 : x;
|
|
50384
|
+
}
|
|
50385
|
+
function segmentSegmentClosest(p1, p2, q1, q2) {
|
|
50386
|
+
const d1 = sub(p2, p1);
|
|
50387
|
+
const d2 = sub(q2, q1);
|
|
50388
|
+
const r = sub(p1, q1);
|
|
50389
|
+
const a = dot7(d1, d1);
|
|
50390
|
+
const e = dot7(d2, d2);
|
|
50391
|
+
const f = dot7(d2, r);
|
|
50392
|
+
let s;
|
|
50393
|
+
let t;
|
|
50394
|
+
if (a <= EPS3 && e <= EPS3) {
|
|
50395
|
+
s = 0;
|
|
50396
|
+
t = 0;
|
|
50397
|
+
} else if (a <= EPS3) {
|
|
50398
|
+
s = 0;
|
|
50399
|
+
t = clamp01(f / e);
|
|
50400
|
+
} else {
|
|
50401
|
+
const c = dot7(d1, r);
|
|
50402
|
+
if (e <= EPS3) {
|
|
50403
|
+
t = 0;
|
|
50404
|
+
s = clamp01(-c / a);
|
|
50405
|
+
} else {
|
|
50406
|
+
const b = dot7(d1, d2);
|
|
50407
|
+
const denom = a * e - b * b;
|
|
50408
|
+
s = denom !== 0 ? clamp01((b * f - c * e) / denom) : 0;
|
|
50409
|
+
t = (b * s + f) / e;
|
|
50410
|
+
if (t < 0) {
|
|
50411
|
+
t = 0;
|
|
50412
|
+
s = clamp01(-c / a);
|
|
50413
|
+
} else if (t > 1) {
|
|
50414
|
+
t = 1;
|
|
50415
|
+
s = clamp01((b - c) / a);
|
|
50416
|
+
}
|
|
50417
|
+
}
|
|
50418
|
+
}
|
|
50419
|
+
const point1 = add3(p1, scale3(d1, s));
|
|
50420
|
+
const point2 = add3(q1, scale3(d2, t));
|
|
50421
|
+
const distance2 = Math.sqrt(dot7(sub(point1, point2), sub(point1, point2)));
|
|
50422
|
+
return { point1, point2, distance: distance2 };
|
|
50423
|
+
}
|
|
50424
|
+
|
|
50321
50425
|
// src/stats/inference-extra2.ts
|
|
50322
50426
|
var TWO_PI = 2 * Math.PI;
|
|
50323
50427
|
function noncentralChi2CDF(x, df, nc) {
|
|
@@ -50377,22 +50481,22 @@ function noncentralTCDF(t, df, nc) {
|
|
|
50377
50481
|
}
|
|
50378
50482
|
function circularSums(angles, opts) {
|
|
50379
50483
|
const { high = TWO_PI, low = 0 } = opts;
|
|
50380
|
-
const
|
|
50484
|
+
const scale4 = TWO_PI / (high - low);
|
|
50381
50485
|
let sinSum = 0;
|
|
50382
50486
|
let cosSum = 0;
|
|
50383
50487
|
for (const a of angles) {
|
|
50384
|
-
const theta = (a - low) *
|
|
50488
|
+
const theta = (a - low) * scale4;
|
|
50385
50489
|
sinSum += Math.sin(theta);
|
|
50386
50490
|
cosSum += Math.cos(theta);
|
|
50387
50491
|
}
|
|
50388
|
-
return { sinSum, cosSum, scale:
|
|
50492
|
+
return { sinSum, cosSum, scale: scale4 };
|
|
50389
50493
|
}
|
|
50390
50494
|
function circmean(angles, opts = {}) {
|
|
50391
50495
|
const { low = 0 } = opts;
|
|
50392
|
-
const { sinSum, cosSum, scale:
|
|
50496
|
+
const { sinSum, cosSum, scale: scale4 } = circularSums(angles, opts);
|
|
50393
50497
|
let mean7 = Math.atan2(sinSum, cosSum);
|
|
50394
50498
|
if (mean7 < 0) mean7 += TWO_PI;
|
|
50395
|
-
return mean7 /
|
|
50499
|
+
return mean7 / scale4 + low;
|
|
50396
50500
|
}
|
|
50397
50501
|
function circvar(angles, opts = {}) {
|
|
50398
50502
|
const n = angles.length;
|
|
@@ -50924,10 +51028,10 @@ function hungarian(cost) {
|
|
|
50924
51028
|
}
|
|
50925
51029
|
|
|
50926
51030
|
// src/numeric/interval.ts
|
|
50927
|
-
var
|
|
51031
|
+
var EPS4 = Number.EPSILON;
|
|
50928
51032
|
function outward(lo, hi) {
|
|
50929
|
-
const loOut = lo - Math.abs(lo) *
|
|
50930
|
-
const hiOut = hi + Math.abs(hi) *
|
|
51033
|
+
const loOut = lo - Math.abs(lo) * EPS4 - Number.MIN_VALUE;
|
|
51034
|
+
const hiOut = hi + Math.abs(hi) * EPS4 + Number.MIN_VALUE;
|
|
50931
51035
|
return new Interval(loOut, hiOut);
|
|
50932
51036
|
}
|
|
50933
51037
|
var Interval = class {
|
|
@@ -51062,6 +51166,270 @@ var Interval = class {
|
|
|
51062
51166
|
function interval(lo, hi) {
|
|
51063
51167
|
return new Interval(lo, hi);
|
|
51064
51168
|
}
|
|
51169
|
+
|
|
51170
|
+
// src/graph/community-coloring.ts
|
|
51171
|
+
function _edgeExists(adj, i, j) {
|
|
51172
|
+
const w = adj[i][j];
|
|
51173
|
+
return Number.isFinite(w) && w !== 0;
|
|
51174
|
+
}
|
|
51175
|
+
function _undirectedEdgeExists(adj, i, j) {
|
|
51176
|
+
return _edgeExists(adj, i, j) || _edgeExists(adj, j, i);
|
|
51177
|
+
}
|
|
51178
|
+
function graphColoring(adj) {
|
|
51179
|
+
const n = adj.length;
|
|
51180
|
+
const colors = new Array(n).fill(-1);
|
|
51181
|
+
if (n === 0) return colors;
|
|
51182
|
+
const degree2 = new Array(n).fill(0);
|
|
51183
|
+
for (let i = 0; i < n; i++) {
|
|
51184
|
+
for (let j = 0; j < n; j++) {
|
|
51185
|
+
if (i !== j && _undirectedEdgeExists(adj, i, j)) degree2[i]++;
|
|
51186
|
+
}
|
|
51187
|
+
}
|
|
51188
|
+
const order = Array.from({ length: n }, (_, i) => i).sort(
|
|
51189
|
+
(a, b) => degree2[b] - degree2[a] || a - b
|
|
51190
|
+
);
|
|
51191
|
+
for (const v of order) {
|
|
51192
|
+
const usedByNeighbor = /* @__PURE__ */ new Set();
|
|
51193
|
+
for (let u = 0; u < n; u++) {
|
|
51194
|
+
if (u !== v && _undirectedEdgeExists(adj, v, u) && colors[u] !== -1) {
|
|
51195
|
+
usedByNeighbor.add(colors[u]);
|
|
51196
|
+
}
|
|
51197
|
+
}
|
|
51198
|
+
let c = 0;
|
|
51199
|
+
while (usedByNeighbor.has(c)) c++;
|
|
51200
|
+
colors[v] = c;
|
|
51201
|
+
}
|
|
51202
|
+
return colors;
|
|
51203
|
+
}
|
|
51204
|
+
function maxClique(adj) {
|
|
51205
|
+
const n = adj.length;
|
|
51206
|
+
if (n === 0) return [];
|
|
51207
|
+
const hasEdge = (i, j) => i !== j && _undirectedEdgeExists(adj, i, j);
|
|
51208
|
+
let best = [];
|
|
51209
|
+
function bronKerbosch(R, P2, X) {
|
|
51210
|
+
if (P2.size === 0 && X.size === 0) {
|
|
51211
|
+
if (R.length > best.length) best = R.slice();
|
|
51212
|
+
return;
|
|
51213
|
+
}
|
|
51214
|
+
let pivot = -1;
|
|
51215
|
+
let pivotCount = -1;
|
|
51216
|
+
for (const u of [...P2, ...X]) {
|
|
51217
|
+
let cnt = 0;
|
|
51218
|
+
for (const w of P2) if (hasEdge(u, w)) cnt++;
|
|
51219
|
+
if (cnt > pivotCount) {
|
|
51220
|
+
pivotCount = cnt;
|
|
51221
|
+
pivot = u;
|
|
51222
|
+
}
|
|
51223
|
+
}
|
|
51224
|
+
const candidates = pivot === -1 ? [...P2] : [...P2].filter((v) => !hasEdge(pivot, v));
|
|
51225
|
+
for (const v of candidates) {
|
|
51226
|
+
const newP = /* @__PURE__ */ new Set();
|
|
51227
|
+
const newX = /* @__PURE__ */ new Set();
|
|
51228
|
+
for (const w of P2) if (hasEdge(v, w)) newP.add(w);
|
|
51229
|
+
for (const w of X) if (hasEdge(v, w)) newX.add(w);
|
|
51230
|
+
bronKerbosch([...R, v], newP, newX);
|
|
51231
|
+
P2.delete(v);
|
|
51232
|
+
X.add(v);
|
|
51233
|
+
}
|
|
51234
|
+
}
|
|
51235
|
+
const initialP = new Set(Array.from({ length: n }, (_, i) => i));
|
|
51236
|
+
bronKerbosch([], initialP, /* @__PURE__ */ new Set());
|
|
51237
|
+
return best.sort((a, b) => a - b);
|
|
51238
|
+
}
|
|
51239
|
+
function _louvainLocalMoving(W) {
|
|
51240
|
+
const n = W.length;
|
|
51241
|
+
const kDeg = new Array(n).fill(0);
|
|
51242
|
+
for (let i = 0; i < n; i++) {
|
|
51243
|
+
let s = 0;
|
|
51244
|
+
for (let j = 0; j < n; j++) s += W[i][j];
|
|
51245
|
+
kDeg[i] = s;
|
|
51246
|
+
}
|
|
51247
|
+
const m2 = kDeg.reduce((a, b) => a + b, 0);
|
|
51248
|
+
const m = m2 / 2;
|
|
51249
|
+
const community = Array.from({ length: n }, (_, i) => i);
|
|
51250
|
+
const sigmaTot = kDeg.slice();
|
|
51251
|
+
if (m === 0) return community;
|
|
51252
|
+
let improved = true;
|
|
51253
|
+
while (improved) {
|
|
51254
|
+
improved = false;
|
|
51255
|
+
for (let i = 0; i < n; i++) {
|
|
51256
|
+
const ci = community[i];
|
|
51257
|
+
sigmaTot[ci] -= kDeg[i];
|
|
51258
|
+
const neighborWeight = /* @__PURE__ */ new Map();
|
|
51259
|
+
for (let j = 0; j < n; j++) {
|
|
51260
|
+
if (j === i) continue;
|
|
51261
|
+
const w = W[i][j];
|
|
51262
|
+
if (w > 0) {
|
|
51263
|
+
const cj = community[j];
|
|
51264
|
+
neighborWeight.set(cj, (neighborWeight.get(cj) ?? 0) + w);
|
|
51265
|
+
}
|
|
51266
|
+
}
|
|
51267
|
+
const candidates = new Set(neighborWeight.keys());
|
|
51268
|
+
candidates.add(ci);
|
|
51269
|
+
const sortedCandidates = [...candidates].sort((a, b) => a - b);
|
|
51270
|
+
let bestC = ci;
|
|
51271
|
+
let bestGain = (neighborWeight.get(ci) ?? 0) / m - kDeg[i] * sigmaTot[ci] / (2 * m * m);
|
|
51272
|
+
for (const c of sortedCandidates) {
|
|
51273
|
+
if (c === ci) continue;
|
|
51274
|
+
const gain = (neighborWeight.get(c) ?? 0) / m - kDeg[i] * sigmaTot[c] / (2 * m * m);
|
|
51275
|
+
if (gain > bestGain + 1e-12) {
|
|
51276
|
+
bestGain = gain;
|
|
51277
|
+
bestC = c;
|
|
51278
|
+
}
|
|
51279
|
+
}
|
|
51280
|
+
community[i] = bestC;
|
|
51281
|
+
sigmaTot[bestC] += kDeg[i];
|
|
51282
|
+
if (bestC !== ci) improved = true;
|
|
51283
|
+
}
|
|
51284
|
+
}
|
|
51285
|
+
return community;
|
|
51286
|
+
}
|
|
51287
|
+
function _louvainAggregate(W, community) {
|
|
51288
|
+
const distinct = [...new Set(community)].sort((a, b) => a - b);
|
|
51289
|
+
const remap = new Map(distinct.map((c, idx) => [c, idx]));
|
|
51290
|
+
const k = distinct.length;
|
|
51291
|
+
const n = W.length;
|
|
51292
|
+
const newW = Array.from({ length: k }, () => new Array(k).fill(0));
|
|
51293
|
+
for (let i = 0; i < n; i++) {
|
|
51294
|
+
const ci = remap.get(community[i]);
|
|
51295
|
+
for (let j = 0; j < n; j++) {
|
|
51296
|
+
const cj = remap.get(community[j]);
|
|
51297
|
+
newW[ci][cj] += W[i][j];
|
|
51298
|
+
}
|
|
51299
|
+
}
|
|
51300
|
+
return { newW, remap };
|
|
51301
|
+
}
|
|
51302
|
+
function louvainCommunities(adj) {
|
|
51303
|
+
const n = adj.length;
|
|
51304
|
+
if (n === 0) return [];
|
|
51305
|
+
if (n === 1) return [[0]];
|
|
51306
|
+
let curW = adj.map((row2) => row2.slice());
|
|
51307
|
+
let membership = Array.from({ length: n }, (_, i) => i);
|
|
51308
|
+
for (; ; ) {
|
|
51309
|
+
const community = _louvainLocalMoving(curW);
|
|
51310
|
+
const isIdentity = community.every((c, i) => c === i);
|
|
51311
|
+
if (isIdentity) break;
|
|
51312
|
+
const { newW, remap } = _louvainAggregate(curW, community);
|
|
51313
|
+
membership = membership.map((c) => remap.get(community[c]));
|
|
51314
|
+
curW = newW;
|
|
51315
|
+
if (curW.length === 1) break;
|
|
51316
|
+
}
|
|
51317
|
+
const groups = /* @__PURE__ */ new Map();
|
|
51318
|
+
for (let i = 0; i < n; i++) {
|
|
51319
|
+
const c = membership[i];
|
|
51320
|
+
const group = groups.get(c);
|
|
51321
|
+
if (group) group.push(i);
|
|
51322
|
+
else groups.set(c, [i]);
|
|
51323
|
+
}
|
|
51324
|
+
return [...groups.entries()].sort((a, b) => a[0] - b[0]).map(([, group]) => group);
|
|
51325
|
+
}
|
|
51326
|
+
function _solveLinearSystem(A, b) {
|
|
51327
|
+
const n = A.length;
|
|
51328
|
+
const M = A.map((row2, i) => [...row2, b[i]]);
|
|
51329
|
+
for (let col = 0; col < n; col++) {
|
|
51330
|
+
let pivotRow = col;
|
|
51331
|
+
let maxVal = Math.abs(M[col][col]);
|
|
51332
|
+
for (let r = col + 1; r < n; r++) {
|
|
51333
|
+
if (Math.abs(M[r][col]) > maxVal) {
|
|
51334
|
+
maxVal = Math.abs(M[r][col]);
|
|
51335
|
+
pivotRow = r;
|
|
51336
|
+
}
|
|
51337
|
+
}
|
|
51338
|
+
if (maxVal < 1e-14) {
|
|
51339
|
+
throw new Error(
|
|
51340
|
+
"katzCentrality: singular system \u2014 reduce alpha (must be < 1/largest eigenvalue)"
|
|
51341
|
+
);
|
|
51342
|
+
}
|
|
51343
|
+
if (pivotRow !== col) {
|
|
51344
|
+
const tmp = M[col];
|
|
51345
|
+
M[col] = M[pivotRow];
|
|
51346
|
+
M[pivotRow] = tmp;
|
|
51347
|
+
}
|
|
51348
|
+
const pivotVal = M[col][col];
|
|
51349
|
+
for (let j = col; j <= n; j++) M[col][j] /= pivotVal;
|
|
51350
|
+
for (let r = 0; r < n; r++) {
|
|
51351
|
+
if (r === col) continue;
|
|
51352
|
+
const factor2 = M[r][col];
|
|
51353
|
+
if (factor2 === 0) continue;
|
|
51354
|
+
for (let j = col; j <= n; j++) M[r][j] -= factor2 * M[col][j];
|
|
51355
|
+
}
|
|
51356
|
+
}
|
|
51357
|
+
return M.map((row2) => row2[n]);
|
|
51358
|
+
}
|
|
51359
|
+
function katzCentrality(adj, alpha, beta2 = 1) {
|
|
51360
|
+
const n = adj.length;
|
|
51361
|
+
if (n === 0) return [];
|
|
51362
|
+
const M = Array.from(
|
|
51363
|
+
{ length: n },
|
|
51364
|
+
(_, i) => Array.from({ length: n }, (_2, j) => (i === j ? 1 : 0) - alpha * adj[j][i])
|
|
51365
|
+
);
|
|
51366
|
+
const b = new Array(n).fill(beta2);
|
|
51367
|
+
const x = _solveLinearSystem(M, b);
|
|
51368
|
+
let sum3 = 0;
|
|
51369
|
+
let sumSq = 0;
|
|
51370
|
+
for (const xi of x) {
|
|
51371
|
+
sum3 += xi;
|
|
51372
|
+
sumSq += xi * xi;
|
|
51373
|
+
}
|
|
51374
|
+
const norm4 = Math.sign(sum3) * Math.sqrt(sumSq);
|
|
51375
|
+
if (norm4 === 0) return x;
|
|
51376
|
+
return x.map((xi) => xi / norm4);
|
|
51377
|
+
}
|
|
51378
|
+
function isIsomorphic(graphA, graphB) {
|
|
51379
|
+
const n = graphA.length;
|
|
51380
|
+
if (graphB.length !== n) return false;
|
|
51381
|
+
if (n === 0) return true;
|
|
51382
|
+
const degreeSequence = (adj) => {
|
|
51383
|
+
const size2 = adj.length;
|
|
51384
|
+
const seq = [];
|
|
51385
|
+
for (let i = 0; i < size2; i++) {
|
|
51386
|
+
let outDeg = 0;
|
|
51387
|
+
let inDeg = 0;
|
|
51388
|
+
for (let j = 0; j < size2; j++) {
|
|
51389
|
+
if (_edgeExists(adj, i, j)) outDeg++;
|
|
51390
|
+
if (_edgeExists(adj, j, i)) inDeg++;
|
|
51391
|
+
}
|
|
51392
|
+
seq.push(outDeg * (size2 + 1) + inDeg);
|
|
51393
|
+
}
|
|
51394
|
+
return seq.sort((a, b) => a - b);
|
|
51395
|
+
};
|
|
51396
|
+
const degA = degreeSequence(graphA);
|
|
51397
|
+
const degB = degreeSequence(graphB);
|
|
51398
|
+
for (let i = 0; i < n; i++) {
|
|
51399
|
+
if (degA[i] !== degB[i]) return false;
|
|
51400
|
+
}
|
|
51401
|
+
const mapAtoB = new Array(n).fill(-1);
|
|
51402
|
+
const usedB = new Array(n).fill(false);
|
|
51403
|
+
const order = Array.from({ length: n }, (_, i) => i);
|
|
51404
|
+
function backtrack(pos) {
|
|
51405
|
+
if (pos === n) return true;
|
|
51406
|
+
const a = order[pos];
|
|
51407
|
+
for (let b = 0; b < n; b++) {
|
|
51408
|
+
if (usedB[b]) continue;
|
|
51409
|
+
let consistent = true;
|
|
51410
|
+
for (let k = 0; k < pos; k++) {
|
|
51411
|
+
const a2 = order[k];
|
|
51412
|
+
const b2 = mapAtoB[a2];
|
|
51413
|
+
if (_edgeExists(graphA, a, a2) !== _edgeExists(graphB, b, b2)) {
|
|
51414
|
+
consistent = false;
|
|
51415
|
+
break;
|
|
51416
|
+
}
|
|
51417
|
+
if (_edgeExists(graphA, a2, a) !== _edgeExists(graphB, b2, b)) {
|
|
51418
|
+
consistent = false;
|
|
51419
|
+
break;
|
|
51420
|
+
}
|
|
51421
|
+
}
|
|
51422
|
+
if (!consistent) continue;
|
|
51423
|
+
mapAtoB[a] = b;
|
|
51424
|
+
usedB[b] = true;
|
|
51425
|
+
if (backtrack(pos + 1)) return true;
|
|
51426
|
+
usedB[b] = false;
|
|
51427
|
+
mapAtoB[a] = -1;
|
|
51428
|
+
}
|
|
51429
|
+
return false;
|
|
51430
|
+
}
|
|
51431
|
+
return backtrack(0);
|
|
51432
|
+
}
|
|
51065
51433
|
export {
|
|
51066
51434
|
ARRAY_WORKER_THRESHOLD,
|
|
51067
51435
|
CAS_BATCH_THRESHOLD,
|
|
@@ -51501,6 +51869,7 @@ export {
|
|
|
51501
51869
|
gradientAt,
|
|
51502
51870
|
gradientDescent,
|
|
51503
51871
|
gradientSymbolic,
|
|
51872
|
+
graphColoring,
|
|
51504
51873
|
graphDistance,
|
|
51505
51874
|
gravitationConstant,
|
|
51506
51875
|
gravity,
|
|
@@ -51567,6 +51936,7 @@ export {
|
|
|
51567
51936
|
isGpuChainSupported,
|
|
51568
51937
|
isGpuEnabled3 as isGpuEnabled,
|
|
51569
51938
|
isInteger2 as isInteger,
|
|
51939
|
+
isIsomorphic,
|
|
51570
51940
|
isNaN2 as isNaN,
|
|
51571
51941
|
isNegative,
|
|
51572
51942
|
isNumeric,
|
|
@@ -51584,6 +51954,7 @@ export {
|
|
|
51584
51954
|
jordanForm,
|
|
51585
51955
|
josephson,
|
|
51586
51956
|
jsDivergence,
|
|
51957
|
+
katzCentrality,
|
|
51587
51958
|
kdTree,
|
|
51588
51959
|
kdTreeKNN,
|
|
51589
51960
|
kdTreeNearest,
|
|
@@ -51648,6 +52019,7 @@ export {
|
|
|
51648
52019
|
logisticRegression,
|
|
51649
52020
|
logsumexp,
|
|
51650
52021
|
loschmidt,
|
|
52022
|
+
louvainCommunities,
|
|
51651
52023
|
lowRankApprox,
|
|
51652
52024
|
lowpassFilter,
|
|
51653
52025
|
lsolve,
|
|
@@ -51679,6 +52051,7 @@ export {
|
|
|
51679
52051
|
matrixSqrtm,
|
|
51680
52052
|
matvec,
|
|
51681
52053
|
max,
|
|
52054
|
+
maxClique,
|
|
51682
52055
|
maxFlow,
|
|
51683
52056
|
maxSelect,
|
|
51684
52057
|
maximize,
|
|
@@ -51846,10 +52219,13 @@ export {
|
|
|
51846
52219
|
quantileSeq,
|
|
51847
52220
|
quantumOfCirculation,
|
|
51848
52221
|
quaternionConjugate,
|
|
52222
|
+
quaternionExp,
|
|
51849
52223
|
quaternionFromAxisAngle,
|
|
51850
52224
|
quaternionInverse,
|
|
52225
|
+
quaternionLog,
|
|
51851
52226
|
quaternionMultiply,
|
|
51852
52227
|
quaternionNormalize,
|
|
52228
|
+
quaternionPow,
|
|
51853
52229
|
quaternionRotate,
|
|
51854
52230
|
quaternionSlerp,
|
|
51855
52231
|
quaternionToEuler,
|
|
@@ -51862,6 +52238,8 @@ export {
|
|
|
51862
52238
|
rank,
|
|
51863
52239
|
rankdata,
|
|
51864
52240
|
rationalize,
|
|
52241
|
+
rayPlaneIntersect,
|
|
52242
|
+
rayTriangleIntersect,
|
|
51865
52243
|
rayleighDist,
|
|
51866
52244
|
rbfInterpolate,
|
|
51867
52245
|
re,
|
|
@@ -51904,6 +52282,7 @@ export {
|
|
|
51904
52282
|
sech,
|
|
51905
52283
|
secondRadiation,
|
|
51906
52284
|
seedProbabilityRng,
|
|
52285
|
+
segmentSegmentClosest,
|
|
51907
52286
|
sem,
|
|
51908
52287
|
series,
|
|
51909
52288
|
seriesCoefficient,
|