@cortex-js/compute-engine 0.58.0 → 0.59.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.
Files changed (270) hide show
  1. package/README.md +4 -0
  2. package/dist/compile.esm.js +1721 -483
  3. package/dist/compile.min.esm.js +122 -74
  4. package/dist/compile.min.umd.cjs +122 -74
  5. package/dist/compile.umd.cjs +1721 -483
  6. package/dist/compute-engine.esm.js +25209 -22883
  7. package/dist/compute-engine.min.esm.js +135 -87
  8. package/dist/compute-engine.min.umd.cjs +135 -87
  9. package/dist/compute-engine.umd.cjs +24952 -22626
  10. package/dist/core.esm.js +25208 -22882
  11. package/dist/core.min.esm.js +134 -86
  12. package/dist/core.min.umd.cjs +134 -86
  13. package/dist/core.umd.cjs +24951 -22625
  14. package/dist/identities.esm.js +1921 -0
  15. package/dist/identities.min.esm.js +2 -0
  16. package/dist/identities.min.umd.cjs +4 -0
  17. package/dist/identities.umd.cjs +1946 -0
  18. package/dist/interval.esm.js +653 -330
  19. package/dist/interval.min.esm.js +8 -8
  20. package/dist/interval.min.umd.cjs +8 -8
  21. package/dist/interval.umd.cjs +653 -330
  22. package/dist/latex-syntax.esm.js +758 -512
  23. package/dist/latex-syntax.min.esm.js +7 -7
  24. package/dist/latex-syntax.min.umd.cjs +7 -7
  25. package/dist/latex-syntax.umd.cjs +758 -512
  26. package/dist/math-json.esm.js +8 -12
  27. package/dist/math-json.min.esm.js +2 -2
  28. package/dist/math-json.min.umd.cjs +2 -2
  29. package/dist/math-json.umd.cjs +8 -12
  30. package/dist/numerics.esm.js +1349 -228
  31. package/dist/numerics.min.esm.js +16 -5
  32. package/dist/numerics.min.umd.cjs +16 -5
  33. package/dist/numerics.umd.cjs +1349 -228
  34. package/dist/types/big-decimal/big-decimal.d.ts +1 -1
  35. package/dist/types/big-decimal/index.d.ts +1 -1
  36. package/dist/types/big-decimal/transcendentals.d.ts +1 -1
  37. package/dist/types/big-decimal/utils.d.ts +1 -1
  38. package/dist/types/common/ansi-codes.d.ts +1 -1
  39. package/dist/types/common/configuration-change.d.ts +1 -1
  40. package/dist/types/common/fuzzy-string-match.d.ts +1 -1
  41. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  42. package/dist/types/common/interruptible.d.ts +1 -1
  43. package/dist/types/common/one-of.d.ts +1 -1
  44. package/dist/types/common/signals.d.ts +1 -1
  45. package/dist/types/common/type/ast-nodes.d.ts +1 -1
  46. package/dist/types/common/type/boxed-type.d.ts +1 -1
  47. package/dist/types/common/type/lexer.d.ts +1 -1
  48. package/dist/types/common/type/parse.d.ts +1 -208
  49. package/dist/types/common/type/parser.d.ts +124 -2
  50. package/dist/types/common/type/primitive.d.ts +5 -1
  51. package/dist/types/common/type/reduce.d.ts +1 -1
  52. package/dist/types/common/type/serialize.d.ts +1 -1
  53. package/dist/types/common/type/subtype.d.ts +18 -1
  54. package/dist/types/common/type/type-builder.d.ts +1 -1
  55. package/dist/types/common/type/types.d.ts +1 -1
  56. package/dist/types/common/type/utils.d.ts +1 -1
  57. package/dist/types/common/utils.d.ts +1 -1
  58. package/dist/types/compile.d.ts +1 -1
  59. package/dist/types/compute-engine/assume.d.ts +13 -6
  60. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
  61. package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
  62. package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
  63. package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
  64. package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
  65. package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
  66. package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
  67. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
  68. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
  69. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
  70. package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +1 -1
  71. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
  72. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
  73. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +3 -3
  74. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
  75. package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +1 -1
  76. package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
  77. package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
  78. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
  79. package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
  80. package/dist/types/compute-engine/boxed-expression/constants.d.ts +1 -1
  81. package/dist/types/compute-engine/boxed-expression/constraint-subject.d.ts +140 -0
  82. package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
  83. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  84. package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
  85. package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
  86. package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
  87. package/dist/types/compute-engine/boxed-expression/inequality-bounds.d.ts +14 -4
  88. package/dist/types/compute-engine/boxed-expression/init-lazy-refs.d.ts +1 -1
  89. package/dist/types/compute-engine/boxed-expression/invisible-operator.d.ts +1 -1
  90. package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
  91. package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
  92. package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
  93. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  94. package/dist/types/compute-engine/boxed-expression/pattern-utils.d.ts +1 -1
  95. package/dist/types/compute-engine/boxed-expression/polynomial-degree.d.ts +1 -1
  96. package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
  97. package/dist/types/compute-engine/boxed-expression/predicates.d.ts +1 -1
  98. package/dist/types/compute-engine/boxed-expression/rule-index.d.ts +112 -0
  99. package/dist/types/compute-engine/boxed-expression/rules.d.ts +2 -1
  100. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
  101. package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
  102. package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
  103. package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
  104. package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
  105. package/dist/types/compute-engine/boxed-expression/stochastic-equal.d.ts +1 -1
  106. package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
  107. package/dist/types/compute-engine/boxed-expression/type-guards.d.ts +1 -1
  108. package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
  109. package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
  110. package/dist/types/compute-engine/collection-utils.d.ts +1 -1
  111. package/dist/types/compute-engine/compilation/base-compiler.d.ts +1 -1
  112. package/dist/types/compute-engine/compilation/compile-expression.d.ts +1 -1
  113. package/dist/types/compute-engine/compilation/constant-folding.d.ts +16 -1
  114. package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
  115. package/dist/types/compute-engine/compilation/gpu-target.d.ts +15 -5
  116. package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +4 -4
  117. package/dist/types/compute-engine/compilation/javascript-target.d.ts +1 -1
  118. package/dist/types/compute-engine/compilation/python-target.d.ts +1 -1
  119. package/dist/types/compute-engine/compilation/types.d.ts +1 -1
  120. package/dist/types/compute-engine/compilation/wgsl-target.d.ts +1 -1
  121. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  122. package/dist/types/compute-engine/engine-assumptions.d.ts +1 -1
  123. package/dist/types/compute-engine/engine-cache.d.ts +1 -1
  124. package/dist/types/compute-engine/engine-common-symbols.d.ts +1 -1
  125. package/dist/types/compute-engine/engine-compilation-targets.d.ts +1 -1
  126. package/dist/types/compute-engine/engine-configuration-lifecycle.d.ts +1 -1
  127. package/dist/types/compute-engine/engine-declarations.d.ts +1 -1
  128. package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +1 -1
  129. package/dist/types/compute-engine/engine-extension-contracts.d.ts +1 -1
  130. package/dist/types/compute-engine/engine-library-bootstrap.d.ts +1 -1
  131. package/dist/types/compute-engine/engine-numeric-configuration.d.ts +1 -1
  132. package/dist/types/compute-engine/engine-runtime-state.d.ts +1 -1
  133. package/dist/types/compute-engine/engine-scope.d.ts +1 -1
  134. package/dist/types/compute-engine/engine-sequences.d.ts +1 -1
  135. package/dist/types/compute-engine/engine-simplification-rules.d.ts +10 -2
  136. package/dist/types/compute-engine/engine-startup-coordinator.d.ts +1 -1
  137. package/dist/types/compute-engine/engine-type-resolver.d.ts +1 -1
  138. package/dist/types/compute-engine/engine-validation-entrypoints.d.ts +1 -1
  139. package/dist/types/compute-engine/free-functions.d.ts +1 -1
  140. package/dist/types/compute-engine/function-utils.d.ts +1 -1
  141. package/dist/types/compute-engine/fungrim/loader.d.ts +13 -0
  142. package/dist/types/compute-engine/fungrim/types.d.ts +160 -0
  143. package/dist/types/compute-engine/global-types.d.ts +1 -1
  144. package/dist/types/compute-engine/index.d.ts +48 -2
  145. package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
  146. package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
  147. package/dist/types/compute-engine/interval/elementary.d.ts +10 -2
  148. package/dist/types/compute-engine/interval/index.d.ts +2 -2
  149. package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
  150. package/dist/types/compute-engine/interval/types.d.ts +1 -1
  151. package/dist/types/compute-engine/interval/util.d.ts +1 -1
  152. package/dist/types/compute-engine/latex-syntax/dictionary/default-dictionary.d.ts +1 -1
  153. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  154. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  155. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  156. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-colors.d.ts +1 -1
  157. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  158. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  159. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
  160. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  161. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  162. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
  163. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  164. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  165. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  166. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  167. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-units.d.ts +1 -1
  168. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
  169. package/dist/types/compute-engine/latex-syntax/dictionary/indexed-types.d.ts +4 -1
  170. package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
  171. package/dist/types/compute-engine/latex-syntax/parse-number.d.ts +1 -1
  172. package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
  173. package/dist/types/compute-engine/latex-syntax/parse.d.ts +3 -2
  174. package/dist/types/compute-engine/latex-syntax/serialize-dms.d.ts +1 -1
  175. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -11
  176. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
  177. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
  178. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  179. package/dist/types/compute-engine/latex-syntax/types.d.ts +1 -1
  180. package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
  181. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
  182. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  183. package/dist/types/compute-engine/library/collections.d.ts +1 -1
  184. package/dist/types/compute-engine/library/colors.d.ts +1 -1
  185. package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
  186. package/dist/types/compute-engine/library/complex.d.ts +13 -1
  187. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  188. package/dist/types/compute-engine/library/core.d.ts +1 -1
  189. package/dist/types/compute-engine/library/fractals.d.ts +1 -1
  190. package/dist/types/compute-engine/library/library.d.ts +1 -1
  191. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  192. package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
  193. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  194. package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
  195. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  196. package/dist/types/compute-engine/library/quantity-arithmetic.d.ts +1 -1
  197. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  198. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  199. package/dist/types/compute-engine/library/sets.d.ts +27 -1
  200. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  201. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  202. package/dist/types/compute-engine/library/type-handlers.d.ts +1 -1
  203. package/dist/types/compute-engine/library/unit-data.d.ts +1 -1
  204. package/dist/types/compute-engine/library/units.d.ts +1 -1
  205. package/dist/types/compute-engine/library/utils.d.ts +1 -1
  206. package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
  207. package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +7 -1
  208. package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
  209. package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
  210. package/dist/types/compute-engine/numerics/bernoulli.d.ts +39 -0
  211. package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
  212. package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
  213. package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
  214. package/dist/types/compute-engine/numerics/linear-algebra.d.ts +1 -1
  215. package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
  216. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
  217. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  218. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +12 -1
  219. package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
  220. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  221. package/dist/types/compute-engine/numerics/random.d.ts +1 -1
  222. package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
  223. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  224. package/dist/types/compute-engine/numerics/special-functions.d.ts +78 -10
  225. package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
  226. package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
  227. package/dist/types/compute-engine/numerics/types.d.ts +1 -1
  228. package/dist/types/compute-engine/numerics/unit-data.d.ts +1 -1
  229. package/dist/types/compute-engine/oeis.d.ts +1 -1
  230. package/dist/types/compute-engine/sequence.d.ts +1 -1
  231. package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
  232. package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
  233. package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
  234. package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
  235. package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
  236. package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
  237. package/dist/types/compute-engine/symbolic/logic-utils.d.ts +1 -1
  238. package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
  239. package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
  240. package/dist/types/compute-engine/symbolic/simplify-factorial.d.ts +1 -1
  241. package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
  242. package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
  243. package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
  244. package/dist/types/compute-engine/symbolic/simplify-logic.d.ts +1 -1
  245. package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
  246. package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
  247. package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
  248. package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
  249. package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
  250. package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
  251. package/dist/types/compute-engine/tensor/tensors.d.ts +3 -3
  252. package/dist/types/compute-engine/types-definitions.d.ts +1 -1
  253. package/dist/types/compute-engine/types-engine.d.ts +19 -3
  254. package/dist/types/compute-engine/types-evaluation.d.ts +1 -1
  255. package/dist/types/compute-engine/types-expression.d.ts +17 -14
  256. package/dist/types/compute-engine/types-kernel-evaluation.d.ts +32 -1
  257. package/dist/types/compute-engine/types-kernel-serialization.d.ts +45 -3
  258. package/dist/types/compute-engine/types-serialization.d.ts +1 -1
  259. package/dist/types/compute-engine/types.d.ts +1 -1
  260. package/dist/types/compute-engine.d.ts +1 -1
  261. package/dist/types/core.d.ts +1 -1
  262. package/dist/types/identities.d.ts +3 -0
  263. package/dist/types/interval.d.ts +1 -1
  264. package/dist/types/latex-syntax.d.ts +2 -2
  265. package/dist/types/math-json/symbols.d.ts +1 -1
  266. package/dist/types/math-json/types.d.ts +1 -1
  267. package/dist/types/math-json/utils.d.ts +1 -1
  268. package/dist/types/math-json.d.ts +2 -2
  269. package/dist/types/numerics.d.ts +1 -1
  270. package/package.json +9 -3
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import { BoxedType } from '../../common/type/boxed-type';
3
3
  import type { OperatorDefinition, Expression, BoxedOperatorDefinition, CollectionHandlers, CompiledExpression, EvaluateOptions, IComputeEngine as ComputeEngine, Sign } from '../global-types';
