@danielsimonjr/mathts-functions 0.13.3 → 0.15.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/config-api.d.ts +11 -0
- package/dist/config-api.d.ts.map +1 -0
- package/dist/descriptive-stats.d.ts +11 -0
- package/dist/descriptive-stats.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +460 -176
- package/dist/special/zeta.d.ts.map +1 -1
- package/dist/typed/dist-objects.d.ts +17 -0
- package/dist/typed/dist-objects.d.ts.map +1 -1
- package/dist/typed/hypothesis.d.ts +78 -0
- package/dist/typed/hypothesis.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48,6 +48,7 @@ __export(typed_exports, {
|
|
|
48
48
|
autoCorrelation: () => autoCorrelation,
|
|
49
49
|
bandpassFilter: () => bandpassFilter,
|
|
50
50
|
bartlettPSD: () => bartlettPSD,
|
|
51
|
+
bartlettTest: () => bartlettTest,
|
|
51
52
|
bernoulli: () => bernoulli,
|
|
52
53
|
bernoulliPMF: () => bernoulliPMF,
|
|
53
54
|
besselI: () => besselI,
|
|
@@ -67,6 +68,7 @@ __export(typed_exports, {
|
|
|
67
68
|
bin: () => bin,
|
|
68
69
|
binomialDist: () => binomialDist,
|
|
69
70
|
binomialPMF: () => binomialPMF,
|
|
71
|
+
binomialTest: () => binomialTest,
|
|
70
72
|
bitAnd: () => bitAnd,
|
|
71
73
|
bitNot: () => bitNot,
|
|
72
74
|
bitOr: () => bitOr,
|
|
@@ -205,6 +207,7 @@ __export(typed_exports, {
|
|
|
205
207
|
hex: () => hex,
|
|
206
208
|
highpassFilter: () => highpassFilter,
|
|
207
209
|
hilbertTransform: () => hilbertTransform,
|
|
210
|
+
hypergeometricDist: () => hypergeometricDist,
|
|
208
211
|
hypot: () => hypot,
|
|
209
212
|
idct: () => idct,
|
|
210
213
|
idst: () => idst,
|
|
@@ -223,6 +226,7 @@ __export(typed_exports, {
|
|
|
223
226
|
jsDivergence: () => jsDivergence,
|
|
224
227
|
kdTree: () => kdTree,
|
|
225
228
|
kdTreeNearest: () => kdTreeNearest,
|
|
229
|
+
kolmogorovSmirnov2Test: () => kolmogorovSmirnov2Test,
|
|
226
230
|
kolmogorovSmirnovTest: () => kolmogorovSmirnovTest,
|
|
227
231
|
lagrangeInterp: () => lagrangeInterp,
|
|
228
232
|
laguerreL: () => laguerreL,
|
|
@@ -234,6 +238,7 @@ __export(typed_exports, {
|
|
|
234
238
|
leftShift: () => leftShift,
|
|
235
239
|
legendreFit: () => legendreFit,
|
|
236
240
|
legendreP: () => legendreP,
|
|
241
|
+
leveneTest: () => leveneTest,
|
|
237
242
|
lgamma: () => lgamma,
|
|
238
243
|
linearInterp: () => linearInterp,
|
|
239
244
|
linprog: () => linprog,
|
|
@@ -277,6 +282,7 @@ __export(typed_exports, {
|
|
|
277
282
|
multinomial: () => multinomial,
|
|
278
283
|
multiply: () => multiply,
|
|
279
284
|
nearestNeighbor: () => nearestNeighbor,
|
|
285
|
+
negativeBinomialDist: () => negativeBinomialDist,
|
|
280
286
|
newtonInterp: () => newtonInterp,
|
|
281
287
|
nextPrime: () => nextPrime,
|
|
282
288
|
nintegrate: () => nintegrate,
|
|
@@ -354,6 +360,7 @@ __export(typed_exports, {
|
|
|
354
360
|
principalComponentAnalysis: () => principalComponentAnalysis,
|
|
355
361
|
print: () => print,
|
|
356
362
|
projectVector: () => projectVector,
|
|
363
|
+
proportionZTest: () => proportionZTest,
|
|
357
364
|
quadprog: () => quadprog,
|
|
358
365
|
quickSelect: () => quickSelect,
|
|
359
366
|
random: () => random,
|
|
@@ -410,6 +417,7 @@ __export(typed_exports, {
|
|
|
410
417
|
stronglyConnectedComponents: () => stronglyConnectedComponents,
|
|
411
418
|
studentTPDF: () => studentTPDF,
|
|
412
419
|
studentTTest: () => studentTTest,
|
|
420
|
+
studentTTestPaired: () => studentTTestPaired,
|
|
413
421
|
subfactorial: () => subfactorial,
|
|
414
422
|
substitute: () => substitute,
|
|
415
423
|
subtract: () => subtract,
|
|
@@ -12813,12 +12821,7 @@ function _normalQuantileStd(p) {
|
|
|
12813
12821
|
4.374664141464968,
|
|
12814
12822
|
2.938163982698783
|
|
12815
12823
|
];
|
|
12816
|
-
const d = [
|
|
12817
|
-
0.007784695709041462,
|
|
12818
|
-
0.3224671290700398,
|
|
12819
|
-
2.445134137142996,
|
|
12820
|
-
3.754408661907416
|
|
12821
|
-
];
|
|
12824
|
+
const d = [0.007784695709041462, 0.3224671290700398, 2.445134137142996, 3.754408661907416];
|
|
12822
12825
|
const pLow = 0.02425;
|
|
12823
12826
|
let x;
|
|
12824
12827
|
if (p < pLow) {
|
|
@@ -13489,6 +13492,109 @@ function weibullDist(k, lambda = 1) {
|
|
|
13489
13492
|
})
|
|
13490
13493
|
};
|
|
13491
13494
|
}
|
|
13495
|
+
function _logChoose(n, r) {
|
|
13496
|
+
if (r < 0 || r > n) return -Infinity;
|
|
13497
|
+
return _logFactorial2(n) - _logFactorial2(r) - _logFactorial2(n - r);
|
|
13498
|
+
}
|
|
13499
|
+
function _choose(n, r) {
|
|
13500
|
+
if (r < 0 || r > n) return 0;
|
|
13501
|
+
const k = Math.min(r, n - r);
|
|
13502
|
+
let c = 1;
|
|
13503
|
+
for (let i = 0; i < k; i++) c = c * (n - i) / (i + 1);
|
|
13504
|
+
return c;
|
|
13505
|
+
}
|
|
13506
|
+
function _discreteSample(cdf, rng, cap) {
|
|
13507
|
+
const u = rng();
|
|
13508
|
+
for (let k = 0; k <= cap; k++) {
|
|
13509
|
+
if (cdf(k) >= u) return k;
|
|
13510
|
+
}
|
|
13511
|
+
return cap;
|
|
13512
|
+
}
|
|
13513
|
+
function hypergeometricDist(population, successes, draws) {
|
|
13514
|
+
if (![population, successes, draws].every((v) => Number.isInteger(v) && v >= 0)) {
|
|
13515
|
+
throw new Error(
|
|
13516
|
+
"hypergeometricDist: population, successes, draws must be non-negative integers"
|
|
13517
|
+
);
|
|
13518
|
+
}
|
|
13519
|
+
if (successes > population || draws > population) {
|
|
13520
|
+
throw new Error("hypergeometricDist: successes and draws cannot exceed population");
|
|
13521
|
+
}
|
|
13522
|
+
const M = population;
|
|
13523
|
+
const K = successes;
|
|
13524
|
+
const N = draws;
|
|
13525
|
+
const kMin = Math.max(0, N - (M - K));
|
|
13526
|
+
const kMax = Math.min(K, N);
|
|
13527
|
+
const useExact = M <= 1e3;
|
|
13528
|
+
const pmf = (k) => {
|
|
13529
|
+
if (!Number.isInteger(k) || k < kMin || k > kMax) return 0;
|
|
13530
|
+
return useExact ? _choose(K, k) * _choose(M - K, N - k) / _choose(M, N) : Math.exp(_logChoose(K, k) + _logChoose(M - K, N - k) - _logChoose(M, N));
|
|
13531
|
+
};
|
|
13532
|
+
const cdf = (k) => {
|
|
13533
|
+
if (k < kMin) return 0;
|
|
13534
|
+
const kk = Math.min(Math.floor(k), kMax);
|
|
13535
|
+
let sum3 = 0;
|
|
13536
|
+
for (let i = kMin; i <= kk; i++) sum3 += pmf(i);
|
|
13537
|
+
return Math.min(1, sum3);
|
|
13538
|
+
};
|
|
13539
|
+
const mean6 = N * K / M;
|
|
13540
|
+
const variance2 = N * (K / M) * ((M - K) / M) * ((M - N) / (M - 1));
|
|
13541
|
+
return {
|
|
13542
|
+
pdf: pmf,
|
|
13543
|
+
cdf,
|
|
13544
|
+
quantile: (p) => {
|
|
13545
|
+
if (p <= 0) return kMin;
|
|
13546
|
+
if (p >= 1) return kMax;
|
|
13547
|
+
for (let k = kMin; k <= kMax; k++) if (cdf(k) >= p) return k;
|
|
13548
|
+
return kMax;
|
|
13549
|
+
},
|
|
13550
|
+
mean: mean6,
|
|
13551
|
+
variance: variance2,
|
|
13552
|
+
sample: () => _discreteSample(cdf, Math.random, kMax),
|
|
13553
|
+
sampleN: (n, opts) => _sampleNDispatch(null, [], n, opts, (count2, rng) => {
|
|
13554
|
+
const out = new Float64Array(count2);
|
|
13555
|
+
for (let j = 0; j < count2; j++) out[j] = _discreteSample(cdf, rng, kMax);
|
|
13556
|
+
return out;
|
|
13557
|
+
})
|
|
13558
|
+
};
|
|
13559
|
+
}
|
|
13560
|
+
function negativeBinomialDist(r, p) {
|
|
13561
|
+
if (!Number.isInteger(r) || r < 1)
|
|
13562
|
+
throw new Error("negativeBinomialDist: r must be a positive integer");
|
|
13563
|
+
if (p <= 0 || p > 1) throw new Error("negativeBinomialDist: p must be in (0, 1]");
|
|
13564
|
+
const pmf = (k) => {
|
|
13565
|
+
if (!Number.isInteger(k) || k < 0) return 0;
|
|
13566
|
+
return Math.exp(_logChoose(k + r - 1, k) + r * Math.log(p) + k * Math.log(1 - p));
|
|
13567
|
+
};
|
|
13568
|
+
const cdf = (k) => {
|
|
13569
|
+
if (k < 0) return 0;
|
|
13570
|
+
return Math.min(1, _betainc(p, r, Math.floor(k) + 1));
|
|
13571
|
+
};
|
|
13572
|
+
const mean6 = r * (1 - p) / p;
|
|
13573
|
+
const variance2 = r * (1 - p) / (p * p);
|
|
13574
|
+
return {
|
|
13575
|
+
pdf: pmf,
|
|
13576
|
+
cdf,
|
|
13577
|
+
quantile: (prob) => {
|
|
13578
|
+
if (prob <= 0) return 0;
|
|
13579
|
+
if (prob >= 1) return Infinity;
|
|
13580
|
+
let cumul = 0;
|
|
13581
|
+
for (let k = 0; k < 1e5; k++) {
|
|
13582
|
+
cumul += pmf(k);
|
|
13583
|
+
if (cumul >= prob) return k;
|
|
13584
|
+
}
|
|
13585
|
+
return Infinity;
|
|
13586
|
+
},
|
|
13587
|
+
mean: mean6,
|
|
13588
|
+
variance: variance2,
|
|
13589
|
+
sample: () => _discreteSample(cdf, Math.random, Math.ceil(mean6 + 20 * Math.sqrt(variance2) + 20)),
|
|
13590
|
+
sampleN: (n, opts) => _sampleNDispatch(null, [], n, opts, (count2, rng) => {
|
|
13591
|
+
const out = new Float64Array(count2);
|
|
13592
|
+
const cap = Math.ceil(mean6 + 20 * Math.sqrt(variance2) + 20);
|
|
13593
|
+
for (let j = 0; j < count2; j++) out[j] = _discreteSample(cdf, rng, cap);
|
|
13594
|
+
return out;
|
|
13595
|
+
})
|
|
13596
|
+
};
|
|
13597
|
+
}
|
|
13492
13598
|
|
|
13493
13599
|
// src/typed/hypothesis.ts
|
|
13494
13600
|
import { computePool as computePool10 } from "@danielsimonjr/mathts-parallel";
|
|
@@ -14252,6 +14358,140 @@ function principalComponentAnalysis(data, k) {
|
|
|
14252
14358
|
});
|
|
14253
14359
|
return { components: eigenvectors, explained, scores };
|
|
14254
14360
|
}
|
|
14361
|
+
function _kstwobignSf(x) {
|
|
14362
|
+
if (x <= 0) return 1;
|
|
14363
|
+
let sum3 = 0;
|
|
14364
|
+
for (let k = 1; k <= 100; k++) {
|
|
14365
|
+
const term = 2 * (k % 2 === 1 ? 1 : -1) * Math.exp(-2 * k * k * x * x);
|
|
14366
|
+
sum3 += term;
|
|
14367
|
+
if (Math.abs(term) < 1e-15) break;
|
|
14368
|
+
}
|
|
14369
|
+
return Math.max(0, Math.min(1, sum3));
|
|
14370
|
+
}
|
|
14371
|
+
function kolmogorovSmirnov2Test(sample1, sample2) {
|
|
14372
|
+
const n16 = sample1.length;
|
|
14373
|
+
const n26 = sample2.length;
|
|
14374
|
+
if (n16 < 1 || n26 < 1) {
|
|
14375
|
+
throw new Error("kolmogorovSmirnov2Test: both samples must be non-empty");
|
|
14376
|
+
}
|
|
14377
|
+
const a = sample1.slice().sort((x, y) => x - y);
|
|
14378
|
+
const b = sample2.slice().sort((x, y) => x - y);
|
|
14379
|
+
let i = 0;
|
|
14380
|
+
let j = 0;
|
|
14381
|
+
let d = 0;
|
|
14382
|
+
while (i < n16 && j < n26) {
|
|
14383
|
+
const x = Math.min(a[i], b[j]);
|
|
14384
|
+
while (i < n16 && a[i] <= x) i++;
|
|
14385
|
+
while (j < n26 && b[j] <= x) j++;
|
|
14386
|
+
d = Math.max(d, Math.abs(i / n16 - j / n26));
|
|
14387
|
+
}
|
|
14388
|
+
const en = Math.sqrt(n16 * n26 / (n16 + n26));
|
|
14389
|
+
return { statistic: d, pValue: _kstwobignSf(en * d) };
|
|
14390
|
+
}
|
|
14391
|
+
function _median(arr7) {
|
|
14392
|
+
const s = arr7.slice().sort((a, b) => a - b);
|
|
14393
|
+
const n = s.length;
|
|
14394
|
+
const m = n >> 1;
|
|
14395
|
+
return n % 2 === 1 ? s[m] : (s[m - 1] + s[m]) / 2;
|
|
14396
|
+
}
|
|
14397
|
+
function leveneTest(groups, center = "median") {
|
|
14398
|
+
const k = groups.length;
|
|
14399
|
+
if (k < 2) throw new Error("leveneTest: need at least 2 groups");
|
|
14400
|
+
let N = 0;
|
|
14401
|
+
for (const g of groups) {
|
|
14402
|
+
if (g.length < 1) throw new Error("leveneTest: every group must be non-empty");
|
|
14403
|
+
N += g.length;
|
|
14404
|
+
}
|
|
14405
|
+
const z = groups.map((g) => {
|
|
14406
|
+
const c = center === "median" ? _median(g) : _mean(g);
|
|
14407
|
+
return g.map((x) => Math.abs(x - c));
|
|
14408
|
+
});
|
|
14409
|
+
const allZ = [];
|
|
14410
|
+
for (const zi of z) for (const v of zi) allZ.push(v);
|
|
14411
|
+
const zBarAll = _mean(allZ);
|
|
14412
|
+
let num2 = 0;
|
|
14413
|
+
let den = 0;
|
|
14414
|
+
for (const zi of z) {
|
|
14415
|
+
const zBarI = _mean(zi);
|
|
14416
|
+
num2 += zi.length * (zBarI - zBarAll) * (zBarI - zBarAll);
|
|
14417
|
+
for (const v of zi) den += (v - zBarI) * (v - zBarI);
|
|
14418
|
+
}
|
|
14419
|
+
const W = (N - k) / (k - 1) * (num2 / den);
|
|
14420
|
+
return { statistic: W, pValue: _fPValue(W, k - 1, N - k), degreesOfFreedom: [k - 1, N - k] };
|
|
14421
|
+
}
|
|
14422
|
+
function bartlettTest(groups) {
|
|
14423
|
+
const k = groups.length;
|
|
14424
|
+
if (k < 2) throw new Error("bartlettTest: need at least 2 groups");
|
|
14425
|
+
let N = 0;
|
|
14426
|
+
for (const g of groups) {
|
|
14427
|
+
if (g.length < 2) throw new Error("bartlettTest: every group needs \u22652 observations");
|
|
14428
|
+
N += g.length;
|
|
14429
|
+
}
|
|
14430
|
+
let pooledNum = 0;
|
|
14431
|
+
let sumLnVar = 0;
|
|
14432
|
+
let sumInv = 0;
|
|
14433
|
+
for (const g of groups) {
|
|
14434
|
+
const ni = g.length;
|
|
14435
|
+
const si2 = _variance(g, 1);
|
|
14436
|
+
pooledNum += (ni - 1) * si2;
|
|
14437
|
+
sumLnVar += (ni - 1) * Math.log(si2);
|
|
14438
|
+
sumInv += 1 / (ni - 1);
|
|
14439
|
+
}
|
|
14440
|
+
const sp2 = pooledNum / (N - k);
|
|
14441
|
+
const numerator = (N - k) * Math.log(sp2) - sumLnVar;
|
|
14442
|
+
const C = 1 + (sumInv - 1 / (N - k)) / (3 * (k - 1));
|
|
14443
|
+
const T = numerator / C;
|
|
14444
|
+
return { statistic: T, pValue: _chiSquaredPValue(T, k - 1), degreesOfFreedom: k - 1 };
|
|
14445
|
+
}
|
|
14446
|
+
function studentTTestPaired(sample1, sample2) {
|
|
14447
|
+
const n = sample1.length;
|
|
14448
|
+
if (n < 2 || sample2.length !== n) {
|
|
14449
|
+
throw new Error("studentTTestPaired: samples must be the same length \u2265 2");
|
|
14450
|
+
}
|
|
14451
|
+
const d = sample1.map((x, i) => x - sample2[i]);
|
|
14452
|
+
const dBar = _mean(d);
|
|
14453
|
+
const sd = Math.sqrt(_variance(d, 1));
|
|
14454
|
+
const df = n - 1;
|
|
14455
|
+
const t = dBar / (sd / Math.sqrt(n));
|
|
14456
|
+
return { statistic: t, pValue: _tPValue(t, df), degreesOfFreedom: df };
|
|
14457
|
+
}
|
|
14458
|
+
function proportionZTest(count2, nobs, value) {
|
|
14459
|
+
let z;
|
|
14460
|
+
if (Array.isArray(count2) && Array.isArray(nobs)) {
|
|
14461
|
+
const [c1, c2] = count2;
|
|
14462
|
+
const [n16, n26] = nobs;
|
|
14463
|
+
const p1 = c1 / n16;
|
|
14464
|
+
const p2 = c2 / n26;
|
|
14465
|
+
const pPool = (c1 + c2) / (n16 + n26);
|
|
14466
|
+
z = (p1 - p2) / Math.sqrt(pPool * (1 - pPool) * (1 / n16 + 1 / n26));
|
|
14467
|
+
} else if (typeof count2 === "number" && typeof nobs === "number") {
|
|
14468
|
+
const p0 = value ?? 0.5;
|
|
14469
|
+
const pHat = count2 / nobs;
|
|
14470
|
+
z = (pHat - p0) / Math.sqrt(p0 * (1 - p0) / nobs);
|
|
14471
|
+
} else {
|
|
14472
|
+
throw new Error("proportionZTest: count and nobs must both be numbers or both be [a, b] pairs");
|
|
14473
|
+
}
|
|
14474
|
+
const pValue = erfcScalar(Math.abs(z) / Math.SQRT2);
|
|
14475
|
+
return { statistic: z, pValue };
|
|
14476
|
+
}
|
|
14477
|
+
function _binomPmf(k, n, p) {
|
|
14478
|
+
if (k < 0 || k > n) return 0;
|
|
14479
|
+
const logC = _lgamma3(n + 1) - _lgamma3(k + 1) - _lgamma3(n - k + 1);
|
|
14480
|
+
return Math.exp(logC + k * Math.log(p) + (n - k) * Math.log(1 - p));
|
|
14481
|
+
}
|
|
14482
|
+
function binomialTest(successes, n, p = 0.5) {
|
|
14483
|
+
if (!Number.isInteger(successes) || !Number.isInteger(n) || successes < 0 || successes > n) {
|
|
14484
|
+
throw new Error("binomialTest: successes must be an integer in [0, n]");
|
|
14485
|
+
}
|
|
14486
|
+
const dObs = _binomPmf(successes, n, p);
|
|
14487
|
+
const rel = 1 + 1e-7;
|
|
14488
|
+
let pValue = 0;
|
|
14489
|
+
for (let k = 0; k <= n; k++) {
|
|
14490
|
+
const pk = _binomPmf(k, n, p);
|
|
14491
|
+
if (pk <= dObs * rel) pValue += pk;
|
|
14492
|
+
}
|
|
14493
|
+
return { statistic: successes / n, pValue: Math.min(1, pValue) };
|
|
14494
|
+
}
|
|
14255
14495
|
|
|
14256
14496
|
// src/typed/matrix-ops.ts
|
|
14257
14497
|
import {
|
|
@@ -17242,9 +17482,9 @@ var createExpm1 = /* @__PURE__ */ factory(
|
|
|
17242
17482
|
);
|
|
17243
17483
|
|
|
17244
17484
|
// src/utils/bigint.ts
|
|
17245
|
-
function promoteLogarithm(log162, numberLog,
|
|
17485
|
+
function promoteLogarithm(log162, numberLog, config2, cplx) {
|
|
17246
17486
|
return function(b) {
|
|
17247
|
-
if (b > 0 ||
|
|
17487
|
+
if (b > 0 || config2.predictable) {
|
|
17248
17488
|
if (b <= 0) return NaN;
|
|
17249
17489
|
const s = b.toString(16);
|
|
17250
17490
|
const s15 = s.substring(0, 15);
|
|
@@ -17261,7 +17501,7 @@ var log16 = log10Number(16);
|
|
|
17261
17501
|
var createLog10 = /* @__PURE__ */ factory(
|
|
17262
17502
|
name6,
|
|
17263
17503
|
dependencies6,
|
|
17264
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
17504
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
17265
17505
|
function complexLog(c) {
|
|
17266
17506
|
return c.log().div(Math.LN10);
|
|
17267
17507
|
}
|
|
@@ -17270,16 +17510,16 @@ var createLog10 = /* @__PURE__ */ factory(
|
|
|
17270
17510
|
}
|
|
17271
17511
|
return typed3(name6, {
|
|
17272
17512
|
number: function(x) {
|
|
17273
|
-
if (x >= 0 ||
|
|
17513
|
+
if (x >= 0 || config2.predictable) {
|
|
17274
17514
|
return log10Number(x);
|
|
17275
17515
|
} else {
|
|
17276
17516
|
return complexLogNumber(x);
|
|
17277
17517
|
}
|
|
17278
17518
|
},
|
|
17279
|
-
bigint: promoteLogarithm(log16, log10Number,
|
|
17519
|
+
bigint: promoteLogarithm(log16, log10Number, config2, complexLogNumber),
|
|
17280
17520
|
Complex: complexLog,
|
|
17281
17521
|
BigNumber: function(x) {
|
|
17282
|
-
if (!x.isNegative() ||
|
|
17522
|
+
if (!x.isNegative() || config2.predictable) {
|
|
17283
17523
|
return x.log();
|
|
17284
17524
|
} else {
|
|
17285
17525
|
return complexLogNumber(x.toNumber());
|
|
@@ -17298,22 +17538,22 @@ var dependencies7 = ["typed", "config", "Complex"];
|
|
|
17298
17538
|
var createLog2 = /* @__PURE__ */ factory(
|
|
17299
17539
|
name7,
|
|
17300
17540
|
dependencies7,
|
|
17301
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
17541
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
17302
17542
|
function complexLog2Number(x) {
|
|
17303
17543
|
return _log2Complex(new Complex12(x, 0));
|
|
17304
17544
|
}
|
|
17305
17545
|
return typed3(name7, {
|
|
17306
17546
|
number: function(x) {
|
|
17307
|
-
if (x >= 0 ||
|
|
17547
|
+
if (x >= 0 || config2.predictable) {
|
|
17308
17548
|
return log2Number(x);
|
|
17309
17549
|
} else {
|
|
17310
17550
|
return complexLog2Number(x);
|
|
17311
17551
|
}
|
|
17312
17552
|
},
|
|
17313
|
-
bigint: promoteLogarithm(4, log2Number,
|
|
17553
|
+
bigint: promoteLogarithm(4, log2Number, config2, complexLog2Number),
|
|
17314
17554
|
Complex: _log2Complex,
|
|
17315
17555
|
BigNumber: function(x) {
|
|
17316
|
-
if (!x.isNegative() ||
|
|
17556
|
+
if (!x.isNegative() || config2.predictable) {
|
|
17317
17557
|
return x.log(2);
|
|
17318
17558
|
} else {
|
|
17319
17559
|
return complexLog2Number(x.toNumber());
|
|
@@ -17401,14 +17641,14 @@ var dependencies10 = ["config", "typed", "Complex"];
|
|
|
17401
17641
|
var createSqrt = /* @__PURE__ */ factory(
|
|
17402
17642
|
name10,
|
|
17403
17643
|
dependencies10,
|
|
17404
|
-
({ config, typed: typed3, Complex: Complex12 }) => {
|
|
17644
|
+
({ config: config2, typed: typed3, Complex: Complex12 }) => {
|
|
17405
17645
|
return typed3("sqrt", {
|
|
17406
17646
|
number: _sqrtNumber,
|
|
17407
17647
|
Complex: function(x) {
|
|
17408
17648
|
return x.sqrt();
|
|
17409
17649
|
},
|
|
17410
17650
|
BigNumber: function(x) {
|
|
17411
|
-
if (!x.isNegative() ||
|
|
17651
|
+
if (!x.isNegative() || config2.predictable) {
|
|
17412
17652
|
return x.sqrt();
|
|
17413
17653
|
} else {
|
|
17414
17654
|
return _sqrtNumber(x.toNumber());
|
|
@@ -17421,7 +17661,7 @@ var createSqrt = /* @__PURE__ */ factory(
|
|
|
17421
17661
|
function _sqrtNumber(x) {
|
|
17422
17662
|
if (isNaN(x)) {
|
|
17423
17663
|
return NaN;
|
|
17424
|
-
} else if (x >= 0 ||
|
|
17664
|
+
} else if (x >= 0 || config2.predictable) {
|
|
17425
17665
|
return Math.sqrt(x);
|
|
17426
17666
|
} else {
|
|
17427
17667
|
return new Complex12(x, 0).sqrt();
|
|
@@ -17504,7 +17744,7 @@ var dependencies13 = ["typed", "config", "?bignumber"];
|
|
|
17504
17744
|
var createUnaryMinus = /* @__PURE__ */ factory(
|
|
17505
17745
|
name13,
|
|
17506
17746
|
dependencies13,
|
|
17507
|
-
({ typed: typed3, config, bignumber: bignumber2 }) => {
|
|
17747
|
+
({ typed: typed3, config: config2, bignumber: bignumber2 }) => {
|
|
17508
17748
|
return typed3(name13, {
|
|
17509
17749
|
number: unaryMinusNumber,
|
|
17510
17750
|
"Complex | BigNumber | Fraction": (x) => x.neg(),
|
|
@@ -17517,7 +17757,7 @@ var createUnaryMinus = /* @__PURE__ */ factory(
|
|
|
17517
17757
|
boolean: function(x) {
|
|
17518
17758
|
const numValue = x ? 1 : 0;
|
|
17519
17759
|
const negValue = -numValue;
|
|
17520
|
-
const numberType =
|
|
17760
|
+
const numberType = config2?.number || "number";
|
|
17521
17761
|
switch (numberType) {
|
|
17522
17762
|
case "BigNumber":
|
|
17523
17763
|
if (!bignumber2) {
|
|
@@ -18552,8 +18792,8 @@ var dependencies30 = ["typed", "config", "?on"];
|
|
|
18552
18792
|
var createPickRandom = /* @__PURE__ */ factory(
|
|
18553
18793
|
name30,
|
|
18554
18794
|
dependencies30,
|
|
18555
|
-
({ typed: typed3, config, on }) => {
|
|
18556
|
-
let rng = createRng(
|
|
18795
|
+
({ typed: typed3, config: config2, on }) => {
|
|
18796
|
+
let rng = createRng(config2.randomSeed);
|
|
18557
18797
|
if (on) {
|
|
18558
18798
|
on("config", function(curr, prev) {
|
|
18559
18799
|
if (curr.randomSeed !== prev.randomSeed) {
|
|
@@ -18653,8 +18893,8 @@ var dependencies31 = ["typed", "config", "?on"];
|
|
|
18653
18893
|
var createRandom = /* @__PURE__ */ factory(
|
|
18654
18894
|
name31,
|
|
18655
18895
|
dependencies31,
|
|
18656
|
-
({ typed: typed3, config, on }) => {
|
|
18657
|
-
let rng = createRng(
|
|
18896
|
+
({ typed: typed3, config: config2, on }) => {
|
|
18897
|
+
let rng = createRng(config2.randomSeed);
|
|
18658
18898
|
if (on) {
|
|
18659
18899
|
on("config", function(curr, prev) {
|
|
18660
18900
|
if (curr.randomSeed !== prev.randomSeed) {
|
|
@@ -18733,7 +18973,7 @@ var dependencies32 = ["typed", "config"];
|
|
|
18733
18973
|
var createEqualScalar = /* @__PURE__ */ factory(
|
|
18734
18974
|
name32,
|
|
18735
18975
|
dependencies32,
|
|
18736
|
-
({ typed: typed3, config }) => {
|
|
18976
|
+
({ typed: typed3, config: config2 }) => {
|
|
18737
18977
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
18738
18978
|
return typed3(
|
|
18739
18979
|
name32,
|
|
@@ -18742,10 +18982,10 @@ var createEqualScalar = /* @__PURE__ */ factory(
|
|
|
18742
18982
|
return x === y;
|
|
18743
18983
|
},
|
|
18744
18984
|
"number, number": function(x, y) {
|
|
18745
|
-
return nearlyEqual(x, y,
|
|
18985
|
+
return nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
18746
18986
|
},
|
|
18747
18987
|
"BigNumber, BigNumber": function(x, y) {
|
|
18748
|
-
return x.eq(y) || nearlyEqual2(x, y,
|
|
18988
|
+
return x.eq(y) || nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
18749
18989
|
},
|
|
18750
18990
|
"bigint, bigint": function(x, y) {
|
|
18751
18991
|
return x === y;
|
|
@@ -18754,7 +18994,7 @@ var createEqualScalar = /* @__PURE__ */ factory(
|
|
|
18754
18994
|
return x.equals(y);
|
|
18755
18995
|
},
|
|
18756
18996
|
"Complex, Complex": function(x, y) {
|
|
18757
|
-
return complexEquals(x, y,
|
|
18997
|
+
return complexEquals(x, y, config2.relTol, config2.absTol);
|
|
18758
18998
|
}
|
|
18759
18999
|
},
|
|
18760
19000
|
compareUnits2
|
|
@@ -18959,10 +19199,10 @@ var dependencies36 = ["typed", "config", "Complex"];
|
|
|
18959
19199
|
var createAcos = /* @__PURE__ */ factory(
|
|
18960
19200
|
name36,
|
|
18961
19201
|
dependencies36,
|
|
18962
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
19202
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
18963
19203
|
return typed3(name36, {
|
|
18964
19204
|
number: function(x) {
|
|
18965
|
-
if (x >= -1 && x <= 1 ||
|
|
19205
|
+
if (x >= -1 && x <= 1 || config2.predictable) {
|
|
18966
19206
|
return Math.acos(x);
|
|
18967
19207
|
} else {
|
|
18968
19208
|
return new Complex12(x, 0).acos();
|
|
@@ -18984,10 +19224,10 @@ var dependencies37 = ["typed", "config", "Complex"];
|
|
|
18984
19224
|
var createAcosh = /* @__PURE__ */ factory(
|
|
18985
19225
|
name37,
|
|
18986
19226
|
dependencies37,
|
|
18987
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
19227
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
18988
19228
|
return typed3(name37, {
|
|
18989
19229
|
number: function(x) {
|
|
18990
|
-
if (x >= 1 ||
|
|
19230
|
+
if (x >= 1 || config2.predictable) {
|
|
18991
19231
|
return acoshNumber(x);
|
|
18992
19232
|
}
|
|
18993
19233
|
if (x <= -1) {
|
|
@@ -19030,10 +19270,10 @@ var dependencies39 = ["typed", "config", "Complex", "BigNumber"];
|
|
|
19030
19270
|
var createAcoth = /* @__PURE__ */ factory(
|
|
19031
19271
|
name39,
|
|
19032
19272
|
dependencies39,
|
|
19033
|
-
({ typed: typed3, config, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19273
|
+
({ typed: typed3, config: config2, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19034
19274
|
return typed3(name39, {
|
|
19035
19275
|
number: function(x) {
|
|
19036
|
-
if (x >= 1 || x <= -1 ||
|
|
19276
|
+
if (x >= 1 || x <= -1 || config2.predictable) {
|
|
19037
19277
|
return acothNumber(x);
|
|
19038
19278
|
}
|
|
19039
19279
|
return new Complex12(x, 0).acoth();
|
|
@@ -19054,10 +19294,10 @@ var dependencies40 = ["typed", "config", "Complex", "BigNumber"];
|
|
|
19054
19294
|
var createAcsc = /* @__PURE__ */ factory(
|
|
19055
19295
|
name40,
|
|
19056
19296
|
dependencies40,
|
|
19057
|
-
({ typed: typed3, config, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19297
|
+
({ typed: typed3, config: config2, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19058
19298
|
return typed3(name40, {
|
|
19059
19299
|
number: function(x) {
|
|
19060
|
-
if (x <= -1 || x >= 1 ||
|
|
19300
|
+
if (x <= -1 || x >= 1 || config2.predictable) {
|
|
19061
19301
|
return acscNumber(x);
|
|
19062
19302
|
}
|
|
19063
19303
|
return new Complex12(x, 0).acsc();
|
|
@@ -19097,10 +19337,10 @@ var dependencies42 = ["typed", "config", "Complex", "BigNumber"];
|
|
|
19097
19337
|
var createAsec = /* @__PURE__ */ factory(
|
|
19098
19338
|
name42,
|
|
19099
19339
|
dependencies42,
|
|
19100
|
-
({ typed: typed3, config, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19340
|
+
({ typed: typed3, config: config2, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19101
19341
|
return typed3(name42, {
|
|
19102
19342
|
number: function(x) {
|
|
19103
|
-
if (x <= -1 || x >= 1 ||
|
|
19343
|
+
if (x <= -1 || x >= 1 || config2.predictable) {
|
|
19104
19344
|
return asecNumber(x);
|
|
19105
19345
|
}
|
|
19106
19346
|
return new Complex12(x, 0).asec();
|
|
@@ -19121,12 +19361,12 @@ var dependencies43 = ["typed", "config", "Complex", "BigNumber"];
|
|
|
19121
19361
|
var createAsech = /* @__PURE__ */ factory(
|
|
19122
19362
|
name43,
|
|
19123
19363
|
dependencies43,
|
|
19124
|
-
({ typed: typed3, config, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19364
|
+
({ typed: typed3, config: config2, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19125
19365
|
return typed3(name43, {
|
|
19126
19366
|
number: function(x) {
|
|
19127
|
-
if (x <= 1 && x >= -1 ||
|
|
19367
|
+
if (x <= 1 && x >= -1 || config2.predictable) {
|
|
19128
19368
|
const xInv = 1 / x;
|
|
19129
|
-
if (xInv > 0 ||
|
|
19369
|
+
if (xInv > 0 || config2.predictable) {
|
|
19130
19370
|
return asechNumber(x);
|
|
19131
19371
|
}
|
|
19132
19372
|
const ret = Math.sqrt(xInv * xInv - 1);
|
|
@@ -19150,10 +19390,10 @@ var dependencies44 = ["typed", "config", "Complex"];
|
|
|
19150
19390
|
var createAsin = /* @__PURE__ */ factory(
|
|
19151
19391
|
name44,
|
|
19152
19392
|
dependencies44,
|
|
19153
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
19393
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
19154
19394
|
return typed3(name44, {
|
|
19155
19395
|
number: function(x) {
|
|
19156
|
-
if (x >= -1 && x <= 1 ||
|
|
19396
|
+
if (x >= -1 && x <= 1 || config2.predictable) {
|
|
19157
19397
|
return Math.asin(x);
|
|
19158
19398
|
} else {
|
|
19159
19399
|
return new Complex12(x, 0).asin();
|
|
@@ -19215,10 +19455,10 @@ var dependencies47 = ["typed", "config", "Complex"];
|
|
|
19215
19455
|
var createAtanh = /* @__PURE__ */ factory(
|
|
19216
19456
|
name47,
|
|
19217
19457
|
dependencies47,
|
|
19218
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
19458
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
19219
19459
|
return typed3(name47, {
|
|
19220
19460
|
number: function(x) {
|
|
19221
|
-
if (x <= 1 && x >= -1 ||
|
|
19461
|
+
if (x <= 1 && x >= -1 || config2.predictable) {
|
|
19222
19462
|
return atanhNumber(x);
|
|
19223
19463
|
}
|
|
19224
19464
|
return new Complex12(x, 0).atanh();
|
|
@@ -19544,10 +19784,10 @@ var dependencies64 = ["typed", "config"];
|
|
|
19544
19784
|
var createIsNegative = /* @__PURE__ */ factory(
|
|
19545
19785
|
name64,
|
|
19546
19786
|
dependencies64,
|
|
19547
|
-
({ typed: typed3, config }) => {
|
|
19787
|
+
({ typed: typed3, config: config2 }) => {
|
|
19548
19788
|
return typed3(name64, {
|
|
19549
|
-
number: (x) => nearlyEqual(x, 0,
|
|
19550
|
-
BigNumber: (x) => nearlyEqual2(x, new x.constructor(0),
|
|
19789
|
+
number: (x) => nearlyEqual(x, 0, config2.relTol, config2.absTol) ? false : isNegativeNumber(x),
|
|
19790
|
+
BigNumber: (x) => nearlyEqual2(x, new x.constructor(0), config2.relTol, config2.absTol) ? false : x.isNeg() && !x.isZero() && !x.isNaN(),
|
|
19551
19791
|
bigint: (x) => x < 0n,
|
|
19552
19792
|
Fraction: (x) => x.s < 0n,
|
|
19553
19793
|
// It's enough to decide on the sign
|
|
@@ -19584,10 +19824,10 @@ var dependencies66 = ["typed", "config"];
|
|
|
19584
19824
|
var createIsPositive = /* @__PURE__ */ factory(
|
|
19585
19825
|
name66,
|
|
19586
19826
|
dependencies66,
|
|
19587
|
-
({ typed: typed3, config }) => {
|
|
19827
|
+
({ typed: typed3, config: config2 }) => {
|
|
19588
19828
|
return typed3(name66, {
|
|
19589
|
-
number: (x) => nearlyEqual(x, 0,
|
|
19590
|
-
BigNumber: (x) => nearlyEqual2(x, new x.constructor(0),
|
|
19829
|
+
number: (x) => nearlyEqual(x, 0, config2.relTol, config2.absTol) ? false : isPositiveNumber(x),
|
|
19830
|
+
BigNumber: (x) => nearlyEqual2(x, new x.constructor(0), config2.relTol, config2.absTol) ? false : !x.isNeg() && !x.isZero() && !x.isNaN(),
|
|
19591
19831
|
bigint: (x) => x > 0n,
|
|
19592
19832
|
Fraction: (x) => x.s > 0n && x.n > 0n,
|
|
19593
19833
|
Unit: typed3.referToSelf(
|
|
@@ -19806,7 +20046,7 @@ var dependencies71 = ["typed", "config", "numeric"];
|
|
|
19806
20046
|
var createUnaryPlus = /* @__PURE__ */ factory(
|
|
19807
20047
|
name71,
|
|
19808
20048
|
dependencies71,
|
|
19809
|
-
({ typed: typed3, config, numeric: numeric2 }) => {
|
|
20049
|
+
({ typed: typed3, config: config2, numeric: numeric2 }) => {
|
|
19810
20050
|
return typed3(name71, {
|
|
19811
20051
|
number: unaryPlusNumber,
|
|
19812
20052
|
Complex: function(x) {
|
|
@@ -19829,10 +20069,10 @@ var createUnaryPlus = /* @__PURE__ */ factory(
|
|
|
19829
20069
|
(self) => (x) => deepMap2(x, self, true)
|
|
19830
20070
|
),
|
|
19831
20071
|
boolean: function(x) {
|
|
19832
|
-
return numeric2(x ? 1 : 0,
|
|
20072
|
+
return numeric2(x ? 1 : 0, config2.number);
|
|
19833
20073
|
},
|
|
19834
20074
|
string: function(x) {
|
|
19835
|
-
return numeric2(x, safeNumberType(x,
|
|
20075
|
+
return numeric2(x, safeNumberType(x, config2));
|
|
19836
20076
|
}
|
|
19837
20077
|
});
|
|
19838
20078
|
}
|
|
@@ -19962,8 +20202,8 @@ var dependencies73 = ["typed", "config", "log2", "?on"];
|
|
|
19962
20202
|
var createRandomInt = /* @__PURE__ */ factory(
|
|
19963
20203
|
name73,
|
|
19964
20204
|
dependencies73,
|
|
19965
|
-
({ typed: typed3, config, log2: log23, on }) => {
|
|
19966
|
-
let rng = createRng(
|
|
20205
|
+
({ typed: typed3, config: config2, log2: log23, on }) => {
|
|
20206
|
+
let rng = createRng(config2.randomSeed);
|
|
19967
20207
|
if (on) {
|
|
19968
20208
|
on("config", function(curr, prev) {
|
|
19969
20209
|
if (curr.randomSeed !== prev.randomSeed) {
|
|
@@ -20255,12 +20495,12 @@ var dependencies82 = ["config", "?bignumber"];
|
|
|
20255
20495
|
var createParseNumberWithConfig = /* @__PURE__ */ factory(
|
|
20256
20496
|
name82,
|
|
20257
20497
|
dependencies82,
|
|
20258
|
-
({ config, bignumber: bignumber2 }) => {
|
|
20498
|
+
({ config: config2, bignumber: bignumber2 }) => {
|
|
20259
20499
|
function parseNumberWithConfig2(str) {
|
|
20260
20500
|
if (typeof str !== "string") {
|
|
20261
20501
|
throw new TypeError(`parseNumberWithConfig expects string, got ${typeof str}`);
|
|
20262
20502
|
}
|
|
20263
|
-
const numberType =
|
|
20503
|
+
const numberType = config2.number || "number";
|
|
20264
20504
|
switch (numberType) {
|
|
20265
20505
|
case "BigNumber":
|
|
20266
20506
|
if (!bignumber2) {
|
|
@@ -20475,22 +20715,22 @@ var dependencies85 = ["typed", "config", "matrix", "BigNumber", "DenseMatrix", "
|
|
|
20475
20715
|
var createIdentity = /* @__PURE__ */ factory(
|
|
20476
20716
|
name85,
|
|
20477
20717
|
dependencies85,
|
|
20478
|
-
({ typed: typed3, config, matrix: matrix2, BigNumber: BigNumber9, DenseMatrix: DenseMatrix6, SparseMatrix }) => {
|
|
20718
|
+
({ typed: typed3, config: config2, matrix: matrix2, BigNumber: BigNumber9, DenseMatrix: DenseMatrix6, SparseMatrix }) => {
|
|
20479
20719
|
return typed3(name85, {
|
|
20480
20720
|
"": function() {
|
|
20481
|
-
return
|
|
20721
|
+
return config2.matrix === "Matrix" ? matrix2([]) : [];
|
|
20482
20722
|
},
|
|
20483
20723
|
string: function(format6) {
|
|
20484
20724
|
return matrix2(format6);
|
|
20485
20725
|
},
|
|
20486
20726
|
"number | BigNumber": function(rows) {
|
|
20487
|
-
return _identity(rows, rows,
|
|
20727
|
+
return _identity(rows, rows, config2.matrix === "Matrix" ? "dense" : void 0);
|
|
20488
20728
|
},
|
|
20489
20729
|
"number | BigNumber, string": function(rows, format6) {
|
|
20490
20730
|
return _identity(rows, rows, format6);
|
|
20491
20731
|
},
|
|
20492
20732
|
"number | BigNumber, number | BigNumber": function(rows, cols) {
|
|
20493
|
-
return _identity(rows, cols,
|
|
20733
|
+
return _identity(rows, cols, config2.matrix === "Matrix" ? "dense" : void 0);
|
|
20494
20734
|
},
|
|
20495
20735
|
"number | BigNumber, number | BigNumber, string": function(rows, cols, format6) {
|
|
20496
20736
|
return _identity(rows, cols, format6);
|
|
@@ -20553,10 +20793,10 @@ var createIdentity = /* @__PURE__ */ factory(
|
|
|
20553
20793
|
);
|
|
20554
20794
|
|
|
20555
20795
|
// src/matrix/utils/zerosAndOnes.ts
|
|
20556
|
-
function createZerosAndOnes(name254, defaultValue, { typed: typed3, config, matrix: matrix2, BigNumber: BigNumber9 }) {
|
|
20796
|
+
function createZerosAndOnes(name254, defaultValue, { typed: typed3, config: config2, matrix: matrix2, BigNumber: BigNumber9 }) {
|
|
20557
20797
|
return typed3(name254, {
|
|
20558
20798
|
"": function() {
|
|
20559
|
-
return
|
|
20799
|
+
return config2.matrix === "Array" ? _zerosAndOnes([]) : _zerosAndOnes([], "default");
|
|
20560
20800
|
},
|
|
20561
20801
|
// math.zeros/ones(m, n, p, ..., format)
|
|
20562
20802
|
// TODO: more accurate signature '...number | BigNumber, string' as soon as typed-function supports this
|
|
@@ -20565,7 +20805,7 @@ function createZerosAndOnes(name254, defaultValue, { typed: typed3, config, matr
|
|
|
20565
20805
|
if (typeof last === "string") {
|
|
20566
20806
|
const format6 = size2.pop();
|
|
20567
20807
|
return _zerosAndOnes(size2, format6);
|
|
20568
|
-
} else if (
|
|
20808
|
+
} else if (config2.matrix === "Array") {
|
|
20569
20809
|
return _zerosAndOnes(size2);
|
|
20570
20810
|
} else {
|
|
20571
20811
|
return _zerosAndOnes(size2, "default");
|
|
@@ -23045,7 +23285,7 @@ var createCbrt = /* @__PURE__ */ factory(
|
|
|
23045
23285
|
name105,
|
|
23046
23286
|
dependencies105,
|
|
23047
23287
|
({
|
|
23048
|
-
config,
|
|
23288
|
+
config: config2,
|
|
23049
23289
|
typed: typed3,
|
|
23050
23290
|
isNegative: isNegative2,
|
|
23051
23291
|
unaryMinus: unaryMinus2,
|
|
@@ -23081,7 +23321,7 @@ var createCbrt = /* @__PURE__ */ factory(
|
|
|
23081
23321
|
new Complex12(cbrtNumber(abs2), 0).mul(new Complex12(0, arg3 + Math.PI * 2 / 3).exp()),
|
|
23082
23322
|
new Complex12(cbrtNumber(abs2), 0).mul(new Complex12(0, arg3 - Math.PI * 2 / 3).exp())
|
|
23083
23323
|
];
|
|
23084
|
-
return
|
|
23324
|
+
return config2.matrix === "Array" ? all : matrix2(all);
|
|
23085
23325
|
} else {
|
|
23086
23326
|
return principal;
|
|
23087
23327
|
}
|
|
@@ -23357,7 +23597,7 @@ var dependencies110 = [
|
|
|
23357
23597
|
var createRound = /* @__PURE__ */ factory(
|
|
23358
23598
|
name110,
|
|
23359
23599
|
dependencies110,
|
|
23360
|
-
({ typed: typed3, config, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, BigNumber: BigNumber9, DenseMatrix: DenseMatrix6 }) => {
|
|
23600
|
+
({ typed: typed3, config: config2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, BigNumber: BigNumber9, DenseMatrix: DenseMatrix6 }) => {
|
|
23361
23601
|
const matAlgo11xS0s = createMatAlgo11xS0s({ typed: typed3, equalScalar: equalScalar3 });
|
|
23362
23602
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
23363
23603
|
const matAlgo14xDs = createMatAlgo14xDs({ typed: typed3 });
|
|
@@ -23366,17 +23606,17 @@ var createRound = /* @__PURE__ */ factory(
|
|
|
23366
23606
|
}
|
|
23367
23607
|
return typed3(name110, {
|
|
23368
23608
|
number: function(x) {
|
|
23369
|
-
const xEpsilon = roundNumber(x, toExponent(
|
|
23370
|
-
const xSelected = nearlyEqual(x, xEpsilon,
|
|
23609
|
+
const xEpsilon = roundNumber(x, toExponent(config2.relTol));
|
|
23610
|
+
const xSelected = nearlyEqual(x, xEpsilon, config2.relTol, config2.absTol) ? xEpsilon : x;
|
|
23371
23611
|
return roundNumber(xSelected);
|
|
23372
23612
|
},
|
|
23373
23613
|
"number, number": function(x, n) {
|
|
23374
|
-
const epsilonExponent = toExponent(
|
|
23614
|
+
const epsilonExponent = toExponent(config2.relTol);
|
|
23375
23615
|
if (n >= epsilonExponent) {
|
|
23376
23616
|
return roundNumber(x, n);
|
|
23377
23617
|
}
|
|
23378
23618
|
const xEpsilon = roundNumber(x, epsilonExponent);
|
|
23379
|
-
const xSelected = nearlyEqual(x, xEpsilon,
|
|
23619
|
+
const xSelected = nearlyEqual(x, xEpsilon, config2.relTol, config2.absTol) ? xEpsilon : x;
|
|
23380
23620
|
return roundNumber(xSelected, n);
|
|
23381
23621
|
},
|
|
23382
23622
|
"number, BigNumber": function(x, n) {
|
|
@@ -23402,20 +23642,20 @@ var createRound = /* @__PURE__ */ factory(
|
|
|
23402
23642
|
return x.round(_n);
|
|
23403
23643
|
},
|
|
23404
23644
|
BigNumber: function(x) {
|
|
23405
|
-
const xEpsilon = new BigNumber9(x).toDecimalPlaces(toExponent(
|
|
23406
|
-
const xSelected = nearlyEqual2(x, xEpsilon,
|
|
23645
|
+
const xEpsilon = new BigNumber9(x).toDecimalPlaces(toExponent(config2.relTol));
|
|
23646
|
+
const xSelected = nearlyEqual2(x, xEpsilon, config2.relTol, config2.absTol) ? xEpsilon : x;
|
|
23407
23647
|
return xSelected.toDecimalPlaces(0);
|
|
23408
23648
|
},
|
|
23409
23649
|
"BigNumber, BigNumber": function(x, n) {
|
|
23410
23650
|
if (!n.isInteger()) {
|
|
23411
23651
|
throw new TypeError(NO_INT);
|
|
23412
23652
|
}
|
|
23413
|
-
const epsilonExponent = toExponent(
|
|
23653
|
+
const epsilonExponent = toExponent(config2.relTol);
|
|
23414
23654
|
if (n >= epsilonExponent) {
|
|
23415
23655
|
return x.toDecimalPlaces(n.toNumber());
|
|
23416
23656
|
}
|
|
23417
23657
|
const xEpsilon = x.toDecimalPlaces(epsilonExponent);
|
|
23418
|
-
const xSelected = nearlyEqual2(x, xEpsilon,
|
|
23658
|
+
const xSelected = nearlyEqual2(x, xEpsilon, config2.relTol, config2.absTol) ? xEpsilon : x;
|
|
23419
23659
|
return xSelected.toDecimalPlaces(n.toNumber());
|
|
23420
23660
|
},
|
|
23421
23661
|
// bigints can't be rounded
|
|
@@ -23505,11 +23745,11 @@ var dependencies111 = ["typed", "config", "matrix", "BigNumber"];
|
|
|
23505
23745
|
var createXgcd = /* @__PURE__ */ factory(
|
|
23506
23746
|
name111,
|
|
23507
23747
|
dependencies111,
|
|
23508
|
-
({ typed: typed3, config, matrix: matrix2, BigNumber: BigNumber9 }) => {
|
|
23748
|
+
({ typed: typed3, config: config2, matrix: matrix2, BigNumber: BigNumber9 }) => {
|
|
23509
23749
|
return typed3(name111, {
|
|
23510
23750
|
"number, number": function(a, b) {
|
|
23511
23751
|
const res = xgcdNumber(a, b);
|
|
23512
|
-
return
|
|
23752
|
+
return config2.matrix === "Array" ? res : matrix2(res);
|
|
23513
23753
|
},
|
|
23514
23754
|
"BigNumber, BigNumber": _xgcdBigNumber
|
|
23515
23755
|
// TODO: implement support for Fraction
|
|
@@ -23545,7 +23785,7 @@ var createXgcd = /* @__PURE__ */ factory(
|
|
|
23545
23785
|
} else {
|
|
23546
23786
|
res = [a, !a.isZero() ? lastx : 0, lasty];
|
|
23547
23787
|
}
|
|
23548
|
-
return
|
|
23788
|
+
return config2.matrix === "Array" ? res : matrix2(res);
|
|
23549
23789
|
}
|
|
23550
23790
|
}
|
|
23551
23791
|
);
|
|
@@ -23557,7 +23797,7 @@ var nlg16 = Math.log(16);
|
|
|
23557
23797
|
var createLog = /* @__PURE__ */ factory(
|
|
23558
23798
|
name112,
|
|
23559
23799
|
dependencies112,
|
|
23560
|
-
({ typed: typed3, typeOf: typeOf3, config, divideScalar: divideScalar2, Complex: Complex12 }) => {
|
|
23800
|
+
({ typed: typed3, typeOf: typeOf3, config: config2, divideScalar: divideScalar2, Complex: Complex12 }) => {
|
|
23561
23801
|
function complexLog(c) {
|
|
23562
23802
|
return c.log();
|
|
23563
23803
|
}
|
|
@@ -23566,16 +23806,16 @@ var createLog = /* @__PURE__ */ factory(
|
|
|
23566
23806
|
}
|
|
23567
23807
|
return typed3(name112, {
|
|
23568
23808
|
number: function(x) {
|
|
23569
|
-
if (x >= 0 ||
|
|
23809
|
+
if (x >= 0 || config2.predictable) {
|
|
23570
23810
|
return logNumber(x);
|
|
23571
23811
|
} else {
|
|
23572
23812
|
return complexLogNumber(x);
|
|
23573
23813
|
}
|
|
23574
23814
|
},
|
|
23575
|
-
bigint: promoteLogarithm(nlg16, logNumber,
|
|
23815
|
+
bigint: promoteLogarithm(nlg16, logNumber, config2, complexLogNumber),
|
|
23576
23816
|
Complex: complexLog,
|
|
23577
23817
|
BigNumber: function(x) {
|
|
23578
|
-
if (!x.isNegative() ||
|
|
23818
|
+
if (!x.isNegative() || config2.predictable) {
|
|
23579
23819
|
return x.ln();
|
|
23580
23820
|
} else {
|
|
23581
23821
|
return complexLogNumber(x.toNumber());
|
|
@@ -23963,7 +24203,7 @@ var dependencies117 = ["typed", "config", "matrix"];
|
|
|
23963
24203
|
var createResize = /* @__PURE__ */ factory(
|
|
23964
24204
|
name117,
|
|
23965
24205
|
dependencies117,
|
|
23966
|
-
({ typed: typed3, config, matrix: matrix2 }) => {
|
|
24206
|
+
({ typed: typed3, config: config2, matrix: matrix2 }) => {
|
|
23967
24207
|
return typed3(name117, {
|
|
23968
24208
|
"any, Array | Matrix": function(x, size2) {
|
|
23969
24209
|
return _resize2(x, size2);
|
|
@@ -23985,7 +24225,7 @@ var createResize = /* @__PURE__ */ factory(
|
|
|
23985
24225
|
if (typeof x === "string") {
|
|
23986
24226
|
return _resizeString(x, sz, defaultValue);
|
|
23987
24227
|
}
|
|
23988
|
-
const asMatrix = Array.isArray(x) ? false :
|
|
24228
|
+
const asMatrix = Array.isArray(x) ? false : config2.matrix !== "Array";
|
|
23989
24229
|
if (sz.length === 0) {
|
|
23990
24230
|
let scalar = x;
|
|
23991
24231
|
while (Array.isArray(scalar)) {
|
|
@@ -24284,7 +24524,7 @@ var createBernoulli = /* @__PURE__ */ factory(
|
|
|
24284
24524
|
dependencies119,
|
|
24285
24525
|
({
|
|
24286
24526
|
typed: typed3,
|
|
24287
|
-
config,
|
|
24527
|
+
config: config2,
|
|
24288
24528
|
isInteger: _isInteger,
|
|
24289
24529
|
number: number2,
|
|
24290
24530
|
BigNumber: BigNumber9,
|
|
@@ -24312,9 +24552,9 @@ var createBernoulli = /* @__PURE__ */ factory(
|
|
|
24312
24552
|
(a, b) => a.div(b)
|
|
24313
24553
|
),
|
|
24314
24554
|
BigNumber: (index) => {
|
|
24315
|
-
if (
|
|
24555
|
+
if (config2.precision !== cachedPrecision) {
|
|
24316
24556
|
bigCache = [void 0];
|
|
24317
|
-
cachedPrecision =
|
|
24557
|
+
cachedPrecision = config2.precision;
|
|
24318
24558
|
}
|
|
24319
24559
|
return _bernoulli(
|
|
24320
24560
|
number2(index),
|
|
@@ -25019,7 +25259,7 @@ var dependencies128 = ["typed", "config", "add", "numeric", "parseNumberWithConf
|
|
|
25019
25259
|
var createSum = /* @__PURE__ */ factory(
|
|
25020
25260
|
name128,
|
|
25021
25261
|
dependencies128,
|
|
25022
|
-
({ typed: typed3, config, add: add2, numeric: numeric2, parseNumberWithConfig: parseNumberWithConfig2 }) => {
|
|
25262
|
+
({ typed: typed3, config: config2, add: add2, numeric: numeric2, parseNumberWithConfig: parseNumberWithConfig2 }) => {
|
|
25023
25263
|
return typed3(name128, {
|
|
25024
25264
|
// sum(string) - single string input
|
|
25025
25265
|
string: function(x) {
|
|
@@ -25064,7 +25304,7 @@ var createSum = /* @__PURE__ */ factory(
|
|
|
25064
25304
|
}
|
|
25065
25305
|
});
|
|
25066
25306
|
if (sum3 === void 0) {
|
|
25067
|
-
sum3 = numeric2(0,
|
|
25307
|
+
sum3 = numeric2(0, config2.number);
|
|
25068
25308
|
}
|
|
25069
25309
|
return sum3;
|
|
25070
25310
|
}
|
|
@@ -25313,12 +25553,12 @@ var bigTen = new Decimal(10);
|
|
|
25313
25553
|
var createFloorNumber = /* @__PURE__ */ factory(
|
|
25314
25554
|
name133,
|
|
25315
25555
|
["typed", "config", "round"],
|
|
25316
|
-
({ typed: typed3, config, round: round2 }) => {
|
|
25556
|
+
({ typed: typed3, config: config2, round: round2 }) => {
|
|
25317
25557
|
function _floorNumber(x) {
|
|
25318
25558
|
const f = Math.floor(x);
|
|
25319
25559
|
const r = round2(x);
|
|
25320
25560
|
if (f === r) return f;
|
|
25321
|
-
if (nearlyEqual(x, r,
|
|
25561
|
+
if (nearlyEqual(x, r, config2.relTol, config2.absTol) && !nearlyEqual(x, f, config2.relTol, config2.absTol)) {
|
|
25322
25562
|
return r;
|
|
25323
25563
|
}
|
|
25324
25564
|
return f;
|
|
@@ -25341,13 +25581,13 @@ var createFloorNumber = /* @__PURE__ */ factory(
|
|
|
25341
25581
|
var createFloor = /* @__PURE__ */ factory(
|
|
25342
25582
|
name133,
|
|
25343
25583
|
dependencies133,
|
|
25344
|
-
({ typed: typed3, config, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6 }) => {
|
|
25584
|
+
({ typed: typed3, config: config2, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6 }) => {
|
|
25345
25585
|
const matAlgo11xS0s = createMatAlgo11xS0s({ typed: typed3, equalScalar: equalScalar3 });
|
|
25346
25586
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
25347
25587
|
const matAlgo14xDs = createMatAlgo14xDs({ typed: typed3 });
|
|
25348
|
-
const floorNumber = createFloorNumber({ typed: typed3, config, round: round2 });
|
|
25588
|
+
const floorNumber = createFloorNumber({ typed: typed3, config: config2, round: round2 });
|
|
25349
25589
|
function _bigFloor(x) {
|
|
25350
|
-
const bne = (a, b) => nearlyEqual2(a, b,
|
|
25590
|
+
const bne = (a, b) => nearlyEqual2(a, b, config2.relTol, config2.absTol);
|
|
25351
25591
|
const f = x.floor();
|
|
25352
25592
|
const r = round2(x);
|
|
25353
25593
|
if (f.eq(r)) return f;
|
|
@@ -25554,10 +25794,10 @@ var dependencies135 = [
|
|
|
25554
25794
|
var createMod = /* @__PURE__ */ factory(
|
|
25555
25795
|
name135,
|
|
25556
25796
|
dependencies135,
|
|
25557
|
-
({ typed: typed3, config, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6, concat: concat3 }) => {
|
|
25797
|
+
({ typed: typed3, config: config2, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6, concat: concat3 }) => {
|
|
25558
25798
|
const floor2 = createFloor({
|
|
25559
25799
|
typed: typed3,
|
|
25560
|
-
config,
|
|
25800
|
+
config: config2,
|
|
25561
25801
|
round: round2,
|
|
25562
25802
|
matrix: matrix2,
|
|
25563
25803
|
equalScalar: equalScalar3,
|
|
@@ -25855,7 +26095,7 @@ var createGcd = /* @__PURE__ */ factory(
|
|
|
25855
26095
|
({
|
|
25856
26096
|
typed: typed3,
|
|
25857
26097
|
matrix: matrix2,
|
|
25858
|
-
config,
|
|
26098
|
+
config: config2,
|
|
25859
26099
|
round: round2,
|
|
25860
26100
|
equalScalar: equalScalar3,
|
|
25861
26101
|
zeros: zeros2,
|
|
@@ -25865,7 +26105,7 @@ var createGcd = /* @__PURE__ */ factory(
|
|
|
25865
26105
|
}) => {
|
|
25866
26106
|
const mod2 = createMod({
|
|
25867
26107
|
typed: typed3,
|
|
25868
|
-
config,
|
|
26108
|
+
config: config2,
|
|
25869
26109
|
round: round2,
|
|
25870
26110
|
matrix: matrix2,
|
|
25871
26111
|
equalScalar: equalScalar3,
|
|
@@ -26122,10 +26362,10 @@ var dependencies142 = ["typed", "config", "divideScalar", "log", "Complex"];
|
|
|
26122
26362
|
var createLog1p = /* @__PURE__ */ factory(
|
|
26123
26363
|
name142,
|
|
26124
26364
|
dependencies142,
|
|
26125
|
-
({ typed: typed3, config, divideScalar: divideScalar2, log: log3, Complex: Complex12 }) => {
|
|
26365
|
+
({ typed: typed3, config: config2, divideScalar: divideScalar2, log: log3, Complex: Complex12 }) => {
|
|
26126
26366
|
return typed3(name142, {
|
|
26127
26367
|
number: function(x) {
|
|
26128
|
-
if (x >= -1 ||
|
|
26368
|
+
if (x >= -1 || config2.predictable) {
|
|
26129
26369
|
return log1p2(x);
|
|
26130
26370
|
} else {
|
|
26131
26371
|
return _log1pComplex(new Complex12(x, 0));
|
|
@@ -26134,7 +26374,7 @@ var createLog1p = /* @__PURE__ */ factory(
|
|
|
26134
26374
|
Complex: _log1pComplex,
|
|
26135
26375
|
BigNumber: function(x) {
|
|
26136
26376
|
const y = x.plus(1);
|
|
26137
|
-
if (!y.isNegative() ||
|
|
26377
|
+
if (!y.isNegative() || config2.predictable) {
|
|
26138
26378
|
return y.ln();
|
|
26139
26379
|
} else {
|
|
26140
26380
|
return _log1pComplex(new Complex12(x.toNumber(), 0));
|
|
@@ -26296,7 +26536,7 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26296
26536
|
dependencies144,
|
|
26297
26537
|
({
|
|
26298
26538
|
typed: typed3,
|
|
26299
|
-
config,
|
|
26539
|
+
config: config2,
|
|
26300
26540
|
identity: identity2,
|
|
26301
26541
|
multiply: multiply2,
|
|
26302
26542
|
matrix: matrix2,
|
|
@@ -26311,7 +26551,7 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26311
26551
|
return x.pow(y);
|
|
26312
26552
|
},
|
|
26313
26553
|
"BigNumber, BigNumber": function(x, y) {
|
|
26314
|
-
if (y.isInteger() || x.gte(0) ||
|
|
26554
|
+
if (y.isInteger() || x.gte(0) || config2.predictable) {
|
|
26315
26555
|
return x.pow(y);
|
|
26316
26556
|
} else {
|
|
26317
26557
|
return new Complex12(x.toNumber(), 0).pow(y.toNumber(), 0);
|
|
@@ -26323,7 +26563,7 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26323
26563
|
if (result != null) {
|
|
26324
26564
|
return result;
|
|
26325
26565
|
}
|
|
26326
|
-
if (
|
|
26566
|
+
if (config2.predictable) {
|
|
26327
26567
|
throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");
|
|
26328
26568
|
} else {
|
|
26329
26569
|
return _pow(x.valueOf(), y.valueOf());
|
|
@@ -26342,7 +26582,7 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26342
26582
|
}
|
|
26343
26583
|
});
|
|
26344
26584
|
function _pow(x, y) {
|
|
26345
|
-
if (
|
|
26585
|
+
if (config2.predictable && !isInteger(y) && x < 0) {
|
|
26346
26586
|
try {
|
|
26347
26587
|
const yFrac = fraction2(y);
|
|
26348
26588
|
const yNum = number2(yFrac);
|
|
@@ -26354,10 +26594,10 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26354
26594
|
} catch {
|
|
26355
26595
|
}
|
|
26356
26596
|
}
|
|
26357
|
-
if (
|
|
26597
|
+
if (config2.predictable && (x < -1 && y === Infinity || x > -1 && x < 0 && y === -Infinity)) {
|
|
26358
26598
|
return NaN;
|
|
26359
26599
|
}
|
|
26360
|
-
if (isInteger(y) || x >= 0 ||
|
|
26600
|
+
if (isInteger(y) || x >= 0 || config2.predictable) {
|
|
26361
26601
|
return powNumber(x, y);
|
|
26362
26602
|
} else {
|
|
26363
26603
|
if (isPowZeroAtInfinity(x, y)) {
|
|
@@ -26414,12 +26654,12 @@ var bigTen2 = new Decimal2(10);
|
|
|
26414
26654
|
var createCeilNumber = /* @__PURE__ */ factory(
|
|
26415
26655
|
name145,
|
|
26416
26656
|
["typed", "config", "round"],
|
|
26417
|
-
({ typed: typed3, config, round: round2 }) => {
|
|
26657
|
+
({ typed: typed3, config: config2, round: round2 }) => {
|
|
26418
26658
|
function _ceilNumber(x) {
|
|
26419
26659
|
const c = Math.ceil(x);
|
|
26420
26660
|
const r = round2(x);
|
|
26421
26661
|
if (c === r) return c;
|
|
26422
|
-
if (nearlyEqual(x, r,
|
|
26662
|
+
if (nearlyEqual(x, r, config2.relTol, config2.absTol) && !nearlyEqual(x, c, config2.relTol, config2.absTol)) {
|
|
26423
26663
|
return r;
|
|
26424
26664
|
}
|
|
26425
26665
|
return c;
|
|
@@ -26442,13 +26682,13 @@ var createCeilNumber = /* @__PURE__ */ factory(
|
|
|
26442
26682
|
var createCeil = /* @__PURE__ */ factory(
|
|
26443
26683
|
name145,
|
|
26444
26684
|
dependencies145,
|
|
26445
|
-
({ typed: typed3, config, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6 }) => {
|
|
26685
|
+
({ typed: typed3, config: config2, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6 }) => {
|
|
26446
26686
|
const matAlgo11xS0s = createMatAlgo11xS0s({ typed: typed3, equalScalar: equalScalar3 });
|
|
26447
26687
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
26448
26688
|
const matAlgo14xDs = createMatAlgo14xDs({ typed: typed3 });
|
|
26449
|
-
const ceilNumber = createCeilNumber({ typed: typed3, config, round: round2 });
|
|
26689
|
+
const ceilNumber = createCeilNumber({ typed: typed3, config: config2, round: round2 });
|
|
26450
26690
|
function _bigCeil(x) {
|
|
26451
|
-
const bne = (a, b) => nearlyEqual2(a, b,
|
|
26691
|
+
const bne = (a, b) => nearlyEqual2(a, b, config2.relTol, config2.absTol);
|
|
26452
26692
|
const c = x.ceil();
|
|
26453
26693
|
const r = round2(x);
|
|
26454
26694
|
if (c.eq(r)) return c;
|
|
@@ -27054,7 +27294,7 @@ var createCompare = /* @__PURE__ */ factory(
|
|
|
27054
27294
|
dependencies155,
|
|
27055
27295
|
({
|
|
27056
27296
|
typed: typed3,
|
|
27057
|
-
config,
|
|
27297
|
+
config: config2,
|
|
27058
27298
|
equalScalar: equalScalar3,
|
|
27059
27299
|
matrix: matrix2,
|
|
27060
27300
|
BigNumber: BigNumber9,
|
|
@@ -27073,13 +27313,13 @@ var createCompare = /* @__PURE__ */ factory(
|
|
|
27073
27313
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
27074
27314
|
return typed3(
|
|
27075
27315
|
name155,
|
|
27076
|
-
createCompareNumber({ typed: typed3, config }),
|
|
27316
|
+
createCompareNumber({ typed: typed3, config: config2 }),
|
|
27077
27317
|
{
|
|
27078
27318
|
"boolean, boolean": function(x, y) {
|
|
27079
27319
|
return x === y ? 0 : x > y ? 1 : -1;
|
|
27080
27320
|
},
|
|
27081
27321
|
"BigNumber, BigNumber": function(x, y) {
|
|
27082
|
-
return nearlyEqual2(x, y,
|
|
27322
|
+
return nearlyEqual2(x, y, config2.relTol, config2.absTol) ? new BigNumber9(0) : new BigNumber9(x.cmp(y));
|
|
27083
27323
|
},
|
|
27084
27324
|
"bigint, bigint": function(x, y) {
|
|
27085
27325
|
return x === y ? 0n : x > y ? 1n : -1n;
|
|
@@ -27103,10 +27343,10 @@ var createCompare = /* @__PURE__ */ factory(
|
|
|
27103
27343
|
var createCompareNumber = /* @__PURE__ */ factory(
|
|
27104
27344
|
name155,
|
|
27105
27345
|
["typed", "config"],
|
|
27106
|
-
({ typed: typed3, config }) => {
|
|
27346
|
+
({ typed: typed3, config: config2 }) => {
|
|
27107
27347
|
return typed3(name155, {
|
|
27108
27348
|
"number, number": function(x, y) {
|
|
27109
|
-
return nearlyEqual(x, y,
|
|
27349
|
+
return nearlyEqual(x, y, config2.relTol, config2.absTol) ? 0 : x > y ? 1 : -1;
|
|
27110
27350
|
}
|
|
27111
27351
|
});
|
|
27112
27352
|
}
|
|
@@ -27189,7 +27429,7 @@ var dependencies158 = [
|
|
|
27189
27429
|
var createLarger = /* @__PURE__ */ factory(
|
|
27190
27430
|
name158,
|
|
27191
27431
|
dependencies158,
|
|
27192
|
-
({ typed: typed3, config, bignumber: bignumber2, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27432
|
+
({ typed: typed3, config: config2, bignumber: bignumber2, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27193
27433
|
const matAlgo03xDSf = createMatAlgo03xDSf({ typed: typed3 });
|
|
27194
27434
|
const matAlgo07xSSf = createMatAlgo07xSSf({ typed: typed3, SparseMatrix });
|
|
27195
27435
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
@@ -27200,11 +27440,11 @@ var createLarger = /* @__PURE__ */ factory(
|
|
|
27200
27440
|
});
|
|
27201
27441
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
27202
27442
|
function bignumLarger(x, y) {
|
|
27203
|
-
return x.gt(y) && !nearlyEqual2(x, y,
|
|
27443
|
+
return x.gt(y) && !nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
27204
27444
|
}
|
|
27205
27445
|
return typed3(
|
|
27206
27446
|
name158,
|
|
27207
|
-
createLargerNumber({ typed: typed3, config }),
|
|
27447
|
+
createLargerNumber({ typed: typed3, config: config2 }),
|
|
27208
27448
|
{
|
|
27209
27449
|
"boolean, boolean": (x, y) => x > y,
|
|
27210
27450
|
"BigNumber, BigNumber": bignumLarger,
|
|
@@ -27232,10 +27472,10 @@ var createLarger = /* @__PURE__ */ factory(
|
|
|
27232
27472
|
var createLargerNumber = /* @__PURE__ */ factory(
|
|
27233
27473
|
name158,
|
|
27234
27474
|
["typed", "config"],
|
|
27235
|
-
({ typed: typed3, config }) => {
|
|
27475
|
+
({ typed: typed3, config: config2 }) => {
|
|
27236
27476
|
return typed3(name158, {
|
|
27237
27477
|
"number, number": function(x, y) {
|
|
27238
|
-
return x > y && !nearlyEqual(x, y,
|
|
27478
|
+
return x > y && !nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
27239
27479
|
}
|
|
27240
27480
|
});
|
|
27241
27481
|
}
|
|
@@ -27247,7 +27487,7 @@ var dependencies159 = ["typed", "config", "matrix", "DenseMatrix", "concat", "Sp
|
|
|
27247
27487
|
var createLargerEq = /* @__PURE__ */ factory(
|
|
27248
27488
|
name159,
|
|
27249
27489
|
dependencies159,
|
|
27250
|
-
({ typed: typed3, config, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27490
|
+
({ typed: typed3, config: config2, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27251
27491
|
const matAlgo03xDSf = createMatAlgo03xDSf({ typed: typed3 });
|
|
27252
27492
|
const matAlgo07xSSf = createMatAlgo07xSSf({ typed: typed3, SparseMatrix });
|
|
27253
27493
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
@@ -27259,11 +27499,11 @@ var createLargerEq = /* @__PURE__ */ factory(
|
|
|
27259
27499
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
27260
27500
|
return typed3(
|
|
27261
27501
|
name159,
|
|
27262
|
-
createLargerEqNumber({ typed: typed3, config }),
|
|
27502
|
+
createLargerEqNumber({ typed: typed3, config: config2 }),
|
|
27263
27503
|
{
|
|
27264
27504
|
"boolean, boolean": (x, y) => x >= y,
|
|
27265
27505
|
"BigNumber, BigNumber": function(x, y) {
|
|
27266
|
-
return x.gte(y) || nearlyEqual2(x, y,
|
|
27506
|
+
return x.gte(y) || nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
27267
27507
|
},
|
|
27268
27508
|
"bigint, bigint": function(x, y) {
|
|
27269
27509
|
return x >= y;
|
|
@@ -27285,10 +27525,10 @@ var createLargerEq = /* @__PURE__ */ factory(
|
|
|
27285
27525
|
var createLargerEqNumber = /* @__PURE__ */ factory(
|
|
27286
27526
|
name159,
|
|
27287
27527
|
["typed", "config"],
|
|
27288
|
-
({ typed: typed3, config }) => {
|
|
27528
|
+
({ typed: typed3, config: config2 }) => {
|
|
27289
27529
|
return typed3(name159, {
|
|
27290
27530
|
"number, number": function(x, y) {
|
|
27291
|
-
return x >= y || nearlyEqual(x, y,
|
|
27531
|
+
return x >= y || nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
27292
27532
|
}
|
|
27293
27533
|
});
|
|
27294
27534
|
}
|
|
@@ -27310,7 +27550,7 @@ var createSmaller = /* @__PURE__ */ factory(
|
|
|
27310
27550
|
dependencies160,
|
|
27311
27551
|
({
|
|
27312
27552
|
typed: typed3,
|
|
27313
|
-
config,
|
|
27553
|
+
config: config2,
|
|
27314
27554
|
bignumber: bignumber2,
|
|
27315
27555
|
matrix: matrix2,
|
|
27316
27556
|
DenseMatrix: DenseMatrix6,
|
|
@@ -27327,11 +27567,11 @@ var createSmaller = /* @__PURE__ */ factory(
|
|
|
27327
27567
|
});
|
|
27328
27568
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
27329
27569
|
function bignumSmaller(x, y) {
|
|
27330
|
-
return x.lt(y) && !nearlyEqual2(x, y,
|
|
27570
|
+
return x.lt(y) && !nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
27331
27571
|
}
|
|
27332
27572
|
return typed3(
|
|
27333
27573
|
name160,
|
|
27334
|
-
createSmallerNumber({ typed: typed3, config }),
|
|
27574
|
+
createSmallerNumber({ typed: typed3, config: config2 }),
|
|
27335
27575
|
{
|
|
27336
27576
|
"boolean, boolean": (x, y) => x < y,
|
|
27337
27577
|
"BigNumber, BigNumber": bignumSmaller,
|
|
@@ -27359,10 +27599,10 @@ var createSmaller = /* @__PURE__ */ factory(
|
|
|
27359
27599
|
var createSmallerNumber = /* @__PURE__ */ factory(
|
|
27360
27600
|
name160,
|
|
27361
27601
|
["typed", "config"],
|
|
27362
|
-
({ typed: typed3, config }) => {
|
|
27602
|
+
({ typed: typed3, config: config2 }) => {
|
|
27363
27603
|
return typed3(name160, {
|
|
27364
27604
|
"number, number": function(x, y) {
|
|
27365
|
-
return x < y && !nearlyEqual(x, y,
|
|
27605
|
+
return x < y && !nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
27366
27606
|
}
|
|
27367
27607
|
});
|
|
27368
27608
|
}
|
|
@@ -27374,7 +27614,7 @@ var dependencies161 = ["typed", "config", "matrix", "DenseMatrix", "concat", "Sp
|
|
|
27374
27614
|
var createSmallerEq = /* @__PURE__ */ factory(
|
|
27375
27615
|
name161,
|
|
27376
27616
|
dependencies161,
|
|
27377
|
-
({ typed: typed3, config, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27617
|
+
({ typed: typed3, config: config2, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27378
27618
|
const matAlgo03xDSf = createMatAlgo03xDSf({ typed: typed3 });
|
|
27379
27619
|
const matAlgo07xSSf = createMatAlgo07xSSf({ typed: typed3, SparseMatrix });
|
|
27380
27620
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
@@ -27386,11 +27626,11 @@ var createSmallerEq = /* @__PURE__ */ factory(
|
|
|
27386
27626
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
27387
27627
|
return typed3(
|
|
27388
27628
|
name161,
|
|
27389
|
-
createSmallerEqNumber({ typed: typed3, config }),
|
|
27629
|
+
createSmallerEqNumber({ typed: typed3, config: config2 }),
|
|
27390
27630
|
{
|
|
27391
27631
|
"boolean, boolean": (x, y) => x <= y,
|
|
27392
27632
|
"BigNumber, BigNumber": function(x, y) {
|
|
27393
|
-
return x.lte(y) || nearlyEqual2(x, y,
|
|
27633
|
+
return x.lte(y) || nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
27394
27634
|
},
|
|
27395
27635
|
"bigint, bigint": (x, y) => x <= y,
|
|
27396
27636
|
"Fraction, Fraction": (x, y) => x.compare(y) !== 1,
|
|
@@ -27410,10 +27650,10 @@ var createSmallerEq = /* @__PURE__ */ factory(
|
|
|
27410
27650
|
var createSmallerEqNumber = /* @__PURE__ */ factory(
|
|
27411
27651
|
name161,
|
|
27412
27652
|
["typed", "config"],
|
|
27413
|
-
({ typed: typed3, config }) => {
|
|
27653
|
+
({ typed: typed3, config: config2 }) => {
|
|
27414
27654
|
return typed3(name161, {
|
|
27415
27655
|
"number, number": function(x, y) {
|
|
27416
|
-
return x <= y || nearlyEqual(x, y,
|
|
27656
|
+
return x <= y || nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
27417
27657
|
}
|
|
27418
27658
|
});
|
|
27419
27659
|
}
|
|
@@ -28346,7 +28586,7 @@ var createRange = /* @__PURE__ */ factory(
|
|
|
28346
28586
|
dependencies173,
|
|
28347
28587
|
({
|
|
28348
28588
|
typed: typed3,
|
|
28349
|
-
config,
|
|
28589
|
+
config: config2,
|
|
28350
28590
|
matrix: matrix2,
|
|
28351
28591
|
bignumber: bignumber2,
|
|
28352
28592
|
smaller: smaller2,
|
|
@@ -28440,7 +28680,7 @@ var createRange = /* @__PURE__ */ factory(
|
|
|
28440
28680
|
}
|
|
28441
28681
|
});
|
|
28442
28682
|
function _out(arr7) {
|
|
28443
|
-
if (
|
|
28683
|
+
if (config2.matrix === "Matrix") {
|
|
28444
28684
|
return matrix2 ? matrix2(arr7) : noMatrix();
|
|
28445
28685
|
}
|
|
28446
28686
|
return arr7;
|
|
@@ -28450,7 +28690,7 @@ var createRange = /* @__PURE__ */ factory(
|
|
|
28450
28690
|
if (!r) {
|
|
28451
28691
|
throw new SyntaxError('String "' + str + '" is no valid range');
|
|
28452
28692
|
}
|
|
28453
|
-
if (
|
|
28693
|
+
if (config2.number === "BigNumber") {
|
|
28454
28694
|
if (bignumber2 === void 0) {
|
|
28455
28695
|
noBignumber();
|
|
28456
28696
|
}
|
|
@@ -28509,7 +28749,7 @@ var createGamma = /* @__PURE__ */ factory(
|
|
|
28509
28749
|
dependencies174,
|
|
28510
28750
|
({
|
|
28511
28751
|
typed: typed3,
|
|
28512
|
-
config,
|
|
28752
|
+
config: config2,
|
|
28513
28753
|
multiplyScalar: _multiplyScalar,
|
|
28514
28754
|
pow: _pow,
|
|
28515
28755
|
BigNumber: BigNumber9,
|
|
@@ -28555,7 +28795,7 @@ var createGamma = /* @__PURE__ */ factory(
|
|
|
28555
28795
|
if (nNum < 8) {
|
|
28556
28796
|
return new BigNumber9([1, 1, 2, 6, 24, 120, 720, 5040][nNum]);
|
|
28557
28797
|
}
|
|
28558
|
-
const precision =
|
|
28798
|
+
const precision = config2.precision + (Math.log(nNum) | 0);
|
|
28559
28799
|
const Big = BigNumber9.clone({ precision });
|
|
28560
28800
|
if (nNum % 2 === 1) {
|
|
28561
28801
|
return n.times(bigFactorial(n.minus(1)));
|
|
@@ -28763,7 +29003,7 @@ var dependencies177 = ["typed", "config", "numeric", "larger", "isNaN"];
|
|
|
28763
29003
|
var createMax = /* @__PURE__ */ factory(
|
|
28764
29004
|
name177,
|
|
28765
29005
|
dependencies177,
|
|
28766
|
-
({ typed: typed3, config, numeric: numeric2, larger: larger2, isNaN: mathIsNaN }) => {
|
|
29006
|
+
({ typed: typed3, config: config2, numeric: numeric2, larger: larger2, isNaN: mathIsNaN }) => {
|
|
28767
29007
|
return typed3(name177, {
|
|
28768
29008
|
// max([a, b, c, d, ...])
|
|
28769
29009
|
"Array | Matrix": _max,
|
|
@@ -28820,7 +29060,7 @@ var createMax = /* @__PURE__ */ factory(
|
|
|
28820
29060
|
throw new Error("Cannot calculate max of an empty array");
|
|
28821
29061
|
}
|
|
28822
29062
|
if (typeof res === "string") {
|
|
28823
|
-
res = numeric2(res, safeNumberType(res,
|
|
29063
|
+
res = numeric2(res, safeNumberType(res, config2));
|
|
28824
29064
|
}
|
|
28825
29065
|
return res;
|
|
28826
29066
|
}
|
|
@@ -28842,7 +29082,7 @@ var dependencies178 = ["typed", "config", "numeric", "smaller", "isNaN"];
|
|
|
28842
29082
|
var createMin = /* @__PURE__ */ factory(
|
|
28843
29083
|
name178,
|
|
28844
29084
|
dependencies178,
|
|
28845
|
-
({ typed: typed3, config, numeric: numeric2, smaller: smaller2, isNaN: mathIsNaN }) => {
|
|
29085
|
+
({ typed: typed3, config: config2, numeric: numeric2, smaller: smaller2, isNaN: mathIsNaN }) => {
|
|
28846
29086
|
return typed3(name178, {
|
|
28847
29087
|
// min([a, b, c, d, ...])
|
|
28848
29088
|
"Array | Matrix": _min,
|
|
@@ -28899,7 +29139,7 @@ var createMin = /* @__PURE__ */ factory(
|
|
|
28899
29139
|
throw new Error("Cannot calculate min of an empty array");
|
|
28900
29140
|
}
|
|
28901
29141
|
if (typeof min2 === "string") {
|
|
28902
|
-
min2 = numeric2(min2, safeNumberType(min2,
|
|
29142
|
+
min2 = numeric2(min2, safeNumberType(min2, config2));
|
|
28903
29143
|
}
|
|
28904
29144
|
return min2;
|
|
28905
29145
|
}
|
|
@@ -30180,7 +30420,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(
|
|
|
30180
30420
|
dependencies193,
|
|
30181
30421
|
({
|
|
30182
30422
|
typed: typed3,
|
|
30183
|
-
config,
|
|
30423
|
+
config: config2,
|
|
30184
30424
|
mathWithTransform,
|
|
30185
30425
|
matrix: matrix2,
|
|
30186
30426
|
parse: parse3,
|
|
@@ -30280,7 +30520,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(
|
|
|
30280
30520
|
}
|
|
30281
30521
|
const _toNumber = typed3({
|
|
30282
30522
|
"string, Object": function(s, options) {
|
|
30283
|
-
const numericType = safeNumberType(s,
|
|
30523
|
+
const numericType = safeNumberType(s, config2);
|
|
30284
30524
|
if (numericType === "BigNumber") {
|
|
30285
30525
|
if (bignumber2 === void 0) {
|
|
30286
30526
|
noBignumber();
|
|
@@ -30329,7 +30569,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(
|
|
|
30329
30569
|
return new OperatorNode("-", "unaryMinus", [n]);
|
|
30330
30570
|
}
|
|
30331
30571
|
function _fractionToNode(f) {
|
|
30332
|
-
const fromBigInt = (value) =>
|
|
30572
|
+
const fromBigInt = (value) => config2.number === "BigNumber" && bignumber2 ? bignumber2(value) : Number(value);
|
|
30333
30573
|
const signBigInt = BigInt(f.s);
|
|
30334
30574
|
const numeratorValue = signBigInt * f.n;
|
|
30335
30575
|
const numeratorNode = numeratorValue < 0n ? new OperatorNode("-", "unaryMinus", [new ConstantNode(fromBigInt(-numeratorValue))]) : new ConstantNode(fromBigInt(numeratorValue));
|
|
@@ -33164,7 +33404,7 @@ var createIntersect = /* @__PURE__ */ factory(
|
|
|
33164
33404
|
dependencies217,
|
|
33165
33405
|
({
|
|
33166
33406
|
typed: typed3,
|
|
33167
|
-
config,
|
|
33407
|
+
config: config2,
|
|
33168
33408
|
abs: abs2,
|
|
33169
33409
|
add: add2,
|
|
33170
33410
|
addScalar: addScalar2,
|
|
@@ -33292,7 +33532,7 @@ var createIntersect = /* @__PURE__ */ factory(
|
|
|
33292
33532
|
multiplyScalar2(d2[0], d1[1])
|
|
33293
33533
|
);
|
|
33294
33534
|
if (isZero2(det2)) return null;
|
|
33295
|
-
if (smaller2(abs2(det2),
|
|
33535
|
+
if (smaller2(abs2(det2), config2.relTol)) {
|
|
33296
33536
|
return null;
|
|
33297
33537
|
}
|
|
33298
33538
|
const d20o11 = multiplyScalar2(d2[0], o1[1]);
|
|
@@ -33488,7 +33728,7 @@ var createMedian = /* @__PURE__ */ factory(
|
|
|
33488
33728
|
name219,
|
|
33489
33729
|
dependencies219,
|
|
33490
33730
|
({ typed: typed3, add: add2, divide: divide2, compare: compare2, partitionSelect: partitionSelect2 }) => {
|
|
33491
|
-
function
|
|
33731
|
+
function _median2(array) {
|
|
33492
33732
|
try {
|
|
33493
33733
|
const flat = flatten2(array.valueOf());
|
|
33494
33734
|
const num2 = flat.length;
|
|
@@ -33525,7 +33765,7 @@ var createMedian = /* @__PURE__ */ factory(
|
|
|
33525
33765
|
});
|
|
33526
33766
|
return typed3(name219, {
|
|
33527
33767
|
// median([a, b, c, d, ...])
|
|
33528
|
-
"Array | Matrix":
|
|
33768
|
+
"Array | Matrix": _median2,
|
|
33529
33769
|
// median([a, b, c, d, ...], dim)
|
|
33530
33770
|
"Array | Matrix, number | BigNumber": function(_array, _dim) {
|
|
33531
33771
|
throw new Error("median(A, dim) is not yet supported");
|
|
@@ -33535,7 +33775,7 @@ var createMedian = /* @__PURE__ */ factory(
|
|
|
33535
33775
|
if (containsCollections(args)) {
|
|
33536
33776
|
throw new TypeError("Scalar values expected in function median");
|
|
33537
33777
|
}
|
|
33538
|
-
return
|
|
33778
|
+
return _median2(args);
|
|
33539
33779
|
}
|
|
33540
33780
|
});
|
|
33541
33781
|
}
|
|
@@ -35276,7 +35516,7 @@ var createZeta = /* @__PURE__ */ factory(
|
|
|
35276
35516
|
dependencies235,
|
|
35277
35517
|
({
|
|
35278
35518
|
typed: typed3,
|
|
35279
|
-
config,
|
|
35519
|
+
config: config2,
|
|
35280
35520
|
multiply: multiply2,
|
|
35281
35521
|
pow: pow2,
|
|
35282
35522
|
divide: divide2,
|
|
@@ -35306,7 +35546,7 @@ var createZeta = /* @__PURE__ */ factory(
|
|
|
35306
35546
|
s,
|
|
35307
35547
|
(value) => new BigNumber9(value),
|
|
35308
35548
|
() => {
|
|
35309
|
-
return Math.abs(Math.log10(
|
|
35549
|
+
return Math.abs(Math.log10(config2.relTol));
|
|
35310
35550
|
}
|
|
35311
35551
|
),
|
|
35312
35552
|
Complex: zetaComplex
|
|
@@ -35327,7 +35567,7 @@ var createZeta = /* @__PURE__ */ factory(
|
|
|
35327
35567
|
if (s.re === 0 && s.im === 0) {
|
|
35328
35568
|
return new Complex12(-0.5);
|
|
35329
35569
|
}
|
|
35330
|
-
if (s.re === 1) {
|
|
35570
|
+
if (s.re === 1 && s.im === 0) {
|
|
35331
35571
|
return new Complex12(NaN, NaN);
|
|
35332
35572
|
}
|
|
35333
35573
|
if (s.re === Infinity && s.im === 0) {
|
|
@@ -35907,7 +36147,7 @@ function flattenToFloat649(matrix2, rows, cols) {
|
|
|
35907
36147
|
return result;
|
|
35908
36148
|
}
|
|
35909
36149
|
function createRealSymmetric({
|
|
35910
|
-
config,
|
|
36150
|
+
config: config2,
|
|
35911
36151
|
addScalar: addScalar2,
|
|
35912
36152
|
subtract: subtract2,
|
|
35913
36153
|
abs: abs2,
|
|
@@ -35932,7 +36172,7 @@ function createRealSymmetric({
|
|
|
35932
36172
|
if (typeof a === "number" && typeof b === "number") return a <= b;
|
|
35933
36173
|
return a.lte(b);
|
|
35934
36174
|
}
|
|
35935
|
-
function main(arr7, _N, prec =
|
|
36175
|
+
function main(arr7, _N, prec = config2.relTol, type, computeVectors) {
|
|
35936
36176
|
if (type === "number") {
|
|
35937
36177
|
return diag2(arr7, prec, computeVectors);
|
|
35938
36178
|
}
|
|
@@ -36053,7 +36293,7 @@ function createRealSymmetric({
|
|
|
36053
36293
|
}
|
|
36054
36294
|
function getTheta(aii, ajj, aij) {
|
|
36055
36295
|
const denom = ajj - aii;
|
|
36056
|
-
if (Math.abs(denom) <=
|
|
36296
|
+
if (Math.abs(denom) <= config2.relTol) {
|
|
36057
36297
|
return Math.PI / 4;
|
|
36058
36298
|
} else {
|
|
36059
36299
|
return 0.5 * Math.atan(2 * aij / (ajj - aii));
|
|
@@ -36061,7 +36301,7 @@ function createRealSymmetric({
|
|
|
36061
36301
|
}
|
|
36062
36302
|
function getThetaBig(aii, ajj, aij) {
|
|
36063
36303
|
const denom = subtract2(ajj, aii);
|
|
36064
|
-
if (bigLte(abs2(denom), bignumber2(
|
|
36304
|
+
if (bigLte(abs2(denom), bignumber2(config2.relTol))) {
|
|
36065
36305
|
return bignumber2(-1).acos().div(4);
|
|
36066
36306
|
} else {
|
|
36067
36307
|
return multiplyScalar2(
|
|
@@ -36272,7 +36512,7 @@ var createEigs = /* @__PURE__ */ factory(
|
|
|
36272
36512
|
name237,
|
|
36273
36513
|
dependencies237,
|
|
36274
36514
|
({
|
|
36275
|
-
config,
|
|
36515
|
+
config: config2,
|
|
36276
36516
|
typed: typed3,
|
|
36277
36517
|
matrix: matrix2,
|
|
36278
36518
|
addScalar: addScalar2,
|
|
@@ -36307,7 +36547,7 @@ var createEigs = /* @__PURE__ */ factory(
|
|
|
36307
36547
|
dot: dot3
|
|
36308
36548
|
}) => {
|
|
36309
36549
|
const doRealSymmetric = createRealSymmetric({
|
|
36310
|
-
config,
|
|
36550
|
+
config: config2,
|
|
36311
36551
|
addScalar: addScalar2,
|
|
36312
36552
|
subtract: subtract2,
|
|
36313
36553
|
abs: abs2,
|
|
@@ -36375,7 +36615,7 @@ var createEigs = /* @__PURE__ */ factory(
|
|
|
36375
36615
|
});
|
|
36376
36616
|
function doEigs(mat, opts = {}) {
|
|
36377
36617
|
const computeVectors = "eigenvectors" in opts ? opts.eigenvectors : true;
|
|
36378
|
-
const prec = opts.precision ??
|
|
36618
|
+
const prec = opts.precision ?? config2.relTol;
|
|
36379
36619
|
const result = computeValuesAndVectors(mat, prec, computeVectors);
|
|
36380
36620
|
if (opts.matricize) {
|
|
36381
36621
|
result.values = matrix2(result.values);
|
|
@@ -37834,7 +38074,7 @@ var createDerivative = /* @__PURE__ */ factory(
|
|
|
37834
38074
|
dependencies244,
|
|
37835
38075
|
({
|
|
37836
38076
|
typed: typed3,
|
|
37837
|
-
config,
|
|
38077
|
+
config: config2,
|
|
37838
38078
|
parse: parse3,
|
|
37839
38079
|
simplify: simplify2,
|
|
37840
38080
|
equal: equal2,
|
|
@@ -38363,7 +38603,7 @@ var createDerivative = /* @__PURE__ */ factory(
|
|
|
38363
38603
|
}
|
|
38364
38604
|
});
|
|
38365
38605
|
function createConstantNode2(value, valueType) {
|
|
38366
|
-
return new ConstantNode(numeric2(value, valueType || safeNumberType(String(value),
|
|
38606
|
+
return new ConstantNode(numeric2(value, valueType || safeNumberType(String(value), config2)));
|
|
38367
38607
|
}
|
|
38368
38608
|
return derivative2;
|
|
38369
38609
|
}
|
|
@@ -39128,7 +39368,7 @@ var createRotationMatrix = /* @__PURE__ */ factory(
|
|
|
39128
39368
|
dependencies249,
|
|
39129
39369
|
({
|
|
39130
39370
|
typed: typed3,
|
|
39131
|
-
config,
|
|
39371
|
+
config: config2,
|
|
39132
39372
|
multiplyScalar: multiplyScalar2,
|
|
39133
39373
|
addScalar: addScalar2,
|
|
39134
39374
|
unaryMinus: unaryMinus2,
|
|
@@ -39142,13 +39382,13 @@ var createRotationMatrix = /* @__PURE__ */ factory(
|
|
|
39142
39382
|
}) => {
|
|
39143
39383
|
return typed3(name249, {
|
|
39144
39384
|
"": function() {
|
|
39145
|
-
return
|
|
39385
|
+
return config2.matrix === "Matrix" ? matrix2([]) : [];
|
|
39146
39386
|
},
|
|
39147
39387
|
string: function(format6) {
|
|
39148
39388
|
return matrix2(format6);
|
|
39149
39389
|
},
|
|
39150
39390
|
"number | BigNumber | Complex | Unit": function(theta) {
|
|
39151
|
-
return _rotationMatrix2x2(theta,
|
|
39391
|
+
return _rotationMatrix2x2(theta, config2.matrix === "Matrix" ? "dense" : void 0);
|
|
39152
39392
|
},
|
|
39153
39393
|
"number | BigNumber | Complex | Unit, string": function(theta, format6) {
|
|
39154
39394
|
return _rotationMatrix2x2(theta, format6);
|
|
@@ -39160,7 +39400,7 @@ var createRotationMatrix = /* @__PURE__ */ factory(
|
|
|
39160
39400
|
},
|
|
39161
39401
|
"number | BigNumber | Complex | Unit, Matrix": function(theta, v) {
|
|
39162
39402
|
_validateVector(v);
|
|
39163
|
-
const storageType = v.storage() || (
|
|
39403
|
+
const storageType = v.storage() || (config2.matrix === "Matrix" ? "dense" : void 0);
|
|
39164
39404
|
return _rotationMatrix3x3(theta, v, storageType);
|
|
39165
39405
|
},
|
|
39166
39406
|
"number | BigNumber | Complex | Unit, Array, string": function(theta, v, format6) {
|
|
@@ -39691,8 +39931,8 @@ function unitFactory(name254, valueStr, unitStr) {
|
|
|
39691
39931
|
return factory(
|
|
39692
39932
|
name254,
|
|
39693
39933
|
dependencies254,
|
|
39694
|
-
({ config, Unit: Unit2, BigNumber: BigNumber9 }) => {
|
|
39695
|
-
const value =
|
|
39934
|
+
({ config: config2, Unit: Unit2, BigNumber: BigNumber9 }) => {
|
|
39935
|
+
const value = config2.number === "BigNumber" ? new BigNumber9(valueStr) : parseFloat(valueStr);
|
|
39696
39936
|
const unit2 = new Unit2(value, unitStr);
|
|
39697
39937
|
unit2.fixPrefix = true;
|
|
39698
39938
|
return unit2;
|
|
@@ -39704,8 +39944,8 @@ function numberFactory(name254, value) {
|
|
|
39704
39944
|
return factory(
|
|
39705
39945
|
name254,
|
|
39706
39946
|
dependencies254,
|
|
39707
|
-
({ config, BigNumber: BigNumber9 }) => {
|
|
39708
|
-
return
|
|
39947
|
+
({ config: config2, BigNumber: BigNumber9 }) => {
|
|
39948
|
+
return config2.number === "BigNumber" ? new BigNumber9(value) : value;
|
|
39709
39949
|
}
|
|
39710
39950
|
);
|
|
39711
39951
|
}
|
|
@@ -42331,6 +42571,13 @@ function casFactor(input) {
|
|
|
42331
42571
|
}).then((r) => r.result);
|
|
42332
42572
|
}
|
|
42333
42573
|
|
|
42574
|
+
// src/config-api.ts
|
|
42575
|
+
function config(options) {
|
|
42576
|
+
const shared = factoryScope.config;
|
|
42577
|
+
if (options) Object.assign(shared, options);
|
|
42578
|
+
return { ...shared };
|
|
42579
|
+
}
|
|
42580
|
+
|
|
42334
42581
|
// src/help.ts
|
|
42335
42582
|
import { createHelpClass, embeddedDocs } from "@danielsimonjr/mathts-expression";
|
|
42336
42583
|
var savedConfig = {};
|
|
@@ -42529,6 +42776,33 @@ function corrcoef(matrix2) {
|
|
|
42529
42776
|
(_, i) => Array.from({ length: n }, (_2, j) => c[i][j] / (d[i] * d[j]))
|
|
42530
42777
|
);
|
|
42531
42778
|
}
|
|
42779
|
+
function kendallTau(x, y) {
|
|
42780
|
+
const n = x.length;
|
|
42781
|
+
if (n !== y.length) throw new Error("kendallTau: inputs must have equal length");
|
|
42782
|
+
if (n < 2) return NaN;
|
|
42783
|
+
let P2 = 0;
|
|
42784
|
+
let Q2 = 0;
|
|
42785
|
+
for (let i = 0; i < n; i++) {
|
|
42786
|
+
for (let j = i + 1; j < n; j++) {
|
|
42787
|
+
const s = Math.sign(x[j] - x[i]) * Math.sign(y[j] - y[i]);
|
|
42788
|
+
if (s > 0) P2++;
|
|
42789
|
+
else if (s < 0) Q2++;
|
|
42790
|
+
}
|
|
42791
|
+
}
|
|
42792
|
+
const n0 = n * (n - 1) / 2;
|
|
42793
|
+
const tiePairs = (arr7) => {
|
|
42794
|
+
const counts = /* @__PURE__ */ new Map();
|
|
42795
|
+
for (const v of arr7) counts.set(v, (counts.get(v) ?? 0) + 1);
|
|
42796
|
+
let s = 0;
|
|
42797
|
+
for (const c of counts.values()) s += c * (c - 1) / 2;
|
|
42798
|
+
return s;
|
|
42799
|
+
};
|
|
42800
|
+
const n16 = tiePairs(x);
|
|
42801
|
+
const n26 = tiePairs(y);
|
|
42802
|
+
const denom = Math.sqrt((n0 - n16) * (n0 - n26));
|
|
42803
|
+
if (denom === 0) return NaN;
|
|
42804
|
+
return (P2 - Q2) / denom;
|
|
42805
|
+
}
|
|
42532
42806
|
|
|
42533
42807
|
// src/numeric-extra.ts
|
|
42534
42808
|
var toArr = (x) => Array.isArray(x) ? x : Array.from(x);
|
|
@@ -43709,6 +43983,7 @@ export {
|
|
|
43709
43983
|
avogadro,
|
|
43710
43984
|
bandpassFilter,
|
|
43711
43985
|
bartlettPSD,
|
|
43986
|
+
bartlettTest,
|
|
43712
43987
|
bellNumbers,
|
|
43713
43988
|
bernoulli,
|
|
43714
43989
|
bernoulliPMF,
|
|
@@ -43733,6 +44008,7 @@ export {
|
|
|
43733
44008
|
bin,
|
|
43734
44009
|
binomialDist,
|
|
43735
44010
|
binomialPMF,
|
|
44011
|
+
binomialTest,
|
|
43736
44012
|
bitAnd,
|
|
43737
44013
|
bitNot,
|
|
43738
44014
|
bitOr,
|
|
@@ -43796,6 +44072,7 @@ export {
|
|
|
43796
44072
|
concat2 as concat,
|
|
43797
44073
|
cond,
|
|
43798
44074
|
conductanceQuantum,
|
|
44075
|
+
config,
|
|
43799
44076
|
conj,
|
|
43800
44077
|
connectedComponents,
|
|
43801
44078
|
convexHull,
|
|
@@ -44049,6 +44326,7 @@ export {
|
|
|
44049
44326
|
highpassFilter,
|
|
44050
44327
|
hilbertTransform,
|
|
44051
44328
|
hmean,
|
|
44329
|
+
hypergeometricDist,
|
|
44052
44330
|
hypot,
|
|
44053
44331
|
idct,
|
|
44054
44332
|
identity,
|
|
@@ -44092,9 +44370,11 @@ export {
|
|
|
44092
44370
|
jsDivergence,
|
|
44093
44371
|
kdTree,
|
|
44094
44372
|
kdTreeNearest,
|
|
44373
|
+
kendallTau,
|
|
44095
44374
|
kldivergence,
|
|
44096
44375
|
klitzing,
|
|
44097
44376
|
kmeans,
|
|
44377
|
+
kolmogorovSmirnov2Test,
|
|
44098
44378
|
kolmogorovSmirnovTest,
|
|
44099
44379
|
kron,
|
|
44100
44380
|
kruskalWallis,
|
|
@@ -44117,6 +44397,7 @@ export {
|
|
|
44117
44397
|
legendreFit,
|
|
44118
44398
|
legendreP,
|
|
44119
44399
|
levenbergMarquardt,
|
|
44400
|
+
leveneTest,
|
|
44120
44401
|
lfilter,
|
|
44121
44402
|
lfilterZi,
|
|
44122
44403
|
lgamma,
|
|
@@ -44195,6 +44476,7 @@ export {
|
|
|
44195
44476
|
multiplyScalar,
|
|
44196
44477
|
multivariateTaylor,
|
|
44197
44478
|
nearestNeighbor,
|
|
44479
|
+
negativeBinomialDist,
|
|
44198
44480
|
nelderMead,
|
|
44199
44481
|
neutronMass,
|
|
44200
44482
|
newtonInterp,
|
|
@@ -44296,6 +44578,7 @@ export {
|
|
|
44296
44578
|
print,
|
|
44297
44579
|
prod,
|
|
44298
44580
|
projectVector,
|
|
44581
|
+
proportionZTest,
|
|
44299
44582
|
protonMass,
|
|
44300
44583
|
qr,
|
|
44301
44584
|
quadprog,
|
|
@@ -44408,6 +44691,7 @@ export {
|
|
|
44408
44691
|
studentTPDF,
|
|
44409
44692
|
studentTQuantile,
|
|
44410
44693
|
studentTTest,
|
|
44694
|
+
studentTTestPaired,
|
|
44411
44695
|
studentizedRangeCDF,
|
|
44412
44696
|
studentizedRangeQuantile,
|
|
44413
44697
|
subfactorial,
|