@cortex-js/compute-engine 0.55.4 → 0.55.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compile.esm.js +100 -13
- package/dist/compile.min.esm.js +101 -49
- package/dist/compile.min.umd.cjs +101 -49
- package/dist/compile.umd.cjs +100 -13
- package/dist/compute-engine.esm.js +102 -14
- package/dist/compute-engine.min.esm.js +114 -62
- package/dist/compute-engine.min.umd.cjs +114 -62
- package/dist/compute-engine.umd.cjs +102 -14
- package/dist/core.esm.js +100 -13
- package/dist/core.min.esm.js +113 -61
- package/dist/core.min.umd.cjs +113 -61
- package/dist/core.umd.cjs +100 -13
- package/dist/interval.esm.js +2 -2
- package/dist/interval.min.esm.js +2 -2
- package/dist/interval.min.umd.cjs +2 -2
- package/dist/interval.umd.cjs +2 -2
- package/dist/latex-syntax.esm.js +2 -2
- package/dist/latex-syntax.min.esm.js +2 -2
- package/dist/latex-syntax.min.umd.cjs +2 -2
- package/dist/latex-syntax.umd.cjs +2 -2
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.umd.cjs +2 -2
- package/dist/math-json.umd.cjs +2 -2
- package/dist/numerics.esm.js +2 -2
- package/dist/numerics.min.esm.js +2 -2
- package/dist/numerics.min.umd.cjs +2 -2
- package/dist/numerics.umd.cjs +2 -2
- package/dist/types/big-decimal/big-decimal.d.ts +1 -1
- package/dist/types/big-decimal/index.d.ts +1 -1
- package/dist/types/big-decimal/transcendentals.d.ts +1 -1
- package/dist/types/big-decimal/utils.d.ts +1 -1
- 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/compile.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/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 +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/types/compute-engine/boxed-expression/constants.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
- 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 +3 -2
- package/dist/types/compute-engine/compilation/constant-folding.d.ts +1 -1
- package/dist/types/compute-engine/compilation/fractal-orbit.d.ts +9 -3
- package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/gpu-target.d.ts +12 -5
- 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 +22 -3
- 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 -1
- package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +1 -1
- package/dist/types/compute-engine/engine-extension-contracts.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-runtime-state.d.ts +1 -1
- package/dist/types/compute-engine/engine-scope.d.ts +1 -1
- 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 +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/global-types.d.ts +1 -1
- package/dist/types/compute-engine/index.d.ts +3 -2
- 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/default-dictionary.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/latex-syntax.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 +1 -1
- package/dist/types/compute-engine/library/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-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/linear-algebra.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 +1 -1
- package/dist/types/compute-engine/types-engine.d.ts +1 -1
- package/dist/types/compute-engine/types-evaluation.d.ts +1 -1
- package/dist/types/compute-engine/types-expression.d.ts +1 -1
- package/dist/types/compute-engine/types-kernel-evaluation.d.ts +1 -1
- 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 +3 -2
- package/dist/types/core.d.ts +1 -1
- package/dist/types/interval.d.ts +1 -1
- package/dist/types/latex-syntax.d.ts +2 -2
- 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/dist/types/numerics.d.ts +1 -1
- package/package.json +1 -1
package/dist/compile.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.55.
|
|
1
|
+
/** Compute Engine 0.55.5 */
|
|
2
2
|
|
|
3
3
|
// src/compute-engine/numerics/richardson.ts
|
|
4
4
|
function extrapolate(f, x0, options = {}) {
|
|
@@ -15066,7 +15066,8 @@ function compile(expr, options) {
|
|
|
15066
15066
|
vars: options?.vars,
|
|
15067
15067
|
imports: options?.imports,
|
|
15068
15068
|
preamble: options?.preamble,
|
|
15069
|
-
realOnly: options?.realOnly
|
|
15069
|
+
realOnly: options?.realOnly,
|
|
15070
|
+
hints: options?.hints
|
|
15070
15071
|
});
|
|
15071
15072
|
} catch (e) {
|
|
15072
15073
|
if (options?.fallback ?? true) {
|
|
@@ -20749,12 +20750,22 @@ function fibonacci(n) {
|
|
|
20749
20750
|
}
|
|
20750
20751
|
|
|
20751
20752
|
// src/compute-engine/compilation/fractal-orbit.ts
|
|
20753
|
+
function toBigDecimal(v) {
|
|
20754
|
+
if (typeof v === "object" && "hi" in v)
|
|
20755
|
+
return new BigDecimal(v.hi).add(new BigDecimal(v.lo));
|
|
20756
|
+
return new BigDecimal(v);
|
|
20757
|
+
}
|
|
20758
|
+
function hpToNumber(v) {
|
|
20759
|
+
if (typeof v === "number") return v;
|
|
20760
|
+
if (typeof v === "string") return Number(v);
|
|
20761
|
+
return v.hi + v.lo;
|
|
20762
|
+
}
|
|
20752
20763
|
function computeReferenceOrbit(center, maxIter, precision) {
|
|
20753
20764
|
const prevPrecision = BigDecimal.precision;
|
|
20754
20765
|
BigDecimal.precision = precision;
|
|
20755
20766
|
try {
|
|
20756
|
-
const cr =
|
|
20757
|
-
const ci =
|
|
20767
|
+
const cr = toBigDecimal(center[0]);
|
|
20768
|
+
const ci = toBigDecimal(center[1]);
|
|
20758
20769
|
let zr = BigDecimal.ZERO;
|
|
20759
20770
|
let zi = BigDecimal.ZERO;
|
|
20760
20771
|
const ESCAPE = new BigDecimal(256);
|
|
@@ -21362,12 +21373,12 @@ var GPU_FUNCTIONS = {
|
|
|
21362
21373
|
const iterCode = compileIntArg(maxIter, compile2, target);
|
|
21363
21374
|
const strategy = selectFractalStrategy(target);
|
|
21364
21375
|
if (strategy === "double") {
|
|
21365
|
-
const
|
|
21366
|
-
return `_fractal_mandelbrot_dp(
|
|
21376
|
+
const dpCoord = target?.language === "wgsl" ? "_dp_coord(v_uv)" : "_dp_coord()";
|
|
21377
|
+
return `_fractal_mandelbrot_dp(${dpCoord}, ${iterCode})`;
|
|
21367
21378
|
}
|
|
21368
21379
|
if (strategy === "perturbation") {
|
|
21369
|
-
const
|
|
21370
|
-
return `_fractal_mandelbrot_pt(${
|
|
21380
|
+
const ptDelta = target?.language === "wgsl" ? "_pt_delta(v_uv)" : "_pt_delta()";
|
|
21381
|
+
return `_fractal_mandelbrot_pt(${ptDelta}, ${iterCode})`;
|
|
21371
21382
|
}
|
|
21372
21383
|
return `_fractal_mandelbrot(${compile2(c)}, ${iterCode})`;
|
|
21373
21384
|
},
|
|
@@ -21377,14 +21388,14 @@ var GPU_FUNCTIONS = {
|
|
|
21377
21388
|
const iterCode = compileIntArg(maxIter, compile2, target);
|
|
21378
21389
|
const strategy = selectFractalStrategy(target);
|
|
21379
21390
|
if (strategy === "double") {
|
|
21380
|
-
const
|
|
21391
|
+
const dpCoord = target?.language === "wgsl" ? "_dp_coord(v_uv)" : "_dp_coord()";
|
|
21381
21392
|
const cCode = compile2(c);
|
|
21382
|
-
return `_fractal_julia_dp(
|
|
21393
|
+
return `_fractal_julia_dp(${dpCoord}, vec4(${cCode}, vec2(0.0)), ${iterCode})`;
|
|
21383
21394
|
}
|
|
21384
21395
|
if (strategy === "perturbation") {
|
|
21385
|
-
const
|
|
21396
|
+
const ptDelta = target?.language === "wgsl" ? "_pt_delta(v_uv)" : "_pt_delta()";
|
|
21386
21397
|
const cCode = compile2(c);
|
|
21387
|
-
return `_fractal_julia_pt(${
|
|
21398
|
+
return `_fractal_julia_pt(${ptDelta}, ${cCode}, ${iterCode})`;
|
|
21388
21399
|
}
|
|
21389
21400
|
return `_fractal_julia(${compile2(z)}, ${compile2(c)}, ${iterCode})`;
|
|
21390
21401
|
},
|
|
@@ -22099,6 +22110,23 @@ fn ds_cmp(a: vec2f, b: vec2f) -> f32 {
|
|
|
22099
22110
|
}
|
|
22100
22111
|
`;
|
|
22101
22112
|
var GPU_FRACTAL_DP_PREAMBLE_GLSL = `
|
|
22113
|
+
uniform float _dp_cx_hi;
|
|
22114
|
+
uniform float _dp_cx_lo;
|
|
22115
|
+
uniform float _dp_cy_hi;
|
|
22116
|
+
uniform float _dp_cy_lo;
|
|
22117
|
+
uniform float _dp_w;
|
|
22118
|
+
uniform float _dp_h;
|
|
22119
|
+
|
|
22120
|
+
vec4 _dp_coord() {
|
|
22121
|
+
// Per-pixel offset from center \u2014 small, so float-precise
|
|
22122
|
+
float dx = (v_uv.x - 0.5) * _dp_w;
|
|
22123
|
+
float dy = (v_uv.y - 0.5) * _dp_h;
|
|
22124
|
+
// Combine center (hi+lo) + delta with emulated double precision
|
|
22125
|
+
vec2 cre = ds_add(vec2(_dp_cx_hi, _dp_cx_lo), ds_from(dx));
|
|
22126
|
+
vec2 cim = ds_add(vec2(_dp_cy_hi, _dp_cy_lo), ds_from(dy));
|
|
22127
|
+
return vec4(cre.x, cim.x, cre.y, cim.y);
|
|
22128
|
+
}
|
|
22129
|
+
|
|
22102
22130
|
float _fractal_mandelbrot_dp(vec4 c, int maxIter) {
|
|
22103
22131
|
// c = (re_hi, im_hi, re_lo, im_lo)
|
|
22104
22132
|
vec2 cr = vec2(c.x, c.z); // real part as ds
|
|
@@ -22139,6 +22167,21 @@ float _fractal_julia_dp(vec4 z_in, vec4 c, int maxIter) {
|
|
|
22139
22167
|
}
|
|
22140
22168
|
`;
|
|
22141
22169
|
var GPU_FRACTAL_DP_PREAMBLE_WGSL = `
|
|
22170
|
+
@group(0) @binding(10) var<uniform> _dp_cx_hi: f32;
|
|
22171
|
+
@group(0) @binding(11) var<uniform> _dp_cx_lo: f32;
|
|
22172
|
+
@group(0) @binding(12) var<uniform> _dp_cy_hi: f32;
|
|
22173
|
+
@group(0) @binding(13) var<uniform> _dp_cy_lo: f32;
|
|
22174
|
+
@group(0) @binding(14) var<uniform> _dp_w: f32;
|
|
22175
|
+
@group(0) @binding(15) var<uniform> _dp_h: f32;
|
|
22176
|
+
|
|
22177
|
+
fn _dp_coord(uv: vec2f) -> vec4f {
|
|
22178
|
+
let dx = (uv.x - 0.5) * _dp_w;
|
|
22179
|
+
let dy = (uv.y - 0.5) * _dp_h;
|
|
22180
|
+
let cre = ds_add(vec2f(_dp_cx_hi, _dp_cx_lo), ds_from(dx));
|
|
22181
|
+
let cim = ds_add(vec2f(_dp_cy_hi, _dp_cy_lo), ds_from(dy));
|
|
22182
|
+
return vec4f(cre.x, cim.x, cre.y, cim.y);
|
|
22183
|
+
}
|
|
22184
|
+
|
|
22142
22185
|
fn _fractal_mandelbrot_dp(c: vec4f, maxIter: i32) -> f32 {
|
|
22143
22186
|
let cr = vec2f(c.x, c.z);
|
|
22144
22187
|
let ci = vec2f(c.y, c.w);
|
|
@@ -22224,6 +22267,16 @@ var GPU_FRACTAL_PT_PREAMBLE_GLSL = `
|
|
|
22224
22267
|
uniform sampler2D _refOrbit;
|
|
22225
22268
|
uniform int _refOrbitLen;
|
|
22226
22269
|
uniform int _refOrbitTexWidth;
|
|
22270
|
+
uniform float _pt_offset_x;
|
|
22271
|
+
uniform float _pt_offset_y;
|
|
22272
|
+
uniform float _pt_w;
|
|
22273
|
+
uniform float _pt_h;
|
|
22274
|
+
|
|
22275
|
+
vec2 _pt_delta() {
|
|
22276
|
+
float dx = _pt_offset_x + (v_uv.x - 0.5) * _pt_w;
|
|
22277
|
+
float dy = _pt_offset_y + (v_uv.y - 0.5) * _pt_h;
|
|
22278
|
+
return vec2(dx, dy);
|
|
22279
|
+
}
|
|
22227
22280
|
|
|
22228
22281
|
vec2 _pt_fetch_orbit(int i) {
|
|
22229
22282
|
int y = i / _refOrbitTexWidth;
|
|
@@ -22315,6 +22368,16 @@ var GPU_FRACTAL_PT_PREAMBLE_WGSL = `
|
|
|
22315
22368
|
@group(0) @binding(1) var _refOrbit: texture_2d<f32>;
|
|
22316
22369
|
var<uniform> _refOrbitLen: i32;
|
|
22317
22370
|
var<uniform> _refOrbitTexWidth: i32;
|
|
22371
|
+
var<uniform> _pt_offset_x: f32;
|
|
22372
|
+
var<uniform> _pt_offset_y: f32;
|
|
22373
|
+
var<uniform> _pt_w: f32;
|
|
22374
|
+
var<uniform> _pt_h: f32;
|
|
22375
|
+
|
|
22376
|
+
fn _pt_delta(uv: vec2f) -> vec2f {
|
|
22377
|
+
let dx = _pt_offset_x + (uv.x - 0.5) * _pt_w;
|
|
22378
|
+
let dy = _pt_offset_y + (uv.y - 0.5) * _pt_h;
|
|
22379
|
+
return vec2f(dx, dy);
|
|
22380
|
+
}
|
|
22318
22381
|
|
|
22319
22382
|
fn _pt_fetch_orbit(i: i32) -> vec2f {
|
|
22320
22383
|
let y = i / _refOrbitTexWidth;
|
|
@@ -22912,8 +22975,32 @@ var GPUShaderTarget = class {
|
|
|
22912
22975
|
break;
|
|
22913
22976
|
}
|
|
22914
22977
|
}
|
|
22978
|
+
if ((code.includes("_fractal_mandelbrot_dp") || code.includes("_fractal_julia_dp")) && options.hints?.viewport) {
|
|
22979
|
+
const cx = hpToNumber(options.hints.viewport.center[0]);
|
|
22980
|
+
const cy = hpToNumber(options.hints.viewport.center[1]);
|
|
22981
|
+
const size = options.hints.viewport.radius * 2;
|
|
22982
|
+
const cx_hi = Math.fround(cx);
|
|
22983
|
+
const cy_hi = Math.fround(cy);
|
|
22984
|
+
result.uniforms = {
|
|
22985
|
+
...result.uniforms,
|
|
22986
|
+
_dp_cx_hi: cx_hi,
|
|
22987
|
+
_dp_cx_lo: cx - cx_hi,
|
|
22988
|
+
_dp_cy_hi: cy_hi,
|
|
22989
|
+
_dp_cy_lo: cy - cy_hi,
|
|
22990
|
+
_dp_w: size,
|
|
22991
|
+
_dp_h: size
|
|
22992
|
+
};
|
|
22993
|
+
}
|
|
22915
22994
|
if ((code.includes("_fractal_mandelbrot_pt") || code.includes("_fractal_julia_pt")) && options.hints?.viewport) {
|
|
22916
22995
|
const viewport = options.hints.viewport;
|
|
22996
|
+
const size = viewport.radius * 2;
|
|
22997
|
+
result.uniforms = {
|
|
22998
|
+
...result.uniforms,
|
|
22999
|
+
_pt_offset_x: 0,
|
|
23000
|
+
_pt_offset_y: 0,
|
|
23001
|
+
_pt_w: size,
|
|
23002
|
+
_pt_h: size
|
|
23003
|
+
};
|
|
22917
23004
|
const digits = Math.max(50, Math.ceil(-Math.log10(viewport.radius)) + 10);
|
|
22918
23005
|
const maxIter = 1e3;
|
|
22919
23006
|
const orbit = computeReferenceOrbit(
|
|
@@ -25272,7 +25359,7 @@ function compileToIntervalTarget(expr, target) {
|
|
|
25272
25359
|
}
|
|
25273
25360
|
|
|
25274
25361
|
// src/compile.ts
|
|
25275
|
-
var version = "0.55.
|
|
25362
|
+
var version = "0.55.5";
|
|
25276
25363
|
export {
|
|
25277
25364
|
BaseCompiler,
|
|
25278
25365
|
GLSLTarget,
|