@cortex-js/compute-engine 0.50.2 → 0.51.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 (236) hide show
  1. package/dist/compute-engine.esm.js +7900 -267
  2. package/dist/compute-engine.min.esm.js +490 -65
  3. package/dist/compute-engine.min.umd.js +490 -65
  4. package/dist/compute-engine.umd.js +7900 -267
  5. package/dist/math-json.esm.js +2 -2
  6. package/dist/math-json.min.esm.js +2 -2
  7. package/dist/math-json.min.umd.js +2 -2
  8. package/dist/math-json.umd.js +2 -2
  9. package/dist/types/color/categorical.d.ts +16 -0
  10. package/dist/types/color/contrast.d.ts +16 -0
  11. package/dist/types/color/conversion.d.ts +13 -0
  12. package/dist/types/color/diverging-palettes.d.ts +15 -0
  13. package/dist/types/color/index.d.ts +4 -0
  14. package/dist/types/color/manipulation.d.ts +95 -0
  15. package/dist/types/color/palette.d.ts +68 -0
  16. package/dist/types/color/sequential.d.ts +21 -0
  17. package/dist/types/color/types.d.ts +19 -0
  18. package/dist/types/common/ansi-codes.d.ts +1 -1
  19. package/dist/types/common/configuration-change.d.ts +1 -1
  20. package/dist/types/common/fuzzy-string-match.d.ts +1 -1
  21. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  22. package/dist/types/common/interruptible.d.ts +1 -1
  23. package/dist/types/common/one-of.d.ts +1 -1
  24. package/dist/types/common/signals.d.ts +1 -1
  25. package/dist/types/common/type/ast-nodes.d.ts +1 -1
  26. package/dist/types/common/type/boxed-type.d.ts +1 -1
  27. package/dist/types/common/type/lexer.d.ts +1 -1
  28. package/dist/types/common/type/parse.d.ts +1 -1
  29. package/dist/types/common/type/parser.d.ts +1 -1
  30. package/dist/types/common/type/primitive.d.ts +1 -1
  31. package/dist/types/common/type/reduce.d.ts +1 -1
  32. package/dist/types/common/type/serialize.d.ts +1 -1
  33. package/dist/types/common/type/subtype.d.ts +1 -1
  34. package/dist/types/common/type/type-builder.d.ts +1 -1
  35. package/dist/types/common/type/types.d.ts +1 -1
  36. package/dist/types/common/type/utils.d.ts +1 -1
  37. package/dist/types/common/utils.d.ts +1 -1
  38. package/dist/types/compute-engine/assume.d.ts +1 -1
  39. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
  40. package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
  41. package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
  42. package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
  43. package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
  44. package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
  45. package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
  46. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
  47. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
  48. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
  49. package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +1 -1
  50. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
  51. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
  52. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
  53. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
  54. package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +1 -1
  55. package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
  56. package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
  57. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
  58. package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
  59. package/dist/types/compute-engine/boxed-expression/constants.d.ts +1 -1
  60. package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
  61. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  62. package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
  63. package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
  64. package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
  65. package/dist/types/compute-engine/boxed-expression/inequality-bounds.d.ts +1 -1
  66. package/dist/types/compute-engine/boxed-expression/init-lazy-refs.d.ts +1 -1
  67. package/dist/types/compute-engine/boxed-expression/invisible-operator.d.ts +1 -1
  68. package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
  69. package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
  70. package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
  71. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  72. package/dist/types/compute-engine/boxed-expression/pattern-utils.d.ts +1 -1
  73. package/dist/types/compute-engine/boxed-expression/polynomial-degree.d.ts +1 -1
  74. package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
  75. package/dist/types/compute-engine/boxed-expression/predicates.d.ts +1 -1
  76. package/dist/types/compute-engine/boxed-expression/product.d.ts +1 -1
  77. package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
  78. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
  79. package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
  80. package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
  81. package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
  82. package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
  83. package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
  84. package/dist/types/compute-engine/boxed-expression/type-guards.d.ts +1 -1
  85. package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
  86. package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
  87. package/dist/types/compute-engine/collection-utils.d.ts +1 -1
  88. package/dist/types/compute-engine/compilation/base-compiler.d.ts +37 -1
  89. package/dist/types/compute-engine/compilation/compile-expression.d.ts +1 -1
  90. package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
  91. package/dist/types/compute-engine/compilation/gpu-target.d.ts +40 -1
  92. package/dist/types/compute-engine/compilation/interval-glsl-target.d.ts +1 -1
  93. package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +7 -1
  94. package/dist/types/compute-engine/compilation/interval-wgsl-target.d.ts +1 -1
  95. package/dist/types/compute-engine/compilation/javascript-target.d.ts +291 -3
  96. package/dist/types/compute-engine/compilation/python-target.d.ts +1 -1
  97. package/dist/types/compute-engine/compilation/types.d.ts +30 -3
  98. package/dist/types/compute-engine/compilation/wgsl-target.d.ts +1 -1
  99. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  100. package/dist/types/compute-engine/engine-assumptions.d.ts +1 -1
  101. package/dist/types/compute-engine/engine-cache.d.ts +1 -1
  102. package/dist/types/compute-engine/engine-common-symbols.d.ts +1 -1
  103. package/dist/types/compute-engine/engine-compilation-targets.d.ts +1 -1
  104. package/dist/types/compute-engine/engine-configuration-lifecycle.d.ts +1 -1
  105. package/dist/types/compute-engine/engine-declarations.d.ts +1 -1
  106. package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +1 -1
  107. package/dist/types/compute-engine/engine-extension-contracts.d.ts +1 -1
  108. package/dist/types/compute-engine/engine-latex-dictionary-state.d.ts +1 -1
  109. package/dist/types/compute-engine/engine-library-bootstrap.d.ts +1 -1
  110. package/dist/types/compute-engine/engine-numeric-configuration.d.ts +1 -1
  111. package/dist/types/compute-engine/engine-parse-entrypoint.d.ts +1 -1
  112. package/dist/types/compute-engine/engine-runtime-state.d.ts +1 -1
  113. package/dist/types/compute-engine/engine-scope.d.ts +1 -1
  114. package/dist/types/compute-engine/engine-sequences.d.ts +1 -1
  115. package/dist/types/compute-engine/engine-simplification-rules.d.ts +1 -1
  116. package/dist/types/compute-engine/engine-startup-coordinator.d.ts +1 -1
  117. package/dist/types/compute-engine/engine-type-resolver.d.ts +1 -1
  118. package/dist/types/compute-engine/engine-validation-entrypoints.d.ts +1 -1
  119. package/dist/types/compute-engine/free-functions.d.ts +15 -9
  120. package/dist/types/compute-engine/function-utils.d.ts +1 -1
  121. package/dist/types/compute-engine/global-types.d.ts +1 -1
  122. package/dist/types/compute-engine/index.d.ts +2 -2
  123. package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
  124. package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
  125. package/dist/types/compute-engine/interval/elementary.d.ts +26 -1
  126. package/dist/types/compute-engine/interval/index.d.ts +11 -5
  127. package/dist/types/compute-engine/interval/trigonometric.d.ts +16 -1
  128. package/dist/types/compute-engine/interval/types.d.ts +1 -1
  129. package/dist/types/compute-engine/interval/util.d.ts +1 -1
  130. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  131. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  132. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  133. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  134. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  135. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
  136. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  137. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  138. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
  139. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  140. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  141. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  142. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  143. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-units.d.ts +23 -0
  144. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
  145. package/dist/types/compute-engine/latex-syntax/dictionary/indexed-types.d.ts +1 -1
  146. package/dist/types/compute-engine/latex-syntax/parse-number.d.ts +1 -1
  147. package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
  148. package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
  149. package/dist/types/compute-engine/latex-syntax/serialize-dms.d.ts +22 -0
  150. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
  151. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
  152. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +2 -2
  153. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  154. package/dist/types/compute-engine/latex-syntax/types.d.ts +59 -2
  155. package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
  156. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
  157. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  158. package/dist/types/compute-engine/library/collections.d.ts +1 -1
  159. package/dist/types/compute-engine/library/colors.d.ts +2 -0
  160. package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
  161. package/dist/types/compute-engine/library/complex.d.ts +1 -1
  162. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  163. package/dist/types/compute-engine/library/core.d.ts +1 -1
  164. package/dist/types/compute-engine/library/library.d.ts +1 -1
  165. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  166. package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
  167. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  168. package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
  169. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  170. package/dist/types/compute-engine/library/quantity-arithmetic.d.ts +37 -0
  171. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  172. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  173. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  174. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  175. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  176. package/dist/types/compute-engine/library/type-handlers.d.ts +1 -1
  177. package/dist/types/compute-engine/library/unit-data.d.ts +8 -0
  178. package/dist/types/compute-engine/library/units.d.ts +9 -0
  179. package/dist/types/compute-engine/library/utils.d.ts +1 -1
  180. package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
  181. package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
  182. package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
  183. package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
  184. package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
  185. package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
  186. package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
  187. package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
  188. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
  189. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  190. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  191. package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
  192. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  193. package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
  194. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  195. package/dist/types/compute-engine/numerics/special-functions.d.ts +15 -1
  196. package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
  197. package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
  198. package/dist/types/compute-engine/numerics/types.d.ts +1 -1
  199. package/dist/types/compute-engine/numerics/unit-data.d.ts +128 -0
  200. package/dist/types/compute-engine/oeis.d.ts +1 -1
  201. package/dist/types/compute-engine/sequence.d.ts +1 -1
  202. package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
  203. package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
  204. package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
  205. package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
  206. package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
  207. package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
  208. package/dist/types/compute-engine/symbolic/logic-utils.d.ts +1 -1
  209. package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
  210. package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +4 -2
  211. package/dist/types/compute-engine/symbolic/simplify-factorial.d.ts +33 -0
  212. package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
  213. package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
  214. package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
  215. package/dist/types/compute-engine/symbolic/simplify-logic.d.ts +1 -1
  216. package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
  217. package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
  218. package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
  219. package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
  220. package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
  221. package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
  222. package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
  223. package/dist/types/compute-engine/types-definitions.d.ts +1 -1
  224. package/dist/types/compute-engine/types-engine.d.ts +1 -1
  225. package/dist/types/compute-engine/types-evaluation.d.ts +1 -1
  226. package/dist/types/compute-engine/types-expression.d.ts +1 -1
  227. package/dist/types/compute-engine/types-kernel-evaluation.d.ts +1 -1
  228. package/dist/types/compute-engine/types-kernel-serialization.d.ts +1 -1
  229. package/dist/types/compute-engine/types-serialization.d.ts +1 -1
  230. package/dist/types/compute-engine/types.d.ts +1 -1
  231. package/dist/types/compute-engine.d.ts +2 -2
  232. package/dist/types/math-json/symbols.d.ts +1 -1
  233. package/dist/types/math-json/types.d.ts +1 -1
  234. package/dist/types/math-json/utils.d.ts +1 -1
  235. package/dist/types/math-json.d.ts +2 -2
  236. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  export declare function canonicalForm(expr: Expression, forms: CanonicalOptions, scope?: Scope): Expression;
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  import type { expand as _ExpandFn } from './expand';
3
3
  /** @internal */
