universal-physics-tensor 10.0.0 → 12.0.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 +39 -36
- package/bin/upt.mjs +13 -1
- package/data/applied-cases.json +1892 -0
- package/data/applied-cases.schema.json +194 -0
- package/data/atlas/atlas.json +25 -25
- package/data/atlas/atlas.jsonld +1 -1
- package/data/atlas/diffusion.json +6 -6
- package/data/atlas/oscillators.json +7 -7
- package/data/atlas/waves.json +14 -14
- package/data/atlas/witness-results.json +11 -11
- package/data/bridge-catalog.json +389 -230
- package/data/bridge-catalog.schema.json +45 -7
- package/data/units.json +6 -25
- package/dist/atlas/applicability.d.ts.map +1 -1
- package/dist/atlas/applicability.js +21 -15
- package/dist/atlas/applicability.js.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts +9 -1
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.js +15 -13
- package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
- package/dist/atlas/benchmark/loader.js +2 -2
- package/dist/atlas/benchmark/loader.js.map +1 -1
- package/dist/atlas/benchmark/stats.d.ts +2 -2
- package/dist/atlas/benchmark/stats.d.ts.map +1 -1
- package/dist/atlas/benchmark/stats.js +9 -15
- package/dist/atlas/benchmark/stats.js.map +1 -1
- package/dist/atlas/catalog-formal-ref.d.ts +26 -3
- package/dist/atlas/catalog-formal-ref.d.ts.map +1 -1
- package/dist/atlas/catalog-formal-ref.js +52 -5
- package/dist/atlas/catalog-formal-ref.js.map +1 -1
- package/dist/atlas/chain-pipeline.d.ts.map +1 -1
- package/dist/atlas/chain-pipeline.js +7 -8
- package/dist/atlas/chain-pipeline.js.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.d.ts +0 -4
- package/dist/atlas/diffusion/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.js +8 -12
- package/dist/atlas/diffusion/bridges-closure.js.map +1 -1
- package/dist/atlas/diffusion/bridges.d.ts.map +1 -1
- package/dist/atlas/diffusion/bridges.js +27 -39
- package/dist/atlas/diffusion/bridges.js.map +1 -1
- package/dist/atlas/diffusion/dimensions.d.ts +6 -14
- package/dist/atlas/diffusion/dimensions.d.ts.map +1 -1
- package/dist/atlas/diffusion/dimensions.js +8 -16
- package/dist/atlas/diffusion/dimensions.js.map +1 -1
- package/dist/atlas/diffusion/models.d.ts +3 -3
- package/dist/atlas/diffusion/models.d.ts.map +1 -1
- package/dist/atlas/diffusion/models.js +5 -10
- package/dist/atlas/diffusion/models.js.map +1 -1
- package/dist/atlas/diffusion/numerics.d.ts +16 -4
- package/dist/atlas/diffusion/numerics.d.ts.map +1 -1
- package/dist/atlas/diffusion/numerics.js +38 -24
- package/dist/atlas/diffusion/numerics.js.map +1 -1
- package/dist/atlas/link-prediction.d.ts +106 -3
- package/dist/atlas/link-prediction.d.ts.map +1 -1
- package/dist/atlas/link-prediction.js +212 -66
- package/dist/atlas/link-prediction.js.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.js +7 -11
- package/dist/atlas/oscillators/bridges-coarse.js.map +1 -1
- package/dist/atlas/oscillators/bridges-exact.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-exact.js +6 -7
- package/dist/atlas/oscillators/bridges-exact.js.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.d.ts +3 -16
- package/dist/atlas/oscillators/bridges-limits.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.js +23 -34
- package/dist/atlas/oscillators/bridges-limits.js.map +1 -1
- package/dist/atlas/oscillators/dimensions.d.ts +9 -21
- package/dist/atlas/oscillators/dimensions.d.ts.map +1 -1
- package/dist/atlas/oscillators/dimensions.js +9 -21
- package/dist/atlas/oscillators/dimensions.js.map +1 -1
- package/dist/atlas/oscillators/limit-witnesses.d.ts +2 -2
- package/dist/atlas/oscillators/limit-witnesses.d.ts.map +1 -1
- package/dist/atlas/oscillators/limit-witnesses.js +17 -15
- package/dist/atlas/oscillators/limit-witnesses.js.map +1 -1
- package/dist/atlas/oscillators/models.d.ts.map +1 -1
- package/dist/atlas/oscillators/models.js +2 -6
- package/dist/atlas/oscillators/models.js.map +1 -1
- package/dist/atlas/oscillators/pendulum-motion.d.ts +29 -6
- package/dist/atlas/oscillators/pendulum-motion.d.ts.map +1 -1
- package/dist/atlas/oscillators/pendulum-motion.js +60 -40
- package/dist/atlas/oscillators/pendulum-motion.js.map +1 -1
- package/dist/atlas/oscillators/phase-translation.d.ts +0 -11
- package/dist/atlas/oscillators/phase-translation.d.ts.map +1 -1
- package/dist/atlas/oscillators/phase-translation.js +3 -4
- package/dist/atlas/oscillators/phase-translation.js.map +1 -1
- package/dist/atlas/oscillators/position-translation.d.ts +68 -7
- package/dist/atlas/oscillators/position-translation.d.ts.map +1 -1
- package/dist/atlas/oscillators/position-translation.js +123 -12
- package/dist/atlas/oscillators/position-translation.js.map +1 -1
- package/dist/atlas/oscillators/rejections.d.ts +0 -2
- package/dist/atlas/oscillators/rejections.d.ts.map +1 -1
- package/dist/atlas/oscillators/rejections.js +0 -7
- package/dist/atlas/oscillators/rejections.js.map +1 -1
- package/dist/atlas/physjs-entries.generated.d.ts +35 -25
- package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
- package/dist/atlas/physjs-entries.generated.js +37 -25
- package/dist/atlas/physjs-entries.generated.js.map +1 -1
- package/dist/atlas/physjs-ref.d.ts +34 -31
- package/dist/atlas/physjs-ref.d.ts.map +1 -1
- package/dist/atlas/physjs-ref.js +55 -53
- package/dist/atlas/physjs-ref.js.map +1 -1
- package/dist/atlas/physjs-reviewed.d.ts +1 -1
- package/dist/atlas/physjs-reviewed.js +15 -15
- package/dist/atlas/physjs-reviewed.js.map +1 -1
- package/dist/atlas/poster/statements.d.ts +0 -19
- package/dist/atlas/poster/statements.d.ts.map +1 -1
- package/dist/atlas/poster/statements.js +1 -1
- package/dist/atlas/poster/statements.js.map +1 -1
- package/dist/atlas/proof-target.d.ts +1 -1
- package/dist/atlas/proof-target.js +1 -1
- package/dist/atlas/proof-target.js.map +1 -1
- package/dist/atlas/regime.d.ts +1 -1
- package/dist/atlas/regime.d.ts.map +1 -1
- package/dist/atlas/regime.js +1 -1
- package/dist/atlas/regime.js.map +1 -1
- package/dist/atlas/text-overlap.d.ts +23 -0
- package/dist/atlas/text-overlap.d.ts.map +1 -0
- package/dist/atlas/text-overlap.js +41 -0
- package/dist/atlas/text-overlap.js.map +1 -0
- package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/waves/bridges-closure.js +2 -6
- package/dist/atlas/waves/bridges-closure.js.map +1 -1
- package/dist/atlas/waves/bridges.d.ts.map +1 -1
- package/dist/atlas/waves/bridges.js +32 -48
- package/dist/atlas/waves/bridges.js.map +1 -1
- package/dist/atlas/waves/models.d.ts +5 -6
- package/dist/atlas/waves/models.d.ts.map +1 -1
- package/dist/atlas/waves/models.js +7 -13
- package/dist/atlas/waves/models.js.map +1 -1
- package/dist/atlas/waves/numerics.d.ts.map +1 -1
- package/dist/atlas/waves/numerics.js +10 -3
- package/dist/atlas/waves/numerics.js.map +1 -1
- package/dist/atlas/witness-numeric.d.ts +30 -0
- package/dist/atlas/witness-numeric.d.ts.map +1 -1
- package/dist/atlas/witness-numeric.js +53 -0
- package/dist/atlas/witness-numeric.js.map +1 -1
- package/dist/atlas/witness-specs.d.ts.map +1 -1
- package/dist/atlas/witness-specs.js +19 -0
- package/dist/atlas/witness-specs.js.map +1 -1
- package/dist/atlas/witness-symbolic.d.ts +75 -3
- package/dist/atlas/witness-symbolic.d.ts.map +1 -1
- package/dist/atlas/witness-symbolic.js +116 -10
- package/dist/atlas/witness-symbolic.js.map +1 -1
- package/dist/bridges/catalog-load.d.ts.map +1 -1
- package/dist/bridges/catalog-load.js +13 -8
- package/dist/bridges/catalog-load.js.map +1 -1
- package/dist/bridges/catalog-types.d.ts +26 -2
- package/dist/bridges/catalog-types.d.ts.map +1 -1
- package/dist/bridges/catalog-types.js +11 -1
- package/dist/bridges/catalog-types.js.map +1 -1
- package/dist/bridges/evaluation-errors.d.ts +31 -1
- package/dist/bridges/evaluation-errors.d.ts.map +1 -1
- package/dist/bridges/evaluation-errors.js +20 -2
- package/dist/bridges/evaluation-errors.js.map +1 -1
- package/dist/bridges/evaluator-inputs.d.ts.map +1 -1
- package/dist/bridges/evaluator-inputs.js +7 -5
- package/dist/bridges/evaluator-inputs.js.map +1 -1
- package/dist/bridges/evaluators.d.ts.map +1 -1
- package/dist/bridges/evaluators.js +27 -12
- package/dist/bridges/evaluators.js.map +1 -1
- package/dist/bridges/expr-parse.d.ts +11 -0
- package/dist/bridges/expr-parse.d.ts.map +1 -1
- package/dist/bridges/expr-parse.js +14 -5
- package/dist/bridges/expr-parse.js.map +1 -1
- package/dist/bridges/holds.d.ts +35 -3
- package/dist/bridges/holds.d.ts.map +1 -1
- package/dist/bridges/holds.js +117 -23
- package/dist/bridges/holds.js.map +1 -1
- package/dist/bridges/notices.d.ts.map +1 -1
- package/dist/bridges/notices.js +5 -5
- package/dist/bridges/notices.js.map +1 -1
- package/dist/bridges/relation-eval.d.ts +4 -4
- package/dist/bridges/relation-eval.d.ts.map +1 -1
- package/dist/bridges/relation-eval.js +15 -16
- package/dist/bridges/relation-eval.js.map +1 -1
- package/dist/bridges/sensitivity.d.ts.map +1 -1
- package/dist/bridges/sensitivity.js +3 -3
- package/dist/bridges/sensitivity.js.map +1 -1
- package/dist/bridges/validity.d.ts +33 -0
- package/dist/bridges/validity.d.ts.map +1 -0
- package/dist/bridges/validity.js +67 -0
- package/dist/bridges/validity.js.map +1 -0
- package/dist/canonical/entries/atomic.js +1 -3
- package/dist/canonical/entries/atomic.js.map +1 -1
- package/dist/canonical/entries/condensed-matter.d.ts.map +1 -1
- package/dist/canonical/entries/condensed-matter.js +4 -5
- package/dist/canonical/entries/condensed-matter.js.map +1 -1
- package/dist/canonical/entries/dimensional-classics.d.ts.map +1 -1
- package/dist/canonical/entries/dimensional-classics.js +3 -4
- package/dist/canonical/entries/dimensional-classics.js.map +1 -1
- package/dist/canonical/entries/electromagnetism.d.ts.map +1 -1
- package/dist/canonical/entries/electromagnetism.js +4 -10
- package/dist/canonical/entries/electromagnetism.js.map +1 -1
- package/dist/canonical/entries/fluids-waves.d.ts.map +1 -1
- package/dist/canonical/entries/fluids-waves.js +3 -7
- package/dist/canonical/entries/fluids-waves.js.map +1 -1
- package/dist/canonical/entries/mechanics.d.ts.map +1 -1
- package/dist/canonical/entries/mechanics.js +4 -6
- package/dist/canonical/entries/mechanics.js.map +1 -1
- package/dist/canonical/entries/nonmonomial.d.ts.map +1 -1
- package/dist/canonical/entries/nonmonomial.js +9 -17
- package/dist/canonical/entries/nonmonomial.js.map +1 -1
- package/dist/canonical/entries/relativity.d.ts.map +1 -1
- package/dist/canonical/entries/relativity.js +6 -6
- package/dist/canonical/entries/relativity.js.map +1 -1
- package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts.map +1 -1
- package/dist/canonical/entries/thermo-nuclear-cosmo.js +6 -10
- package/dist/canonical/entries/thermo-nuclear-cosmo.js.map +1 -1
- package/dist/canonical/fixed-points.d.ts +94 -0
- package/dist/canonical/fixed-points.d.ts.map +1 -0
- package/dist/canonical/fixed-points.js +81 -0
- package/dist/canonical/fixed-points.js.map +1 -0
- package/dist/canonical/linkage.d.ts.map +1 -1
- package/dist/canonical/linkage.js +25 -44
- package/dist/canonical/linkage.js.map +1 -1
- package/dist/canonical/normal-form.d.ts.map +1 -1
- package/dist/canonical/normal-form.js +5 -11
- package/dist/canonical/normal-form.js.map +1 -1
- package/dist/canonical/structural.d.ts +21 -21
- package/dist/canonical/structural.d.ts.map +1 -1
- package/dist/canonical/structural.js +40 -19
- package/dist/canonical/structural.js.map +1 -1
- package/dist/cases/catalog-checks.d.ts +10 -0
- package/dist/cases/catalog-checks.d.ts.map +1 -0
- package/dist/cases/catalog-checks.js +241 -0
- package/dist/cases/catalog-checks.js.map +1 -0
- package/dist/cases/catalog.d.ts +83 -0
- package/dist/cases/catalog.d.ts.map +1 -0
- package/dist/cases/catalog.js +118 -0
- package/dist/cases/catalog.js.map +1 -0
- package/dist/cases/engine.d.ts +13 -0
- package/dist/cases/engine.d.ts.map +1 -0
- package/dist/cases/engine.js +179 -0
- package/dist/cases/engine.js.map +1 -0
- package/dist/cases/index.d.ts.map +1 -1
- package/dist/cases/index.js +5 -7
- package/dist/cases/index.js.map +1 -1
- package/dist/cases/methods.d.ts +215 -0
- package/dist/cases/methods.d.ts.map +1 -0
- package/dist/cases/methods.js +743 -0
- package/dist/cases/methods.js.map +1 -0
- package/dist/cases/quadrature.d.ts +7 -9
- package/dist/cases/quadrature.d.ts.map +1 -1
- package/dist/cases/quadrature.js +28 -32
- package/dist/cases/quadrature.js.map +1 -1
- package/dist/cases/types.d.ts +12 -0
- package/dist/cases/types.d.ts.map +1 -1
- package/dist/cases/types.js.map +1 -1
- package/dist/cli/args.d.ts +25 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +30 -8
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/bindings.d.ts.map +1 -1
- package/dist/cli/bindings.js +5 -4
- package/dist/cli/bindings.js.map +1 -1
- package/dist/cli/command.d.ts +11 -1
- package/dist/cli/command.d.ts.map +1 -1
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/commands/_atlas-map.d.ts +0 -9
- package/dist/cli/commands/_atlas-map.d.ts.map +1 -1
- package/dist/cli/commands/_atlas-map.js +8 -18
- package/dist/cli/commands/_atlas-map.js.map +1 -1
- package/dist/cli/commands/_atlas-route.d.ts.map +1 -1
- package/dist/cli/commands/_atlas-route.js +6 -2
- package/dist/cli/commands/_atlas-route.js.map +1 -1
- package/dist/cli/commands/_discovery-opts.d.ts +1 -0
- package/dist/cli/commands/_discovery-opts.d.ts.map +1 -1
- package/dist/cli/commands/_discovery-opts.js +9 -9
- package/dist/cli/commands/_discovery-opts.js.map +1 -1
- package/dist/cli/commands/atlas.d.ts.map +1 -1
- package/dist/cli/commands/atlas.js +8 -5
- package/dist/cli/commands/atlas.js.map +1 -1
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +8 -1
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/axes.d.ts.map +1 -1
- package/dist/cli/commands/axes.js +20 -1
- package/dist/cli/commands/axes.js.map +1 -1
- package/dist/cli/commands/confront.d.ts.map +1 -1
- package/dist/cli/commands/confront.js +8 -14
- package/dist/cli/commands/confront.js.map +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +22 -22
- package/dist/cli/commands/derive.js.map +1 -1
- package/dist/cli/commands/discover.d.ts.map +1 -1
- package/dist/cli/commands/discover.js +122 -73
- package/dist/cli/commands/discover.js.map +1 -1
- package/dist/cli/commands/eval.d.ts.map +1 -1
- package/dist/cli/commands/eval.js +1 -0
- package/dist/cli/commands/eval.js.map +1 -1
- package/dist/cli/commands/evaluate.d.ts.map +1 -1
- package/dist/cli/commands/evaluate.js +67 -39
- package/dist/cli/commands/evaluate.js.map +1 -1
- package/dist/cli/commands/explain.d.ts.map +1 -1
- package/dist/cli/commands/explain.js +24 -3
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/ground.d.ts.map +1 -1
- package/dist/cli/commands/ground.js +7 -1
- package/dist/cli/commands/ground.js.map +1 -1
- package/dist/cli/commands/map.d.ts.map +1 -1
- package/dist/cli/commands/map.js +84 -11
- package/dist/cli/commands/map.js.map +1 -1
- package/dist/cli/commands/metric.d.ts.map +1 -1
- package/dist/cli/commands/metric.js +12 -9
- package/dist/cli/commands/metric.js.map +1 -1
- package/dist/cli/commands/path.d.ts +10 -0
- package/dist/cli/commands/path.d.ts.map +1 -1
- package/dist/cli/commands/path.js +25 -3
- package/dist/cli/commands/path.js.map +1 -1
- package/dist/cli/commands/probe.d.ts.map +1 -1
- package/dist/cli/commands/probe.js +59 -16
- package/dist/cli/commands/probe.js.map +1 -1
- package/dist/cli/commands/regime.d.ts.map +1 -1
- package/dist/cli/commands/regime.js +1 -0
- package/dist/cli/commands/regime.js.map +1 -1
- package/dist/cli/commands/retrieve.d.ts.map +1 -1
- package/dist/cli/commands/retrieve.js +1 -0
- package/dist/cli/commands/retrieve.js.map +1 -1
- package/dist/cli/commands/search.d.ts.map +1 -1
- package/dist/cli/commands/search.js +1 -0
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/symbolic.d.ts.map +1 -1
- package/dist/cli/commands/symbolic.js +19 -28
- package/dist/cli/commands/symbolic.js.map +1 -1
- package/dist/cli/commands/testplan.d.ts.map +1 -1
- package/dist/cli/commands/testplan.js +4 -2
- package/dist/cli/commands/testplan.js.map +1 -1
- package/dist/cli/determination.d.ts +1 -0
- package/dist/cli/determination.d.ts.map +1 -1
- package/dist/cli/determination.js.map +1 -1
- package/dist/cli/expr-print.d.ts +0 -2
- package/dist/cli/expr-print.d.ts.map +1 -1
- package/dist/cli/expr-print.js +7 -31
- package/dist/cli/expr-print.js.map +1 -1
- package/dist/cli/flag-help.d.ts +1 -0
- package/dist/cli/flag-help.d.ts.map +1 -1
- package/dist/cli/flag-help.js +1 -0
- package/dist/cli/flag-help.js.map +1 -1
- package/dist/cli/graphs.d.ts +2 -0
- package/dist/cli/graphs.d.ts.map +1 -1
- package/dist/cli/graphs.js +1 -0
- package/dist/cli/graphs.js.map +1 -1
- package/dist/cli/main.d.ts +8 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +19 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/numeric-flag.d.ts +12 -0
- package/dist/cli/numeric-flag.d.ts.map +1 -0
- package/dist/cli/numeric-flag.js +44 -0
- package/dist/cli/numeric-flag.js.map +1 -0
- package/dist/cli/output.d.ts +28 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +23 -0
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/record-reach.js +2 -2
- package/dist/cli/record-reach.js.map +1 -1
- package/dist/cli/record-tables.d.ts.map +1 -1
- package/dist/cli/record-tables.js +6 -5
- package/dist/cli/record-tables.js.map +1 -1
- package/dist/cli/record.d.ts +1 -5
- package/dist/cli/record.d.ts.map +1 -1
- package/dist/cli/record.js +9 -8
- package/dist/cli/record.js.map +1 -1
- package/dist/cli/search-index.d.ts.map +1 -1
- package/dist/cli/search-index.js +7 -6
- package/dist/cli/search-index.js.map +1 -1
- package/dist/cli/statuses.d.ts +0 -2
- package/dist/cli/statuses.d.ts.map +1 -1
- package/dist/cli/statuses.js +12 -9
- package/dist/cli/statuses.js.map +1 -1
- package/dist/cli/stored-results.d.ts +7 -0
- package/dist/cli/stored-results.d.ts.map +1 -0
- package/dist/cli/stored-results.js +23 -0
- package/dist/cli/stored-results.js.map +1 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.d.ts.map +1 -1
- package/dist/cli/version.js +8 -5
- package/dist/cli/version.js.map +1 -1
- package/dist/cli-api.d.ts +36 -5
- package/dist/cli-api.d.ts.map +1 -1
- package/dist/cli-api.js +30 -4
- package/dist/cli-api.js.map +1 -1
- package/dist/composition/algebraic-equivalence.d.ts +43 -0
- package/dist/composition/algebraic-equivalence.d.ts.map +1 -0
- package/dist/composition/algebraic-equivalence.js +115 -0
- package/dist/composition/algebraic-equivalence.js.map +1 -0
- package/dist/composition/axes.d.ts +0 -6
- package/dist/composition/axes.d.ts.map +1 -1
- package/dist/composition/axes.js +6 -6
- package/dist/composition/axes.js.map +1 -1
- package/dist/composition/axis-audit.d.ts +47 -20
- package/dist/composition/axis-audit.d.ts.map +1 -1
- package/dist/composition/axis-audit.js +82 -9
- package/dist/composition/axis-audit.js.map +1 -1
- package/dist/composition/bridge-analysis.d.ts +17 -0
- package/dist/composition/bridge-analysis.d.ts.map +1 -1
- package/dist/composition/bridge-analysis.js +102 -55
- package/dist/composition/bridge-analysis.js.map +1 -1
- package/dist/composition/canonical-compare.d.ts +40 -0
- package/dist/composition/canonical-compare.d.ts.map +1 -1
- package/dist/composition/canonical-compare.js +122 -24
- package/dist/composition/canonical-compare.js.map +1 -1
- package/dist/composition/canonical-graph.d.ts +3 -3
- package/dist/composition/canonical-graph.d.ts.map +1 -1
- package/dist/composition/canonical-graph.js +11 -38
- package/dist/composition/canonical-graph.js.map +1 -1
- package/dist/composition/canonical-json.js +2 -2
- package/dist/composition/canonical-json.js.map +1 -1
- package/dist/composition/catalog-graph.d.ts.map +1 -1
- package/dist/composition/catalog-graph.js +2 -5
- package/dist/composition/catalog-graph.js.map +1 -1
- package/dist/composition/chain-candidate.d.ts +8 -0
- package/dist/composition/chain-candidate.d.ts.map +1 -1
- package/dist/composition/chain-candidate.js +9 -2
- package/dist/composition/chain-candidate.js.map +1 -1
- package/dist/composition/chain-match.d.ts +6 -3
- package/dist/composition/chain-match.d.ts.map +1 -1
- package/dist/composition/chain-match.js +4 -1
- package/dist/composition/chain-match.js.map +1 -1
- package/dist/composition/chain-result.d.ts.map +1 -1
- package/dist/composition/chain-result.js +2 -14
- package/dist/composition/chain-result.js.map +1 -1
- package/dist/composition/compose-symbolic.d.ts.map +1 -1
- package/dist/composition/compose-symbolic.js +3 -2
- package/dist/composition/compose-symbolic.js.map +1 -1
- package/dist/composition/compose.d.ts.map +1 -1
- package/dist/composition/compose.js +13 -5
- package/dist/composition/compose.js.map +1 -1
- package/dist/composition/composition-recovery.d.ts.map +1 -1
- package/dist/composition/composition-recovery.js +4 -7
- package/dist/composition/composition-recovery.js.map +1 -1
- package/dist/composition/consequence.d.ts +15 -5
- package/dist/composition/consequence.d.ts.map +1 -1
- package/dist/composition/consequence.js +6 -4
- package/dist/composition/consequence.js.map +1 -1
- package/dist/composition/discovery.d.ts +129 -9
- package/dist/composition/discovery.d.ts.map +1 -1
- package/dist/composition/discovery.js +171 -67
- package/dist/composition/discovery.js.map +1 -1
- package/dist/composition/edge.d.ts +21 -2
- package/dist/composition/edge.d.ts.map +1 -1
- package/dist/composition/edge.js +23 -1
- package/dist/composition/edge.js.map +1 -1
- package/dist/composition/enumerate.d.ts.map +1 -1
- package/dist/composition/enumerate.js +18 -3
- package/dist/composition/enumerate.js.map +1 -1
- package/dist/composition/evaluate-relation.d.ts +35 -11
- package/dist/composition/evaluate-relation.d.ts.map +1 -1
- package/dist/composition/evaluate-relation.js +60 -39
- package/dist/composition/evaluate-relation.js.map +1 -1
- package/dist/composition/explain.d.ts +3 -12
- package/dist/composition/explain.d.ts.map +1 -1
- package/dist/composition/explain.js +7 -20
- package/dist/composition/explain.js.map +1 -1
- package/dist/composition/expr-eval.d.ts +1 -1
- package/dist/composition/expr-eval.d.ts.map +1 -1
- package/dist/composition/expr-eval.js +6 -15
- package/dist/composition/expr-eval.js.map +1 -1
- package/dist/composition/expr-simplify.d.ts +26 -14
- package/dist/composition/expr-simplify.d.ts.map +1 -1
- package/dist/composition/expr-simplify.js +64 -72
- package/dist/composition/expr-simplify.js.map +1 -1
- package/dist/composition/formula-shape.d.ts +23 -4
- package/dist/composition/formula-shape.d.ts.map +1 -1
- package/dist/composition/formula-shape.js +57 -17
- package/dist/composition/formula-shape.js.map +1 -1
- package/dist/composition/graph-structure.d.ts +98 -0
- package/dist/composition/graph-structure.d.ts.map +1 -0
- package/dist/composition/graph-structure.js +167 -0
- package/dist/composition/graph-structure.js.map +1 -0
- package/dist/composition/graph-viz-svg.d.ts.map +1 -1
- package/dist/composition/graph-viz-svg.js +1 -1
- package/dist/composition/graph-viz-svg.js.map +1 -1
- package/dist/composition/graph-viz.d.ts.map +1 -1
- package/dist/composition/graph-viz.js +8 -37
- package/dist/composition/graph-viz.js.map +1 -1
- package/dist/composition/grounding.d.ts.map +1 -1
- package/dist/composition/grounding.js +19 -7
- package/dist/composition/grounding.js.map +1 -1
- package/dist/composition/identifiability.d.ts +91 -4
- package/dist/composition/identifiability.d.ts.map +1 -1
- package/dist/composition/identifiability.js +363 -6
- package/dist/composition/identifiability.js.map +1 -1
- package/dist/composition/index.d.ts +8 -4
- package/dist/composition/index.d.ts.map +1 -1
- package/dist/composition/index.js +3 -2
- package/dist/composition/index.js.map +1 -1
- package/dist/composition/mathts-quiet.d.ts +7 -8
- package/dist/composition/mathts-quiet.d.ts.map +1 -1
- package/dist/composition/mathts-quiet.js +7 -16
- package/dist/composition/mathts-quiet.js.map +1 -1
- package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -1
- package/dist/composition/mathts-scalar-symbols.js +2 -1
- package/dist/composition/mathts-scalar-symbols.js.map +1 -1
- package/dist/composition/own-equation-magnitude.d.ts +95 -0
- package/dist/composition/own-equation-magnitude.d.ts.map +1 -0
- package/dist/composition/own-equation-magnitude.js +270 -0
- package/dist/composition/own-equation-magnitude.js.map +1 -0
- package/dist/composition/probe/backend-protocol.d.ts +3 -0
- package/dist/composition/probe/backend-protocol.d.ts.map +1 -1
- package/dist/composition/probe/backend-protocol.js.map +1 -1
- package/dist/composition/probe/candidate-store.d.ts +1 -0
- package/dist/composition/probe/candidate-store.d.ts.map +1 -1
- package/dist/composition/probe/candidate-store.js +1 -0
- package/dist/composition/probe/candidate-store.js.map +1 -1
- package/dist/composition/probe/corpus.d.ts +8 -4
- package/dist/composition/probe/corpus.d.ts.map +1 -1
- package/dist/composition/probe/corpus.js +23 -12
- package/dist/composition/probe/corpus.js.map +1 -1
- package/dist/composition/probe/dataset.d.ts +18 -0
- package/dist/composition/probe/dataset.d.ts.map +1 -1
- package/dist/composition/probe/dataset.js +95 -50
- package/dist/composition/probe/dataset.js.map +1 -1
- package/dist/composition/probe/experiment-design.d.ts +7 -1
- package/dist/composition/probe/experiment-design.d.ts.map +1 -1
- package/dist/composition/probe/experiment-design.js +44 -24
- package/dist/composition/probe/experiment-design.js.map +1 -1
- package/dist/composition/probe/falsify.d.ts +2 -0
- package/dist/composition/probe/falsify.d.ts.map +1 -1
- package/dist/composition/probe/falsify.js +2 -0
- package/dist/composition/probe/falsify.js.map +1 -1
- package/dist/composition/probe/fit.d.ts +7 -0
- package/dist/composition/probe/fit.d.ts.map +1 -1
- package/dist/composition/probe/fit.js +46 -22
- package/dist/composition/probe/fit.js.map +1 -1
- package/dist/composition/probe/frontier.d.ts.map +1 -1
- package/dist/composition/probe/frontier.js +33 -15
- package/dist/composition/probe/frontier.js.map +1 -1
- package/dist/composition/probe/generator.d.ts +30 -1
- package/dist/composition/probe/generator.d.ts.map +1 -1
- package/dist/composition/probe/generator.js +58 -36
- package/dist/composition/probe/generator.js.map +1 -1
- package/dist/composition/probe/index.d.ts +14 -0
- package/dist/composition/probe/index.d.ts.map +1 -1
- package/dist/composition/probe/index.js +6 -0
- package/dist/composition/probe/index.js.map +1 -1
- package/dist/composition/probe/limits.d.ts +25 -1
- package/dist/composition/probe/limits.d.ts.map +1 -1
- package/dist/composition/probe/limits.js +53 -11
- package/dist/composition/probe/limits.js.map +1 -1
- package/dist/composition/probe/pipeline.d.ts +5 -0
- package/dist/composition/probe/pipeline.d.ts.map +1 -1
- package/dist/composition/probe/pipeline.js +73 -24
- package/dist/composition/probe/pipeline.js.map +1 -1
- package/dist/composition/probe/power-law.d.ts +121 -0
- package/dist/composition/probe/power-law.d.ts.map +1 -0
- package/dist/composition/probe/power-law.js +251 -0
- package/dist/composition/probe/power-law.js.map +1 -0
- package/dist/composition/probe/problem.d.ts +8 -4
- package/dist/composition/probe/problem.d.ts.map +1 -1
- package/dist/composition/probe/problem.js +177 -49
- package/dist/composition/probe/problem.js.map +1 -1
- package/dist/composition/probe/report.js +1 -1
- package/dist/composition/probe/report.js.map +1 -1
- package/dist/composition/probe/residual.d.ts +7 -1
- package/dist/composition/probe/residual.d.ts.map +1 -1
- package/dist/composition/probe/residual.js +10 -7
- package/dist/composition/probe/residual.js.map +1 -1
- package/dist/composition/probe/run-manifest.d.ts +1 -0
- package/dist/composition/probe/run-manifest.d.ts.map +1 -1
- package/dist/composition/probe/run-manifest.js.map +1 -1
- package/dist/composition/probe/scalar-search.d.ts +50 -0
- package/dist/composition/probe/scalar-search.d.ts.map +1 -0
- package/dist/composition/probe/scalar-search.js +169 -0
- package/dist/composition/probe/scalar-search.js.map +1 -0
- package/dist/composition/probe/scoring.d.ts +1 -0
- package/dist/composition/probe/scoring.d.ts.map +1 -1
- package/dist/composition/probe/scoring.js.map +1 -1
- package/dist/composition/probe/structure.d.ts +82 -17
- package/dist/composition/probe/structure.d.ts.map +1 -1
- package/dist/composition/probe/structure.js +129 -55
- package/dist/composition/probe/structure.js.map +1 -1
- package/dist/composition/probe/study.d.ts +31 -9
- package/dist/composition/probe/study.d.ts.map +1 -1
- package/dist/composition/probe/study.js +235 -184
- package/dist/composition/probe/study.js.map +1 -1
- package/dist/composition/probe/t-tail.d.ts +16 -0
- package/dist/composition/probe/t-tail.d.ts.map +1 -0
- package/dist/composition/probe/t-tail.js +29 -0
- package/dist/composition/probe/t-tail.js.map +1 -0
- package/dist/composition/probe/types.d.ts +3 -0
- package/dist/composition/probe/types.d.ts.map +1 -1
- package/dist/composition/probe/types.js.map +1 -1
- package/dist/composition/proposed-bridges.d.ts +52 -12
- package/dist/composition/proposed-bridges.d.ts.map +1 -1
- package/dist/composition/proposed-bridges.js +107 -60
- package/dist/composition/proposed-bridges.js.map +1 -1
- package/dist/composition/quantity-clusters.d.ts +48 -0
- package/dist/composition/quantity-clusters.d.ts.map +1 -0
- package/dist/composition/quantity-clusters.js +98 -0
- package/dist/composition/quantity-clusters.js.map +1 -0
- package/dist/composition/rational-exponent.d.ts +40 -0
- package/dist/composition/rational-exponent.d.ts.map +1 -0
- package/dist/composition/rational-exponent.js +65 -0
- package/dist/composition/rational-exponent.js.map +1 -0
- package/dist/composition/representative-values.d.ts +22 -0
- package/dist/composition/representative-values.d.ts.map +1 -1
- package/dist/composition/representative-values.js +29 -0
- package/dist/composition/representative-values.js.map +1 -1
- package/dist/composition/retrodiction.d.ts +15 -0
- package/dist/composition/retrodiction.d.ts.map +1 -1
- package/dist/composition/retrodiction.js +12 -4
- package/dist/composition/retrodiction.js.map +1 -1
- package/dist/composition/user-equation.d.ts +1 -0
- package/dist/composition/user-equation.d.ts.map +1 -1
- package/dist/composition/user-equation.js +3 -2
- package/dist/composition/user-equation.js.map +1 -1
- package/dist/core/assignment.d.ts +19 -0
- package/dist/core/assignment.d.ts.map +1 -0
- package/dist/core/assignment.js +19 -0
- package/dist/core/assignment.js.map +1 -0
- package/dist/core/compare.d.ts +32 -0
- package/dist/core/compare.d.ts.map +1 -0
- package/dist/core/compare.js +46 -0
- package/dist/core/compare.js.map +1 -0
- package/dist/core/constants.d.ts +42 -41
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +71 -51
- package/dist/core/constants.js.map +1 -1
- package/dist/core/data-file.d.ts +7 -0
- package/dist/core/data-file.d.ts.map +1 -1
- package/dist/core/data-file.js +17 -0
- package/dist/core/data-file.js.map +1 -1
- package/dist/core/format.d.ts +36 -0
- package/dist/core/format.d.ts.map +1 -0
- package/dist/core/format.js +39 -0
- package/dist/core/format.js.map +1 -0
- package/dist/core/hash.d.ts +14 -0
- package/dist/core/hash.d.ts.map +1 -0
- package/dist/core/hash.js +17 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/json-schema.d.ts +2 -0
- package/dist/core/json-schema.d.ts.map +1 -1
- package/dist/core/json-schema.js +14 -13
- package/dist/core/json-schema.js.map +1 -1
- package/dist/core/labeled-tensor.d.ts.map +1 -1
- package/dist/core/labeled-tensor.js +0 -8
- package/dist/core/labeled-tensor.js.map +1 -1
- package/dist/core/mathts-read.d.ts +25 -0
- package/dist/core/mathts-read.d.ts.map +1 -0
- package/dist/core/mathts-read.js +51 -0
- package/dist/core/mathts-read.js.map +1 -0
- package/dist/core/tensor.d.ts.map +1 -1
- package/dist/core/tensor.js +24 -0
- package/dist/core/tensor.js.map +1 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/diff/bridge-ast-gradient.d.ts +27 -23
- package/dist/diff/bridge-ast-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-ast-gradient.js +75 -173
- package/dist/diff/bridge-ast-gradient.js.map +1 -1
- package/dist/diff/bridge-gradient.d.ts +19 -6
- package/dist/diff/bridge-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-gradient.js +19 -11
- package/dist/diff/bridge-gradient.js.map +1 -1
- package/dist/diff/bridge-specs.d.ts.map +1 -1
- package/dist/diff/bridge-specs.js +3 -0
- package/dist/diff/bridge-specs.js.map +1 -1
- package/dist/dimensional/algebra.d.ts +18 -0
- package/dist/dimensional/algebra.d.ts.map +1 -1
- package/dist/dimensional/algebra.js +41 -1
- package/dist/dimensional/algebra.js.map +1 -1
- package/dist/dimensional/ast-builders.d.ts +7 -0
- package/dist/dimensional/ast-builders.d.ts.map +1 -1
- package/dist/dimensional/ast-builders.js +11 -0
- package/dist/dimensional/ast-builders.js.map +1 -1
- package/dist/dimensional/ast-leaves.d.ts +81 -0
- package/dist/dimensional/ast-leaves.d.ts.map +1 -0
- package/dist/dimensional/ast-leaves.js +146 -0
- package/dist/dimensional/ast-leaves.js.map +1 -0
- package/dist/dimensional/ast-types.d.ts +15 -0
- package/dist/dimensional/ast-types.d.ts.map +1 -1
- package/dist/dimensional/ast-types.js.map +1 -1
- package/dist/dimensional/buckingham.d.ts.map +1 -1
- package/dist/dimensional/buckingham.js +15 -27
- package/dist/dimensional/buckingham.js.map +1 -1
- package/dist/dimensional/constant-rows.js +9 -9
- package/dist/dimensional/constant-rows.js.map +1 -1
- package/dist/dimensional/curvature-composite.d.ts +1 -1
- package/dist/dimensional/curvature-composite.js.map +1 -1
- package/dist/dimensional/dimension-inference.d.ts.map +1 -1
- package/dist/dimensional/dimension-inference.js +1 -2
- package/dist/dimensional/dimension-inference.js.map +1 -1
- package/dist/dimensional/errors.d.ts +1 -1
- package/dist/dimensional/errors.d.ts.map +1 -1
- package/dist/dimensional/errors.js +1 -15
- package/dist/dimensional/errors.js.map +1 -1
- package/dist/dimensional/exact-scale.d.ts +24 -11
- package/dist/dimensional/exact-scale.d.ts.map +1 -1
- package/dist/dimensional/exact-scale.js +122 -130
- package/dist/dimensional/exact-scale.js.map +1 -1
- package/dist/dimensional/gauge-field.d.ts.map +1 -1
- package/dist/dimensional/gauge-field.js +2 -2
- package/dist/dimensional/gauge-field.js.map +1 -1
- package/dist/dimensional/hyphen-names.d.ts +12 -2
- package/dist/dimensional/hyphen-names.d.ts.map +1 -1
- package/dist/dimensional/hyphen-names.js +44 -19
- package/dist/dimensional/hyphen-names.js.map +1 -1
- package/dist/dimensional/mathts-unit-delegation.d.ts +29 -0
- package/dist/dimensional/mathts-unit-delegation.d.ts.map +1 -0
- package/dist/dimensional/mathts-unit-delegation.js +187 -0
- package/dist/dimensional/mathts-unit-delegation.js.map +1 -0
- package/dist/dimensional/mathts-unit-wrapper.d.ts +33 -0
- package/dist/dimensional/mathts-unit-wrapper.d.ts.map +1 -0
- package/dist/dimensional/mathts-unit-wrapper.js +190 -0
- package/dist/dimensional/mathts-unit-wrapper.js.map +1 -0
- package/dist/dimensional/metric.d.ts.map +1 -1
- package/dist/dimensional/metric.js +0 -1
- package/dist/dimensional/metric.js.map +1 -1
- package/dist/dimensional/scalar-lowering.d.ts +21 -0
- package/dist/dimensional/scalar-lowering.d.ts.map +1 -0
- package/dist/dimensional/scalar-lowering.js +45 -0
- package/dist/dimensional/scalar-lowering.js.map +1 -0
- package/dist/dimensional/symbolic-constants.d.ts +9 -0
- package/dist/dimensional/symbolic-constants.d.ts.map +1 -1
- package/dist/dimensional/symbolic-constants.js +13 -1
- package/dist/dimensional/symbolic-constants.js.map +1 -1
- package/dist/dimensional/types.d.ts +36 -0
- package/dist/dimensional/types.d.ts.map +1 -1
- package/dist/dimensional/types.js +45 -7
- package/dist/dimensional/types.js.map +1 -1
- package/dist/dimensional/unit-data.d.ts +5 -1
- package/dist/dimensional/unit-data.d.ts.map +1 -1
- package/dist/dimensional/unit-data.js +30 -6
- package/dist/dimensional/unit-data.js.map +1 -1
- package/dist/dimensional/units.d.ts +2 -0
- package/dist/dimensional/units.d.ts.map +1 -1
- package/dist/dimensional/units.js +59 -3
- package/dist/dimensional/units.js.map +1 -1
- package/dist/dimensional/validator.d.ts +2 -0
- package/dist/dimensional/validator.d.ts.map +1 -1
- package/dist/dimensional/validator.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/numerical/christoffel-flat.d.ts.map +1 -1
- package/dist/numerical/christoffel-flat.js +3 -2
- package/dist/numerical/christoffel-flat.js.map +1 -1
- package/dist/numerical/connection-lowering-helpers.d.ts +3 -1
- package/dist/numerical/connection-lowering-helpers.d.ts.map +1 -1
- package/dist/numerical/connection-lowering-helpers.js +11 -15
- package/dist/numerical/connection-lowering-helpers.js.map +1 -1
- package/dist/numerical/covariant-eikonal.d.ts.map +1 -1
- package/dist/numerical/covariant-eikonal.js +34 -11
- package/dist/numerical/covariant-eikonal.js.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.js +3 -2
- package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
- package/dist/numerical/errors.d.ts.map +1 -1
- package/dist/numerical/errors.js +0 -3
- package/dist/numerical/errors.js.map +1 -1
- package/dist/numerical/finite-difference.d.ts +22 -0
- package/dist/numerical/finite-difference.d.ts.map +1 -0
- package/dist/numerical/finite-difference.js +27 -0
- package/dist/numerical/finite-difference.js.map +1 -0
- package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
- package/dist/numerical/geodesic-integrator.js +22 -14
- package/dist/numerical/geodesic-integrator.js.map +1 -1
- package/dist/numerical/geometrized.d.ts.map +1 -1
- package/dist/numerical/geometrized.js +0 -1
- package/dist/numerical/geometrized.js.map +1 -1
- package/dist/numerical/mathts-engine.d.ts.map +1 -1
- package/dist/numerical/mathts-engine.js +10 -24
- package/dist/numerical/mathts-engine.js.map +1 -1
- package/dist/numerical/metric-inverse.d.ts.map +1 -1
- package/dist/numerical/metric-inverse.js +83 -46
- package/dist/numerical/metric-inverse.js.map +1 -1
- package/dist/numerical/null-ray-integrator.d.ts +2 -1
- package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
- package/dist/numerical/null-ray-integrator.js +12 -12
- package/dist/numerical/null-ray-integrator.js.map +1 -1
- package/dist/numerical/painleve-gullstrand-metric.js +2 -2
- package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
- package/dist/numerical/pderiv.d.ts.map +1 -1
- package/dist/numerical/pderiv.js +2 -6
- package/dist/numerical/pderiv.js.map +1 -1
- package/dist/numerical/perihelion-finder.d.ts +0 -36
- package/dist/numerical/perihelion-finder.d.ts.map +1 -1
- package/dist/numerical/perihelion-finder.js +41 -87
- package/dist/numerical/perihelion-finder.js.map +1 -1
- package/dist/numerical/quadrature.d.ts.map +1 -1
- package/dist/numerical/quadrature.js +11 -13
- package/dist/numerical/quadrature.js.map +1 -1
- package/dist/numerical/rk4-trajectory.d.ts +10 -0
- package/dist/numerical/rk4-trajectory.d.ts.map +1 -0
- package/dist/numerical/rk4-trajectory.js +37 -0
- package/dist/numerical/rk4-trajectory.js.map +1 -0
- package/dist/numerical/schwarzschild.d.ts +14 -0
- package/dist/numerical/schwarzschild.d.ts.map +1 -0
- package/dist/numerical/schwarzschild.js +17 -0
- package/dist/numerical/schwarzschild.js.map +1 -0
- package/dist/numerical/spacetime-metrics.d.ts +12 -0
- package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
- package/dist/numerical/spacetime-metrics.js +72 -56
- package/dist/numerical/spacetime-metrics.js.map +1 -1
- package/dist/numerical/statistics.d.ts +24 -0
- package/dist/numerical/statistics.d.ts.map +1 -0
- package/dist/numerical/statistics.js +52 -0
- package/dist/numerical/statistics.js.map +1 -0
- package/dist/numerical/strides.d.ts +3 -2
- package/dist/numerical/strides.d.ts.map +1 -1
- package/dist/numerical/strides.js +3 -10
- package/dist/numerical/strides.js.map +1 -1
- package/dist/numerical/tensor-engine.d.ts +21 -0
- package/dist/numerical/tensor-engine.d.ts.map +1 -1
- package/dist/numerical/tensor-engine.js +12 -0
- package/dist/numerical/tensor-engine.js.map +1 -1
- package/dist/relations/regime.d.ts +10 -0
- package/dist/relations/regime.d.ts.map +1 -1
- package/dist/relations/regime.js +18 -1
- package/dist/relations/regime.js.map +1 -1
- package/package.json +9 -12
- package/dist/cases/brownian-sphere.d.ts +0 -68
- package/dist/cases/brownian-sphere.d.ts.map +0 -1
- package/dist/cases/brownian-sphere.js +0 -354
- package/dist/cases/brownian-sphere.js.map +0 -1
- package/dist/cases/damped-resonator.d.ts +0 -23
- package/dist/cases/damped-resonator.d.ts.map +0 -1
- package/dist/cases/damped-resonator.js +0 -224
- package/dist/cases/damped-resonator.js.map +0 -1
- package/dist/cases/kepler-rv.d.ts +0 -13
- package/dist/cases/kepler-rv.d.ts.map +0 -1
- package/dist/cases/kepler-rv.js +0 -172
- package/dist/cases/kepler-rv.js.map +0 -1
- package/dist/cases/lumped-cooling.d.ts +0 -46
- package/dist/cases/lumped-cooling.d.ts.map +0 -1
- package/dist/cases/lumped-cooling.js +0 -261
- package/dist/cases/lumped-cooling.js.map +0 -1
- package/dist/cases/resistor-noise.d.ts +0 -14
- package/dist/cases/resistor-noise.d.ts.map +0 -1
- package/dist/cases/resistor-noise.js +0 -215
- package/dist/cases/resistor-noise.js.map +0 -1
- package/dist/cases/skin-depth.d.ts +0 -21
- package/dist/cases/skin-depth.d.ts.map +0 -1
- package/dist/cases/skin-depth.js +0 -174
- package/dist/cases/skin-depth.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../../src/core/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;AAChG,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,MAAM;IACN,UAAU;IACV,YAAY;IACZ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,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,SAAS,EAAE,QAAQ,CAAC,CAAC;YAC9G,+EAA+E;YAC/E,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC9E,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACvB,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;YAChD,CAAC;iBAAM,IAAI,MAAM,CAAC,sBAAsB,CAAC,KAAK,KAAK,EAAE,CAAC;gBACpD,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,uBAAuB,CAAC,CAAC;YACjD,CAAC;iBAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC;gBACpD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,sBAAsB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAkB,EAAE,KAAc;IAC/D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC5C,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/**\n * A JSON Schema reader for the keyword subset the repository's data schemas use.\n *\n * The library adds no runtime dependency for this, so the schema a data file\n * names is checked here, at load, and not only by a test. A keyword outside\n * the subset is an error in the schema, not a keyword silently ignored, so a\n * schema cannot state a rule this reader does not enforce.\n *\n * Subset: `type` (a name or an array of names), `required`, `properties`,\n * `additionalProperties` (boolean or schema), `propertyNames`, `items`,\n * `minItems`, `maxItems`, `uniqueItems`, `minLength`, `pattern`, `minimum`,\n * `enum`, `const`, `if`/`then`/`else`, and `$ref` to `#/$defs/<name>` or `#/definitions/<name>`. `$schema`, `$id`, `$defs`,\n * `title` and `description` are annotations.\n *\n * @module core/json-schema\n */\n\n/** A JSON Schema document or subschema, as parsed from JSON. @internal */\nexport type JsonSchema = { readonly [keyword: string]: unknown };\n\nconst ANNOTATIONS = new Set(['$schema', '$id', '$defs', 'definitions', 'title', 'description']);\nconst KEYWORDS = new Set([\n 'type',\n 'required',\n 'properties',\n 'additionalProperties',\n 'propertyNames',\n 'items',\n 'minItems',\n 'maxItems',\n 'uniqueItems',\n 'minLength',\n 'pattern',\n 'minimum',\n 'enum',\n 'const',\n '$ref',\n 'if',\n 'then',\n 'else',\n]);\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction typeMatches(type: string, value: unknown): boolean {\n switch (type) {\n case 'object':\n return isObject(value);\n case 'array':\n return Array.isArray(value);\n case 'string':\n return typeof value === 'string';\n case 'boolean':\n return typeof value === 'boolean';\n case 'number':\n return typeof value === 'number' && Number.isFinite(value);\n case 'integer':\n return typeof value === 'number' && Number.isInteger(value);\n case 'null':\n return value === null;\n default:\n throw new Error(`json-schema: unsupported type '${type}'`);\n }\n}\n\nfunction resolveRef(root: JsonSchema, ref: string): JsonSchema {\n // `#/$defs/<name>` (2019-09 and later) or `#/definitions/<name>` (draft-07): both are a\n // local definition table and nothing else is resolved.\n const m = /^#\\/(\\$defs|definitions)\\/([^/]+)$/.exec(ref);\n const defs = m === null ? undefined : root[m[1]!];\n const target = m === null || !isObject(defs) ? undefined : defs[m[2]!];\n if (!isObject(target)) throw new Error(`json-schema: unresolved $ref '${ref}'`);\n return target;\n}\n\nfunction check(root: JsonSchema, schema: JsonSchema, value: unknown, path: string, problems: string[]): void {\n for (const keyword of Object.keys(schema)) {\n if (!KEYWORDS.has(keyword) && !ANNOTATIONS.has(keyword)) {\n throw new Error(`json-schema: keyword '${keyword}' at ${path} is outside the supported subset`);\n }\n }\n if (typeof schema['$ref'] === 'string') check(root, resolveRef(root, schema['$ref']), value, path, problems);\n // `if`/`then`/`else`: the branch whose condition the value meets is checked; the condition's\n // own problems are not reported.\n if (isObject(schema['if'])) {\n const condition: string[] = [];\n check(root, schema['if'], value, path, condition);\n const branch = condition.length === 0 ? schema['then'] : schema['else'];\n if (isObject(branch)) check(root, branch, value, path, problems);\n }\n if (schema['type'] !== undefined) {\n const types = Array.isArray(schema['type']) ? (schema['type'] as unknown[]) : [schema['type']];\n if (types.length === 0 || types.some((type) => typeof type !== 'string')) {\n throw new Error(`json-schema: 'type' at ${path} is not a type name or an array of type names`);\n }\n if (!types.some((type) => typeMatches(type as string, value))) {\n problems.push(`${path}: expected ${types.join(' or ')}`);\n return;\n }\n }\n if ('const' in schema && JSON.stringify(schema['const']) !== JSON.stringify(value)) {\n problems.push(`${path}: expected ${JSON.stringify(schema['const'])}`);\n }\n if (Array.isArray(schema['enum']) && !schema['enum'].some((option) => JSON.stringify(option) === JSON.stringify(value))) {\n problems.push(`${path}: ${JSON.stringify(value)} is not one of ${JSON.stringify(schema['enum'])}`);\n }\n if (typeof value === 'number' && typeof schema['minimum'] === 'number' && value < schema['minimum']) {\n problems.push(`${path}: ${value} is less than ${schema['minimum']}`);\n }\n if (typeof value === 'string') {\n if (typeof schema['minLength'] === 'number' && [...value].length < schema['minLength']) {\n problems.push(`${path}: shorter than ${schema['minLength']}`);\n }\n if (typeof schema['pattern'] === 'string' && !new RegExp(schema['pattern'], 'u').test(value)) {\n problems.push(`${path}: '${value}' does not match ${schema['pattern']}`);\n }\n }\n if (Array.isArray(value)) {\n if (typeof schema['minItems'] === 'number' && value.length < schema['minItems']) {\n problems.push(`${path}: fewer than ${schema['minItems']} items`);\n }\n if (typeof schema['maxItems'] === 'number' && value.length > schema['maxItems']) {\n problems.push(`${path}: more than ${schema['maxItems']} items`);\n }\n if (schema['uniqueItems'] === true) {\n const seen = new Set(value.map((item) => JSON.stringify(item)));\n if (seen.size !== value.length) problems.push(`${path}: items are not unique`);\n }\n if (isObject(schema['items'])) {\n const items = schema['items'];\n value.forEach((item, i) => check(root, items, item, `${path}[${i}]`, problems));\n } else if (Array.isArray(schema['items'])) {\n // A tuple: each position has its own schema; a position past the tuple is unchecked.\n (schema['items'] as unknown[]).forEach((itemSchema, i) => {\n if (!isObject(itemSchema)) throw new Error(`json-schema: items[${i}] at ${path} is not a schema`);\n if (i < value.length) check(root, itemSchema, value[i], `${path}[${i}]`, problems);\n });\n }\n }\n if (isObject(value)) {\n const properties = isObject(schema['properties']) ? schema['properties'] : {};\n if (Array.isArray(schema['required'])) {\n for (const key of schema['required'] as readonly string[]) {\n if (!Object.hasOwn(value, key)) problems.push(`${path}: missing '${key}'`);\n }\n }\n for (const [key, child] of Object.entries(value)) {\n const where = `${path}.${key}`;\n if (isObject(schema['propertyNames'])) check(root, schema['propertyNames'], key, `${where} (name)`, problems);\n // Own properties only: a `__proto__` key must not resolve to Object.prototype.\n const declared = Object.hasOwn(properties, key) ? properties[key] : undefined;\n if (isObject(declared)) {\n check(root, declared, child, where, problems);\n } else if (schema['additionalProperties'] === false) {\n problems.push(`${where}: unexpected property`);\n } else if (isObject(schema['additionalProperties'])) {\n check(root, schema['additionalProperties'], child, where, problems);\n }\n }\n }\n}\n\n/**\n * Every place `value` breaks `schema`, as `$.path: reason` lines. Empty when it conforms.\n * Throws when the schema uses a keyword outside the subset.\n * @internal\n */\nexport function schemaProblems(schema: JsonSchema, value: unknown): string[] {\n const problems: string[] = [];\n check(schema, schema, value, '$', problems);\n return problems;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../../src/core/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EA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AAK,CAAC,EAAE,CAAC;YACjD,MAAM,KAAK,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC;YAC/B,IAAI,aAAa,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;gBAAE,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,SAAS,EAAE,QAAQ,CAAC,CAAC;YACnH,+EAA+E;YAC/E,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC9E,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;YAChD,CAAC;iBAAM,IAAI,MAAM,CAAC,sBAAsB,CAAC,KAAK,KAAK,EAAE,CAAC;gBACpD,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,uBAAuB,CAAC,CAAC;YACjD,CAAC;iBAAM,IAAI,aAAa,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC;gBACzD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,sBAAsB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAkB,EAAE,KAAc;IAC/D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC5C,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/**\n * A JSON Schema reader for the keyword subset the repository's data schemas use.\n *\n * The library adds no runtime dependency for this, so the schema a data file\n * names is checked here, at load, and not only by a test. A keyword outside\n * the subset is an error in the schema, not a keyword silently ignored, so a\n * schema cannot state a rule this reader does not enforce.\n *\n * Subset: `type` (a name or an array of names), `required`, `properties`,\n * `additionalProperties` (boolean or schema), `propertyNames`, `items`,\n * `minItems`, `maxItems`, `uniqueItems`, `minLength`, `pattern`, `minimum`,\n * `enum`, `const`, `if`/`then`/`else`, and `$ref` to `#/$defs/<name>` or `#/definitions/<name>`. `$schema`, `$id`, `$defs`,\n * `title` and `description` are annotations.\n *\n * @module core/json-schema\n */\n\n/** A JSON Schema document or subschema, as parsed from JSON. @internal */\nexport type JsonSchema = { readonly [keyword: string]: unknown };\n\nconst ANNOTATIONS = new Set(['$schema', '$id', '$defs', 'definitions', 'title', 'description']);\nconst KEYWORDS = new Set([\n 'type',\n 'required',\n 'properties',\n 'additionalProperties',\n 'propertyNames',\n 'items',\n 'minItems',\n 'maxItems',\n 'uniqueItems',\n 'minLength',\n 'pattern',\n 'minimum',\n 'enum',\n 'const',\n '$ref',\n 'if',\n 'then',\n 'else',\n]);\n\n/** A JSON object: not an array, not null. The one object guard of the data readers. @internal */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction typeMatches(type: string, value: unknown): boolean {\n switch (type) {\n case 'object':\n return isPlainObject(value);\n case 'array':\n return Array.isArray(value);\n case 'string':\n return typeof value === 'string';\n case 'boolean':\n return typeof value === 'boolean';\n case 'number':\n return typeof value === 'number' && Number.isFinite(value);\n case 'integer':\n return typeof value === 'number' && Number.isInteger(value);\n case 'null':\n return value === null;\n default:\n throw new Error(`json-schema: unsupported type '${type}'`);\n }\n}\n\nfunction resolveRef(root: JsonSchema, ref: string): JsonSchema {\n // `#/$defs/<name>` (2019-09 and later) or `#/definitions/<name>` (draft-07): both are a\n // local definition table and nothing else is resolved.\n const m = /^#\\/(\\$defs|definitions)\\/([^/]+)$/.exec(ref);\n const defs = m === null ? undefined : root[m[1]!];\n const target = m === null || !isPlainObject(defs) ? undefined : defs[m[2]!];\n if (!isPlainObject(target)) throw new Error(`json-schema: unresolved $ref '${ref}'`);\n return target;\n}\n\nfunction check(root: JsonSchema, schema: JsonSchema, value: unknown, path: string, problems: string[]): void {\n for (const keyword of Object.keys(schema)) {\n if (!KEYWORDS.has(keyword) && !ANNOTATIONS.has(keyword)) {\n throw new Error(`json-schema: keyword '${keyword}' at ${path} is outside the supported subset`);\n }\n }\n if (typeof schema['$ref'] === 'string') check(root, resolveRef(root, schema['$ref']), value, path, problems);\n // `if`/`then`/`else`: the branch whose condition the value meets is checked; the condition's\n // own problems are not reported.\n if (isPlainObject(schema['if'])) {\n const condition: string[] = [];\n check(root, schema['if'], value, path, condition);\n const branch = condition.length === 0 ? schema['then'] : schema['else'];\n if (isPlainObject(branch)) check(root, branch, value, path, problems);\n }\n if (schema['type'] !== undefined) {\n const types = Array.isArray(schema['type']) ? (schema['type'] as unknown[]) : [schema['type']];\n if (types.length === 0 || types.some((type) => typeof type !== 'string')) {\n throw new Error(`json-schema: 'type' at ${path} is not a type name or an array of type names`);\n }\n if (!types.some((type) => typeMatches(type as string, value))) {\n problems.push(`${path}: expected ${types.join(' or ')}`);\n return;\n }\n }\n if ('const' in schema && JSON.stringify(schema['const']) !== JSON.stringify(value)) {\n problems.push(`${path}: expected ${JSON.stringify(schema['const'])}`);\n }\n if (Array.isArray(schema['enum']) && !schema['enum'].some((option) => JSON.stringify(option) === JSON.stringify(value))) {\n problems.push(`${path}: ${JSON.stringify(value)} is not one of ${JSON.stringify(schema['enum'])}`);\n }\n if (typeof value === 'number' && typeof schema['minimum'] === 'number' && value < schema['minimum']) {\n problems.push(`${path}: ${value} is less than ${schema['minimum']}`);\n }\n if (typeof value === 'string') {\n if (typeof schema['minLength'] === 'number' && [...value].length < schema['minLength']) {\n problems.push(`${path}: shorter than ${schema['minLength']}`);\n }\n if (typeof schema['pattern'] === 'string' && !new RegExp(schema['pattern'], 'u').test(value)) {\n problems.push(`${path}: '${value}' does not match ${schema['pattern']}`);\n }\n }\n if (Array.isArray(value)) {\n if (typeof schema['minItems'] === 'number' && value.length < schema['minItems']) {\n problems.push(`${path}: fewer than ${schema['minItems']} items`);\n }\n if (typeof schema['maxItems'] === 'number' && value.length > schema['maxItems']) {\n problems.push(`${path}: more than ${schema['maxItems']} items`);\n }\n if (schema['uniqueItems'] === true) {\n const seen = new Set(value.map((item) => JSON.stringify(item)));\n if (seen.size !== value.length) problems.push(`${path}: items are not unique`);\n }\n if (isPlainObject(schema['items'])) {\n const items = schema['items'];\n value.forEach((item, i) => check(root, items, item, `${path}[${i}]`, problems));\n } else if (Array.isArray(schema['items'])) {\n // A tuple: each position has its own schema; a position past the tuple is unchecked.\n (schema['items'] as unknown[]).forEach((itemSchema, i) => {\n if (!isPlainObject(itemSchema)) throw new Error(`json-schema: items[${i}] at ${path} is not a schema`);\n if (i < value.length) check(root, itemSchema, value[i], `${path}[${i}]`, problems);\n });\n }\n }\n if (isPlainObject(value)) {\n const properties = isPlainObject(schema['properties']) ? schema['properties'] : {};\n if (Array.isArray(schema['required'])) {\n for (const key of schema['required'] as readonly string[]) {\n if (!Object.hasOwn(value, key)) problems.push(`${path}: missing '${key}'`);\n }\n }\n for (const [key, child] of Object.entries(value)) {\n const where = `${path}.${key}`;\n if (isPlainObject(schema['propertyNames'])) check(root, schema['propertyNames'], key, `${where} (name)`, problems);\n // Own properties only: a `__proto__` key must not resolve to Object.prototype.\n const declared = Object.hasOwn(properties, key) ? properties[key] : undefined;\n if (isPlainObject(declared)) {\n check(root, declared, child, where, problems);\n } else if (schema['additionalProperties'] === false) {\n problems.push(`${where}: unexpected property`);\n } else if (isPlainObject(schema['additionalProperties'])) {\n check(root, schema['additionalProperties'], child, where, problems);\n }\n }\n }\n}\n\n/**\n * Every place `value` breaks `schema`, as `$.path: reason` lines. Empty when it conforms.\n * Throws when the schema uses a keyword outside the subset.\n * @internal\n */\nexport function schemaProblems(schema: JsonSchema, value: unknown): string[] {\n const problems: string[] = [];\n check(schema, schema, value, '$', problems);\n return problems;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labeled-tensor.d.ts","sourceRoot":"","sources":["../../src/core/labeled-tensor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAc,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAOvF;;;;;;GAMG;AACH,qBAAa,8BAA+B,SAAQ,QAAQ;IAC1D,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,YAAY,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"labeled-tensor.d.ts","sourceRoot":"","sources":["../../src/core/labeled-tensor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAc,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAOvF;;;;;;GAMG;AACH,qBAAa,8BAA+B,SAAQ,QAAQ;IAC1D,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,YAAY,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EASjD;CACF;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,SAAgB,OAAO,EAAE,gBAAgB,C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AS,MAAM,EAAE,EACvB,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;KAAE,GACvD,aAAa,CAuDf;IAED;;;;;;;OAOG;IACI,SAAS,CACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,GAC/E,aAAa,CA4Df;CACF"}
|
|
@@ -49,7 +49,6 @@ export class LabeledTensorConstructionError extends UPTError {
|
|
|
49
49
|
this.name = 'LabeledTensorConstructionError';
|
|
50
50
|
this.labelCount = labelCount;
|
|
51
51
|
this.tensorRank = tensorRank;
|
|
52
|
-
Object.setPrototypeOf(this, LabeledTensorConstructionError.prototype);
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
/**
|
|
@@ -73,7 +72,6 @@ export class AxisMismatchError extends UPTError {
|
|
|
73
72
|
this.indexId = indexId;
|
|
74
73
|
this.leftAxis = leftAxis;
|
|
75
74
|
this.rightAxis = rightAxis;
|
|
76
|
-
Object.setPrototypeOf(this, AxisMismatchError.prototype);
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
77
|
/**
|
|
@@ -101,7 +99,6 @@ export class IdentityConflictError extends UPTError {
|
|
|
101
99
|
`ambiguous — rename or contract one side first.`);
|
|
102
100
|
this.name = 'IdentityConflictError';
|
|
103
101
|
this.indexId = indexId;
|
|
104
|
-
Object.setPrototypeOf(this, IdentityConflictError.prototype);
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
104
|
/**
|
|
@@ -131,7 +128,6 @@ export class IndexNameMismatchError extends UPTError {
|
|
|
131
128
|
this.name = 'IndexNameMismatchError';
|
|
132
129
|
this.indexName = indexName;
|
|
133
130
|
this.ids = ids;
|
|
134
|
-
Object.setPrototypeOf(this, IndexNameMismatchError.prototype);
|
|
135
131
|
}
|
|
136
132
|
}
|
|
137
133
|
/**
|
|
@@ -152,7 +148,6 @@ export class RankPreservationError extends UPTError {
|
|
|
152
148
|
this.name = 'RankPreservationError';
|
|
153
149
|
this.fromRank = fromRank;
|
|
154
150
|
this.toRank = toRank;
|
|
155
|
-
Object.setPrototypeOf(this, RankPreservationError.prototype);
|
|
156
151
|
}
|
|
157
152
|
}
|
|
158
153
|
/**
|
|
@@ -174,7 +169,6 @@ export class AxisOrderError extends UPTError {
|
|
|
174
169
|
this.name = 'AxisOrderError';
|
|
175
170
|
this.axisOrder = axisOrder;
|
|
176
171
|
this.labelKeys = labelKeys;
|
|
177
|
-
Object.setPrototypeOf(this, AxisOrderError.prototype);
|
|
178
172
|
}
|
|
179
173
|
}
|
|
180
174
|
/**
|
|
@@ -188,7 +182,6 @@ export class AxisMergeError extends UPTError {
|
|
|
188
182
|
constructor(message) {
|
|
189
183
|
super(`LabeledTensor.mergeAxes: ${message}`);
|
|
190
184
|
this.name = 'AxisMergeError';
|
|
191
|
-
Object.setPrototypeOf(this, AxisMergeError.prototype);
|
|
192
185
|
}
|
|
193
186
|
}
|
|
194
187
|
/**
|
|
@@ -202,7 +195,6 @@ export class AxisSplitError extends UPTError {
|
|
|
202
195
|
constructor(message) {
|
|
203
196
|
super(`LabeledTensor.splitAxis: ${message}`);
|
|
204
197
|
this.name = 'AxisSplitError';
|
|
205
|
-
Object.setPrototypeOf(this, AxisSplitError.prototype);
|
|
206
198
|
}
|
|
207
199
|
}
|
|
208
200
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labeled-tensor.js","sourceRoot":"","sources":["../../src/core/labeled-tensor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,8EAA8E;AAC9E,qEAAqE;AACrE,8BAA8B;AAC9B,8EA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OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC5D,OAAO,IAAI,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IAC3E,CAAC;CACF","sourcesContent":["/**\n * `LabeledTensor` — engine-level tensor wrapped with\n * `UniversalIndex`-tagged metadata. The catalog-facing surface\n * for physics-axis-aware contractions.\n *\n * Phase 2 + Phase 3 of v0.7 Proposal 1 (Intelligent Index Layer).\n *\n * Composition (Decision #5): `LabeledTensor` owns an `EngineTensor`,\n * a `TensorEngine`, and a labels record. The engine handle is the\n * boundary — `LabeledTensor` doesn't reach into the underlying\n * Float64Array / MathTS handle. Contract matching is strictly\n * `UniversalIndexId` equality (Decision #3). Two indices that share a\n * `name` and not an `id` are refused: `contract` throws\n * `IndexNameMismatchError` and the message names both ids. It does not\n * contract them and it does not return their outer product. Indices\n * whose names differ stay free axes.\n *\n * Design: `docs/planning/v0.7-Proposal-1-Design.md` Decisions\n * #1, #3, #5, #6, #7, #9.\n *\n * Cross-Phase Invariants preserved:\n * - #1 adapter-on-top: this module does NOT import\n * `src/dimensional/tensor.ts` or `src/numerical/lowering.ts`.\n * - #4 `TensorSymbolNode` + `computeContraction` UNCHANGED.\n * - #5 `TensorEngine` interface UNCHANGED (consumes, doesn't\n * extend).\n *\n * @module core/labeled-tensor\n */\n\nimport type { EngineTensor, TensorEngine, EinsumSpec } from '../numerical/tensor-engine.js';\nimport { UPTError } from '../dimensional/errors.js';\nimport type { AxisName, UniversalIndex, UniversalIndexId } from './universal-index.js';\n\n// ---------------------------------------------------------------------------\n// Error classes (Phase 3 surface, declared here for co-location with\n// the guards that throw them)\n// ---------------------------------------------------------------------------\n\n/**\n * Thrown by the `LabeledTensor` constructor when the labels record\n * doesn't agree with the underlying tensor's rank\n * (`Object.keys(labels).length !== tensor.shape.length`).\n *\n * @public\n */\nexport class LabeledTensorConstructionError extends UPTError {\n public readonly labelCount: number;\n public readonly tensorRank: number;\n constructor(labelCount: number, tensorRank: number) {\n super(\n `LabeledTensor: labels record has ${labelCount} entries but ` +\n `tensor rank is ${tensorRank}. Every tensor axis must carry exactly ` +\n `one UniversalIndex label.`,\n );\n this.name = 'LabeledTensorConstructionError';\n this.labelCount = labelCount;\n this.tensorRank = tensorRank;\n Object.setPrototypeOf(this, LabeledTensorConstructionError.prototype);\n }\n}\n\n/**\n * Thrown by `contract` when two `UniversalIndex` values share an\n * `id` but disagree on `axis`. Per Decision #7, this is a physics\n * error caught at the wrapper level. Impossible if both operands\n * use the `Axes` registry; defensive against off-registry\n * `makeIndex` consumers.\n *\n * @public\n */\nexport class AxisMismatchError extends UPTError {\n public readonly indexId: UniversalIndexId;\n public readonly leftAxis: AxisName;\n public readonly rightAxis: AxisName;\n constructor(\n indexId: UniversalIndexId,\n leftAxis: AxisName,\n rightAxis: AxisName,\n ) {\n super(\n `LabeledTensor.contract: indices with the same id '${indexId}' ` +\n `disagree on axis ('${leftAxis}' vs '${rightAxis}'). Cross-axis ` +\n `contraction is a physics error.`,\n );\n this.name = 'AxisMismatchError';\n this.indexId = indexId;\n this.leftAxis = leftAxis;\n this.rightAxis = rightAxis;\n Object.setPrototypeOf(this, AxisMismatchError.prototype);\n }\n}\n\n/**\n * Thrown by `contract` when the same `UniversalIndexId` appears in\n * more than one non-contracted (free) position across the two\n * operands. Same physical axis showing up free on both sides is\n * physically meaningful (joint distribution) but the einsum\n * machinery has no canonical way to disambiguate.\n *\n * @public\n */\nexport class IdentityConflictError extends UPTError {\n public readonly indexId: UniversalIndexId;\n /**\n * `where` says which shape was met: the id twice on ONE operand (a\n * self-contraction, which `contract` does not perform), or the id as a\n * free axis on BOTH operands beside a contraction (three occurrences).\n */\n constructor(indexId: UniversalIndexId, where: 'one-operand' | 'both-operands' = 'both-operands') {\n super(\n where === 'one-operand'\n ? `LabeledTensor.contract: UniversalIndexId '${indexId}' appears twice on one operand. ` +\n `A self-contraction is not a contract(); rename one axis or trace it first.`\n : `LabeledTensor.contract: UniversalIndexId '${indexId}' appears as a ` +\n `free axis on both operands. Same physical axis on both sides is ` +\n `ambiguous — rename or contract one side first.`,\n );\n this.name = 'IdentityConflictError';\n this.indexId = indexId;\n Object.setPrototypeOf(this, IdentityConflictError.prototype);\n }\n}\n\n/**\n * Thrown by `contract` when both operands carry the same index `name`\n * and those occurrences do not all share one `UniversalIndexId`.\n *\n * Decision #3 matches by id. A second `makeIndex` call with the same\n * name is a different index. Returning the outer product hid that: the\n * caller who meant one index got a higher-rank tensor and no ids.\n * The error names every id. Distinct names stay an outer product.\n *\n * @public\n */\nexport class IndexNameMismatchError extends UPTError {\n public readonly indexName: string;\n public readonly ids: readonly UniversalIndexId[];\n constructor(\n indexName: string,\n occurrences: readonly { id: UniversalIndexId; axis: AxisName }[],\n ) {\n const ids = [...new Set(occurrences.map((o) => o.id))];\n const described = occurrences\n .map((o) => `'${o.id}' (axis '${o.axis}')`)\n .join(' and ');\n super(\n `LabeledTensor.contract: index name '${indexName}' is carried by ` +\n `unequal ids ${described}. Contraction matches UniversalIndexId, ` +\n `not the name. Reuse one UniversalIndex object, or take it from ` +\n `the Axes registry. A second makeIndex call with the same name is ` +\n `a different index and is not an outer product.`,\n );\n this.name = 'IndexNameMismatchError';\n this.indexName = indexName;\n this.ids = ids;\n Object.setPrototypeOf(this, IndexNameMismatchError.prototype);\n }\n}\n\n/**\n * Thrown by `reshape` when the requested shape would change the\n * tensor rank. v0.7.0 allows only axis-by-axis size change;\n * rank-changing reshape is deferred to v0.8.0+ (`mergeAxes` /\n * `splitAxis` helpers).\n *\n * @public\n */\nexport class RankPreservationError extends UPTError {\n public readonly fromRank: number;\n public readonly toRank: number;\n constructor(fromRank: number, toRank: number) {\n super(\n `LabeledTensor.reshape: cannot change rank from ${fromRank} to ` +\n `${toRank}. v0.7.0 supports only same-rank reshape; use a future ` +\n `mergeAxes / splitAxis helper for rank changes.`,\n );\n this.name = 'RankPreservationError';\n this.fromRank = fromRank;\n this.toRank = toRank;\n Object.setPrototypeOf(this, RankPreservationError.prototype);\n }\n}\n\n/**\n * Thrown by the `LabeledTensor` constructor when an explicit `axisOrder` is\n * not a valid permutation of the label keys (wrong length, a key that is not a\n * label, or a duplicate). Distinct from `LabeledTensorConstructionError` (which\n * means label-count ≠ tensor-rank) so a consumer never reads a rank-mismatch\n * field on an order error.\n *\n * @public\n */\nexport class AxisOrderError extends UPTError {\n public readonly axisOrder: readonly string[];\n public readonly labelKeys: readonly string[];\n constructor(axisOrder: readonly string[], labelKeys: readonly string[]) {\n super(\n `LabeledTensor: axisOrder [${axisOrder.join(', ')}] is not a permutation ` +\n `of the label keys [${labelKeys.join(', ')}] (it must list every label ` +\n `key exactly once, in engine-axis order).`,\n );\n this.name = 'AxisOrderError';\n this.axisOrder = axisOrder;\n this.labelKeys = labelKeys;\n Object.setPrototypeOf(this, AxisOrderError.prototype);\n }\n}\n\n/**\n * Thrown by `mergeAxes` when the request is malformed: fewer than two keys, an\n * unknown key, keys that are not a contiguous run of engine-axis positions, or a\n * merged key/id that collides with a surviving axis.\n *\n * @public\n */\nexport class AxisMergeError extends UPTError {\n constructor(message: string) {\n super(`LabeledTensor.mergeAxes: ${message}`);\n this.name = 'AxisMergeError';\n Object.setPrototypeOf(this, AxisMergeError.prototype);\n }\n}\n\n/**\n * Thrown by `splitAxis` when the request is malformed: an unknown key, fewer\n * than two parts, a non-positive/non-integer part size, a size product that\n * does not match the original axis size, or a part key/id that collides.\n *\n * @public\n */\nexport class AxisSplitError extends UPTError {\n constructor(message: string) {\n super(`LabeledTensor.splitAxis: ${message}`);\n this.name = 'AxisSplitError';\n Object.setPrototypeOf(this, AxisSplitError.prototype);\n }\n}\n\n// ---------------------------------------------------------------------------\n// canonicalLabelOrder — Risk 2 mitigation\n// ---------------------------------------------------------------------------\n\n/**\n * Stable lexicographic ordering of label keys. JavaScript's\n * `Object.entries` preserves string-key insertion order, but we\n * route all label-key→axis-position mapping through this helper\n * so the contract algorithm doesn't accidentally depend on\n * constructor-call ordering.\n *\n * @internal\n */\nexport function canonicalLabelOrder<L extends Record<string, UniversalIndex<AxisName>>>(\n labels: L,\n): string[] {\n return Object.keys(labels).sort();\n}\n\n/**\n * True iff `order` lists exactly the members of `keys`, each once (same length,\n * no duplicates, no foreign entries). Used to validate an explicit `axisOrder`.\n *\n * @internal\n */\nfunction isPermutationOf(order: readonly string[], keys: readonly string[]): boolean {\n if (order.length !== keys.length) return false;\n const seen = new Set<string>();\n const keySet = new Set(keys);\n for (const k of order) {\n if (!keySet.has(k) || seen.has(k)) return false;\n seen.add(k);\n }\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// LabeledTensor (wrapper class)\n// ---------------------------------------------------------------------------\n\n/**\n * Engine-agnostic wrapper carrying physics-axis-tagged metadata over\n * an opaque `EngineTensor`. Two `LabeledTensor`s contract over\n * shared `UniversalIndexId` values; non-shared ids become the\n * result's free axes.\n *\n * Construction enforces `Object.keys(labels).length === tensor.shape.length`.\n *\n * @public\n */\nexport class LabeledTensor<\n L extends Record<string, UniversalIndex<AxisName>> = Record<string, UniversalIndex<AxisName>>,\n> {\n public readonly tensor: EngineTensor;\n public readonly engine: TensorEngine;\n public readonly labels: L;\n /**\n * The label keys in ENGINE-AXIS order: `axisOrder[i]` is the key of engine\n * axis `i`. This is the AUTHORITATIVE label↔axis mapping — consumers must use\n * it (or {@link axisOf}) rather than re-deriving position by sorting keys,\n * because `transpose` / `contract` can leave the engine axes in a non-sorted\n * order. Defaults to `canonicalLabelOrder(labels)` (sorted) when not supplied.\n */\n public readonly axisOrder: readonly string[];\n\n constructor(\n tensor: EngineTensor,\n engine: TensorEngine,\n labels: L,\n axisOrder?: readonly string[],\n ) {\n const labelKeys = Object.keys(labels);\n if (labelKeys.length !== tensor.shape.length) {\n throw new LabeledTensorConstructionError(labelKeys.length, tensor.shape.length);\n }\n const order = axisOrder ?? canonicalLabelOrder(labels);\n // Validate `order` is a permutation of the label keys: same length, every\n // entry is a label key, no duplicates.\n if (order.length !== labelKeys.length || !isPermutationOf(order, labelKeys)) {\n throw new AxisOrderError(order, labelKeys);\n }\n this.tensor = tensor;\n this.engine = engine;\n this.labels = labels;\n this.axisOrder = order;\n }\n\n /**\n * Engine-axis position of a label key (the inverse of {@link axisOrder}).\n * Throws if the key is not a label.\n *\n * @public\n */\n public axisOf(key: string): number {\n const axis = this.axisOrder.indexOf(key);\n if (axis === -1) {\n throw new UPTError(`LabeledTensor.axisOf: '${key}' is not a label key.`);\n }\n return axis;\n }\n\n /**\n * Identity-aware contraction (Decision #3): match labels by\n * `UniversalIndexId` equality only. Returns a new `LabeledTensor`\n * whose free labels are the union of both operands' free labels\n * minus the contracted ids, evaluated in `this`-first,\n * `other`-second canonical order.\n *\n * Throws:\n * - `IndexNameMismatchError` if both operands use one `name` and\n * the ids differ. The message names both ids.\n * - `AxisMismatchError` if a shared id disagrees on axis.\n * - `IdentityConflictError` if a non-shared id appears free on\n * both operands.\n *\n * @public\n */\n public contract<R extends Record<string, UniversalIndex<AxisName>>>(\n other: LabeledTensor<R>,\n ): LabeledTensor {\n if (this.engine !== other.engine) {\n throw new UPTError(\n `LabeledTensor.contract: engine mismatch (${this.engine.name} vs ` +\n `${other.engine.name}). Both operands must share an engine.`,\n );\n }\n\n // Map labels → ENGINE axis positions via each operand's authoritative\n // axisOrder (NOT sorted key order — an operand may carry a non-sorted order\n // from a prior transpose/contract).\n const leftOrder = this.axisOrder;\n const rightOrder = other.axisOrder;\n\n // Same name on both operands is one index only when the ids match.\n // A fresh makeIndex with that name is a different id; the outer\n // product of that pair is the footgun Decision #3 exists to stop.\n const byName = new Map<string, Array<{ id: UniversalIndexId; axis: AxisName; side: 0 | 1 }>>();\n const noteName = (\n side: 0 | 1,\n order: readonly string[],\n labels: Record<string, UniversalIndex<AxisName>>,\n ): void => {\n for (const key of order) {\n const idx = labels[key];\n const list = byName.get(idx.name) ?? [];\n list.push({ id: idx.id, axis: idx.axis, side });\n byName.set(idx.name, list);\n }\n };\n noteName(0, leftOrder, this.labels);\n noteName(1, rightOrder, other.labels);\n for (const [indexName, occurrences] of byName) {\n const onLeft = occurrences.some((o) => o.side === 0);\n const onRight = occurrences.some((o) => o.side === 1);\n if (!onLeft || !onRight) continue;\n const ids = new Set(occurrences.map((o) => o.id));\n if (ids.size > 1) throw new IndexNameMismatchError(indexName, occurrences);\n }\n\n // Build id → (operand, axis-position) sites.\n const sites = new Map<UniversalIndexId, Array<{ operand: 0 | 1; axis: number; key: string; axisName: AxisName }>>();\n leftOrder.forEach((key, axis) => {\n const idx = this.labels[key];\n const list = sites.get(idx.id) ?? [];\n list.push({ operand: 0, axis, key, axisName: idx.axis });\n sites.set(idx.id, list);\n });\n rightOrder.forEach((key, axis) => {\n const idx = other.labels[key];\n const list = sites.get(idx.id) ?? [];\n list.push({ operand: 1, axis, key, axisName: idx.axis });\n sites.set(idx.id, list);\n });\n\n // Classify each id: contracted (in both operands) vs free (in one).\n const contractions: EinsumSpec['contractions'][number][] = [];\n const free: EinsumSpec['free'][number][] = [];\n const resultLabels: Record<string, UniversalIndex<AxisName>> = {};\n // The result's engine-axis order: the result key of each free axis, pushed\n // in the SAME order the free axes enter `spec.free` (which is the order the\n // engine emits result axes). Kept exactly parallel to `free` so it is always\n // a valid permutation of `Object.keys(resultLabels)`.\n const resultAxisOrder: string[] = [];\n\n for (const [id, occurrences] of sites) {\n if (occurrences.length === 1) {\n // Free axis on exactly one operand. Carry through.\n const o = occurrences[0];\n free.push({ operand: o.operand, axis: o.axis });\n // Preserve the original label key; on collision (both operands use the\n // same string key for *different* ids) suffix until a FREE key is found\n // (`x` → `x_0`/`x_1` → `x_0_0`…), so result keys stay UNIQUE and\n // resultAxisOrder remains a valid permutation (Eve Y1: guarding only the\n // unsuffixed key could overwrite an existing suffixed key).\n let key = o.key;\n if (resultLabels[key] !== undefined) {\n let n = 0;\n do {\n key = `${o.key}_${o.operand}${n === 0 ? '' : `_${n}`}`;\n n++;\n } while (resultLabels[key] !== undefined);\n }\n resultLabels[key] = o.operand === 0\n ? this.labels[o.key]\n : other.labels[o.key];\n resultAxisOrder.push(key);\n } else if (occurrences.length === 2) {\n const [a, b] = occurrences;\n if (a.operand === b.operand) {\n // The same id twice in one operand is a self-contraction, which\n // contract() does not perform.\n throw new IdentityConflictError(id, 'one-operand');\n }\n if (a.axisName !== b.axisName) {\n throw new AxisMismatchError(id, a.axisName, b.axisName);\n }\n contractions.push({ pair: [[a.operand, a.axis], [b.operand, b.axis]] });\n } else {\n // 3+ occurrences across the two operands: triple+ contraction,\n // not supported by the binary einsum primitive. Reject.\n throw new IdentityConflictError(id);\n }\n }\n\n const spec: EinsumSpec = { contractions, free };\n const resultTensor = this.engine.einsum(spec, this.tensor, other.tensor);\n return new LabeledTensor(resultTensor, this.engine, resultLabels, resultAxisOrder);\n }\n\n /**\n * Reorder axes per the given permutation of label keys. The new\n * label record reflects the new axis order; the engine handles\n * the storage-level permutation via `engine.transpose`.\n *\n * @public\n */\n public transpose(newKeyOrder: ReadonlyArray<keyof L & string>): LabeledTensor<L> {\n // Permutation is computed against the CURRENT engine-axis order\n // (`this.axisOrder`), NOT the sorted key order — `this.axisOrder` may\n // already be non-sorted (e.g. a contract result, or a prior transpose).\n if (newKeyOrder.length !== this.axisOrder.length) {\n throw new UPTError(\n `LabeledTensor.transpose: new key order has ${newKeyOrder.length} ` +\n `entries but tensor has ${this.axisOrder.length} axes.`,\n );\n }\n const currentIndex = new Map(this.axisOrder.map((k, i) => [k, i]));\n const perm: number[] = [];\n for (const key of newKeyOrder) {\n const pos = currentIndex.get(key);\n if (pos === undefined) {\n throw new UPTError(\n `LabeledTensor.transpose: key '${String(key)}' not found in labels.`,\n );\n }\n perm.push(pos);\n }\n const transposedTensor = this.engine.transpose(this.tensor, perm);\n // The result's engine axis i is the old axis perm[i] = newKeyOrder[i], so\n // the new axisOrder IS newKeyOrder.\n return new LabeledTensor(transposedTensor, this.engine, this.labels, [...newKeyOrder]);\n }\n\n /**\n * Per-axis size change. Rank must be preserved (Decision #5);\n * rank-changing reshape throws `RankPreservationError`. v0.8.0+\n * may add `mergeAxes` / `splitAxis` for rank-changing operations.\n *\n * Labels survive unchanged (axis identity is preserved across a\n * size-only reshape).\n *\n * @public\n */\n public reshape(shape: ReadonlyArray<number>): LabeledTensor<L> {\n if (shape.length !== this.tensor.shape.length) {\n throw new RankPreservationError(this.tensor.shape.length, shape.length);\n }\n const reshapedTensor = this.engine.reshape(this.tensor, shape);\n // Rank-preserving size change never reorders axes — carry axisOrder through.\n return new LabeledTensor(reshapedTensor, this.engine, this.labels, this.axisOrder);\n }\n\n /**\n * Fuse a CONTIGUOUS run of engine axes (named by `keys`) into ONE axis\n * carrying the caller-supplied `merged` label. Rank R → R − (keys.length − 1).\n *\n * The keys must occupy a gapless consecutive run of engine-axis positions\n * (`engine.reshape` fuses STORAGE-adjacent axes only) — `transpose` them\n * adjacent first otherwise. The fused axis spans the merged axes in ENGINE\n * order; the order `keys` are listed does not matter (the merged axis is\n * opaque). The caller owns the merged axis's identity — no composite-id is\n * synthesized.\n *\n * @public\n */\n public mergeAxes(\n keys: readonly string[],\n merged: { key: string; index: UniversalIndex<AxisName> },\n ): LabeledTensor {\n if (keys.length < 2) {\n throw new AxisMergeError(`need at least 2 keys to merge, got ${keys.length}.`);\n }\n if (new Set(keys).size !== keys.length) {\n throw new AxisMergeError(`keys ${JSON.stringify(keys)} contain a duplicate.`);\n }\n const positions: number[] = [];\n for (const k of keys) {\n const p = this.axisOrder.indexOf(k);\n if (p === -1) throw new AxisMergeError(`'${k}' is not a label key.`);\n positions.push(p);\n }\n // Distinct keys have distinct positions (the duplicate check above), so a\n // contiguous run is exactly `hi − lo === n − 1`.\n const sorted = [...positions].sort((a, b) => a - b);\n const lo = sorted[0];\n const hi = sorted[sorted.length - 1];\n if (hi - lo !== sorted.length - 1) {\n throw new AxisMergeError(\n `keys ${JSON.stringify(keys)} are not a contiguous run of engine axes ` +\n `(positions ${JSON.stringify(positions)}); transpose them adjacent first.`,\n );\n }\n // Surviving keys = axes outside the merged run. (A merged key may safely\n // REUSE one of the consumed keys' names — those are not surviving.)\n const survivingKeys = this.axisOrder.filter((_, i) => i < lo || i > hi);\n if (survivingKeys.includes(merged.key)) {\n throw new AxisMergeError(`merged key '${merged.key}' collides with a surviving label key.`);\n }\n for (const k of survivingKeys) {\n if (this.labels[k].id === merged.index.id) {\n throw new AxisMergeError(\n `merged id '${merged.index.id}' collides with surviving axis '${k}'.`,\n );\n }\n }\n\n const shape = this.tensor.shape;\n let mergedSize = 1;\n for (let i = lo; i <= hi; i++) mergedSize *= shape[i];\n const newShape = [...shape.slice(0, lo), mergedSize, ...shape.slice(hi + 1)];\n\n const newLabels: Record<string, UniversalIndex<AxisName>> = {};\n for (const k of survivingKeys) newLabels[k] = this.labels[k];\n newLabels[merged.key] = merged.index;\n\n const newAxisOrder = [\n ...this.axisOrder.slice(0, lo),\n merged.key,\n ...this.axisOrder.slice(hi + 1),\n ];\n\n const reshaped = this.engine.reshape(this.tensor, newShape);\n return new LabeledTensor(reshaped, this.engine, newLabels, newAxisOrder);\n }\n\n /**\n * Split ONE engine axis (named `key`) into several, each carrying a\n * caller-supplied sub-label whose sizes multiply to the original axis size.\n * Rank R → R + (parts.length − 1). The parts occupy the split axis's position\n * in `parts` order. Inverse of {@link mergeAxes}.\n *\n * @public\n */\n public splitAxis(\n key: string,\n parts: readonly { key: string; index: UniversalIndex<AxisName>; size: number }[],\n ): LabeledTensor {\n const p = this.axisOrder.indexOf(key);\n if (p === -1) throw new AxisSplitError(`'${key}' is not a label key.`);\n if (parts.length < 2) {\n throw new AxisSplitError(`need at least 2 parts to split into, got ${parts.length}.`);\n }\n let product = 1;\n for (const part of parts) {\n if (!Number.isInteger(part.size) || part.size <= 0) {\n throw new AxisSplitError(`part '${part.key}' size must be a positive integer, got ${part.size}.`);\n }\n product *= part.size;\n }\n const axisSize = this.tensor.shape[p];\n if (product !== axisSize) {\n throw new AxisSplitError(\n `part sizes multiply to ${product} but axis '${key}' has size ${axisSize}.`,\n );\n }\n const survivingKeys = this.axisOrder.filter((k) => k !== key);\n const seen = new Set<string>();\n const seenIds = new Set<UniversalIndexId>();\n for (const part of parts) {\n if (survivingKeys.includes(part.key)) {\n throw new AxisSplitError(`part key '${part.key}' collides with a surviving label key.`);\n }\n if (seen.has(part.key)) throw new AxisSplitError(`duplicate part key '${part.key}'.`);\n seen.add(part.key);\n // Both parts SURVIVE, so two parts sharing one id would build a tensor\n // that `contract` later rejects as IdentityConflictError — fail here at\n // the malformed call instead (Eve Y1). (mergeAxes has no analogue: its\n // merged id replaces consumed axes, so reusing a consumed id is legal.)\n if (seenIds.has(part.index.id)) {\n throw new AxisSplitError(`two parts share id '${part.index.id}'.`);\n }\n seenIds.add(part.index.id);\n for (const k of survivingKeys) {\n if (this.labels[k].id === part.index.id) {\n throw new AxisSplitError(\n `part id '${part.index.id}' collides with surviving axis '${k}'.`,\n );\n }\n }\n }\n\n const shape = this.tensor.shape;\n const newShape = [...shape.slice(0, p), ...parts.map((pt) => pt.size), ...shape.slice(p + 1)];\n\n const newLabels: Record<string, UniversalIndex<AxisName>> = {};\n for (const k of survivingKeys) newLabels[k] = this.labels[k];\n for (const part of parts) newLabels[part.key] = part.index;\n\n const newAxisOrder = [\n ...this.axisOrder.slice(0, p),\n ...parts.map((pt) => pt.key),\n ...this.axisOrder.slice(p + 1),\n ];\n\n const reshaped = this.engine.reshape(this.tensor, newShape);\n return new LabeledTensor(reshaped, this.engine, newLabels, newAxisOrder);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"labeled-tensor.js","sourceRoot":"","sources":["../../src/core/labeled-tensor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,8EAA8E;AAC9E,qEAAqE;AACrE,8BAA8B;AAC9B,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,OAAO,8BAA+B,SAAQ,QAAQ;IAC1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S,GAA6C,EAAE,CAAC;QAC/D,KAAK,MAAM,CAAC,IAAI,aAAa;YAAE,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7D,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAE3D,MAAM,YAAY,GAAG;YACnB,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YAC7B,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC;YAC5B,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;SAC/B,CAAC;QAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC5D,OAAO,IAAI,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IAC3E,CAAC;CACF","sourcesContent":["/**\n * `LabeledTensor` — engine-level tensor wrapped with\n * `UniversalIndex`-tagged metadata. The catalog-facing surface\n * for physics-axis-aware contractions.\n *\n * Phase 2 + Phase 3 of v0.7 Proposal 1 (Intelligent Index Layer).\n *\n * Composition (Decision #5): `LabeledTensor` owns an `EngineTensor`,\n * a `TensorEngine`, and a labels record. The engine handle is the\n * boundary — `LabeledTensor` doesn't reach into the underlying\n * Float64Array / MathTS handle. Contract matching is strictly\n * `UniversalIndexId` equality (Decision #3). Two indices that share a\n * `name` and not an `id` are refused: `contract` throws\n * `IndexNameMismatchError` and the message names both ids. It does not\n * contract them and it does not return their outer product. Indices\n * whose names differ stay free axes.\n *\n * Design: `docs/planning/v0.7-Proposal-1-Design.md` Decisions\n * #1, #3, #5, #6, #7, #9.\n *\n * Cross-Phase Invariants preserved:\n * - #1 adapter-on-top: this module does NOT import\n * `src/dimensional/tensor.ts` or `src/numerical/lowering.ts`.\n * - #4 `TensorSymbolNode` + `computeContraction` UNCHANGED.\n * - #5 `TensorEngine` interface UNCHANGED (consumes, doesn't\n * extend).\n *\n * @module core/labeled-tensor\n */\n\nimport type { EngineTensor, TensorEngine, EinsumSpec } from '../numerical/tensor-engine.js';\nimport { UPTError } from '../dimensional/errors.js';\nimport type { AxisName, UniversalIndex, UniversalIndexId } from './universal-index.js';\n\n// ---------------------------------------------------------------------------\n// Error classes (Phase 3 surface, declared here for co-location with\n// the guards that throw them)\n// ---------------------------------------------------------------------------\n\n/**\n * Thrown by the `LabeledTensor` constructor when the labels record\n * doesn't agree with the underlying tensor's rank\n * (`Object.keys(labels).length !== tensor.shape.length`).\n *\n * @public\n */\nexport class LabeledTensorConstructionError extends UPTError {\n public readonly labelCount: number;\n public readonly tensorRank: number;\n constructor(labelCount: number, tensorRank: number) {\n super(\n `LabeledTensor: labels record has ${labelCount} entries but ` +\n `tensor rank is ${tensorRank}. Every tensor axis must carry exactly ` +\n `one UniversalIndex label.`,\n );\n this.name = 'LabeledTensorConstructionError';\n this.labelCount = labelCount;\n this.tensorRank = tensorRank;\n }\n}\n\n/**\n * Thrown by `contract` when two `UniversalIndex` values share an\n * `id` but disagree on `axis`. Per Decision #7, this is a physics\n * error caught at the wrapper level. Impossible if both operands\n * use the `Axes` registry; defensive against off-registry\n * `makeIndex` consumers.\n *\n * @public\n */\nexport class AxisMismatchError extends UPTError {\n public readonly indexId: UniversalIndexId;\n public readonly leftAxis: AxisName;\n public readonly rightAxis: AxisName;\n constructor(\n indexId: UniversalIndexId,\n leftAxis: AxisName,\n rightAxis: AxisName,\n ) {\n super(\n `LabeledTensor.contract: indices with the same id '${indexId}' ` +\n `disagree on axis ('${leftAxis}' vs '${rightAxis}'). Cross-axis ` +\n `contraction is a physics error.`,\n );\n this.name = 'AxisMismatchError';\n this.indexId = indexId;\n this.leftAxis = leftAxis;\n this.rightAxis = rightAxis;\n }\n}\n\n/**\n * Thrown by `contract` when the same `UniversalIndexId` appears in\n * more than one non-contracted (free) position across the two\n * operands. Same physical axis showing up free on both sides is\n * physically meaningful (joint distribution) but the einsum\n * machinery has no canonical way to disambiguate.\n *\n * @public\n */\nexport class IdentityConflictError extends UPTError {\n public readonly indexId: UniversalIndexId;\n /**\n * `where` says which shape was met: the id twice on ONE operand (a\n * self-contraction, which `contract` does not perform), or the id as a\n * free axis on BOTH operands beside a contraction (three occurrences).\n */\n constructor(indexId: UniversalIndexId, where: 'one-operand' | 'both-operands' = 'both-operands') {\n super(\n where === 'one-operand'\n ? `LabeledTensor.contract: UniversalIndexId '${indexId}' appears twice on one operand. ` +\n `A self-contraction is not a contract(); rename one axis or trace it first.`\n : `LabeledTensor.contract: UniversalIndexId '${indexId}' appears as a ` +\n `free axis on both operands. Same physical axis on both sides is ` +\n `ambiguous — rename or contract one side first.`,\n );\n this.name = 'IdentityConflictError';\n this.indexId = indexId;\n }\n}\n\n/**\n * Thrown by `contract` when both operands carry the same index `name`\n * and those occurrences do not all share one `UniversalIndexId`.\n *\n * Decision #3 matches by id. A second `makeIndex` call with the same\n * name is a different index. Returning the outer product hid that: the\n * caller who meant one index got a higher-rank tensor and no ids.\n * The error names every id. Distinct names stay an outer product.\n *\n * @public\n */\nexport class IndexNameMismatchError extends UPTError {\n public readonly indexName: string;\n public readonly ids: readonly UniversalIndexId[];\n constructor(\n indexName: string,\n occurrences: readonly { id: UniversalIndexId; axis: AxisName }[],\n ) {\n const ids = [...new Set(occurrences.map((o) => o.id))];\n const described = occurrences\n .map((o) => `'${o.id}' (axis '${o.axis}')`)\n .join(' and ');\n super(\n `LabeledTensor.contract: index name '${indexName}' is carried by ` +\n `unequal ids ${described}. Contraction matches UniversalIndexId, ` +\n `not the name. Reuse one UniversalIndex object, or take it from ` +\n `the Axes registry. A second makeIndex call with the same name is ` +\n `a different index and is not an outer product.`,\n );\n this.name = 'IndexNameMismatchError';\n this.indexName = indexName;\n this.ids = ids;\n }\n}\n\n/**\n * Thrown by `reshape` when the requested shape would change the\n * tensor rank. v0.7.0 allows only axis-by-axis size change;\n * rank-changing reshape is deferred to v0.8.0+ (`mergeAxes` /\n * `splitAxis` helpers).\n *\n * @public\n */\nexport class RankPreservationError extends UPTError {\n public readonly fromRank: number;\n public readonly toRank: number;\n constructor(fromRank: number, toRank: number) {\n super(\n `LabeledTensor.reshape: cannot change rank from ${fromRank} to ` +\n `${toRank}. v0.7.0 supports only same-rank reshape; use a future ` +\n `mergeAxes / splitAxis helper for rank changes.`,\n );\n this.name = 'RankPreservationError';\n this.fromRank = fromRank;\n this.toRank = toRank;\n }\n}\n\n/**\n * Thrown by the `LabeledTensor` constructor when an explicit `axisOrder` is\n * not a valid permutation of the label keys (wrong length, a key that is not a\n * label, or a duplicate). Distinct from `LabeledTensorConstructionError` (which\n * means label-count ≠ tensor-rank) so a consumer never reads a rank-mismatch\n * field on an order error.\n *\n * @public\n */\nexport class AxisOrderError extends UPTError {\n public readonly axisOrder: readonly string[];\n public readonly labelKeys: readonly string[];\n constructor(axisOrder: readonly string[], labelKeys: readonly string[]) {\n super(\n `LabeledTensor: axisOrder [${axisOrder.join(', ')}] is not a permutation ` +\n `of the label keys [${labelKeys.join(', ')}] (it must list every label ` +\n `key exactly once, in engine-axis order).`,\n );\n this.name = 'AxisOrderError';\n this.axisOrder = axisOrder;\n this.labelKeys = labelKeys;\n }\n}\n\n/**\n * Thrown by `mergeAxes` when the request is malformed: fewer than two keys, an\n * unknown key, keys that are not a contiguous run of engine-axis positions, or a\n * merged key/id that collides with a surviving axis.\n *\n * @public\n */\nexport class AxisMergeError extends UPTError {\n constructor(message: string) {\n super(`LabeledTensor.mergeAxes: ${message}`);\n this.name = 'AxisMergeError';\n }\n}\n\n/**\n * Thrown by `splitAxis` when the request is malformed: an unknown key, fewer\n * than two parts, a non-positive/non-integer part size, a size product that\n * does not match the original axis size, or a part key/id that collides.\n *\n * @public\n */\nexport class AxisSplitError extends UPTError {\n constructor(message: string) {\n super(`LabeledTensor.splitAxis: ${message}`);\n this.name = 'AxisSplitError';\n }\n}\n\n// ---------------------------------------------------------------------------\n// canonicalLabelOrder — Risk 2 mitigation\n// ---------------------------------------------------------------------------\n\n/**\n * Stable lexicographic ordering of label keys. JavaScript's\n * `Object.entries` preserves string-key insertion order, but we\n * route all label-key→axis-position mapping through this helper\n * so the contract algorithm doesn't accidentally depend on\n * constructor-call ordering.\n *\n * @internal\n */\nexport function canonicalLabelOrder<L extends Record<string, UniversalIndex<AxisName>>>(\n labels: L,\n): string[] {\n return Object.keys(labels).sort();\n}\n\n/**\n * True iff `order` lists exactly the members of `keys`, each once (same length,\n * no duplicates, no foreign entries). Used to validate an explicit `axisOrder`.\n *\n * @internal\n */\nfunction isPermutationOf(order: readonly string[], keys: readonly string[]): boolean {\n if (order.length !== keys.length) return false;\n const seen = new Set<string>();\n const keySet = new Set(keys);\n for (const k of order) {\n if (!keySet.has(k) || seen.has(k)) return false;\n seen.add(k);\n }\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// LabeledTensor (wrapper class)\n// ---------------------------------------------------------------------------\n\n/**\n * Engine-agnostic wrapper carrying physics-axis-tagged metadata over\n * an opaque `EngineTensor`. Two `LabeledTensor`s contract over\n * shared `UniversalIndexId` values; non-shared ids become the\n * result's free axes.\n *\n * Construction enforces `Object.keys(labels).length === tensor.shape.length`.\n *\n * @public\n */\nexport class LabeledTensor<\n L extends Record<string, UniversalIndex<AxisName>> = Record<string, UniversalIndex<AxisName>>,\n> {\n public readonly tensor: EngineTensor;\n public readonly engine: TensorEngine;\n public readonly labels: L;\n /**\n * The label keys in ENGINE-AXIS order: `axisOrder[i]` is the key of engine\n * axis `i`. This is the AUTHORITATIVE label↔axis mapping — consumers must use\n * it (or {@link axisOf}) rather than re-deriving position by sorting keys,\n * because `transpose` / `contract` can leave the engine axes in a non-sorted\n * order. Defaults to `canonicalLabelOrder(labels)` (sorted) when not supplied.\n */\n public readonly axisOrder: readonly string[];\n\n constructor(\n tensor: EngineTensor,\n engine: TensorEngine,\n labels: L,\n axisOrder?: readonly string[],\n ) {\n const labelKeys = Object.keys(labels);\n if (labelKeys.length !== tensor.shape.length) {\n throw new LabeledTensorConstructionError(labelKeys.length, tensor.shape.length);\n }\n const order = axisOrder ?? canonicalLabelOrder(labels);\n // Validate `order` is a permutation of the label keys: same length, every\n // entry is a label key, no duplicates.\n if (order.length !== labelKeys.length || !isPermutationOf(order, labelKeys)) {\n throw new AxisOrderError(order, labelKeys);\n }\n this.tensor = tensor;\n this.engine = engine;\n this.labels = labels;\n this.axisOrder = order;\n }\n\n /**\n * Engine-axis position of a label key (the inverse of {@link axisOrder}).\n * Throws if the key is not a label.\n *\n * @public\n */\n public axisOf(key: string): number {\n const axis = this.axisOrder.indexOf(key);\n if (axis === -1) {\n throw new UPTError(`LabeledTensor.axisOf: '${key}' is not a label key.`);\n }\n return axis;\n }\n\n /**\n * Identity-aware contraction (Decision #3): match labels by\n * `UniversalIndexId` equality only. Returns a new `LabeledTensor`\n * whose free labels are the union of both operands' free labels\n * minus the contracted ids, evaluated in `this`-first,\n * `other`-second canonical order.\n *\n * Throws:\n * - `IndexNameMismatchError` if both operands use one `name` and\n * the ids differ. The message names both ids.\n * - `AxisMismatchError` if a shared id disagrees on axis.\n * - `IdentityConflictError` if a non-shared id appears free on\n * both operands.\n *\n * @public\n */\n public contract<R extends Record<string, UniversalIndex<AxisName>>>(\n other: LabeledTensor<R>,\n ): LabeledTensor {\n if (this.engine !== other.engine) {\n throw new UPTError(\n `LabeledTensor.contract: engine mismatch (${this.engine.name} vs ` +\n `${other.engine.name}). Both operands must share an engine.`,\n );\n }\n\n // Map labels → ENGINE axis positions via each operand's authoritative\n // axisOrder (NOT sorted key order — an operand may carry a non-sorted order\n // from a prior transpose/contract).\n const leftOrder = this.axisOrder;\n const rightOrder = other.axisOrder;\n\n // Same name on both operands is one index only when the ids match.\n // A fresh makeIndex with that name is a different id; the outer\n // product of that pair is the footgun Decision #3 exists to stop.\n const byName = new Map<string, Array<{ id: UniversalIndexId; axis: AxisName; side: 0 | 1 }>>();\n const noteName = (\n side: 0 | 1,\n order: readonly string[],\n labels: Record<string, UniversalIndex<AxisName>>,\n ): void => {\n for (const key of order) {\n const idx = labels[key];\n const list = byName.get(idx.name) ?? [];\n list.push({ id: idx.id, axis: idx.axis, side });\n byName.set(idx.name, list);\n }\n };\n noteName(0, leftOrder, this.labels);\n noteName(1, rightOrder, other.labels);\n for (const [indexName, occurrences] of byName) {\n const onLeft = occurrences.some((o) => o.side === 0);\n const onRight = occurrences.some((o) => o.side === 1);\n if (!onLeft || !onRight) continue;\n const ids = new Set(occurrences.map((o) => o.id));\n if (ids.size > 1) throw new IndexNameMismatchError(indexName, occurrences);\n }\n\n // Build id → (operand, axis-position) sites.\n const sites = new Map<UniversalIndexId, Array<{ operand: 0 | 1; axis: number; key: string; axisName: AxisName }>>();\n leftOrder.forEach((key, axis) => {\n const idx = this.labels[key];\n const list = sites.get(idx.id) ?? [];\n list.push({ operand: 0, axis, key, axisName: idx.axis });\n sites.set(idx.id, list);\n });\n rightOrder.forEach((key, axis) => {\n const idx = other.labels[key];\n const list = sites.get(idx.id) ?? [];\n list.push({ operand: 1, axis, key, axisName: idx.axis });\n sites.set(idx.id, list);\n });\n\n // Classify each id: contracted (in both operands) vs free (in one).\n const contractions: EinsumSpec['contractions'][number][] = [];\n const free: EinsumSpec['free'][number][] = [];\n const resultLabels: Record<string, UniversalIndex<AxisName>> = {};\n // The result's engine-axis order: the result key of each free axis, pushed\n // in the SAME order the free axes enter `spec.free` (which is the order the\n // engine emits result axes). Kept exactly parallel to `free` so it is always\n // a valid permutation of `Object.keys(resultLabels)`.\n const resultAxisOrder: string[] = [];\n\n for (const [id, occurrences] of sites) {\n if (occurrences.length === 1) {\n // Free axis on exactly one operand. Carry through.\n const o = occurrences[0];\n free.push({ operand: o.operand, axis: o.axis });\n // Preserve the original label key; on collision (both operands use the\n // same string key for *different* ids) suffix until a FREE key is found\n // (`x` → `x_0`/`x_1` → `x_0_0`…), so result keys stay UNIQUE and\n // resultAxisOrder remains a valid permutation (Eve Y1: guarding only the\n // unsuffixed key could overwrite an existing suffixed key).\n let key = o.key;\n if (resultLabels[key] !== undefined) {\n let n = 0;\n do {\n key = `${o.key}_${o.operand}${n === 0 ? '' : `_${n}`}`;\n n++;\n } while (resultLabels[key] !== undefined);\n }\n resultLabels[key] = o.operand === 0\n ? this.labels[o.key]\n : other.labels[o.key];\n resultAxisOrder.push(key);\n } else if (occurrences.length === 2) {\n const [a, b] = occurrences;\n if (a.operand === b.operand) {\n // The same id twice in one operand is a self-contraction, which\n // contract() does not perform.\n throw new IdentityConflictError(id, 'one-operand');\n }\n if (a.axisName !== b.axisName) {\n throw new AxisMismatchError(id, a.axisName, b.axisName);\n }\n contractions.push({ pair: [[a.operand, a.axis], [b.operand, b.axis]] });\n } else {\n // 3+ occurrences across the two operands: triple+ contraction,\n // not supported by the binary einsum primitive. Reject.\n throw new IdentityConflictError(id);\n }\n }\n\n const spec: EinsumSpec = { contractions, free };\n const resultTensor = this.engine.einsum(spec, this.tensor, other.tensor);\n return new LabeledTensor(resultTensor, this.engine, resultLabels, resultAxisOrder);\n }\n\n /**\n * Reorder axes per the given permutation of label keys. The new\n * label record reflects the new axis order; the engine handles\n * the storage-level permutation via `engine.transpose`.\n *\n * @public\n */\n public transpose(newKeyOrder: ReadonlyArray<keyof L & string>): LabeledTensor<L> {\n // Permutation is computed against the CURRENT engine-axis order\n // (`this.axisOrder`), NOT the sorted key order — `this.axisOrder` may\n // already be non-sorted (e.g. a contract result, or a prior transpose).\n if (newKeyOrder.length !== this.axisOrder.length) {\n throw new UPTError(\n `LabeledTensor.transpose: new key order has ${newKeyOrder.length} ` +\n `entries but tensor has ${this.axisOrder.length} axes.`,\n );\n }\n const currentIndex = new Map(this.axisOrder.map((k, i) => [k, i]));\n const perm: number[] = [];\n for (const key of newKeyOrder) {\n const pos = currentIndex.get(key);\n if (pos === undefined) {\n throw new UPTError(\n `LabeledTensor.transpose: key '${String(key)}' not found in labels.`,\n );\n }\n perm.push(pos);\n }\n const transposedTensor = this.engine.transpose(this.tensor, perm);\n // The result's engine axis i is the old axis perm[i] = newKeyOrder[i], so\n // the new axisOrder IS newKeyOrder.\n return new LabeledTensor(transposedTensor, this.engine, this.labels, [...newKeyOrder]);\n }\n\n /**\n * Per-axis size change. Rank must be preserved (Decision #5);\n * rank-changing reshape throws `RankPreservationError`. v0.8.0+\n * may add `mergeAxes` / `splitAxis` for rank-changing operations.\n *\n * Labels survive unchanged (axis identity is preserved across a\n * size-only reshape).\n *\n * @public\n */\n public reshape(shape: ReadonlyArray<number>): LabeledTensor<L> {\n if (shape.length !== this.tensor.shape.length) {\n throw new RankPreservationError(this.tensor.shape.length, shape.length);\n }\n const reshapedTensor = this.engine.reshape(this.tensor, shape);\n // Rank-preserving size change never reorders axes — carry axisOrder through.\n return new LabeledTensor(reshapedTensor, this.engine, this.labels, this.axisOrder);\n }\n\n /**\n * Fuse a CONTIGUOUS run of engine axes (named by `keys`) into ONE axis\n * carrying the caller-supplied `merged` label. Rank R → R − (keys.length − 1).\n *\n * The keys must occupy a gapless consecutive run of engine-axis positions\n * (`engine.reshape` fuses STORAGE-adjacent axes only) — `transpose` them\n * adjacent first otherwise. The fused axis spans the merged axes in ENGINE\n * order; the order `keys` are listed does not matter (the merged axis is\n * opaque). The caller owns the merged axis's identity — no composite-id is\n * synthesized.\n *\n * @public\n */\n public mergeAxes(\n keys: readonly string[],\n merged: { key: string; index: UniversalIndex<AxisName> },\n ): LabeledTensor {\n if (keys.length < 2) {\n throw new AxisMergeError(`need at least 2 keys to merge, got ${keys.length}.`);\n }\n if (new Set(keys).size !== keys.length) {\n throw new AxisMergeError(`keys ${JSON.stringify(keys)} contain a duplicate.`);\n }\n const positions: number[] = [];\n for (const k of keys) {\n const p = this.axisOrder.indexOf(k);\n if (p === -1) throw new AxisMergeError(`'${k}' is not a label key.`);\n positions.push(p);\n }\n // Distinct keys have distinct positions (the duplicate check above), so a\n // contiguous run is exactly `hi − lo === n − 1`.\n const sorted = [...positions].sort((a, b) => a - b);\n const lo = sorted[0];\n const hi = sorted[sorted.length - 1];\n if (hi - lo !== sorted.length - 1) {\n throw new AxisMergeError(\n `keys ${JSON.stringify(keys)} are not a contiguous run of engine axes ` +\n `(positions ${JSON.stringify(positions)}); transpose them adjacent first.`,\n );\n }\n // Surviving keys = axes outside the merged run. (A merged key may safely\n // REUSE one of the consumed keys' names — those are not surviving.)\n const survivingKeys = this.axisOrder.filter((_, i) => i < lo || i > hi);\n if (survivingKeys.includes(merged.key)) {\n throw new AxisMergeError(`merged key '${merged.key}' collides with a surviving label key.`);\n }\n for (const k of survivingKeys) {\n if (this.labels[k].id === merged.index.id) {\n throw new AxisMergeError(\n `merged id '${merged.index.id}' collides with surviving axis '${k}'.`,\n );\n }\n }\n\n const shape = this.tensor.shape;\n let mergedSize = 1;\n for (let i = lo; i <= hi; i++) mergedSize *= shape[i];\n const newShape = [...shape.slice(0, lo), mergedSize, ...shape.slice(hi + 1)];\n\n const newLabels: Record<string, UniversalIndex<AxisName>> = {};\n for (const k of survivingKeys) newLabels[k] = this.labels[k];\n newLabels[merged.key] = merged.index;\n\n const newAxisOrder = [\n ...this.axisOrder.slice(0, lo),\n merged.key,\n ...this.axisOrder.slice(hi + 1),\n ];\n\n const reshaped = this.engine.reshape(this.tensor, newShape);\n return new LabeledTensor(reshaped, this.engine, newLabels, newAxisOrder);\n }\n\n /**\n * Split ONE engine axis (named `key`) into several, each carrying a\n * caller-supplied sub-label whose sizes multiply to the original axis size.\n * Rank R → R + (parts.length − 1). The parts occupy the split axis's position\n * in `parts` order. Inverse of {@link mergeAxes}.\n *\n * @public\n */\n public splitAxis(\n key: string,\n parts: readonly { key: string; index: UniversalIndex<AxisName>; size: number }[],\n ): LabeledTensor {\n const p = this.axisOrder.indexOf(key);\n if (p === -1) throw new AxisSplitError(`'${key}' is not a label key.`);\n if (parts.length < 2) {\n throw new AxisSplitError(`need at least 2 parts to split into, got ${parts.length}.`);\n }\n let product = 1;\n for (const part of parts) {\n if (!Number.isInteger(part.size) || part.size <= 0) {\n throw new AxisSplitError(`part '${part.key}' size must be a positive integer, got ${part.size}.`);\n }\n product *= part.size;\n }\n const axisSize = this.tensor.shape[p];\n if (product !== axisSize) {\n throw new AxisSplitError(\n `part sizes multiply to ${product} but axis '${key}' has size ${axisSize}.`,\n );\n }\n const survivingKeys = this.axisOrder.filter((k) => k !== key);\n const seen = new Set<string>();\n const seenIds = new Set<UniversalIndexId>();\n for (const part of parts) {\n if (survivingKeys.includes(part.key)) {\n throw new AxisSplitError(`part key '${part.key}' collides with a surviving label key.`);\n }\n if (seen.has(part.key)) throw new AxisSplitError(`duplicate part key '${part.key}'.`);\n seen.add(part.key);\n // Both parts SURVIVE, so two parts sharing one id would build a tensor\n // that `contract` later rejects as IdentityConflictError — fail here at\n // the malformed call instead (Eve Y1). (mergeAxes has no analogue: its\n // merged id replaces consumed axes, so reusing a consumed id is legal.)\n if (seenIds.has(part.index.id)) {\n throw new AxisSplitError(`two parts share id '${part.index.id}'.`);\n }\n seenIds.add(part.index.id);\n for (const k of survivingKeys) {\n if (this.labels[k].id === part.index.id) {\n throw new AxisSplitError(\n `part id '${part.index.id}' collides with surviving axis '${k}'.`,\n );\n }\n }\n }\n\n const shape = this.tensor.shape;\n const newShape = [...shape.slice(0, p), ...parts.map((pt) => pt.size), ...shape.slice(p + 1)];\n\n const newLabels: Record<string, UniversalIndex<AxisName>> = {};\n for (const k of survivingKeys) newLabels[k] = this.labels[k];\n for (const part of parts) newLabels[part.key] = part.index;\n\n const newAxisOrder = [\n ...this.axisOrder.slice(0, p),\n ...parts.map((pt) => pt.key),\n ...this.axisOrder.slice(p + 1),\n ];\n\n const reshaped = this.engine.reshape(this.tensor, newShape);\n return new LabeledTensor(reshaped, this.engine, newLabels, newAxisOrder);\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Readers for the typed MathTS results.
|
|
3
|
+
*
|
|
4
|
+
* The typed MathTS functions (`lgamma`, `ellipticK`, `mean`, `gcd`, `inv`,
|
|
5
|
+
* …) are dispatch objects whose declared return is `unknown`, so every
|
|
6
|
+
* caller used to carry its own `typeof` check before arithmetic. These three
|
|
7
|
+
* readers are that check, once: each returns the value as the type it is and
|
|
8
|
+
* throws a `TypeError` naming the MathTS function otherwise. They check the
|
|
9
|
+
* shape, not the value: a `NaN` is a number and is passed through, as the
|
|
10
|
+
* inline checks passed it.
|
|
11
|
+
*
|
|
12
|
+
* @module core/mathts-read
|
|
13
|
+
*/
|
|
14
|
+
/** The number `v` is, or a `TypeError` naming the MathTS function `fn` that returned something else. @internal */
|
|
15
|
+
export declare function numberFrom(fn: string, v: unknown): number;
|
|
16
|
+
/** The bigint `v` is, or a `TypeError` naming the MathTS function `fn` that returned something else. @internal */
|
|
17
|
+
export declare function bigintFrom(fn: string, v: unknown): bigint;
|
|
18
|
+
/**
|
|
19
|
+
* The `n`×`n` number matrix `v` is, copied row by row into a fresh `number[][]`,
|
|
20
|
+
* or a `TypeError` naming the MathTS function `fn` when `v` is not an array of
|
|
21
|
+
* `n` rows of `n` numbers.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function numberMatrixFrom(fn: string, v: unknown, n: number): number[][];
|
|
25
|
+
//# sourceMappingURL=mathts-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mathts-read.d.ts","sourceRoot":"","sources":["../../src/core/mathts-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,kHAAkH;AAClH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,CAGzD;AAED,kHAAkH;AAClH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,CAGzD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAS9E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Readers for the typed MathTS results.
|
|
3
|
+
*
|
|
4
|
+
* The typed MathTS functions (`lgamma`, `ellipticK`, `mean`, `gcd`, `inv`,
|
|
5
|
+
* …) are dispatch objects whose declared return is `unknown`, so every
|
|
6
|
+
* caller used to carry its own `typeof` check before arithmetic. These three
|
|
7
|
+
* readers are that check, once: each returns the value as the type it is and
|
|
8
|
+
* throws a `TypeError` naming the MathTS function otherwise. They check the
|
|
9
|
+
* shape, not the value: a `NaN` is a number and is passed through, as the
|
|
10
|
+
* inline checks passed it.
|
|
11
|
+
*
|
|
12
|
+
* @module core/mathts-read
|
|
13
|
+
*/
|
|
14
|
+
function kindOf(v) {
|
|
15
|
+
if (v === null)
|
|
16
|
+
return 'null';
|
|
17
|
+
if (Array.isArray(v))
|
|
18
|
+
return 'array';
|
|
19
|
+
return typeof v;
|
|
20
|
+
}
|
|
21
|
+
/** The number `v` is, or a `TypeError` naming the MathTS function `fn` that returned something else. @internal */
|
|
22
|
+
export function numberFrom(fn, v) {
|
|
23
|
+
if (typeof v !== 'number')
|
|
24
|
+
throw new TypeError(`${fn} did not return a number (got ${kindOf(v)})`);
|
|
25
|
+
return v;
|
|
26
|
+
}
|
|
27
|
+
/** The bigint `v` is, or a `TypeError` naming the MathTS function `fn` that returned something else. @internal */
|
|
28
|
+
export function bigintFrom(fn, v) {
|
|
29
|
+
if (typeof v !== 'bigint')
|
|
30
|
+
throw new TypeError(`${fn} did not return a bigint (got ${kindOf(v)})`);
|
|
31
|
+
return v;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The `n`×`n` number matrix `v` is, copied row by row into a fresh `number[][]`,
|
|
35
|
+
* or a `TypeError` naming the MathTS function `fn` when `v` is not an array of
|
|
36
|
+
* `n` rows of `n` numbers.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export function numberMatrixFrom(fn, v, n) {
|
|
40
|
+
const refuse = () => {
|
|
41
|
+
throw new TypeError(`${fn} did not return a ${n}×${n} number matrix (got ${kindOf(v)})`);
|
|
42
|
+
};
|
|
43
|
+
if (!Array.isArray(v) || v.length !== n)
|
|
44
|
+
return refuse();
|
|
45
|
+
return v.map((row) => {
|
|
46
|
+
if (!Array.isArray(row) || row.length !== n)
|
|
47
|
+
return refuse();
|
|
48
|
+
return row.map((x) => (typeof x === 'number' ? x : refuse()));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=mathts-read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mathts-read.js","sourceRoot":"","sources":["../../src/core/mathts-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,SAAS,MAAM,CAAC,CAAU;IACxB,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC;IACrC,OAAO,OAAO,CAAC,CAAC;AAClB,CAAC;AAED,kHAAkH;AAClH,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,CAAU;IAC/C,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,iCAAiC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACnG,OAAO,CAAC,CAAC;AACX,CAAC;AAED,kHAAkH;AAClH,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,CAAU;IAC/C,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,iCAAiC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACnG,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAU,EAAE,CAAU,EAAE,CAAS;IAChE,MAAM,MAAM,GAAG,GAAU,EAAE;QACzB,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,qBAAqB,CAAC,IAAI,CAAC,uBAAuB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC3F,CAAC,CAAC;IACF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,EAAE,CAAC;IACzD,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAY,EAAE,EAAE;QAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,MAAM,EAAE,CAAC;QAC7D,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Readers for the typed MathTS results.\n *\n * The typed MathTS functions (`lgamma`, `ellipticK`, `mean`, `gcd`, `inv`,\n * …) are dispatch objects whose declared return is `unknown`, so every\n * caller used to carry its own `typeof` check before arithmetic. These three\n * readers are that check, once: each returns the value as the type it is and\n * throws a `TypeError` naming the MathTS function otherwise. They check the\n * shape, not the value: a `NaN` is a number and is passed through, as the\n * inline checks passed it.\n *\n * @module core/mathts-read\n */\n\nfunction kindOf(v: unknown): string {\n if (v === null) return 'null';\n if (Array.isArray(v)) return 'array';\n return typeof v;\n}\n\n/** The number `v` is, or a `TypeError` naming the MathTS function `fn` that returned something else. @internal */\nexport function numberFrom(fn: string, v: unknown): number {\n if (typeof v !== 'number') throw new TypeError(`${fn} did not return a number (got ${kindOf(v)})`);\n return v;\n}\n\n/** The bigint `v` is, or a `TypeError` naming the MathTS function `fn` that returned something else. @internal */\nexport function bigintFrom(fn: string, v: unknown): bigint {\n if (typeof v !== 'bigint') throw new TypeError(`${fn} did not return a bigint (got ${kindOf(v)})`);\n return v;\n}\n\n/**\n * The `n`×`n` number matrix `v` is, copied row by row into a fresh `number[][]`,\n * or a `TypeError` naming the MathTS function `fn` when `v` is not an array of\n * `n` rows of `n` numbers.\n * @internal\n */\nexport function numberMatrixFrom(fn: string, v: unknown, n: number): number[][] {\n const refuse = (): never => {\n throw new TypeError(`${fn} did not return a ${n}×${n} number matrix (got ${kindOf(v)})`);\n };\n if (!Array.isArray(v) || v.length !== n) return refuse();\n return v.map((row: unknown) => {\n if (!Array.isArray(row) || row.length !== n) return refuse();\n return row.map((x: unknown) => (typeof x === 'number' ? x : refuse()));\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tensor.d.ts","sourceRoot":"","sources":["../../src/core/tensor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,EACd,kBAAkB,EAGnB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,IAAI,EAEJ,OAAO,EACP,UAAU,EACV,aAAa,EACd,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"tensor.d.ts","sourceRoot":"","sources":["../../src/core/tensor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,EACd,kBAAkB,EAGnB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,IAAI,EAEJ,OAAO,EACP,UAAU,EACV,aAAa,EACd,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAY,UA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CAc9D;IAED;;;;;;OAMG;IACI,eAAe,IAAI,UAAU,CAcnC;IAMD;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAqBtB;;;;;;;;OAQG;IACH,OAAO,CAAE,kBAAkB;IAoB3B;;;;OAIG;IACI,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE,CAIvD;IAED;;;OAGG;IACI,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAInF;IAED;;OAEG;IACI,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,WAAW,EAAE,CAUtD;IAED;;OAEG;IACI,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,GAAG,cAAc,EAAE,CAajF;IAED;;OAEG;IACI,OAAO,IAAI,WAAW,EAAE,CAE9B;IAED;;OAEG;IACI,UAAU,IAAI,cAAc,EAAE,CAEpC;IAED;;OAEG;IACI,YAAY,IAAI,kBAAkB,EAAE,CAE1C;IAED;;OAEG;IACI,QAAQ;;;;;;;;MAcd;IAED;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAkCvB;;OAEG;IACH,OAAO,CAAC,YAAY;CA2BrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,OAAO,CACrB,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,EAC5B,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,EAClC,UAAU,EAAE,aAAa,CAAC,aAAa,CAAC,EACxC,MAAM,EAAE,YAAY,GACnB,eAAe,CAMjB"}
|
package/dist/core/tensor.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* - E: Emergent phenomena (higher-order correlations)
|
|
12
12
|
*/
|
|
13
13
|
import { lawToCell, bridgeToCell, emergenceToCell } from './cell.js';
|
|
14
|
+
import { Axes } from './axes-registry.js';
|
|
14
15
|
import { runRules, V07_CELL_RULES, FluxViolationError } from './flux-rules.js';
|
|
15
16
|
/**
|
|
16
17
|
* Map the string-vocabulary {@link CellConfidence} to a representative
|
|
@@ -95,6 +96,20 @@ function cellToEmergence(cell) {
|
|
|
95
96
|
confidence: statusToConfidenceNumber(cell.confidence),
|
|
96
97
|
};
|
|
97
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Refuse a configured axis value the registry does not name. `admitted` is the
|
|
101
|
+
* registry namespace for that axis (`Axes.scale`, …), whose keys are the values.
|
|
102
|
+
*/
|
|
103
|
+
function requireAxisValues(field, values, admitted) {
|
|
104
|
+
if (!Array.isArray(values))
|
|
105
|
+
throw new TypeError(`TensorConfig.${field} must be an array`);
|
|
106
|
+
const known = Object.keys(admitted);
|
|
107
|
+
for (const value of values) {
|
|
108
|
+
if (typeof value !== 'string' || !known.includes(value)) {
|
|
109
|
+
throw new RangeError(`TensorConfig.${field}: '${String(value)}' is not an axis value; the registry names ${known.join(', ')}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
98
113
|
/**
|
|
99
114
|
* The rank-6 universal physics tensor Π = L + B + E: a sparse store of
|
|
100
115
|
* physical-law / bridge / emergence cells indexed by regime coordinates.
|
|
@@ -136,6 +151,15 @@ export class UniversalTensor {
|
|
|
136
151
|
if (!Array.isArray(config.forces) || config.forces.length === 0) {
|
|
137
152
|
throw new TypeError('TensorConfig.forces must be a non-empty array');
|
|
138
153
|
}
|
|
154
|
+
// Each value is one the axis registry names: `scales: ['nope']` used to build a tensor over
|
|
155
|
+
// an axis value nothing else in the library knows.
|
|
156
|
+
requireAxisValues('scales', config.scales, Axes.scale);
|
|
157
|
+
requireAxisValues('forces', config.forces, Axes.force);
|
|
158
|
+
if (config.symmetries !== undefined)
|
|
159
|
+
requireAxisValues('symmetries', config.symmetries, Axes.symmetry);
|
|
160
|
+
if (config.informationMeasures !== undefined) {
|
|
161
|
+
requireAxisValues('informationMeasures', config.informationMeasures, Axes.information);
|
|
162
|
+
}
|
|
139
163
|
// Apply defaults
|
|
140
164
|
this.config = {
|
|
141
165
|
rank: config.rank,
|