@cortex-js/compute-engine 0.52.0 → 0.53.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.
- package/README.md +2 -4
- package/dist/compute-engine.esm.js +1404 -3552
- package/dist/compute-engine.min.esm.js +110 -2331
- package/dist/compute-engine.min.umd.js +110 -2331
- package/dist/compute-engine.umd.js +1403 -3551
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.umd.js +2 -2
- package/dist/math-json.umd.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/configuration-change.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +1 -1
- package/dist/types/common/one-of.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/type/ast-nodes.d.ts +1 -1
- package/dist/types/common/type/boxed-type.d.ts +1 -1
- package/dist/types/common/type/lexer.d.ts +1 -1
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/parser.d.ts +1 -1
- package/dist/types/common/type/primitive.d.ts +1 -1
- package/dist/types/common/type/reduce.d.ts +1 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/type-builder.d.ts +1 -1
- package/dist/types/common/type/types.d.ts +1 -1
- package/dist/types/common/type/utils.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +7 -2
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +3 -4
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +4 -2
- package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +10 -11
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +8 -4
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/constants.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/inequality-bounds.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/init-lazy-refs.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/invisible-operator.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/pattern-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomial-degree.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/predicates.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/stochastic-equal.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/type-guards.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compilation/base-compiler.d.ts +1 -1
- package/dist/types/compute-engine/compilation/compile-expression.d.ts +1 -1
- package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/gpu-target.d.ts +14 -2
- package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/python-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/types.d.ts +3 -9
- package/dist/types/compute-engine/compilation/wgsl-target.d.ts +1 -1
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/engine-assumptions.d.ts +1 -1
- package/dist/types/compute-engine/engine-cache.d.ts +1 -1
- package/dist/types/compute-engine/engine-common-symbols.d.ts +1 -1
- package/dist/types/compute-engine/engine-compilation-targets.d.ts +1 -1
- package/dist/types/compute-engine/engine-configuration-lifecycle.d.ts +1 -1
- package/dist/types/compute-engine/engine-declarations.d.ts +1 -2
- package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +2 -2
- package/dist/types/compute-engine/engine-extension-contracts.d.ts +1 -1
- package/dist/types/compute-engine/engine-latex-dictionary-state.d.ts +1 -1
- package/dist/types/compute-engine/engine-library-bootstrap.d.ts +1 -1
- package/dist/types/compute-engine/engine-numeric-configuration.d.ts +1 -1
- package/dist/types/compute-engine/engine-parse-entrypoint.d.ts +1 -1
- package/dist/types/compute-engine/engine-runtime-state.d.ts +1 -1
- package/dist/types/compute-engine/engine-scope.d.ts +1 -4
- package/dist/types/compute-engine/engine-sequences.d.ts +1 -1
- package/dist/types/compute-engine/engine-simplification-rules.d.ts +1 -1
- package/dist/types/compute-engine/engine-startup-coordinator.d.ts +1 -1
- package/dist/types/compute-engine/engine-type-resolver.d.ts +1 -1
- package/dist/types/compute-engine/engine-validation-entrypoints.d.ts +1 -1
- package/dist/types/compute-engine/free-functions.d.ts +3 -3
- package/dist/types/compute-engine/function-utils.d.ts +34 -15
- package/dist/types/compute-engine/global-types.d.ts +1 -1
- package/dist/types/compute-engine/index.d.ts +5 -26
- package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
- package/dist/types/compute-engine/interval/elementary.d.ts +1 -1
- package/dist/types/compute-engine/interval/index.d.ts +1 -1
- package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
- package/dist/types/compute-engine/interval/types.d.ts +1 -1
- package/dist/types/compute-engine/interval/util.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-units.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/indexed-types.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-dms.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/types.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +1 -1
- package/dist/types/compute-engine/library/colors.d.ts +1 -1
- package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/fractals.d.ts +2 -0
- package/dist/types/compute-engine/library/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/quantity-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/type-handlers.d.ts +1 -1
- package/dist/types/compute-engine/library/unit-data.d.ts +1 -1
- package/dist/types/compute-engine/library/units.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
- package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/special-functions.d.ts +1 -1
- package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
- package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
- package/dist/types/compute-engine/numerics/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/unit-data.d.ts +1 -1
- package/dist/types/compute-engine/oeis.d.ts +1 -1
- package/dist/types/compute-engine/sequence.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/logic-utils.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-factorial.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-logic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
- package/dist/types/compute-engine/types-definitions.d.ts +6 -7
- package/dist/types/compute-engine/types-engine.d.ts +1 -9
- package/dist/types/compute-engine/types-evaluation.d.ts +2 -2
- package/dist/types/compute-engine/types-expression.d.ts +58 -8
- package/dist/types/compute-engine/types-kernel-evaluation.d.ts +5 -8
- package/dist/types/compute-engine/types-kernel-serialization.d.ts +1 -1
- package/dist/types/compute-engine/types-serialization.d.ts +1 -1
- package/dist/types/compute-engine/types.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +1 -3
- package/dist/types/math-json/symbols.d.ts +1 -1
- package/dist/types/math-json/types.d.ts +1 -1
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +18 -18
- package/dist/types/compute-engine/compilation/interval-glsl-target.d.ts +0 -51
- package/dist/types/compute-engine/compilation/interval-wgsl-target.d.ts +0 -54
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.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.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
import type { CompileTarget, CompiledOperators, CompiledFunctions, LanguageTarget, CompilationOptions, CompilationResult } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* GPU shader operators shared by GLSL and WGSL.
|
|
@@ -35,12 +35,24 @@ export declare function compileGPUMatrix(args: ReadonlyArray<Expression>, compil
|
|
|
35
35
|
* Uses reflection formula for z < 0.5 and Lanczos for z >= 0.5.
|
|
36
36
|
* Valid for both GLSL and WGSL (uses standard math builtins).
|
|
37
37
|
*/
|
|
38
|
-
export declare const GPU_GAMMA_PREAMBLE = "\nfloat _gpu_gamma(float z) {\n const float PI = 3.14159265358979;\n
|
|
38
|
+
export declare const GPU_GAMMA_PREAMBLE = "\nfloat _gpu_gamma(float z) {\n const float PI = 3.14159265358979;\n // For z < 0.5, use reflection formula with inlined Lanczos (non-recursive)\n float w = z;\n if (z < 0.5) w = 1.0 - z;\n w -= 1.0;\n float x = 0.99999999999980993;\n x += 676.5203681218851 / (w + 1.0);\n x += -1259.1392167224028 / (w + 2.0);\n x += 771.32342877765313 / (w + 3.0);\n x += -176.61502916214059 / (w + 4.0);\n x += 12.507343278686905 / (w + 5.0);\n x += -0.13857109526572012 / (w + 6.0);\n x += 9.9843695780195716e-6 / (w + 7.0);\n x += 1.5056327351493116e-7 / (w + 8.0);\n float t = w + 7.5;\n float g = sqrt(2.0 * PI) * pow(t, w + 0.5) * exp(-t) * x;\n if (z < 0.5) return PI / (sin(PI * z) * g);\n return g;\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
39
|
/**
|
|
40
40
|
* GPU error function using Abramowitz & Stegun approximation.
|
|
41
41
|
* Maximum error: |epsilon(x)| <= 1.5e-7.
|
|
42
42
|
*/
|
|
43
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
|
+
* Fractal preamble (GLSL syntax).
|
|
46
|
+
*
|
|
47
|
+
* Smooth escape-time iteration for Mandelbrot and Julia sets.
|
|
48
|
+
* Both functions return a normalized float in [0, 1] with smooth coloring
|
|
49
|
+
* (log2(log2(|z|²)) formula) to avoid banding.
|
|
50
|
+
*/
|
|
51
|
+
export declare const GPU_FRACTAL_PREAMBLE_GLSL = "\nfloat _fractal_mandelbrot(vec2 c, int maxIter) {\n vec2 z = vec2(0.0, 0.0);\n for (int i = 0; i < maxIter; i++) {\n z = vec2(z.x*z.x - z.y*z.y + c.x, 2.0*z.x*z.y + c.y);\n if (dot(z, z) > 4.0)\n return clamp((float(i) - log2(log2(dot(z, z))) + 4.0) / float(maxIter), 0.0, 1.0);\n }\n return 1.0;\n}\n\nfloat _fractal_julia(vec2 z, vec2 c, int maxIter) {\n for (int i = 0; i < maxIter; i++) {\n z = vec2(z.x*z.x - z.y*z.y + c.x, 2.0*z.x*z.y + c.y);\n if (dot(z, z) > 4.0)\n return clamp((float(i) - log2(log2(dot(z, z))) + 4.0) / float(maxIter), 0.0, 1.0);\n }\n return 1.0;\n}\n";
|
|
52
|
+
/**
|
|
53
|
+
* Fractal preamble (WGSL syntax).
|
|
54
|
+
*/
|
|
55
|
+
export declare const GPU_FRACTAL_PREAMBLE_WGSL = "\nfn _fractal_mandelbrot(c: vec2f, maxIter: i32) -> f32 {\n var z = vec2f(0.0, 0.0);\n for (var i: i32 = 0; i < maxIter; i++) {\n z = vec2f(z.x*z.x - z.y*z.y + c.x, 2.0*z.x*z.y + c.y);\n if (dot(z, z) > 4.0) {\n return clamp((f32(i) - log2(log2(dot(z, z))) + 4.0) / f32(maxIter), 0.0, 1.0);\n }\n }\n return 1.0;\n}\n\nfn _fractal_julia(z_in: vec2f, c: vec2f, maxIter: i32) -> f32 {\n var z = z_in;\n for (var i: i32 = 0; i < maxIter; i++) {\n z = vec2f(z.x*z.x - z.y*z.y + c.x, 2.0*z.x*z.y + c.y);\n if (dot(z, z) > 4.0) {\n return clamp((f32(i) - log2(log2(dot(z, z))) + 4.0) / f32(maxIter), 0.0, 1.0);\n }\n }\n return 1.0;\n}\n";
|
|
44
56
|
/**
|
|
45
57
|
* GPU color space conversion preamble (GLSL syntax).
|
|
46
58
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
import { chop, factorial, factorial2, gcd, lcm, limit } from '../numerics/numeric';
|
|
3
3
|
import { gamma, gammaln, erf, erfc, erfInv, beta, digamma, trigamma, polygamma, zeta, lambertW, besselJ, besselY, besselI, besselK, airyAi, airyBi, fresnelS, fresnelC, sinc } from '../numerics/special-functions';
|
|
4
4
|
import { choose } from '../boxed-expression/expand';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
/**
|
|
3
3
|
* Source code in the target language
|
|
4
4
|
*/
|
|
@@ -71,8 +71,6 @@ export interface CompilationOptions<Expr = unknown> {
|
|
|
71
71
|
* - `'glsl'` - Compile to GLSL (OpenGL Shading Language)
|
|
72
72
|
* - `'wgsl'` - Compile to WGSL (WebGPU Shading Language)
|
|
73
73
|
* - `'interval-js'` - Compile to JavaScript with interval arithmetic
|
|
74
|
-
* - `'interval-glsl'` - Compile to GLSL with interval arithmetic
|
|
75
|
-
* - `'interval-wgsl'` - Compile to WGSL with interval arithmetic
|
|
76
74
|
*
|
|
77
75
|
* Custom targets can be registered using `ce.registerCompilationTarget()`.
|
|
78
76
|
*
|
|
@@ -229,12 +227,8 @@ export type CompilationResult<T extends string = string, R = number | ComplexRes
|
|
|
229
227
|
/**
|
|
230
228
|
* Library/helper code that must be included before the compiled `code`.
|
|
231
229
|
*
|
|
232
|
-
* For
|
|
233
|
-
*
|
|
234
|
-
* that the compiled expression references.
|
|
235
|
-
*
|
|
236
|
-
* To produce a complete shader, concatenate `preamble + code` or use the
|
|
237
|
-
* target's `compileShaderFunction()` method directly.
|
|
230
|
+
* For targets like `interval-js`, this contains the interval arithmetic
|
|
231
|
+
* library (helper functions, etc.) that the compiled expression references.
|
|
238
232
|
*/
|
|
239
233
|
preamble?: string;
|
|
240
234
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
import type { MathJsonSymbol } from '../math-json/types';
|
|
3
3
|
export declare function ask(ce: IComputeEngine, pattern: Expression): BoxedSubstitution[];
|
|
4
4
|
export declare function verify(ce: IComputeEngine, query: Expression): boolean | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
import { BoxedType } from '../common/type/boxed-type';
|
|
3
3
|
import type { MathJsonSymbol } from '../math-json/types';
|
|
4
4
|
import type { ValueDefinition, OperatorDefinition, AssignValue, Expression, BoxedDefinition, SymbolDefinition, IComputeEngine, Scope } from './global-types';
|
|
@@ -7,7 +7,6 @@ export declare function declareSymbolValue(ce: IComputeEngine, name: MathJsonSym
|
|
|
7
7
|
export declare function declareSymbolOperator(ce: IComputeEngine, name: string, def: OperatorDefinition, scope?: Scope): BoxedDefinition;
|
|
8
8
|
export declare function getSymbolValue(ce: IComputeEngine, id: MathJsonSymbol): Expression | undefined;
|
|
9
9
|
export declare function setSymbolValue(ce: IComputeEngine, id: MathJsonSymbol, value: Expression | boolean | number | undefined): void;
|
|
10
|
-
export declare function setCurrentContextValue(ce: IComputeEngine, id: MathJsonSymbol, value: Expression | boolean | number | undefined): void;
|
|
11
10
|
export declare function declareType(ce: IComputeEngine, name: string, type: BoxedType | Type | TypeString, { alias }?: {
|
|
12
11
|
alias?: boolean;
|
|
13
12
|
}): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import type { MathJsonNumberObject, MathJsonSymbol } from '../math-json/types';
|
|
4
4
|
import { NumericValue } from './numeric-value/types';
|
|
@@ -11,7 +11,7 @@ type SymbolHost = ComputeEngine & {
|
|
|
11
11
|
strict: boolean;
|
|
12
12
|
Nothing: Expression;
|
|
13
13
|
lookupDefinition(id: MathJsonSymbol): undefined | BoxedDefinition;
|
|
14
|
-
_declareSymbolValue(name: MathJsonSymbol, def: Partial<ValueDefinition
|
|
14
|
+
_declareSymbolValue(name: MathJsonSymbol, def: Partial<ValueDefinition>, scope?: import('./global-types').Scope): BoxedDefinition;
|
|
15
15
|
error(message: string | string[], where?: string): Expression;
|
|
16
16
|
};
|
|
17
17
|
type NumberHost = ComputeEngine & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
import type { LatexDictionaryEntry, LibraryCategory } from './latex-syntax/types';
|
|
3
3
|
export declare function resolveBootstrapLibraries(libraries?: readonly (string | LibraryDefinition)[]): LibraryDefinition[];
|
|
4
4
|
export declare function loadLibraryDefinitions(engine: ComputeEngine, libraries: readonly LibraryDefinition[]): void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import type { IComputeEngine, Scope, EvalContext } from './global-types';
|
|
1
|
+
/* 0.53.0 */
|
|
3
2
|
export declare function pushScope(ce: IComputeEngine, scope?: Scope, name?: string): void;
|
|
4
3
|
export declare function popScope(ce: IComputeEngine): void;
|
|
5
4
|
export declare function pushEvalContext(ce: IComputeEngine, scope: Scope, name?: string): void;
|
|
@@ -9,5 +8,3 @@ export declare function printStack(ce: IComputeEngine, options?: {
|
|
|
9
8
|
details?: boolean;
|
|
10
9
|
maxDepth?: number;
|
|
11
10
|
}): void;
|
|
12
|
-
export declare function lookupContext(ce: IComputeEngine, id: MathJsonSymbol): EvalContext | undefined;
|
|
13
|
-
export declare function swapContext(ce: IComputeEngine, context: EvalContext): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
export declare function declareSequence(ce: IComputeEngine, name: string, def: SequenceDefinition): IComputeEngine;
|
|
3
3
|
export declare function getSequenceStatus(ce: IComputeEngine, name: string): SequenceStatus;
|
|
4
4
|
export declare function getSequence(ce: IComputeEngine, name: string): SequenceInfo | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
import type { Type, TypeString } from '../common/type/types';
|
|
3
3
|
import type { LatexString } from './latex-syntax/types';
|
|
4
4
|
import { compile as compileExpr } from './compilation/compile-expression';
|
|
@@ -20,9 +20,9 @@ export declare function assign(id: string, value: AssignValue): void;
|
|
|
20
20
|
export declare function assign(ids: {
|
|
21
21
|
[id: string]: AssignValue;
|
|
22
22
|
}): void;
|
|
23
|
-
export declare function expand(expr: LatexString | ExpressionInput): Expression
|
|
23
|
+
export declare function expand(expr: LatexString | ExpressionInput): Expression;
|
|
24
24
|
export declare function solve(expr: LatexString | ExpressionInput, vars?: string | Iterable<string> | Expression | Iterable<Expression>): null | ReadonlyArray<Expression> | Record<string, Expression> | Array<Record<string, Expression>>;
|
|
25
|
-
export declare function expandAll(expr: LatexString | ExpressionInput): Expression
|
|
25
|
+
export declare function expandAll(expr: LatexString | ExpressionInput): Expression;
|
|
26
26
|
export declare function factor(expr: LatexString | ExpressionInput): Expression;
|
|
27
27
|
export declare function compile<T extends string = 'javascript'>(expr: LatexString | ExpressionInput, options: Parameters<typeof compileExpr>[1] & {
|
|
28
28
|
to?: T;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
import type { BoxedDefinition, Expression, IComputeEngine as ComputeEngine, Scope } from './global-types';
|
|
3
3
|
/***
|
|
4
4
|
* ### THEORY OF OPERATIONS
|
|
@@ -11,27 +11,33 @@ import type { BoxedDefinition, Expression, IComputeEngine as ComputeEngine, Scop
|
|
|
11
11
|
* (e.g. `["Function", ["Block", ["Add", "_", 1]], "_"]`).
|
|
12
12
|
*
|
|
13
13
|
*
|
|
14
|
-
* #### DURING
|
|
15
|
-
*
|
|
16
|
-
* During the boxing/canonicalization phase of a function
|
|
17
|
-
* (`["Function"]` expression or operator of expression):
|
|
14
|
+
* #### DURING CANONICALIZATION (in canonicalFunctionLiteralArguments())
|
|
18
15
|
*
|
|
19
16
|
* 1/ If not a `["Function"]` expression, the expression is rewritten
|
|
20
17
|
* to a `["Function"]` expression with anonymous parameters
|
|
21
|
-
* 2/ A
|
|
22
|
-
* 3/ The function parameters are declared in the scope
|
|
23
|
-
* 4/ The function body is
|
|
24
|
-
*
|
|
18
|
+
* 2/ A `Block` scope is created
|
|
19
|
+
* 3/ The function parameters are declared in the Block's scope
|
|
20
|
+
* 4/ The function body is canonicalized in the context of the scope.
|
|
21
|
+
* The Block's localScope captures the defining scope as its parent.
|
|
25
22
|
*
|
|
26
23
|
*
|
|
27
24
|
* #### DURING EVALUATION (executing the result of makeLambda())
|
|
28
25
|
*
|
|
29
|
-
* 1/ The arguments are evaluated in the
|
|
30
|
-
* 2/
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
26
|
+
* 1/ The arguments are evaluated in the **calling** scope
|
|
27
|
+
* 2/ A fresh scope is created per call, with parent = the **defining**
|
|
28
|
+
* scope (body.localScope.parent), giving true lexical scoping
|
|
29
|
+
* 3/ The function parameters are declared in the fresh scope
|
|
30
|
+
* 4/ body.localScope is temporarily re-parented to chain through the
|
|
31
|
+
* fresh scope: bigOpScope → bodyScope → freshScope → capturedScope.
|
|
32
|
+
* Param bindings in bodyScope (stale, from canonicalization) are
|
|
33
|
+
* temporarily hidden so they don't shadow freshScope's values.
|
|
34
|
+
* This lets nested scoped expressions (Sum, Product) find params
|
|
35
|
+
* by walking up their static scope chain.
|
|
36
|
+
* 5/ The function body is evaluated in the context of the fresh scope
|
|
37
|
+
* 6/ If the result contains Function literals, they are rebound to
|
|
38
|
+
* close over the fresh scope (closure capture)
|
|
39
|
+
* 7/ The fresh scope is discarded; body.localScope.parent is restored
|
|
40
|
+
* 8/ The result is returned
|
|
35
41
|
*
|
|
36
42
|
*/
|
|
37
43
|
/**
|
|
@@ -87,6 +93,19 @@ export declare function canonicalFunctionLiteralArguments(ce: ComputeEngine, ops
|
|
|
87
93
|
* - the symbol for a function, e.g. `Sin`.
|
|
88
94
|
*/
|
|
89
95
|
export declare function apply(fn: Expression, args: ReadonlyArray<Expression>): Expression;
|
|
96
|
+
/**
|
|
97
|
+
* Evaluate a sequence of statements, handling Return/Break/Continue.
|
|
98
|
+
*
|
|
99
|
+
* Used by both:
|
|
100
|
+
* - `evaluateBlock` in control-structures.ts (Block evaluation handler)
|
|
101
|
+
* - `makeLambda` below (iterates body.ops directly instead of calling
|
|
102
|
+
* body.evaluate(), because body is a Block whose _localScope has param
|
|
103
|
+
* bindings from canonicalization — declared with type 'unknown' but no
|
|
104
|
+
* value. If body.evaluate() were called, Block would push its _localScope
|
|
105
|
+
* as the eval context, and lookup() would find those stale bindings
|
|
106
|
+
* before reaching the freshScope where actual param values live.)
|
|
107
|
+
*/
|
|
108
|
+
export declare function evaluateStatements(ce: ComputeEngine, ops: Iterable<Expression>): Expression;
|
|
90
109
|
/**
|
|
91
110
|
* Return a lambda function, assuming a scoped environment has been
|
|
92
111
|
* created and there is a single numeric argument
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
export type * from './types-serialization';
|
|
3
3
|
export type { ValueDefinition, SequenceDefinition, SequenceStatus, SequenceInfo, OEISSequenceInfo, OEISOptions, OperatorDefinition, BaseDefinition, SimplifyOptions, SymbolDefinition, SymbolDefinitions, LibraryDefinition, AngularUnit, Sign, BaseCollectionHandlers, IndexedCollectionHandlers, CollectionHandlers, TaggedValueDefinition, TaggedOperatorDefinition, BoxedDefinition, BoxedBaseDefinition, BoxedValueDefinition, OperatorDefinitionFlags, BoxedOperatorDefinition, } from './types-definitions';
|
|
4
4
|
export type * from './types-evaluation';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { Type, TypeResolver, TypeString } from '../common/type/types';
|
|
4
4
|
import { BoxedType } from '../common/type/boxed-type';
|
|
@@ -25,7 +25,6 @@ export { JavaScriptTarget } from './compilation/javascript-target';
|
|
|
25
25
|
export { GLSLTarget } from './compilation/glsl-target';
|
|
26
26
|
export { PythonTarget } from './compilation/python-target';
|
|
27
27
|
export { IntervalJavaScriptTarget } from './compilation/interval-javascript-target';
|
|
28
|
-
export { IntervalGLSLTarget } from './compilation/interval-glsl-target';
|
|
29
28
|
export { BaseCompiler } from './compilation/base-compiler';
|
|
30
29
|
import type { LanguageTarget } from './compilation/types';
|
|
31
30
|
import { compile as _compile } from './compilation/compile-expression';
|
|
@@ -112,9 +111,8 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
112
111
|
/**
|
|
113
112
|
* The stack of evaluation contexts.
|
|
114
113
|
*
|
|
115
|
-
* An **evaluation context**
|
|
116
|
-
* values
|
|
117
|
-
*
|
|
114
|
+
* An **evaluation context** tracks the current lexical scope and
|
|
115
|
+
* assumptions. Symbol values are stored in their definitions, not here.
|
|
118
116
|
*/
|
|
119
117
|
_evalContextStack: EvalContext[];
|
|
120
118
|
/** The current evaluation context */
|
|
@@ -301,7 +299,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
301
299
|
* ```typescript
|
|
302
300
|
* const ce = new ComputeEngine();
|
|
303
301
|
* console.log(ce.listCompilationTargets());
|
|
304
|
-
* // → ['javascript', 'glsl', '
|
|
302
|
+
* // → ['javascript', 'glsl', 'wgsl', 'interval-js']
|
|
305
303
|
* ```
|
|
306
304
|
*/
|
|
307
305
|
listCompilationTargets(): string[];
|
|
@@ -569,10 +567,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
569
567
|
*/
|
|
570
568
|
_declareSymbolOperator(name: string, def: OperatorDefinition, scope?: Scope): BoxedDefinition;
|
|
571
569
|
/**
|
|
572
|
-
*
|
|
573
|
-
* Create a new lexical scope and matching evaluation context and add it
|
|
574
|
-
* to the evaluation context stack.
|
|
575
|
-
*
|
|
570
|
+
* Push a new lexical scope (and its evaluation context) onto the stack.
|
|
576
571
|
*/
|
|
577
572
|
pushScope(scope?: Scope, name?: string): void;
|
|
578
573
|
/**
|
|
@@ -599,13 +594,6 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
599
594
|
* @internal
|
|
600
595
|
*/
|
|
601
596
|
_setSymbolValue(id: MathJsonSymbol, value: Expression | boolean | number | undefined): void;
|
|
602
|
-
/**
|
|
603
|
-
* Set a value directly in the current context's values map.
|
|
604
|
-
* This is used for assumptions so that the value is scoped to the current
|
|
605
|
-
* evaluation context and is automatically removed when the scope is popped.
|
|
606
|
-
* @internal
|
|
607
|
-
*/
|
|
608
|
-
_setCurrentContextValue(id: MathJsonSymbol, value: Expression | boolean | number | undefined): void;
|
|
609
597
|
/**
|
|
610
598
|
* Declare a symbol in the current lexical scope: specify their type and
|
|
611
599
|
* other attributes, including optionally a value.
|
|
@@ -725,15 +713,6 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
725
713
|
matches: OEISSequenceInfo[];
|
|
726
714
|
terms: number[];
|
|
727
715
|
}>;
|
|
728
|
-
/**
|
|
729
|
-
* Return an evaluation context in which the symbol is defined.
|
|
730
|
-
*/
|
|
731
|
-
lookupContext(id: MathJsonSymbol): EvalContext | undefined;
|
|
732
|
-
/** Find the context in the stack frame, and set the stack frame to
|
|
733
|
-
* it. This is used to evaluate expressions in the context of
|
|
734
|
-
* a different scope.
|
|
735
|
-
*/
|
|
736
|
-
_swapContext(context: EvalContext): void;
|
|
737
716
|
/**
|
|
738
717
|
* Assign a value to a symbol in the current scope.
|
|
739
718
|
* Use `undefined` to reset the symbol to no value.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
export declare const DEFINITIONS_CALCULUS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.53.0 */
|
|
2
2
|
export declare const DEFINITIONS_COMPLEX: LatexDictionary;
|