4
4
  export declare class _BoxedOperatorDefinition implements BoxedOperatorDefinition {
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  * # Pattern Matching Wildcards
3
3
  *
4
4
  * Patterns can contain wildcards that match parts of expressions. There are
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import { _BoxedExpression } from './abstract-boxed-expression';
3
3
  import { BoxedType } from '../../common/type/boxed-type';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import type { Type, TypeString } from '../../common/type/types';
3
3
  import type { OneOf } from '../../common/one-of';
4
4
  import { BoxedType } from '../../common/type/boxed-type';
@@ -164,8 +164,8 @@ export declare class BoxedSymbol extends _BoxedExpression implements SymbolInter
164
164
  get isIndexedCollection(): boolean;
165
165
  get isLazyCollection(): boolean;
166
166
  contains(rhs: Expression): boolean | undefined;
167
- get count(): number;
168
- get isEmptyCollection(): boolean;
167
+ get count(): number | undefined;
168
+ get isEmptyCollection(): boolean | undefined;
169
169
  get isFiniteCollection(): boolean | undefined;
170
170
  each(): Generator<Expression>;
171
171
  at(index: number): Expression | undefined;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import type { IComputeEngine as ComputeEngine, TensorDataType, Metadata, BoxedBaseDefinition, BoxedOperatorDefinition, BoxedSubstitution, EvaluateOptions, Expression, SimplifyOptions, PatternMatchOptions, Tensor, TensorInterface } from '../global-types';
3
3
  import { BoxedType } from '../../common/type/boxed-type';
4
4
  import { NumericValue } from '../numeric-value/types';
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import type { Type, TypeString } from '../../common/type/types';
3
3
  import { BoxedType } from '../../common/type/boxed-type';
4
4
  import { ConfigurationChangeListener } from '../../common/configuration-change';
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  value: T | null;
3
3
  generation: number | undefined;
4
4
  };
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  /**
3
3
  * Ensure all expressions in the array are in canonical form
4
4
  */