4
4
  export declare function _setExpand(fn: typeof _ExpandFn): void;
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
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
  */
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
2
2
  /**
3
3
  *
4
4
  * Optionally make all the arguments canonical (default).
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
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,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  /**
3
3
  * Get inequality bounds for a symbol from the assumption database.
4
4
  *
@@ -1 +1 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import type { Rational } from '../numerics/types';
4
4
  import type { Expression, ExpressionInput } from '../global-types';
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
2
2
  export declare function isPrime(expr: Expression): boolean | undefined;
@@ -1 +1 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  export declare const ConditionParent: {
3
3
  boolean: string;
4
4
  string: string;
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  import type { IComputeEngine as ComputeEngine, Expression, JsonSerializationOptions } from '../global-types';
3
3
  import type { Product as _ProductClass } from './product';
4
4
  /** @internal */
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  export declare function sgn(expr: Expression): Sign | undefined;
3
3
  /**
4
4
  * Sign `s` is > 0.
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  type InternalSimplifyOptions = SimplifyOptions & {
3
3
  useVariations: boolean;
4
4
  };
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  /**
3
3
  * Solve a system of linear equations.
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
2
2
  /** Preferred guard for runtime expressions. */
3
3
  export declare function isExpression(x: unknown): x is Expression;
4
4
  export declare function isNumber(expr: Expression | null | undefined): expr is Expression & NumberLiteralInterface;
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  import { Type } from '../../common/type/types';
3
3
  import { NumericValue } from '../numeric-value/types';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
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.50.2 */
1
+ /* 0.51.1 */
2
2
  import type { CompileTarget, TargetSource } from './types';
