@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.
Files changed (107) hide show
  1. package/dist/compute-engine.esm.js +23 -13
  2. package/dist/compute-engine.js +23 -13
  3. package/dist/compute-engine.min.esm.js +10 -10
  4. package/dist/compute-engine.min.js +10 -10
  5. package/dist/math-json.esm.js +2 -2
  6. package/dist/math-json.js +2 -2
  7. package/dist/math-json.min.esm.js +2 -2
  8. package/dist/math-json.min.js +2 -2
  9. package/dist/types/common/ansi-codes.d.ts +1 -1
  10. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  11. package/dist/types/common/signals.d.ts +1 -1
  12. package/dist/types/common/utils.d.ts +1 -1
  13. package/dist/types/compute-engine/assume.d.ts +1 -1
  14. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
  15. package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
  16. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
  17. package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +1 -1
  18. package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +1 -1
  19. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
  20. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
  21. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
  22. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
  23. package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +1 -1
  24. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
  25. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
  26. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
  27. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  28. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  29. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
  30. package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
  31. package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
  32. package/dist/types/compute-engine/collection-utils.d.ts +1 -1
  33. package/dist/types/compute-engine/compile.d.ts +1 -1
  34. package/dist/types/compute-engine/compute-engine.d.ts +1 -1
  35. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  36. package/dist/types/compute-engine/domain-utils.d.ts +1 -1
  37. package/dist/types/compute-engine/function-utils.d.ts +1 -1
  38. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  39. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  40. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  41. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  42. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  43. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
  44. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  45. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  46. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
  47. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  48. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  49. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  50. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  51. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
  52. package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
  53. package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +1 -1
  54. package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
  55. package/dist/types/compute-engine/latex-syntax/public.d.ts +1 -1
  56. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
  57. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
  58. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
  59. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  60. package/dist/types/compute-engine/library/arithmetic-add.d.ts +1 -1
  61. package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
  62. package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +1 -1
  63. package/dist/types/compute-engine/library/arithmetic-power.d.ts +1 -1
  64. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
  65. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  66. package/dist/types/compute-engine/library/collections.d.ts +1 -1
  67. package/dist/types/compute-engine/library/complex.d.ts +1 -1
  68. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  69. package/dist/types/compute-engine/library/core.d.ts +1 -1
  70. package/dist/types/compute-engine/library/domains.d.ts +1 -1
  71. package/dist/types/compute-engine/library/library.d.ts +1 -1
  72. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  73. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  74. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  75. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  76. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  77. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  78. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  79. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  80. package/dist/types/compute-engine/library/utils.d.ts +1 -1
  81. package/dist/types/compute-engine/numerics/factor.d.ts +1 -1
  82. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
  83. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  84. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  85. package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
  86. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  87. package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
  88. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  89. package/dist/types/compute-engine/numerics/terms.d.ts +1 -1
  90. package/dist/types/compute-engine/public.d.ts +1 -1
  91. package/dist/types/compute-engine/rules.d.ts +1 -1
  92. package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
  93. package/dist/types/compute-engine/solve.d.ts +1 -1
  94. package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
  95. package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
  96. package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -1
  97. package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
  98. package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
  99. package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
  100. package/dist/types/compute-engine/symbolic/tensor-fields.d.ts +1 -1
  101. package/dist/types/compute-engine/symbolic/tensors.d.ts +1 -1
  102. package/dist/types/compute-engine/symbolic/utils.d.ts +1 -1
  103. package/dist/types/compute-engine.d.ts +2 -2
  104. package/dist/types/math-json/math-json-format.d.ts +1 -1
  105. package/dist/types/math-json/utils.d.ts +1 -1
  106. package/dist/types/math-json.d.ts +2 -2
  107. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /** CortexJS Compute Engine 0.23.0 */
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 = recursive ? expr.ops.map((x) => canonicalOrder(x, { recursive })) : expr.ops;
15970
- ops2 = expr.head === "Add" ? sortAdd(ops2) : ops2.sort(order);
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 isCommutative = expr.head === "Add" || expr.head === "Multiply";
22823
- if (!isCommutative) {
22831
+ let isAssociative = expr.head === "Add" || expr.head === "Multiply";
22832
+ if (!isAssociative) {
22824
22833
  const def = ce.lookupFunction(expr.head);
22825
- if (def?.commutative)
22826
- isCommutative = true;
22834
+ if (def?.associative)
22835
+ isAssociative = true;
22827
22836
  }
22828
- if (isCommutative && typeof expr.head === "string")
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, [expr.op1, expr.engine.NegativeOne]);
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.0";
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.0"
31647
+ version: "0.23.1"
31638
31648
  };
31639
31649
  export {
31640
31650
  ADDITION_PRECEDENCE,
@@ -1,4 +1,4 @@
1
- /** CortexJS Compute Engine 0.23.0 */
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 = recursive ? expr.ops.map((x) => canonicalOrder(x, { recursive })) : expr.ops;
16000
- ops2 = expr.head === "Add" ? sortAdd(ops2) : ops2.sort(order);
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 isCommutative = expr.head === "Add" || expr.head === "Multiply";
22853
- if (!isCommutative) {
22861
+ let isAssociative = expr.head === "Add" || expr.head === "Multiply";
22862
+ if (!isAssociative) {
22854
22863
  const def = ce.lookupFunction(expr.head);
22855
- if (def?.commutative)
22856
- isCommutative = true;
22864
+ if (def?.associative)
22865
+ isAssociative = true;
22857
22866
  }
22858
- if (isCommutative && typeof expr.head === "string")
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, [expr.op1, expr.engine.NegativeOne]);
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.0";
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.0"
31677
+ version: "0.23.1"
31668
31678
  };
31669
31679
  return __toCommonJS(compute_engine_exports);
31670
31680
  })();