@@ -1,2 +1,2 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export declare function canonicalForm(expr: Expression, forms: CanonicalOptions, scope?: Scope): Expression;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  type ExpandFn = (expr: Expression) => Expression;
3
3
  /** @internal */
4
4
  export declare function _setExpand(fn: ExpandFn): void;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  * Leaf module for shared constants used across boxed-expression modules.
3
3
  * No imports from sibling modules to avoid circular dependencies.
4
4
  */
@@ -0,0 +1,140 @@
1
+ /* 0.59.0 */
2
+ /**
3
+ * Constraint subjects (FUNGRIM-PLAN-3-ASSUMPTIONS.md §2).
4
+ *
5
+ * The assumptions system keys facts not just on bare symbols, but on a small
6
+ * algebra of "subjects": a symbol, or one of the four part-extractors
7
+ * (`Real`, `Imaginary`, `Abs`, `Argument`) applied to exactly a bare symbol.
8
+ *
9
+ * This module is a leaf: it only imports types from `global-types` and the
10
+ * runtime type guards. Do not add imports that could create cycles.
11
+ */
12
+ /** The "part" of a symbol that a constraint subject refers to. */
13
+ export type SubjectPart = 'self' | 're' | 'im' | 'abs' | 'arg';
14
+ /**
15
+ * A constraint subject: either a symbol itself (`part: 'self'`) or a
16
+ * part-extractor (`Real`, `Imaginary`, `Abs`, `Argument`) applied to a
17
+ * bare symbol.
18
+ */
19
+ export type Subject = {
20
+ symbol: string;
21
+ part: SubjectPart;
22
+ };
23
+ /**
24
+ * Recognize a canonical subject term:
25
+ * - a bare symbol → `{ symbol, part: 'self' }`
26
+ * - `Real(x)`, `Imaginary(x)`, `Abs(x)`, `Argument(x)` where `x` is a bare
27
+ * symbol → `{ symbol: x, part: 're'|'im'|'abs'|'arg' }`
28
+ *
29
+ * Nothing deeper is recognized: `Real(z + w)` is **not** a subject, nor is
30
+ * `Abs(Real(z))`.
31
+ */
32
+ export declare function subjectOf(expr: Expression): Subject | undefined;
33
+ /**
34
+ * A stable string key for a subject, for indexing: `"self:x"`, `"re:s"`,
35
+ * `"im:tau"`, `"abs:q"`, `"arg:z"`.
36
+ */
37
+ export declare function subjectKey(subject: Subject): string;
38
+ /** Convert a `string | Subject` argument to a `Subject` ('self' part). */
39
+ export declare function toSubject(subjectOrSymbol: string | Subject): Subject;
40
+ /**
41
+ * True if `expr` is exactly the subject term for `subject` (a bare symbol
42
+ * for `part: 'self'`, or the corresponding part-extractor applied to the
43
+ * symbol otherwise).
44
+ */
45
+ export declare function matchesSubject(expr: Expression, subject: Subject): boolean;
46
+ /** Numeric (real, finite) value of a number literal term, or undefined. */
47
+ export declare function finiteNumericValue(term: Expression | undefined): number | undefined;
48
+ /**
49
+ * Extract the bound contribution of a single normalized inequality
50
+ * assumption — `Less(lhs, 0)` or `LessEqual(lhs, 0)` — for `subject`.
51
+ *
52
+ * Recognized lhs shapes (mirroring the historical symbol-only logic, with
53
+ * the bare symbol generalized to a subject term):
54
+ *
55
+ * - `Negate(subject)` → lower bound 0 (i.e. `subject > 0` / `subject ≥ 0`)
56
+ * - `subject` → upper bound 0
57
+ * - `Add(..., Negate(subject), ..., k…)` with numeric terms summing to
58
+ * `k ≠ 0` → lower bound `k`
59
+ * - `Add(..., subject, ..., k…)` with numeric terms summing to `k ≠ 0` →
60
+ * upper bound `-k`
61
+ *
62
+ * Returns `undefined` if the assumption carries no bound for `subject`.
63
+ *
64
+ * NOTE: as in the historical implementation, non-numeric extra terms in an
65
+ * `Add` are ignored when summing the constant. Callers should treat the
66
+ * result as a best-effort bound (this matches the pre-existing behavior of
67
+ * `getInequalityBoundsFromAssumptions`).
68
+ */
69
+ export declare function boundsFromNormalizedInequality(assumption: Expression, subject: Subject): IntervalBounds | undefined;
70
+ /**
71
+ * Merge `from` into `into`, keeping the tightest bounds.
72
+ *
73
+ * Semantics match the historical accumulation in
74
+ * `getInequalityBoundsFromAssumptions`: a candidate replaces the current
75
+ * bound only when it is strictly tighter (`isGreater`/`isLess` returning
76
+ * exactly `true`); ties keep the existing strictness.
77
+ */
78
+ export declare function mergeTightestBounds(into: IntervalBounds, from: IntervalBounds): void;
79
+ /** Facts indexed for a single subject. */
80
+ export type SubjectFacts = {
81
+ bounds: IntervalBounds;
82
+ /** Values `v` for which `NotEqual(subject, v)` is assumed. */
83
+ notEqual: Expression[];
84
+ };
85
+ /** Membership facts for a single symbol. */
86
+ export type MembershipFacts = {
87
+ /** Set expressions `S` for which `Element(symbol, S)` is assumed. */
88
+ in: Expression[];
89
+ /** Set expressions `S` for which `NotElement(symbol, S)` is assumed. */
90
+ notIn: Expression[];
91
+ };
92
+ /**
93
+ * A derived, read-only index over the scoped assumptions `ExpressionMap`.
94
+ *
95
+ * The `ExpressionMap` remains the single source of truth; this index is
96
+ * rebuilt lazily whenever the assumptions change (see `getFactIndex`).
97
+ * Consumers must treat it as immutable.
98
+ */
99
+ export type FactIndex = {
100
+ bySubject: Map<string, SubjectFacts>;
101
+ membership: Map<string, MembershipFacts>;
102
+ };
103
+ /**
104
+ * Lazily-built, cached index over the current context's assumptions.
105
+ *
106
+ * - Returns a shared empty index (cheaply, with no cache machinery) when
107
+ * there are no assumptions — hot paths with zero assumptions pay only an
108
+ * emptiness check.
109
+ * - Otherwise, the index is cached per engine and invalidated when
110
+ * `ce._generation` changes (bumped by `assume()`, `forget()`,
111
+ * declarations…), when the assumptions map object changes (scope
112
+ * push/pop), or when the number of stored assumptions changes (direct
113
+ * `.set()`/`.delete()` on the map).
114
+ *
115
+ * The returned index must be treated as read-only.
116
+ */
117
+ export declare function getFactIndex(ce: ComputeEngine): FactIndex;
118
+ /**
119
+ * Fast emptiness check for the assumptions store. The P3 query hooks
120
+ * (relational operators, sgn fallbacks, membership lookups, symbol
121
+ * predicates) are gated on this so that zero-assumption engines pay only
122
+ * an (empty) iterator check before any subject or index work.
123
+ */
124
+ export declare function hasAssumptions(ce: ComputeEngine): boolean;
125
+ /**
126
+ * Decide a comparison of a subject against the numeric constant `k` from
127
+ * the subject's assumed interval bounds (design §5.1a).
128
+ *
129
+ * Strict three-valued discipline (design §5.2): returns `true` only when
130
+ * the bounds entail the comparison, `false` only when they refute it, and
131
+ * `undefined` otherwise.
132
+ */
133
+ export declare function decideComparisonFromBounds(bounds: IntervalBounds, k: number, query: 'less' | 'lessEqual' | 'greater' | 'greaterEqual'): boolean | undefined;
134
+ /**
135
+ * Derive a `Sign` from assumed interval bounds (design §5.1b — the
136
+ * `Real`/`Imaginary`/`Abs`/`Argument` sgn fallbacks).
137
+ *
138
+ * Returns a sign only when the bounds entail it; `undefined` otherwise.
139
+ */
140
+ export declare function signFromBounds(bounds: IntervalBounds): Sign | undefined;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export declare function choose(n: number, k: number): number;
3
3
  /** Attempt to transform the expression (h, ops) into a sum */