3
3
  /**
4
4
  * Base compiler class containing language-agnostic compilation logic
@@ -16,10 +16,46 @@ export declare class BaseCompiler {
16
16
  * Compile a block expression
17
17
  */
18
18
  private static compileBlock;
19
+ /**
20
+ * Compile a Loop expression with Element(index, Range(lo, hi)) indexing.
21
+ * Generates: (() => { for (let i = lo; i <= hi; i++) { body } })()
22
+ *
23
+ * The loop counter is always a raw number. For targets that wrap numeric
24
+ * values (e.g. interval-js wraps with `_IA.point()`), references to the
25
+ * loop index inside the body are wrapped via `target.number`.
26
+ */
27
+ private static compileForLoop;
28
+ /**
29
+ * Compile a loop body expression as statements (not wrapped in IIFE).
30
+ * Handles Break, Continue, Return as statements, and If as if-else when
31
+ * branches contain control flow.
32
+ */
33
+ private static compileLoopBody;
34
+ /**
35
+ * Create a target that compiles conditions as plain JS booleans.
36
+ * Used inside `compileLoopBody` so that `if (cond)` gets a real boolean,
37
+ * not an interval result object (which would always be truthy).
38
+ *
39
+ * Overrides comparison and logical operators to use plain JS, and
40
+ * numeric values/variables to use raw numbers (the loop counter is
41
+ * already a plain number).
42
+ */
43
+ private static scalarConditionTarget;
19
44
  /**
20
45
  * Compile loop constructs (Sum/Product)
21
46
  */
