@cortex-js/compute-engine 0.23.0 → 0.23.1
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 +23 -13
- package/dist/compute-engine.js +23 -13
- package/dist/compute-engine.min.esm.js +10 -10
- package/dist/compute-engine.min.js +10 -10
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/signals.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/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-domain.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.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-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-definition.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/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.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/compile.d.ts +1 -1
- package/dist/types/compute-engine/compute-engine.d.ts +1 -1
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.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/latex-syntax.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/public.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/library/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-power.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/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/domains.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.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/numerics/factor.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/terms.d.ts +1 -1
- package/dist/types/compute-engine/public.d.ts +1 -1
- package/dist/types/compute-engine/rules.d.ts +1 -1
- package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/solve.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/tensor-fields.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/tensors.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/utils.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +2 -2
- package/dist/types/math-json/math-json-format.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
|
-
/** CortexJS Compute Engine 0.23.
|
|
1
|
+
/** CortexJS Compute Engine 0.23.1 */
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -2220,7 +2220,7 @@ function cosine(Ctor, x) {
|
|
|
2220
2220
|
Ctor.precision -= k;
|
|
2221
2221
|
return x;
|
|
2222
2222
|
}
|
|
2223
|
-
var divide = function() {
|
|
2223
|
+
var divide = /* @__PURE__ */ function() {
|
|
2224
2224
|
function multiplyInteger(x, k, base) {
|
|
2225
2225
|
var temp, carry = 0, i = x.length;
|
|
2226
2226
|
for (x = x.slice(); i--; ) {
|
|
@@ -15966,8 +15966,17 @@ function order(a, b) {
|
|
|
15966
15966
|
}
|
|
15967
15967
|
function canonicalOrder(expr, { recursive = false }) {
|
|
15968
15968
|
if (expr.ops) {
|
|
15969
|
-
let ops2 =
|
|
15970
|
-
|
|
15969
|
+
let ops2 = expr.ops;
|
|
15970
|
+
if (recursive)
|
|
15971
|
+
ops2 = ops2.map((x) => canonicalOrder(x, { recursive }));
|
|
15972
|
+
const ce = expr.engine;
|
|
15973
|
+
if (expr.head === "Add")
|
|
15974
|
+
ops2 = sortAdd(ops2);
|
|
15975
|
+
else {
|
|
15976
|
+
let isCommutative = expr.head === "Multiply" || (ce.lookupFunction(expr.head)?.commutative ?? false);
|
|
15977
|
+
if (isCommutative)
|
|
15978
|
+
ops2 = ops2.sort(order);
|
|
15979
|
+
}
|
|
15971
15980
|
return expr.engine._fn(expr.head, ops2);
|
|
15972
15981
|
}
|
|
15973
15982
|
return expr;
|
|
@@ -22819,13 +22828,13 @@ function flattenForm(expr) {
|
|
|
22819
22828
|
if (expr.head === "Delimiter")
|
|
22820
22829
|
ops2 = [flattenDelimiter(expr.engine, expr.op1)];
|
|
22821
22830
|
const ce = expr.engine;
|
|
22822
|
-
let
|
|
22823
|
-
if (!
|
|
22831
|
+
let isAssociative = expr.head === "Add" || expr.head === "Multiply";
|
|
22832
|
+
if (!isAssociative) {
|
|
22824
22833
|
const def = ce.lookupFunction(expr.head);
|
|
22825
|
-
if (def?.
|
|
22826
|
-
|
|
22834
|
+
if (def?.associative)
|
|
22835
|
+
isAssociative = true;
|
|
22827
22836
|
}
|
|
22828
|
-
if (
|
|
22837
|
+
if (isAssociative && typeof expr.head === "string")
|
|
22829
22838
|
expr = ce._fn(expr.head, flattenOps(ops2, expr.head));
|
|
22830
22839
|
return expr;
|
|
22831
22840
|
}
|
|
@@ -22853,8 +22862,9 @@ function multiplyForm(expr) {
|
|
|
22853
22862
|
const ops2 = expr.ops.map(multiplyForm);
|
|
22854
22863
|
if (expr.head === "Multiply")
|
|
22855
22864
|
return canonicalMultiply(expr.engine, ops2);
|
|
22856
|
-
if (expr.head === "Negate")
|
|
22857
|
-
return canonicalMultiply(expr.engine, [
|
|
22865
|
+
if (expr.head === "Negate") {
|
|
22866
|
+
return canonicalMultiply(expr.engine, [ops2[0], expr.engine.NegativeOne]);
|
|
22867
|
+
}
|
|
22858
22868
|
return expr;
|
|
22859
22869
|
}
|
|
22860
22870
|
function addForm(expr) {
|
|
@@ -31631,10 +31641,10 @@ function isFunctionValue(value) {
|
|
|
31631
31641
|
}
|
|
31632
31642
|
|
|
31633
31643
|
// src/compute-engine.ts
|
|
31634
|
-
var version = "0.23.
|
|
31644
|
+
var version = "0.23.1";
|
|
31635
31645
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
31636
31646
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
31637
|
-
version: "0.23.
|
|
31647
|
+
version: "0.23.1"
|
|
31638
31648
|
};
|
|
31639
31649
|
export {
|
|
31640
31650
|
ADDITION_PRECEDENCE,
|
package/dist/compute-engine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS Compute Engine 0.23.
|
|
1
|
+
/** CortexJS Compute Engine 0.23.1 */
|
|
2
2
|
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComputeEngine = {}));})(this, (function (exports) { 'use strict';
|
|
3
3
|
var ComputeEngine = (() => {
|
|
4
4
|
var __create = Object.create;
|
|
@@ -2250,7 +2250,7 @@ var ComputeEngine = (() => {
|
|
|
2250
2250
|
Ctor.precision -= k;
|
|
2251
2251
|
return x;
|
|
2252
2252
|
}
|
|
2253
|
-
var divide = function() {
|
|
2253
|
+
var divide = /* @__PURE__ */ function() {
|
|
2254
2254
|
function multiplyInteger(x, k, base) {
|
|
2255
2255
|
var temp, carry = 0, i = x.length;
|
|
2256
2256
|
for (x = x.slice(); i--; ) {
|
|
@@ -15996,8 +15996,17 @@ var ComputeEngine = (() => {
|
|
|
15996
15996
|
}
|
|
15997
15997
|
function canonicalOrder(expr, { recursive = false }) {
|
|
15998
15998
|
if (expr.ops) {
|
|
15999
|
-
let ops2 =
|
|
16000
|
-
|
|
15999
|
+
let ops2 = expr.ops;
|
|
16000
|
+
if (recursive)
|
|
16001
|
+
ops2 = ops2.map((x) => canonicalOrder(x, { recursive }));
|
|
16002
|
+
const ce = expr.engine;
|
|
16003
|
+
if (expr.head === "Add")
|
|
16004
|
+
ops2 = sortAdd(ops2);
|
|
16005
|
+
else {
|
|
16006
|
+
let isCommutative = expr.head === "Multiply" || (ce.lookupFunction(expr.head)?.commutative ?? false);
|
|
16007
|
+
if (isCommutative)
|
|
16008
|
+
ops2 = ops2.sort(order);
|
|
16009
|
+
}
|
|
16001
16010
|
return expr.engine._fn(expr.head, ops2);
|
|
16002
16011
|
}
|
|
16003
16012
|
return expr;
|
|
@@ -22849,13 +22858,13 @@ var ComputeEngine = (() => {
|
|
|
22849
22858
|
if (expr.head === "Delimiter")
|
|
22850
22859
|
ops2 = [flattenDelimiter(expr.engine, expr.op1)];
|
|
22851
22860
|
const ce = expr.engine;
|
|
22852
|
-
let
|
|
22853
|
-
if (!
|
|
22861
|
+
let isAssociative = expr.head === "Add" || expr.head === "Multiply";
|
|
22862
|
+
if (!isAssociative) {
|
|
22854
22863
|
const def = ce.lookupFunction(expr.head);
|
|
22855
|
-
if (def?.
|
|
22856
|
-
|
|
22864
|
+
if (def?.associative)
|
|
22865
|
+
isAssociative = true;
|
|
22857
22866
|
}
|
|
22858
|
-
if (
|
|
22867
|
+
if (isAssociative && typeof expr.head === "string")
|
|
22859
22868
|
expr = ce._fn(expr.head, flattenOps(ops2, expr.head));
|
|
22860
22869
|
return expr;
|
|
22861
22870
|
}
|
|
@@ -22883,8 +22892,9 @@ var ComputeEngine = (() => {
|
|
|
22883
22892
|
const ops2 = expr.ops.map(multiplyForm);
|
|
22884
22893
|
if (expr.head === "Multiply")
|
|
22885
22894
|
return canonicalMultiply(expr.engine, ops2);
|
|
22886
|
-
if (expr.head === "Negate")
|
|
22887
|
-
return canonicalMultiply(expr.engine, [
|
|
22895
|
+
if (expr.head === "Negate") {
|
|
22896
|
+
return canonicalMultiply(expr.engine, [ops2[0], expr.engine.NegativeOne]);
|
|
22897
|
+
}
|
|
22888
22898
|
return expr;
|
|
22889
22899
|
}
|
|
22890
22900
|
function addForm(expr) {
|
|
@@ -31661,10 +31671,10 @@ ${JSON.stringify(entry)}`
|
|
|
31661
31671
|
}
|
|
31662
31672
|
|
|
31663
31673
|
// src/compute-engine.ts
|
|
31664
|
-
var version = "0.23.
|
|
31674
|
+
var version = "0.23.1";
|
|
31665
31675
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
31666
31676
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
31667
|
-
version: "0.23.
|
|
31677
|
+
version: "0.23.1"
|
|
31668
31678
|
};
|
|
31669
31679
|
return __toCommonJS(compute_engine_exports);
|
|
31670
31680
|
})();
|