4
4
  export declare function expandFunction(ce: ComputeEngine, h: string, ops: ReadonlyArray<Expression>): Expression | null;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export declare class ExpressionMap<U> implements ExpressionMapInterface<U> {
3
3
  readonly _items: Map<Expression, U>;
4
4
  constructor(source?: ExpressionMapInterface<U> | readonly (readonly [Expression, U])[]);
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  /** Combine rational expressions into a single fraction */
3
3
  export declare function together(op: Expression): Expression;
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  /**
3
3
  *
4
4
  * Optionally make all the arguments canonical (default).
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  /** Apply the function `f` to each operand of the expression `expr`,
3
3
  * account for the 'lazy' property of the operator definition:
4
4
  *
@@ -1,4 +1,5 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
+ import { type Subject } from './constraint-subject';
2
3
  /**
3
4
  * Extract interval bounds for `symbol` from a condition expression.
4
5
  *
@@ -17,17 +18,26 @@
17
18
  */
18
19
  export declare function extractIntervalBounds(expr: Expression, symbol: string): IntervalBounds | undefined;
19
20
  /**
20
- * Get inequality bounds for a symbol from the assumption database.
21
+ * Get inequality bounds for a subject from the assumption database.
21
22
  *
22
23
  * For example, if `x > 4` is assumed, this returns `{ lower: 4, lowerStrict: true }`.
23
24
  * If `x <= 10` is assumed, this returns `{ upper: 10, upperStrict: false }`.
24
25
  *
26
+ * The subject may be a bare symbol (pass the symbol name, or a `Subject`
27
+ * with `part: 'self'`) or a part-extractor of a symbol, e.g.
28
+ * `{ symbol: 's', part: 're' }` for facts about `Real(s)`
29
+ * (see `constraint-subject.ts`).
30
+ *
25
31
  * Note: Assumptions are normalized to forms like:
26
32
  * - `x > 4` becomes `Less(Add(Negate(x), 4), 0)` i.e., `4 - x < 0`
27
33
  * - `x > 0` becomes `Less(Negate(x), 0)` i.e., `-x < 0`
34
+ * - `Re(s) > 1` becomes `Less(Add(Negate(Real(s)), 1), 0)`
35
+ *
36
+ * The result is derived from the cached fact index (see `getFactIndex`),
37
+ * so repeated queries against unchanged assumptions cost a lookup.
28
38
  *
29
39
  * @param ce - The compute engine instance
30
- * @param symbol - The symbol name to query
40
+ * @param subject - The symbol name or `Subject` to query
31
41
  * @returns The `IntervalBounds` (same shape used by `extractIntervalBounds`).
32
42
  */
33
- export declare function getInequalityBoundsFromAssumptions(ce: ComputeEngine, symbol: string): IntervalBounds;
43
+ export declare function getInequalityBoundsFromAssumptions(ce: ComputeEngine, subject: string | Subject): IntervalBounds;
@@ -1 +1 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export declare function canonicalInvisibleOperator(ops: ReadonlyArray<Expression>, { engine: ce }: {
3
3
  engine: ComputeEngine;
4
4
  }): Expression | null;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  /**
3
3
  * The function attempts to match a subject expression to a
4
4
  * [pattern](/compute-engine/guides/patterns-and-rules/).
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export declare function canonicalNegate(expr: Expression): Expression;
3
3
  /**
4
4
  * Distribute `Negate` (multiply by -1) if expr is a number literal, an
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import { BigDecimal } from '../../big-decimal';
3
3
  import type { Rational } from '../numerics/types';
4
4
  import type { Expression, ExpressionInput } from '../global-types';
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export type Order = 'lex' | 'dexlex' | 'grevlex' | 'elim';
3
3
  import { DEFAULT_COMPLEXITY } from './constants';
4
4
  export { DEFAULT_COMPLEXITY };
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  * Leaf module for wildcard pattern utility functions.
3
3
  *
4
4
  * These are extracted from boxed-patterns.ts to break circular dependencies:
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  /**
3
3
  * The total degree of an expression is the sum of the
4
4
  * positive integer degrees of the factors in the expression:
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export { totalDegree, maxDegree, lex, revlex } from './polynomial-degree';
3
3
  /**
4
4
  * Coefficient of a univariate (single variable) polynomial.
@@ -1,2 +1,2 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export declare function isPrime(expr: Expression): boolean | undefined;
@@ -0,0 +1,112 @@
1
+ /* 0.59.0 */
2
+ * Operator-indexed rule dispatch (FUNGRIM-PLAN-2-RULES.md §2.1, Feature A).
3
+ *
4
+ * This is an INTERNAL side table: the public `BoxedRuleSet` type is
5
+ * unchanged. The index is keyed (via a `WeakMap`) on the identity of the
6
+ * boxed `rules` array, so engine-cached rule sets (which produce a fresh
7
+ * array on each cache invalidation) get one index build per cache
8
+ * generation, with no extra invalidation plumbing.
9
+ *
10
+ * ## Soundness
11
+ *
12
+ * The index partitions rules into:
13
+ * - `byHead`: rules whose match pattern has a literal, head-faithful
14
+ * operator — only tried when the subject expression's operator (or one of
15
+ * its cross-head compatible operators, see `HEAD_COMPAT`) selects that
16
+ * bucket;
17
+ * - `alwaysTry`: rules that may apply to expressions of any shape.
18
+ *
19
+ * The classification must exactly mirror the cross-head special cases in
20
+ * `match.ts`, otherwise the index could skip a rule that would have fired.
21
+ * Each special case is annotated below with the `match.ts` location it
22
+ * mirrors. Anything unclassifiable is conservatively `alwaysTry`.
23
+ *
24
+ * This module is a LEAF module: it imports only types from `global-types`
25
+ * and the runtime type guards. Do not add imports that could create
26
+ * circular dependencies.
27
+ */
28
+ import type { BoxedRule, Expression } from '../global-types';
29
+ /** A rule paired with its position in the original rule array. */
30
+ export type OrdinalRule = {
31
+ rule: BoxedRule;
32
+ ordinal: number;
33
+ };
34
+ export interface RuleIndex {
35
+ /** Rules whose match pattern has a literal, head-faithful operator,
36
+ * bucketed by that operator. Each bucket is in ascending ordinal order. */
37
+ byHead: ReadonlyMap<string, ReadonlyArray<OrdinalRule>>;
38
+ /** Functional rules, non-function-expression patterns, wildcard-headed
39
+ * patterns, and effective-variations rules with variant-capable
40
+ * arithmetic heads. In ascending ordinal order. */
41
+ alwaysTry: ReadonlyArray<OrdinalRule>;
42
+ /** `rules.length` at build time; staleness guard against in-place
43
+ * mutation of the rule array. */
44
+ count: number;
45
+ }
46
+ /**
47
+ * Pattern heads that `matchVariations()` (match.ts:333-440) can match across
48
+ * heads — e.g. expression `x` matches pattern `Add(0, x)`. A rule with one of
49
+ * these pattern heads and effective `useVariations` may match an expression
50
+ * of *any* operator, so it must be `alwaysTry` in that case.
51
+ *
52
+ * - 'Negate' — match.ts:353 (0 → -x)
53
+ * - 'Add' — match.ts:359 (x → 0+x; a-b → a+(-b))
54
+ * - 'Subtract' — match.ts:372 (a → a-0; -a → 0-a)
55
+ * - 'Multiply' — match.ts:385 (x → 1·x; -x → -1·x; x/a → (1/a)·x)
56
+ * - 'Divide' — match.ts:403 (x → x/1)
57
+ * - 'Square' — match.ts:409 (Power(x,2) → Square(x))
58
+ * - 'Exp' — match.ts:415 (Power(E,x) → Exp(x))
59
+ * - 'Power' — match.ts:421 (Square(x), Exp(x), x → Power(x,1))
60
+ *
61
+ * All other pattern heads return `null` from `matchVariations()`, i.e.
62
+ * non-arithmetic heads are safely indexable even under variations.
63
+ */
64
+ export declare const VARIANT_CAPABLE: ReadonlySet<string>;
65
+ /**
66
+ * Cross-head special cases in `matchOnce()` that are ALWAYS active
67
+ * (independent of `useVariations`): maps a subject expression's operator to
68
+ * the additional pattern-head buckets that must be consulted.
69
+ *
70
+ * - expr `Multiply` → pattern `Divide` — match.ts:158-197
71
+ * (`Multiply(Rational(1,n), x)` matches `Divide` patterns)
72
+ * - expr `Divide` → pattern `Power` — match.ts:199-218
73
+ * (`Divide(1, x)` matches `Power` patterns, i.e. x^-1)
74
+ * - expr `Root` → pattern `Power` — match.ts:220-236
75
+ * (`Root(x, n)` matches `Power` patterns, i.e. x^(1/n))
76
+ *
77
+ * Plus, handled directly in `candidateRules()`: a number literal must
78
+ * consult the `Divide` bucket — match.ts:142-156 (rational literals like
79
+ * `3/2` match `Divide` patterns).
80
+ *
81
+ * Also mirrored in classification (not here): a pattern head starting with
82
+ * `_` (wildcard operator) matches any function — match.ts:238-244 — so such
83
+ * rules are `alwaysTry`.
84
+ */
85
+ export declare const HEAD_COMPAT: ReadonlyMap<string, ReadonlyArray<string>>;
86
+ /** Below this rule count, `getRuleIndex()` returns `undefined` and callers
87
+ * fall back to the plain linear scan (index overhead not worth it). */
88
+ export declare const DEFAULT_MIN_INDEX_SIZE = 8;
89
+ /**
90
+ * Get (build + memoize) the index for a boxed rule array.
91
+ *
92
+ * `variations` selects the classification used when the *call-level*
93
+ * `options.useVariations` is `true` (rule-level `useVariations` is folded in
94
+ * at build time for both indexes). Below `minSize` (default 8) returns
95
+ * `undefined` and callers fall back to the linear scan.
96
+ */
97
+ export declare function getRuleIndex(rules: ReadonlyArray<BoxedRule>, variations: boolean, minSize?: number): RuleIndex | undefined;
98
+ /**
99
+ * Candidate rules for `expr`, in original declaration order, with
100
+ * ordinal > `fromOrdinal`.
101
+ *
102
+ * Implemented as an ordinal-merge of:
103
+ * - `alwaysTry`,
104
+ * - `byHead[expr.operator]`,
105
+ * - the `HEAD_COMPAT[expr.operator]` buckets, and
106
+ * - the `Divide` bucket when `expr` is a number literal (match.ts:142-156).
107
+ *
108
+ * A rule hinted with several `operators` may appear in more than one
109
+ * consulted bucket; duplicates are removed during the merge (distinct rules
110
+ * never share an ordinal).
111
+ */
112
+ export declare function candidateRules(index: RuleIndex, expr: Expression, fromOrdinal: number): Generator<OrdinalRule>;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export declare const ConditionParent: {
3
3
  boolean: string;
4
4
  string: string;
@@ -102,6 +102,7 @@ export declare function checkConditions(x: Expression, conditions: string[]): bo
102
102
  */
103
103
  export declare function boxRules(ce: ComputeEngine, rs: Rule | ReadonlyArray<Rule | BoxedRule> | BoxedRuleSet | undefined | null, options?: {
104
104
  canonical?: boolean;
105
+ purpose?: RulePurpose;
105
106
  }): BoxedRuleSet;
106
107
  /**
107
108
  * Apply a rule to an expression, assuming an incoming substitution
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import type { IComputeEngine as ComputeEngine, Expression, JsonSerializationOptions } from '../global-types';
3
3
  interface ProductLike {
4
4
  asRationalExpression(): Expression;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export declare function sgn(expr: Expression): Sign | undefined;
3
3
  /**
4
4
  * Sign `s` is > 0.
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  type InternalSimplifyOptions = SimplifyOptions & {
3
3
  useVariations: boolean;
4
4
  };
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  /**
3
3
  * Solve a system of linear equations.
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  export declare const UNIVARIATE_ROOTS: Rule[];
3
3
  /**
4
4
  * MathJsonExpression is a function of a single variable (`x`) or an Equality
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  type ComplexResult = {
3
3
  re: number;
4
4
  im: number;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  /** Assuming x in an expression in radians, convert to current angular unit. */
3
3
  export declare function radiansToAngle(x: Expression | undefined): Expression | undefined;
4
4
  export declare function evalTrig(name: string, op: Expression | undefined): Expression | undefined;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import type { NumericValue } from '../numeric-value/types';
3
3
  /** Preferred guard for runtime expressions. */
4
4
  export declare function isExpression(x: unknown): x is Expression;
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import { Type } from '../../common/type/types';
3
3
  import { NumericValue } from '../numeric-value/types';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import type { Expression, IComputeEngine as ComputeEngine } from '../global-types';
3
3
  /**
4
4
  * Check that the number of arguments is as expected.
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  /** If a collection has fewer than this many elements, eagerly evaluate it.
3
3
  *
4
4
  * For example, evaluate the Union of two sets with 10 elements each will
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import type { CompileTarget, TargetSource } from './types';
3
3
  /**
4
4
  * Base compiler class containing language-agnostic compilation logic
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import type { Expression, JSSource } from '../global-types';
3
3
  import type { CompileTarget, CompilationResult } from './types';
4
4
  type CompileExpressionOptions<T extends string = string> = {
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  * Constant folding utilities for GPU compilation.
3
3
  *
4
4
  * These helpers allow compilation handlers to detect compile-time constants,
@@ -29,6 +29,21 @@ export declare function tryGetConstant(expr: Expression): number | undefined;
29
29
  * short-circuits on `0.0` (absorbing element), returns `"1.0"` for empty input.
30
30
  */
31
31
  export declare function foldTerms(terms: string[], identity: string, op: '+' | '*'): string;
32
+ /**
33
+ * Parenthesize a compiled operand for safe use as a multiplicative factor.
34
+ *
35
+ * `foldTerms(..., '*')` joins operand strings with ` * ` without adding
36
+ * precedence parentheses. That is fine when operands come through the
37
+ * operator path (which already wraps lower-precedence operands), but the
38
+ * complex-multiply function handlers compile their operands with no
39
+ * precedence context, so a top-level additive factor like `x + 1.0` would be
40
+ * joined as `x + 1.0 * z` (mis-grouped). Wrap `Add`/`Subtract` operands so
41
+ * they bind as a single factor.
42
+ *
43
+ * @param expr The source expression for the operand.
44
+ * @param code The already-compiled operand code.
45
+ */
46
+ export declare function parenthesizeFactor(expr: Expression, code: string): string;
32
47
  /**
33
48
  * Decompose an expression into real and imaginary compiled code strings
34
49
  * for direct `vec2(re, im)` construction.
@@ -1,4 +1,4 @@
1
- /* 0.58.0 */
1
+ /* 0.59.0 */
2
2
  import type { CompiledFunctions } from './types';
3
3
  import { GPUShaderTarget } from './gpu-target';
4
4
  /**