22
47
  private static compileLoop;
48
+ /**
49
+ * Determine at compile time whether an expression produces a complex value.
50
+ *
51
+ * Rules:
52
+ * - Numbers: complex if im !== 0
53
+ * - Symbols: ImaginaryUnit is complex; others use expr.isReal
54
+ * (undefined is treated as real -- assume-real policy)
55
+ * - Functions: Abs, Arg, Re, Im always return real.
56
+ * All others: complex if any operand is complex.
57
+ */
58
+ static isComplexValued(expr: Expression): boolean;
23
59
  /**
24
60
  * Generate a temporary variable name
25
61
  */
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  import type { Expression, JSSource } from '../global-types';
3
3
  import type { CompileTarget, CompilationResult } from './types';
4
4
  type CompileExpressionOptions = {
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  import type { CompiledFunctions } from './types';
3
3
  import { GPUShaderTarget } from './gpu-target';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  import type { CompileTarget, CompiledOperators, CompiledFunctions, LanguageTarget, CompilationOptions, CompilationResult } from './types';
3
3
  /**
4
4
  * GPU shader operators shared by GLSL and WGSL.
@@ -13,8 +13,47 @@ export declare const GPU_OPERATORS: CompiledOperators;
13
13
  * Both languages share identical built-in math functions. Language-specific
14
14
  * functions (inversesqrt naming, mod, vector constructors) are provided
15
15
  * by subclass overrides.
16
+ *
17
+ * Complex numbers are represented as vec2(re, im). Functions that can
18
+ * operate on complex values check `BaseCompiler.isComplexValued()` and
19
+ * dispatch to `_gpu_c*` helper functions from the complex preamble.
16
20
  */
17
21
  export declare const GPU_FUNCTIONS: CompiledFunctions<Expression>;
22
+ /**
23
+ * Compile a Matrix expression to GPU-native types when possible.
24
+ *
25
+ * Handles two optimizations:
26
+ * - Column vectors (Nx1): flatten to vecN instead of nested single-element arrays
27
+ * - Square matrices (NxN, N=2,3,4): use native matN types with column-major transposition
28
+ *
29
+ * Falls back to compiling the nested List structure for other shapes.
30
+ */
31
+ export declare function compileGPUMatrix(args: ReadonlyArray<Expression>, compile: (expr: Expression) => string, vecFn: (n: number) => string, matFn: (n: number) => string, arrayFn: (n: number) => string): string;
32
+ /**
33
+ * GPU gamma function using Lanczos approximation (g=7, n=9 coefficients).
34
+ *
35
+ * Uses reflection formula for z < 0.5 and Lanczos for z >= 0.5.
36
+ * Valid for both GLSL and WGSL (uses standard math builtins).
37
+ */
38
+ export declare const GPU_GAMMA_PREAMBLE = "\nfloat _gpu_gamma(float z) {\n const float PI = 3.14159265358979;\n if (z < 0.5) {\n return PI / (sin(PI * z) * _gpu_gamma(1.0 - z));\n }\n z -= 1.0;\n float x = 0.99999999999980993;\n x += 676.5203681218851 / (z + 1.0);\n x += -1259.1392167224028 / (z + 2.0);\n x += 771.32342877765313 / (z + 3.0);\n x += -176.61502916214059 / (z + 4.0);\n x += 12.507343278686905 / (z + 5.0);\n x += -0.13857109526572012 / (z + 6.0);\n x += 9.9843695780195716e-6 / (z + 7.0);\n x += 1.5056327351493116e-7 / (z + 8.0);\n float t = z + 7.5;\n return sqrt(2.0 * PI) * pow(t, z + 0.5) * exp(-t) * x;\n}\n\nfloat _gpu_gammaln(float z) {\n // Stirling asymptotic expansion for ln(Gamma(z)), z > 0\n float z3 = z * z * z;\n return z * log(z) - z - 0.5 * log(z)\n + 0.5 * log(2.0 * 3.14159265358979)\n + 1.0 / (12.0 * z)\n - 1.0 / (360.0 * z3)\n + 1.0 / (1260.0 * z3 * z * z);\n}\n";
39
+ /**
40
+ * GPU error function using Abramowitz & Stegun approximation.
41
+ * Maximum error: |epsilon(x)| <= 1.5e-7.
42
+ */
43
+ export declare const GPU_ERF_PREAMBLE = "\nfloat _gpu_erf(float x) {\n float ax = abs(x);\n float t = 1.0 / (1.0 + 0.3275911 * ax);\n float y = ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t;\n float result = 1.0 - y * exp(-ax * ax);\n return x < 0.0 ? -result : result;\n}\n\nfloat _gpu_erfinv(float x) {\n float pi = 3.14159265358979;\n float x2 = x * x;\n float x3 = x * x2;\n float x5 = x3 * x2;\n float x7 = x5 * x2;\n float x9 = x7 * x2;\n return sqrt(pi) * 0.5 * (x + (pi / 12.0) * x3 + (7.0 * pi * pi / 480.0) * x5 + (127.0 * pi * pi * pi / 40320.0) * x7 + (4369.0 * pi * pi * pi * pi / 5806080.0) * x9);\n}\n";
44
+ /**
45
+ * GPU color space conversion preamble (GLSL syntax).
46
+ *
47
+ * Provides sRGB ↔ OKLab ↔ OKLCh conversions, color mixing in OKLCh
48
+ * with shorter-arc hue interpolation, and APCA contrast calculation.
49
+ *
50
+ * WGSL targets must adapt syntax (vec3f, atan2→atan2, etc.).
51
+ */
52
+ export declare const GPU_COLOR_PREAMBLE_GLSL = "\nfloat _gpu_srgb_to_linear(float c) {\n if (c <= 0.04045) return c / 12.92;\n return pow((c + 0.055) / 1.055, 2.4);\n}\n\nfloat _gpu_linear_to_srgb(float c) {\n if (c <= 0.0031308) return 12.92 * c;\n return 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\n\nvec3 _gpu_srgb_to_oklab(vec3 rgb) {\n float r = _gpu_srgb_to_linear(rgb.x);\n float g = _gpu_srgb_to_linear(rgb.y);\n float b = _gpu_srgb_to_linear(rgb.z);\n float l_ = pow(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b, 1.0 / 3.0);\n float m_ = pow(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b, 1.0 / 3.0);\n float s_ = pow(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b, 1.0 / 3.0);\n return vec3(\n 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_,\n 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_,\n 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_\n );\n}\n\nvec3 _gpu_oklab_to_srgb(vec3 lab) {\n float l_ = lab.x + 0.3963377774 * lab.y + 0.2158037573 * lab.z;\n float m_ = lab.x - 0.1055613458 * lab.y - 0.0638541728 * lab.z;\n float s_ = lab.x - 0.0894841775 * lab.y - 1.291485548 * lab.z;\n float l = l_ * l_ * l_;\n float m = m_ * m_ * m_;\n float s = s_ * s_ * s_;\n float r = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;\n float g = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;\n float b = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;\n return clamp(vec3(_gpu_linear_to_srgb(r), _gpu_linear_to_srgb(g), _gpu_linear_to_srgb(b)), 0.0, 1.0);\n}\n\nvec3 _gpu_oklab_to_oklch(vec3 lab) {\n float C = length(lab.yz);\n float H = atan(lab.z, lab.y);\n return vec3(lab.x, C, H);\n}\n\nvec3 _gpu_oklch_to_oklab(vec3 lch) {\n return vec3(lch.x, lch.y * cos(lch.z), lch.y * sin(lch.z));\n}\n\nvec3 _gpu_color_mix(vec3 rgb1, vec3 rgb2, float t) {\n vec3 lch1 = _gpu_oklab_to_oklch(_gpu_srgb_to_oklab(rgb1));\n vec3 lch2 = _gpu_oklab_to_oklch(_gpu_srgb_to_oklab(rgb2));\n float L = mix(lch1.x, lch2.x, t);\n float C = mix(lch1.y, lch2.y, t);\n float dh = lch2.z - lch1.z;\n const float PI = 3.14159265359;\n if (dh > PI) dh -= 2.0 * PI;\n if (dh < -PI) dh += 2.0 * PI;\n float H = lch1.z + dh * t;\n return _gpu_oklab_to_srgb(_gpu_oklch_to_oklab(vec3(L, C, H)));\n}\n\nfloat _gpu_apca(vec3 bg, vec3 fg) {\n float bgR = _gpu_srgb_to_linear(bg.x);\n float bgG = _gpu_srgb_to_linear(bg.y);\n float bgB = _gpu_srgb_to_linear(bg.z);\n float fgR = _gpu_srgb_to_linear(fg.x);\n float fgG = _gpu_srgb_to_linear(fg.y);\n float fgB = _gpu_srgb_to_linear(fg.z);\n float bgY = 0.2126729 * bgR + 0.7151522 * bgG + 0.0721750 * bgB;\n float fgY = 0.2126729 * fgR + 0.7151522 * fgG + 0.0721750 * fgB;\n float bgC = pow(bgY, 0.56);\n float fgC = pow(fgY, 0.57);\n float contrast = (bgC > fgC)\n ? (bgC - fgC) * 1.14\n : (bgC - fgC) * 1.14;\n return contrast * 100.0;\n}\n";
53
+ /**
54
+ * GPU color space conversion preamble (WGSL syntax).
55
+ */
56
+ export declare const GPU_COLOR_PREAMBLE_WGSL = "\nfn _gpu_srgb_to_linear(c: f32) -> f32 {\n if (c <= 0.04045) { return c / 12.92; }\n return pow((c + 0.055) / 1.055, 2.4);\n}\n\nfn _gpu_linear_to_srgb(c: f32) -> f32 {\n if (c <= 0.0031308) { return 12.92 * c; }\n return 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\n\nfn _gpu_srgb_to_oklab(rgb: vec3f) -> vec3f {\n let r = _gpu_srgb_to_linear(rgb.x);\n let g = _gpu_srgb_to_linear(rgb.y);\n let b = _gpu_srgb_to_linear(rgb.z);\n let l_ = pow(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b, 1.0 / 3.0);\n let m_ = pow(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b, 1.0 / 3.0);\n let s_ = pow(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b, 1.0 / 3.0);\n return vec3f(\n 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_,\n 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_,\n 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_\n );\n}\n\nfn _gpu_oklab_to_srgb(lab: vec3f) -> vec3f {\n let l_ = lab.x + 0.3963377774 * lab.y + 0.2158037573 * lab.z;\n let m_ = lab.x - 0.1055613458 * lab.y - 0.0638541728 * lab.z;\n let s_ = lab.x - 0.0894841775 * lab.y - 1.291485548 * lab.z;\n let l = l_ * l_ * l_;\n let m = m_ * m_ * m_;\n let s = s_ * s_ * s_;\n let r = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;\n let g = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;\n let b = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;\n return clamp(vec3f(_gpu_linear_to_srgb(r), _gpu_linear_to_srgb(g), _gpu_linear_to_srgb(b)), vec3f(0.0), vec3f(1.0));\n}\n\nfn _gpu_oklab_to_oklch(lab: vec3f) -> vec3f {\n let C = length(lab.yz);\n let H = atan2(lab.z, lab.y);\n return vec3f(lab.x, C, H);\n}\n\nfn _gpu_oklch_to_oklab(lch: vec3f) -> vec3f {\n return vec3f(lch.x, lch.y * cos(lch.z), lch.y * sin(lch.z));\n}\n\nfn _gpu_color_mix(rgb1: vec3f, rgb2: vec3f, t: f32) -> vec3f {\n let lch1 = _gpu_oklab_to_oklch(_gpu_srgb_to_oklab(rgb1));\n let lch2 = _gpu_oklab_to_oklch(_gpu_srgb_to_oklab(rgb2));\n let L = mix(lch1.x, lch2.x, t);\n let C = mix(lch1.y, lch2.y, t);\n let PI = 3.14159265359;\n var dh = lch2.z - lch1.z;\n if (dh > PI) { dh -= 2.0 * PI; }\n if (dh < -PI) { dh += 2.0 * PI; }\n let H = lch1.z + dh * t;\n return _gpu_oklab_to_srgb(_gpu_oklch_to_oklab(vec3f(L, C, H)));\n}\n\nfn _gpu_apca(bg: vec3f, fg: vec3f) -> f32 {\n let bgR = _gpu_srgb_to_linear(bg.x);\n let bgG = _gpu_srgb_to_linear(bg.y);\n let bgB = _gpu_srgb_to_linear(bg.z);\n let fgR = _gpu_srgb_to_linear(fg.x);\n let fgG = _gpu_srgb_to_linear(fg.y);\n let fgB = _gpu_srgb_to_linear(fg.z);\n let bgY = 0.2126729 * bgR + 0.7151522 * bgG + 0.0721750 * bgB;\n let fgY = 0.2126729 * fgR + 0.7151522 * fgG + 0.0721750 * fgB;\n let bgC = pow(bgY, 0.56);\n let fgC = pow(fgY, 0.57);\n let contrast = (bgC - fgC) * 1.14;\n return contrast * 100.0;\n}\n";
18
57
  /**
19
58
  * Abstract base class for GPU shader compilation targets.
20
59
  *
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  * GLSL interval arithmetic compilation target
3
3
  *
4
4
  * Compiles mathematical expressions to GLSL code using interval arithmetic
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  * JavaScript interval arithmetic compilation target
3
3
  *
4
4
  * Compiles mathematical expressions to JavaScript code using interval arithmetic
@@ -54,7 +54,10 @@ export declare class ComputeEngineIntervalFunction extends Function {
54
54
  max: typeof import("../interval").max;
55
55
  mod: typeof import("../interval").mod;
56
56
  remainder: typeof import("../interval").remainder;
57
+ heaviside: typeof import("../interval").heaviside;
57
58
  sign: typeof import("../interval").sign;
59
+ gamma: typeof import("../interval").gamma;
60
+ gammaln: typeof import("../interval").gammaln;
58
61
  sin: typeof import("../interval").sin;
59
62
  cos: typeof import("../interval").cos;
60
63
  tan: typeof import("../interval").tan;
@@ -80,6 +83,9 @@ export declare class ComputeEngineIntervalFunction extends Function {
80
83
  acoth: typeof import("../interval").acoth;
81
84
  acsch: typeof import("../interval").acsch;
82
85
  asech: typeof import("../interval").asech;
86
+ sinc: typeof import("../interval").sinc;
87
+ fresnelS: typeof import("../interval").fresnelS;
88
+ fresnelC: typeof import("../interval").fresnelC;
83
89
  less: typeof import("../interval").less;
84
90
  lessEqual: typeof import("../interval").lessEqual;
85
91
  greater: typeof import("../interval").greater;
@@ -1,4 +1,4 @@
1
- /* 0.50.2 */
1
+ /* 0.51.1 */
2
2
  * WGSL interval arithmetic compilation target
3
3
  *
4
4
  * Compiles mathematical expressions to WGSL code using interval arithmetic