@danielsimonjr/mathts-core 0.14.1 → 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/arithmetic/scalar.d.ts +56 -0
- package/dist/arithmetic/scalar.d.ts.map +1 -0
- package/dist/array.d.ts +253 -0
- package/dist/array.d.ts.map +1 -0
- package/dist/bignumber-formatter.d.ts +135 -0
- package/dist/bignumber-formatter.d.ts.map +1 -0
- package/dist/{chunk-VPK5YTKG.js → chunk-L5MWGOLB.js} +111 -29
- package/dist/collection.d.ts +67 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants.d.ts +30 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/customs.d.ts +44 -0
- package/dist/customs.d.ts.map +1 -0
- package/dist/error/DimensionError.d.ts +26 -0
- package/dist/error/DimensionError.d.ts.map +1 -0
- package/dist/error/IndexError.d.ts +33 -0
- package/dist/error/IndexError.d.ts.map +1 -0
- package/dist/error/MathjsError.d.ts +13 -0
- package/dist/error/MathjsError.d.ts.map +1 -0
- package/dist/factory/factory.d.ts +154 -0
- package/dist/factory/factory.d.ts.map +1 -0
- package/dist/factory/index.d.ts +6 -0
- package/dist/factory/index.d.ts.map +1 -0
- package/dist/factory.d.ts +112 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/index.d.ts +24 -2585
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -18
- package/dist/internal.d.ts +33 -1344
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +5 -3
- package/dist/is.d.ts +102 -0
- package/dist/is.d.ts.map +1 -0
- package/dist/map.d.ts +113 -0
- package/dist/map.d.ts.map +1 -0
- package/dist/number.d.ts +314 -0
- package/dist/number.d.ts.map +1 -0
- package/dist/numeric/stable.d.ts +130 -0
- package/dist/numeric/stable.d.ts.map +1 -0
- package/dist/object.d.ts +119 -0
- package/dist/object.d.ts.map +1 -0
- package/dist/shared.d.ts +41 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/string.d.ts +70 -0
- package/dist/string.d.ts.map +1 -0
- package/dist/switch.d.ts +9 -0
- package/dist/switch.d.ts.map +1 -0
- package/dist/typed/index.d.ts +7 -0
- package/dist/typed/index.d.ts.map +1 -0
- package/dist/typed/mathts-typed.d.ts +246 -0
- package/dist/typed/mathts-typed.d.ts.map +1 -0
- package/dist/typed/type-bridge.d.ts +2 -0
- package/dist/typed/type-bridge.d.ts.map +1 -0
- package/dist/types/bignumber.d.ts +367 -0
- package/dist/types/bignumber.d.ts.map +1 -0
- package/dist/types/complex.d.ts +284 -0
- package/dist/types/complex.d.ts.map +1 -0
- package/dist/types/dual-rules.d.ts +129 -0
- package/dist/types/dual-rules.d.ts.map +1 -0
- package/dist/types/dual.d.ts +36 -0
- package/dist/types/dual.d.ts.map +1 -0
- package/dist/types/fraction.d.ts +215 -0
- package/dist/types/fraction.d.ts.map +1 -0
- package/dist/types/interfaces.d.ts +143 -0
- package/dist/types/interfaces.d.ts.map +1 -0
- package/dist/types/matrix/Range.d.ts +767 -0
- package/dist/types/matrix/Range.d.ts.map +1 -0
- package/dist/types/unit/Unit.d.ts +3 -0
- package/dist/types/unit/Unit.d.ts.map +1 -0
- package/dist/types/unit/dependencies.d.ts +4 -0
- package/dist/types/unit/dependencies.d.ts.map +1 -0
- package/dist/types/unit/errors.d.ts +18 -0
- package/dist/types/unit/errors.d.ts.map +1 -0
- package/dist/types/unit/index.d.ts +7 -0
- package/dist/types/unit/index.d.ts.map +1 -0
- package/dist/types/unit/unit-types.d.ts +231 -0
- package/dist/types/unit/unit-types.d.ts.map +1 -0
- package/dist/types/unit-definitions.d.ts +79 -0
- package/dist/types/unit-definitions.d.ts.map +1 -0
- package/dist/types/unit-prefixes.d.ts +29 -0
- package/dist/types/unit-prefixes.d.ts.map +1 -0
- package/dist/types/unit.d.ts +28 -0
- package/dist/types/unit.d.ts.map +1 -0
- package/dist/types/wasm-loader.d.ts +35 -0
- package/dist/types/wasm-loader.d.ts.map +1 -0
- package/dist/wasm-loader.d.ts +97 -0
- package/dist/wasm-loader.d.ts.map +1 -0
- package/package.json +9 -9
- package/dist/index-B4LIOfHN.d.ts +0 -449
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,YAAY,EACV,WAAW,EACX,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,OAAO,EACP,QAAQ,EACR,SAAS,EACT,UAAU,EACV,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,OAAO,EACP,SAAS,EACT,CAAC,EACD,YAAY,EACZ,WAAW,EACX,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,GACV,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG9E,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG3F,OAAO,EACL,QAAQ,EACR,UAAU,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,SAAS,EACT,WAAW,EACX,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB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,cAAc,GACf,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAW5B,eAAO,MAAM,OAAO,EAAE,MAAwB,CAAC;AAI/C,OAAO,EACL,WAAW,EACX,WAAW,EACX,KAAK,EACL,WAAW,EACX,cAAc,EACd,cAAc,EACd,oBAAoB,GACrB,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
round,
|
|
45
45
|
sign,
|
|
46
46
|
subtractScalar
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-L5MWGOLB.js";
|
|
48
48
|
|
|
49
49
|
// src/types/matrix/Range.ts
|
|
50
50
|
var name = "Range";
|
|
@@ -75,12 +75,21 @@ var createRangeClass = /* @__PURE__ */ factory(
|
|
|
75
75
|
*/
|
|
76
76
|
step;
|
|
77
77
|
/**
|
|
78
|
-
* Cached primitive array representation
|
|
78
|
+
* Cached primitive array representation.
|
|
79
|
+
*
|
|
80
|
+
* @internal Not part of the public API.
|
|
81
|
+
*
|
|
82
|
+
* These four were ES-private (`#cache`) until TypeScript 7. This class is
|
|
83
|
+
* returned from a `factory()` call, so declaration emit describes it as an
|
|
84
|
+
* ANONYMOUS class type -- and TS4094 forbids private or protected members
|
|
85
|
+
* there, because an anonymous type has no name to refer them to. The
|
|
86
|
+
* underscore prefix keeps the "do not touch" signal without the emit
|
|
87
|
+
* failure. Restore `#` if the class is ever hoisted out of the factory.
|
|
79
88
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
_cache = null;
|
|
90
|
+
_cacheStart;
|
|
91
|
+
_cacheEnd;
|
|
92
|
+
_cacheStep;
|
|
84
93
|
constructor(start, end, step) {
|
|
85
94
|
if (!(this instanceof Range2)) {
|
|
86
95
|
throw new SyntaxError("Constructor must be called with the new operator");
|
|
@@ -280,14 +289,14 @@ var createRangeClass = /* @__PURE__ */ factory(
|
|
|
280
289
|
* @returns {Array} array
|
|
281
290
|
*/
|
|
282
291
|
valueOf() {
|
|
283
|
-
if (this
|
|
284
|
-
return this
|
|
292
|
+
if (this._cache !== null && this.start === this._cacheStart && this.end === this._cacheEnd && this.step === this._cacheStep) {
|
|
293
|
+
return this._cache;
|
|
285
294
|
}
|
|
286
|
-
this
|
|
287
|
-
this
|
|
288
|
-
this
|
|
289
|
-
this
|
|
290
|
-
return this
|
|
295
|
+
this._cache = this.toArray();
|
|
296
|
+
this._cacheStart = this.start;
|
|
297
|
+
this._cacheEnd = this.end;
|
|
298
|
+
this._cacheStep = this.step;
|
|
299
|
+
return this._cache;
|
|
291
300
|
}
|
|
292
301
|
/**
|
|
293
302
|
* Get a string representation of the range, with optional formatting options.
|
|
@@ -1301,13 +1310,60 @@ function sumSquaredDeviations(xs) {
|
|
|
1301
1310
|
const n = xs.length;
|
|
1302
1311
|
if (n < 2) return 0;
|
|
1303
1312
|
const mean = pairwiseSum(xs) / n;
|
|
1304
|
-
const
|
|
1305
|
-
for (let i = 0; i < n; i++) d[i] = xs[i] - mean;
|
|
1306
|
-
const sumD = pairwiseSum(d);
|
|
1307
|
-
const sumDD = pairwiseDot(d, d);
|
|
1313
|
+
const { sumD, sumDD } = pairwiseDeviationSums(xs, mean, 0, n);
|
|
1308
1314
|
const corrected = sumDD - sumD * sumD / n;
|
|
1309
1315
|
return corrected < 0 ? 0 : corrected;
|
|
1310
1316
|
}
|
|
1317
|
+
function pairwiseDeviationSums(xs, mean, start, end) {
|
|
1318
|
+
const n = end - start;
|
|
1319
|
+
if (n <= PAIRWISE_BLOCK) {
|
|
1320
|
+
let d0 = 0, d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0, d7 = 0;
|
|
1321
|
+
let q0 = 0, q1 = 0, q2 = 0, q3 = 0, q4 = 0, q5 = 0, q6 = 0, q7 = 0;
|
|
1322
|
+
let i = start;
|
|
1323
|
+
const limit = start + (n - n % 8);
|
|
1324
|
+
for (; i < limit; i += 8) {
|
|
1325
|
+
const a0 = xs[i] - mean;
|
|
1326
|
+
const a1 = xs[i + 1] - mean;
|
|
1327
|
+
const a2 = xs[i + 2] - mean;
|
|
1328
|
+
const a3 = xs[i + 3] - mean;
|
|
1329
|
+
const a4 = xs[i + 4] - mean;
|
|
1330
|
+
const a5 = xs[i + 5] - mean;
|
|
1331
|
+
const a6 = xs[i + 6] - mean;
|
|
1332
|
+
const a7 = xs[i + 7] - mean;
|
|
1333
|
+
d0 += a0;
|
|
1334
|
+
q0 += a0 * a0;
|
|
1335
|
+
d1 += a1;
|
|
1336
|
+
q1 += a1 * a1;
|
|
1337
|
+
d2 += a2;
|
|
1338
|
+
q2 += a2 * a2;
|
|
1339
|
+
d3 += a3;
|
|
1340
|
+
q3 += a3 * a3;
|
|
1341
|
+
d4 += a4;
|
|
1342
|
+
q4 += a4 * a4;
|
|
1343
|
+
d5 += a5;
|
|
1344
|
+
q5 += a5 * a5;
|
|
1345
|
+
d6 += a6;
|
|
1346
|
+
q6 += a6 * a6;
|
|
1347
|
+
d7 += a7;
|
|
1348
|
+
q7 += a7 * a7;
|
|
1349
|
+
}
|
|
1350
|
+
let tailD = 0;
|
|
1351
|
+
let tailDD = 0;
|
|
1352
|
+
for (; i < end; i++) {
|
|
1353
|
+
const a = xs[i] - mean;
|
|
1354
|
+
tailD += a;
|
|
1355
|
+
tailDD += a * a;
|
|
1356
|
+
}
|
|
1357
|
+
return {
|
|
1358
|
+
sumD: d0 + d1 + (d2 + d3) + (d4 + d5 + (d6 + d7)) + tailD,
|
|
1359
|
+
sumDD: q0 + q1 + (q2 + q3) + (q4 + q5 + (q6 + q7)) + tailDD
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
const half = (n >> 1) - (n >> 1) % 8;
|
|
1363
|
+
const left = pairwiseDeviationSums(xs, mean, start, start + half);
|
|
1364
|
+
const right = pairwiseDeviationSums(xs, mean, start + half, end);
|
|
1365
|
+
return { sumD: left.sumD + right.sumD, sumDD: left.sumDD + right.sumDD };
|
|
1366
|
+
}
|
|
1311
1367
|
function neumaierCumsum(xs, out) {
|
|
1312
1368
|
let sum = 0;
|
|
1313
1369
|
let c = 0;
|
|
@@ -1321,7 +1377,7 @@ function neumaierCumsum(xs, out) {
|
|
|
1321
1377
|
}
|
|
1322
1378
|
|
|
1323
1379
|
// src/index.ts
|
|
1324
|
-
var VERSION = "0.
|
|
1380
|
+
var VERSION = "0.15.0";
|
|
1325
1381
|
export {
|
|
1326
1382
|
ALL_UNITS,
|
|
1327
1383
|
BASE_UNITS,
|