@cortex-js/compute-engine 0.35.3 → 0.35.5
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/compute-engine.esm.js +129 -40
- package/dist/compute-engine.min.esm.js +49 -34
- package/dist/compute-engine.min.umd.js +49 -34
- package/dist/compute-engine.umd.js +129 -40
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.umd.js +2 -2
- package/dist/math-json.umd.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/configuration-change.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +1 -1
- package/dist/types/common/one-of.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/type/ast-nodes.d.ts +1 -1
- package/dist/types/common/type/boxed-type.d.ts +1 -1
- package/dist/types/common/type/lexer.d.ts +1 -1
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/parser.d.ts +1 -1
- package/dist/types/common/type/primitive.d.ts +1 -1
- package/dist/types/common/type/reduce.d.ts +1 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/type-builder.d.ts +1 -1
- package/dist/types/common/type/types.d.ts +1 -1
- package/dist/types/common/type/utils.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/product.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/terms.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compilation/base-compiler.d.ts +1 -1
- package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/interval-glsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/types.d.ts +1 -1
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/global-types.d.ts +1 -1
- package/dist/types/compute-engine/index.d.ts +1 -1
- package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
- package/dist/types/compute-engine/interval/elementary.d.ts +1 -1
- package/dist/types/compute-engine/interval/index.d.ts +1 -1
- package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
- package/dist/types/compute-engine/interval/types.d.ts +2 -1
- package/dist/types/compute-engine/interval/util.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/types.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +1 -1
- package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/invisible-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-utils.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
- package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/special-functions.d.ts +1 -1
- package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
- package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
- package/dist/types/compute-engine/numerics/types.d.ts +1 -1
- package/dist/types/compute-engine/oeis.d.ts +1 -1
- package/dist/types/compute-engine/sequence.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
- package/dist/types/compute-engine/types.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +1 -1
- package/dist/types/math-json/symbols.d.ts +1 -1
- package/dist/types/math-json/types.d.ts +1 -1
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.35.
|
|
1
|
+
/** Compute Engine 0.35.5 */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -23824,7 +23824,8 @@ function typeCouldBeCollection(type2) {
|
|
|
23824
23824
|
}
|
|
23825
23825
|
if (type2.kind === "list" || type2.kind === "set" || type2.kind === "tuple")
|
|
23826
23826
|
return true;
|
|
23827
|
-
if (type2.kind === "union")
|
|
23827
|
+
if (type2.kind === "union")
|
|
23828
|
+
return type2.types.some((t) => typeCouldBeCollection(t));
|
|
23828
23829
|
return false;
|
|
23829
23830
|
}
|
|
23830
23831
|
function typeCouldBeNumericCollection(type2) {
|
|
@@ -24632,6 +24633,16 @@ var init_arithmetic = __esm({
|
|
|
24632
24633
|
return engine.function("Power", [engine.E, ...args]);
|
|
24633
24634
|
}
|
|
24634
24635
|
},
|
|
24636
|
+
Exp2: {
|
|
24637
|
+
description: "Base-2 exponential: 2^x",
|
|
24638
|
+
complexity: 3500,
|
|
24639
|
+
broadcastable: true,
|
|
24640
|
+
signature: "(number) -> number",
|
|
24641
|
+
canonical: (args, { engine }) => {
|
|
24642
|
+
args = checkNumericArgs(engine, args, 1);
|
|
24643
|
+
return engine.function("Power", [engine.number(2), ...args]);
|
|
24644
|
+
}
|
|
24645
|
+
},
|
|
24635
24646
|
Factorial: {
|
|
24636
24647
|
description: "Factorial function: the product of all positive integers less than or equal to n",
|
|
24637
24648
|
wikidata: "Q120976",
|
|
@@ -24721,6 +24732,22 @@ var init_arithmetic = __esm({
|
|
|
24721
24732
|
(z) => z.floor(0)
|
|
24722
24733
|
)
|
|
24723
24734
|
},
|
|
24735
|
+
Fract: {
|
|
24736
|
+
description: "Fractional part of a number: x - floor(x)",
|
|
24737
|
+
complexity: 1250,
|
|
24738
|
+
broadcastable: true,
|
|
24739
|
+
signature: "(number) -> number",
|
|
24740
|
+
sgn: ([x]) => {
|
|
24741
|
+
if (x.isNonNegative) return "non-negative";
|
|
24742
|
+
return void 0;
|
|
24743
|
+
},
|
|
24744
|
+
evaluate: ([x]) => apply(
|
|
24745
|
+
x,
|
|
24746
|
+
(x2) => x2 - Math.floor(x2),
|
|
24747
|
+
(x2) => x2.sub(x2.floor()),
|
|
24748
|
+
(z) => z.sub(z.floor(0))
|
|
24749
|
+
)
|
|
24750
|
+
},
|
|
24724
24751
|
Gamma: {
|
|
24725
24752
|
wikidata: "Q190573",
|
|
24726
24753
|
complexity: 8e3,
|
|
@@ -24936,6 +24963,22 @@ var init_arithmetic = __esm({
|
|
|
24936
24963
|
sgn: ([x]) => lnSign(x),
|
|
24937
24964
|
canonical: ([x], { engine }) => engine._fn("Log", [x])
|
|
24938
24965
|
},
|
|
24966
|
+
Log10: {
|
|
24967
|
+
description: "Base-10 Logarithm",
|
|
24968
|
+
complexity: 4100,
|
|
24969
|
+
broadcastable: true,
|
|
24970
|
+
signature: "(number) -> number",
|
|
24971
|
+
sgn: ([x]) => lnSign(x),
|
|
24972
|
+
canonical: ([x], { engine }) => engine._fn("Log", [x])
|
|
24973
|
+
},
|
|
24974
|
+
Log2: {
|
|
24975
|
+
description: "Base-2 Logarithm",
|
|
24976
|
+
complexity: 4100,
|
|
24977
|
+
broadcastable: true,
|
|
24978
|
+
signature: "(number) -> number",
|
|
24979
|
+
sgn: ([x]) => lnSign(x),
|
|
24980
|
+
canonical: ([x], { engine }) => engine._fn("Log", [x, engine.number(2)])
|
|
24981
|
+
},
|
|
24939
24982
|
Mod: {
|
|
24940
24983
|
description: "Modulo",
|
|
24941
24984
|
wikidata: "Q1799665",
|
|
@@ -25178,6 +25221,18 @@ var init_arithmetic = __esm({
|
|
|
25178
25221
|
},
|
|
25179
25222
|
evaluate: ([x, n], { numericApproximation }) => root(x, n, { numericApproximation })
|
|
25180
25223
|
},
|
|
25224
|
+
Remainder: {
|
|
25225
|
+
description: "IEEE remainder: the signed remainder after dividing x by y, with the quotient rounded to the nearest integer",
|
|
25226
|
+
complexity: 2500,
|
|
25227
|
+
broadcastable: true,
|
|
25228
|
+
signature: "(number, number) -> number",
|
|
25229
|
+
evaluate: ([a, b]) => apply2(
|
|
25230
|
+
a,
|
|
25231
|
+
b,
|
|
25232
|
+
(a2, b2) => a2 - b2 * Math.round(a2 / b2),
|
|
25233
|
+
(a2, b2) => a2.sub(b2.mul(a2.div(b2).round()))
|
|
25234
|
+
)
|
|
25235
|
+
},
|
|
25181
25236
|
Round: {
|
|
25182
25237
|
complexity: 1250,
|
|
25183
25238
|
broadcastable: true,
|
|
@@ -25309,6 +25364,19 @@ var init_arithmetic = __esm({
|
|
|
25309
25364
|
const rest = args.slice(1);
|
|
25310
25365
|
return canonicalAdd(engine, [first, ...rest.map((x) => x.neg())]);
|
|
25311
25366
|
}
|
|
25367
|
+
},
|
|
25368
|
+
Truncate: {
|
|
25369
|
+
description: "Rounds a number towards zero (removes the fractional part)",
|
|
25370
|
+
complexity: 1250,
|
|
25371
|
+
broadcastable: true,
|
|
25372
|
+
signature: "(number) -> integer",
|
|
25373
|
+
sgn: ([x]) => x.sgn,
|
|
25374
|
+
evaluate: ([x]) => apply(
|
|
25375
|
+
x,
|
|
25376
|
+
Math.trunc,
|
|
25377
|
+
(x2) => x2.trunc(),
|
|
25378
|
+
(z) => z.trunc(0)
|
|
25379
|
+
)
|
|
25312
25380
|
}
|
|
25313
25381
|
},
|
|
25314
25382
|
{
|
|
@@ -32603,7 +32671,7 @@ var DERIVATIVES_TABLE = {
|
|
|
32603
32671
|
]
|
|
32604
32672
|
],
|
|
32605
32673
|
// d/dx ln(Γ(x)) = ψ(x) (digamma function)
|
|
32606
|
-
|
|
32674
|
+
GammaLn: ["Digamma", "_"],
|
|
32607
32675
|
// d/dx ψ(x) = ψ₁(x) (trigamma function)
|
|
32608
32676
|
// https://en.wikipedia.org/wiki/Trigamma_function
|
|
32609
32677
|
Digamma: ["Trigamma", "_"],
|
|
@@ -35595,8 +35663,7 @@ function numberForm(expr) {
|
|
|
35595
35663
|
function multiplyForm(expr) {
|
|
35596
35664
|
if (!expr.ops) return expr;
|
|
35597
35665
|
const ops = expr.ops.map(multiplyForm);
|
|
35598
|
-
if (expr.operator === "Multiply")
|
|
35599
|
-
return canonicalMultiply(expr.engine, ops);
|
|
35666
|
+
if (expr.operator === "Multiply") return canonicalMultiply(expr.engine, ops);
|
|
35600
35667
|
if (expr.operator === "Negate")
|
|
35601
35668
|
return canonicalMultiply(expr.engine, [ops[0], expr.engine.NegativeOne]);
|
|
35602
35669
|
return expr;
|
|
@@ -45969,7 +46036,8 @@ var BoxedFunction = class extends _BoxedExpression {
|
|
|
45969
46036
|
return this.numeratorDenominator[1];
|
|
45970
46037
|
}
|
|
45971
46038
|
get numeratorDenominator() {
|
|
45972
|
-
if (!(this.isCanonical || this.isStructural))
|
|
46039
|
+
if (!(this.isCanonical || this.isStructural))
|
|
46040
|
+
return [this, this.engine.One];
|
|
45973
46041
|
if (this.isNumber !== true)
|
|
45974
46042
|
return [this.engine.Nothing, this.engine.Nothing];
|
|
45975
46043
|
const operator2 = this.operator;
|
|
@@ -46007,11 +46075,13 @@ var BoxedFunction = class extends _BoxedExpression {
|
|
|
46007
46075
|
// ALGEBRAIC OPERATIONS
|
|
46008
46076
|
//
|
|
46009
46077
|
neg() {
|
|
46010
|
-
if (!(this.isCanonical || this.isStructural))
|
|
46078
|
+
if (!(this.isCanonical || this.isStructural))
|
|
46079
|
+
throw new Error("Not canonical");
|
|
46011
46080
|
return negate(this);
|
|
46012
46081
|
}
|
|
46013
46082
|
inv() {
|
|
46014
|
-
if (!(this.isCanonical || this.isStructural))
|
|
46083
|
+
if (!(this.isCanonical || this.isStructural))
|
|
46084
|
+
throw new Error("Not canonical");
|
|
46015
46085
|
if (this.isOne) return this;
|
|
46016
46086
|
if (this.isNegativeOne) return this;
|
|
46017
46087
|
if (this.operator === "Sqrt") return this.op1.inv().sqrt();
|
|
@@ -46032,7 +46102,8 @@ var BoxedFunction = class extends _BoxedExpression {
|
|
|
46032
46102
|
return this.engine._fn("Divide", [this.engine.One, this]);
|
|
46033
46103
|
}
|
|
46034
46104
|
abs() {
|
|
46035
|
-
if (!(this.isCanonical || this.isStructural))
|
|
46105
|
+
if (!(this.isCanonical || this.isStructural))
|
|
46106
|
+
throw new Error("Not canonical");
|
|
46036
46107
|
if (this.operator === "Abs" || this.operator === "Negate") return this;
|
|
46037
46108
|
if (this.isNonNegative) return this;
|
|
46038
46109
|
if (this.isNonPositive) return this.neg();
|
|
@@ -46040,11 +46111,13 @@ var BoxedFunction = class extends _BoxedExpression {
|
|
|
46040
46111
|
}
|
|
46041
46112
|
add(rhs) {
|
|
46042
46113
|
if (rhs === 0) return this;
|
|
46043
|
-
if (!(this.isCanonical || this.isStructural))
|
|
46114
|
+
if (!(this.isCanonical || this.isStructural))
|
|
46115
|
+
throw new Error("Not canonical");
|
|
46044
46116
|
return add3(this, this.engine.box(rhs));
|
|
46045
46117
|
}
|
|
46046
46118
|
mul(rhs) {
|
|
46047
|
-
if (!(this.isCanonical || this.isStructural))
|
|
46119
|
+
if (!(this.isCanonical || this.isStructural))
|
|
46120
|
+
throw new Error("Not canonical");
|
|
46048
46121
|
if (rhs === 0) return this.engine.Zero;
|
|
46049
46122
|
if (rhs === 1) return this;
|
|
46050
46123
|
if (rhs === -1) return this.neg();
|
|
@@ -46056,7 +46129,8 @@ var BoxedFunction = class extends _BoxedExpression {
|
|
|
46056
46129
|
return mul3(this, this.engine.box(rhs));
|
|
46057
46130
|
}
|
|
46058
46131
|
div(rhs) {
|
|
46059
|
-
if (!(this.isCanonical || this.isStructural))
|
|
46132
|
+
if (!(this.isCanonical || this.isStructural))
|
|
46133
|
+
throw new Error("Not canonical");
|
|
46060
46134
|
return div2(this, rhs);
|
|
46061
46135
|
}
|
|
46062
46136
|
pow(exp3) {
|
|
@@ -46122,7 +46196,8 @@ var BoxedFunction = class extends _BoxedExpression {
|
|
|
46122
46196
|
}
|
|
46123
46197
|
ln(semiBase) {
|
|
46124
46198
|
const base = semiBase ? this.engine.box(semiBase) : void 0;
|
|
46125
|
-
if (!(this.isCanonical || this.isStructural))
|
|
46199
|
+
if (!(this.isCanonical || this.isStructural))
|
|
46200
|
+
throw new Error("Not canonical");
|
|
46126
46201
|
if (this.is(0)) return this.engine.NegativeInfinity;
|
|
46127
46202
|
if (this.operator === "Exp") {
|
|
46128
46203
|
if (!base) return this.op1;
|
|
@@ -51457,7 +51532,7 @@ var JAVASCRIPT_FUNCTIONS = {
|
|
|
51457
51532
|
Arsinh: "Math.asinh",
|
|
51458
51533
|
Arctan: "Math.atan",
|
|
51459
51534
|
Artanh: "Math.atanh",
|
|
51460
|
-
|
|
51535
|
+
Ceil: "Math.ceil",
|
|
51461
51536
|
Chop: "_SYS.chop",
|
|
51462
51537
|
Cos: "Math.cos",
|
|
51463
51538
|
Cosh: "Math.cosh",
|
|
@@ -51487,10 +51562,7 @@ var JAVASCRIPT_FUNCTIONS = {
|
|
|
51487
51562
|
Floor: "Math.floor",
|
|
51488
51563
|
Fract: ([x], compile) => {
|
|
51489
51564
|
if (x === null) throw new Error("Fract: no argument");
|
|
51490
|
-
return BaseCompiler.inlineExpression(
|
|
51491
|
-
"${x} - Math.floor(${x})",
|
|
51492
|
-
compile(x)
|
|
51493
|
-
);
|
|
51565
|
+
return BaseCompiler.inlineExpression("${x} - Math.floor(${x})", compile(x));
|
|
51494
51566
|
},
|
|
51495
51567
|
Gamma: "_SYS.gamma",
|
|
51496
51568
|
GCD: "_SYS.gcd",
|
|
@@ -51503,7 +51575,7 @@ var JAVASCRIPT_FUNCTIONS = {
|
|
|
51503
51575
|
if (args.length === 1) return `Math.log10(${compile(args[0])})`;
|
|
51504
51576
|
return `(Math.log(${compile(args[0])}) / Math.log(${compile(args[1])}))`;
|
|
51505
51577
|
},
|
|
51506
|
-
|
|
51578
|
+
GammaLn: "_SYS.lngamma",
|
|
51507
51579
|
Lb: "Math.log2",
|
|
51508
51580
|
Max: "Math.max",
|
|
51509
51581
|
Mean: (args, compile) => {
|
|
@@ -51632,7 +51704,7 @@ var JAVASCRIPT_FUNCTIONS = {
|
|
|
51632
51704
|
if (arg === null) throw new Error("Sech: no argument");
|
|
51633
51705
|
return `1 / Math.cosh(${compile(arg)})`;
|
|
51634
51706
|
},
|
|
51635
|
-
|
|
51707
|
+
Sign: "Math.sign",
|
|
51636
51708
|
Sin: "Math.sin",
|
|
51637
51709
|
Sinh: "Math.sinh",
|
|
51638
51710
|
Sqrt: "Math.sqrt",
|
|
@@ -51900,7 +51972,7 @@ var GLSL_FUNCTIONS = {
|
|
|
51900
51972
|
Arccos: "acos",
|
|
51901
51973
|
Arcsin: "asin",
|
|
51902
51974
|
Arctan: "atan",
|
|
51903
|
-
|
|
51975
|
+
Ceil: "ceil",
|
|
51904
51976
|
Clamp: "clamp",
|
|
51905
51977
|
Cos: "cos",
|
|
51906
51978
|
Degrees: "degrees",
|
|
@@ -51988,7 +52060,7 @@ var GLSL_FUNCTIONS = {
|
|
|
51988
52060
|
return `acosh(1.0 / (${compile(x)}))`;
|
|
51989
52061
|
},
|
|
51990
52062
|
// Additional math functions
|
|
51991
|
-
|
|
52063
|
+
// Sign is already registered in the standard functions above
|
|
51992
52064
|
Lb: "log2",
|
|
51993
52065
|
Log: (args, compile) => {
|
|
51994
52066
|
if (args.length === 0) throw new Error("Log: no argument");
|
|
@@ -52555,7 +52627,7 @@ function floor2(x) {
|
|
|
52555
52627
|
const flo = Math.floor(xVal.lo);
|
|
52556
52628
|
const fhi = Math.floor(xVal.hi);
|
|
52557
52629
|
if (flo === fhi) return ok({ lo: flo, hi: fhi });
|
|
52558
|
-
return { kind: "singular", at: flo + 1 };
|
|
52630
|
+
return { kind: "singular", at: flo + 1, continuity: "right" };
|
|
52559
52631
|
}
|
|
52560
52632
|
function ceil2(x) {
|
|
52561
52633
|
const unwrapped = unwrapOrPropagate(x);
|
|
@@ -52564,7 +52636,7 @@ function ceil2(x) {
|
|
|
52564
52636
|
const clo = Math.ceil(xVal.lo);
|
|
52565
52637
|
const chi = Math.ceil(xVal.hi);
|
|
52566
52638
|
if (clo === chi) return ok({ lo: clo, hi: chi });
|
|
52567
|
-
return { kind: "singular", at: clo };
|
|
52639
|
+
return { kind: "singular", at: clo, continuity: "left" };
|
|
52568
52640
|
}
|
|
52569
52641
|
function round2(x) {
|
|
52570
52642
|
const unwrapped = unwrapOrPropagate(x);
|
|
@@ -52573,7 +52645,7 @@ function round2(x) {
|
|
|
52573
52645
|
const rlo = Math.round(xVal.lo);
|
|
52574
52646
|
const rhi = Math.round(xVal.hi);
|
|
52575
52647
|
if (rlo === rhi) return ok({ lo: rlo, hi: rhi });
|
|
52576
|
-
return { kind: "singular", at: rlo + 0.5 };
|
|
52648
|
+
return { kind: "singular", at: rlo + 0.5, continuity: "right" };
|
|
52577
52649
|
}
|
|
52578
52650
|
function fract(x) {
|
|
52579
52651
|
const unwrapped = unwrapOrPropagate(x);
|
|
@@ -52584,7 +52656,7 @@ function fract(x) {
|
|
|
52584
52656
|
if (flo === fhi) {
|
|
52585
52657
|
return ok({ lo: xVal.lo - flo, hi: xVal.hi - flo });
|
|
52586
52658
|
}
|
|
52587
|
-
return { kind: "singular", at: flo + 1 };
|
|
52659
|
+
return { kind: "singular", at: flo + 1, continuity: "right" };
|
|
52588
52660
|
}
|
|
52589
52661
|
function min2(a, b) {
|
|
52590
52662
|
const unwrapped = unwrapOrPropagate(a, b);
|
|
@@ -52611,11 +52683,13 @@ function mod2(a, b) {
|
|
|
52611
52683
|
if (containsZero(bVal)) {
|
|
52612
52684
|
return { kind: "singular" };
|
|
52613
52685
|
}
|
|
52614
|
-
const period = Math.abs(
|
|
52686
|
+
const period = Math.abs(
|
|
52687
|
+
bVal.lo === bVal.hi ? bVal.lo : Math.max(Math.abs(bVal.lo), Math.abs(bVal.hi))
|
|
52688
|
+
);
|
|
52615
52689
|
const flo = Math.floor(aVal.lo / period);
|
|
52616
52690
|
const fhi = Math.floor(aVal.hi / period);
|
|
52617
52691
|
if (flo !== fhi) {
|
|
52618
|
-
return { kind: "singular", at: (flo + 1) * period };
|
|
52692
|
+
return { kind: "singular", at: (flo + 1) * period, continuity: "right" };
|
|
52619
52693
|
}
|
|
52620
52694
|
const modLo = aVal.lo - period * flo;
|
|
52621
52695
|
const modHi = aVal.hi - period * flo;
|
|
@@ -53219,7 +53293,7 @@ var INTERVAL_JAVASCRIPT_FUNCTIONS = {
|
|
|
53219
53293
|
Negate: (args, compile) => `_IA.negate(${compile(args[0])})`,
|
|
53220
53294
|
// Elementary functions
|
|
53221
53295
|
Abs: (args, compile) => `_IA.abs(${compile(args[0])})`,
|
|
53222
|
-
|
|
53296
|
+
Ceil: (args, compile) => `_IA.ceil(${compile(args[0])})`,
|
|
53223
53297
|
Exp: (args, compile) => `_IA.exp(${compile(args[0])})`,
|
|
53224
53298
|
Floor: (args, compile) => `_IA.floor(${compile(args[0])})`,
|
|
53225
53299
|
Ln: (args, compile) => `_IA.ln(${compile(args[0])})`,
|
|
@@ -53272,7 +53346,7 @@ var INTERVAL_JAVASCRIPT_FUNCTIONS = {
|
|
|
53272
53346
|
return `_IA.powInterval(${compile(arg)}, _IA.div(_IA.point(1), ${compile(exp3)}))`;
|
|
53273
53347
|
},
|
|
53274
53348
|
Round: (args, compile) => `_IA.round(${compile(args[0])})`,
|
|
53275
|
-
|
|
53349
|
+
Sign: (args, compile) => `_IA.sign(${compile(args[0])})`,
|
|
53276
53350
|
Sqrt: (args, compile) => `_IA.sqrt(${compile(args[0])})`,
|
|
53277
53351
|
Square: (args, compile) => `_IA.square(${compile(args[0])})`,
|
|
53278
53352
|
// Trigonometric functions
|
|
@@ -53468,6 +53542,8 @@ const float IA_SINGULAR = 3.0;
|
|
|
53468
53542
|
const float IA_PARTIAL_LO = 4.0;
|
|
53469
53543
|
const float IA_PARTIAL_HI = 5.0;
|
|
53470
53544
|
const float IA_PARTIAL_BOTH = 6.0;
|
|
53545
|
+
const float IA_SINGULAR_RIGHT = 7.0;
|
|
53546
|
+
const float IA_SINGULAR_LEFT = 8.0;
|
|
53471
53547
|
|
|
53472
53548
|
// Interval result struct
|
|
53473
53549
|
struct IntervalResult {
|
|
@@ -53501,12 +53577,20 @@ IntervalResult ia_singular(float at) {
|
|
|
53501
53577
|
return IntervalResult(vec2(at, at), IA_SINGULAR);
|
|
53502
53578
|
}
|
|
53503
53579
|
|
|
53580
|
+
IntervalResult ia_singular_right(float at) {
|
|
53581
|
+
return IntervalResult(vec2(at, at), IA_SINGULAR_RIGHT);
|
|
53582
|
+
}
|
|
53583
|
+
|
|
53584
|
+
IntervalResult ia_singular_left(float at) {
|
|
53585
|
+
return IntervalResult(vec2(at, at), IA_SINGULAR_LEFT);
|
|
53586
|
+
}
|
|
53587
|
+
|
|
53504
53588
|
IntervalResult ia_partial(vec2 v, float clip) {
|
|
53505
53589
|
return IntervalResult(v, clip);
|
|
53506
53590
|
}
|
|
53507
53591
|
|
|
53508
53592
|
bool ia_is_error(float status) {
|
|
53509
|
-
return status == IA_EMPTY || status == IA_ENTIRE || status == IA_SINGULAR;
|
|
53593
|
+
return status == IA_EMPTY || status == IA_ENTIRE || status == IA_SINGULAR || status == IA_SINGULAR_RIGHT || status == IA_SINGULAR_LEFT;
|
|
53510
53594
|
}
|
|
53511
53595
|
|
|
53512
53596
|
// Addition
|
|
@@ -53646,7 +53730,8 @@ IntervalResult ia_floor(vec2 x) {
|
|
|
53646
53730
|
return ia_ok(vec2(flo, fhi));
|
|
53647
53731
|
}
|
|
53648
53732
|
// Interval spans an integer boundary - discontinuity at first integer > x.x
|
|
53649
|
-
|
|
53733
|
+
// floor is right-continuous
|
|
53734
|
+
return ia_singular_right(flo + 1.0);
|
|
53650
53735
|
}
|
|
53651
53736
|
|
|
53652
53737
|
// Ceiling - has jump discontinuities at every integer
|
|
@@ -53657,7 +53742,8 @@ IntervalResult ia_ceil(vec2 x) {
|
|
|
53657
53742
|
return ia_ok(vec2(clo, chi));
|
|
53658
53743
|
}
|
|
53659
53744
|
// Interval spans an integer boundary - discontinuity at ceil(x.x)
|
|
53660
|
-
|
|
53745
|
+
// ceil is left-continuous
|
|
53746
|
+
return ia_singular_left(clo);
|
|
53661
53747
|
}
|
|
53662
53748
|
|
|
53663
53749
|
// Round - has jump discontinuities at every half-integer
|
|
@@ -53671,7 +53757,8 @@ IntervalResult ia_round(vec2 x) {
|
|
|
53671
53757
|
return ia_ok(vec2(rlo, rhi));
|
|
53672
53758
|
}
|
|
53673
53759
|
// Interval spans a half-integer boundary - discontinuity
|
|
53674
|
-
|
|
53760
|
+
// round is right-continuous (with round-half-up convention)
|
|
53761
|
+
return ia_singular_right(rlo + 0.5);
|
|
53675
53762
|
}
|
|
53676
53763
|
|
|
53677
53764
|
// Fract - sawtooth discontinuities at every integer
|
|
@@ -53684,7 +53771,8 @@ IntervalResult ia_fract(vec2 x) {
|
|
|
53684
53771
|
return ia_ok(vec2(fract(x.x) - IA_EPS, fract(x.y) + IA_EPS));
|
|
53685
53772
|
}
|
|
53686
53773
|
// Interval spans an integer - sawtooth discontinuity
|
|
53687
|
-
|
|
53774
|
+
// fract is right-continuous (inherits from floor)
|
|
53775
|
+
return ia_singular_right(flo + 1.0);
|
|
53688
53776
|
}
|
|
53689
53777
|
|
|
53690
53778
|
// Mod - periodic discontinuities at multiples of the modulus
|
|
@@ -53707,7 +53795,8 @@ IntervalResult ia_mod(vec2 x, vec2 y) {
|
|
|
53707
53795
|
return ia_ok(vec2(min(mlo, mhi) - IA_EPS, max(mlo, mhi) + IA_EPS));
|
|
53708
53796
|
}
|
|
53709
53797
|
// Discontinuity at first multiple of period in the interval
|
|
53710
|
-
|
|
53798
|
+
// mod has sawtooth discontinuities, right-continuous
|
|
53799
|
+
return ia_singular_right((flo + 1.0) * period);
|
|
53711
53800
|
}
|
|
53712
53801
|
|
|
53713
53802
|
// General case: compose from existing operations
|
|
@@ -54417,7 +54506,7 @@ var INTERVAL_GLSL_FUNCTIONS = {
|
|
|
54417
54506
|
Negate: (args, compile) => `ia_negate(${compile(args[0])})`,
|
|
54418
54507
|
// Elementary functions
|
|
54419
54508
|
Abs: (args, compile) => `ia_abs(${compile(args[0])})`,
|
|
54420
|
-
|
|
54509
|
+
Ceil: (args, compile) => `ia_ceil(${compile(args[0])})`,
|
|
54421
54510
|
Exp: (args, compile) => `ia_exp(${compile(args[0])})`,
|
|
54422
54511
|
Floor: (args, compile) => `ia_floor(${compile(args[0])})`,
|
|
54423
54512
|
Fract: (args, compile) => `ia_fract(${compile(args[0])})`,
|
|
@@ -54456,7 +54545,7 @@ var INTERVAL_GLSL_FUNCTIONS = {
|
|
|
54456
54545
|
throw new Error("Interval GLSL does not support variable exponents");
|
|
54457
54546
|
},
|
|
54458
54547
|
Round: (args, compile) => `ia_round(${compile(args[0])})`,
|
|
54459
|
-
|
|
54548
|
+
Sign: (args, compile) => `ia_sign(${compile(args[0])})`,
|
|
54460
54549
|
Sqrt: (args, compile) => `ia_sqrt(${compile(args[0])})`,
|
|
54461
54550
|
Square: (args, compile) => `ia_square(${compile(args[0])})`,
|
|
54462
54551
|
// Trigonometric functions
|
|
@@ -56397,10 +56486,10 @@ function defToString(name, def, v) {
|
|
|
56397
56486
|
// src/compute-engine.ts
|
|
56398
56487
|
init_types6();
|
|
56399
56488
|
init_base_compiler();
|
|
56400
|
-
var version = "0.35.
|
|
56489
|
+
var version = "0.35.5";
|
|
56401
56490
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
56402
56491
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
56403
|
-
version: "0.35.
|
|
56492
|
+
version: "0.35.5"
|
|
56404
56493
|
};
|
|
56405
56494
|
export {
|
|
56406
56495
|
BaseCompiler,
|