universal-physics-tensor 8.0.0 → 10.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 +26 -21
- package/data/atlas/atlas.json +75 -64
- package/data/atlas/atlas.jsonld +1 -1
- package/data/atlas/diffusion.json +23 -22
- package/data/atlas/oscillators.json +21 -16
- package/data/atlas/waves.json +33 -28
- package/data/bridge-catalog.json +1356 -1791
- package/data/bridge-catalog.schema.json +789 -46
- package/data/quantities.json +280 -234
- package/data/quantities.schema.json +52 -0
- package/data/schemas/atlas-record.v0.json +184 -46
- package/data/units.json +1178 -0
- package/data/units.schema.json +124 -0
- package/dist/atlas/applicability.d.ts.map +1 -1
- package/dist/atlas/applicability.js +14 -3
- package/dist/atlas/applicability.js.map +1 -1
- package/dist/atlas/association.d.ts +1 -1
- package/dist/atlas/association.js.map +1 -1
- package/dist/atlas/benchmark/backend-shapes.d.ts.map +1 -1
- package/dist/atlas/benchmark/backend-shapes.js +5 -1
- package/dist/atlas/benchmark/backend-shapes.js.map +1 -1
- package/dist/atlas/benchmark/baselines.d.ts.map +1 -1
- package/dist/atlas/benchmark/baselines.js +8 -0
- package/dist/atlas/benchmark/baselines.js.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts +3 -2
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.js +16 -12
- package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
- package/dist/atlas/benchmark/leakage.js.map +1 -1
- package/dist/atlas/benchmark/loader.js.map +1 -1
- package/dist/atlas/benchmark/run-atlas.d.ts.map +1 -1
- package/dist/atlas/benchmark/run-atlas.js +14 -2
- package/dist/atlas/benchmark/run-atlas.js.map +1 -1
- package/dist/atlas/benchmark/stats.d.ts +1 -1
- package/dist/atlas/benchmark/stats.d.ts.map +1 -1
- package/dist/atlas/benchmark/stats.js +1 -1
- package/dist/atlas/benchmark/stats.js.map +1 -1
- package/dist/atlas/benchmark/study.js.map +1 -1
- package/dist/atlas/benchmark/types.js.map +1 -1
- package/dist/atlas/bridge-record.d.ts +4 -4
- package/dist/atlas/bridge-record.d.ts.map +1 -1
- package/dist/atlas/bridge-record.js +6 -6
- package/dist/atlas/bridge-record.js.map +1 -1
- package/dist/atlas/catalog-formal-ref.js.map +1 -1
- package/dist/atlas/chain-pipeline.d.ts +0 -11
- package/dist/atlas/chain-pipeline.d.ts.map +1 -1
- package/dist/atlas/chain-pipeline.js +5 -16
- package/dist/atlas/chain-pipeline.js.map +1 -1
- package/dist/atlas/composition-table.js.map +1 -1
- package/dist/atlas/conventions.js.map +1 -1
- package/dist/atlas/coverage.d.ts +2 -2
- package/dist/atlas/coverage.js.map +1 -1
- package/dist/atlas/derivation.js.map +1 -1
- package/dist/atlas/derive-evidence.d.ts +6 -4
- package/dist/atlas/derive-evidence.d.ts.map +1 -1
- package/dist/atlas/derive-evidence.js +7 -2
- package/dist/atlas/derive-evidence.js.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.js +0 -5
- 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 +0 -3
- package/dist/atlas/diffusion/bridges.js.map +1 -1
- package/dist/atlas/diffusion/dimensions.js.map +1 -1
- package/dist/atlas/diffusion/index.d.ts +1 -1
- package/dist/atlas/diffusion/index.d.ts.map +1 -1
- package/dist/atlas/diffusion/index.js.map +1 -1
- package/dist/atlas/diffusion/models.js.map +1 -1
- package/dist/atlas/diffusion/numerics.js.map +1 -1
- package/dist/atlas/error-algebra.d.ts +6 -0
- package/dist/atlas/error-algebra.d.ts.map +1 -1
- package/dist/atlas/error-algebra.js +26 -0
- package/dist/atlas/error-algebra.js.map +1 -1
- package/dist/atlas/export.d.ts +18 -2
- package/dist/atlas/export.d.ts.map +1 -1
- package/dist/atlas/export.js +9 -3
- package/dist/atlas/export.js.map +1 -1
- package/dist/atlas/families.d.ts +19 -2
- package/dist/atlas/families.d.ts.map +1 -1
- package/dist/atlas/families.js +26 -3
- package/dist/atlas/families.js.map +1 -1
- package/dist/atlas/family.d.ts +27 -0
- package/dist/atlas/family.d.ts.map +1 -0
- package/dist/atlas/family.js +12 -0
- package/dist/atlas/family.js.map +1 -0
- package/dist/atlas/index.d.ts +3 -2
- package/dist/atlas/index.d.ts.map +1 -1
- package/dist/atlas/index.js +2 -1
- package/dist/atlas/index.js.map +1 -1
- package/dist/atlas/link-prediction.d.ts +1 -1
- package/dist/atlas/link-prediction.d.ts.map +1 -1
- package/dist/atlas/link-prediction.js.map +1 -1
- package/dist/atlas/model.js.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.js +0 -1
- 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 +0 -3
- package/dist/atlas/oscillators/bridges-exact.js.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.js +0 -2
- package/dist/atlas/oscillators/bridges-limits.js.map +1 -1
- package/dist/atlas/oscillators/dimensions.js.map +1 -1
- package/dist/atlas/oscillators/index.d.ts +1 -16
- package/dist/atlas/oscillators/index.d.ts.map +1 -1
- package/dist/atlas/oscillators/index.js.map +1 -1
- package/dist/atlas/oscillators/limit-witnesses.js.map +1 -1
- package/dist/atlas/oscillators/models.js.map +1 -1
- package/dist/atlas/oscillators/norm-transport-witness.js.map +1 -1
- package/dist/atlas/oscillators/norm-transport.js.map +1 -1
- package/dist/atlas/oscillators/norms.js.map +1 -1
- package/dist/atlas/oscillators/pendulum-motion.js.map +1 -1
- package/dist/atlas/oscillators/phase-carriage.js.map +1 -1
- package/dist/atlas/oscillators/phase-translation.js.map +1 -1
- package/dist/atlas/oscillators/position-translation.js.map +1 -1
- package/dist/atlas/oscillators/rejections.js.map +1 -1
- package/dist/atlas/path-bound.js.map +1 -1
- package/dist/atlas/physjs-entries.generated.d.ts +1601 -220
- package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
- package/dist/atlas/physjs-entries.generated.js +1854 -345
- package/dist/atlas/physjs-entries.generated.js.map +1 -1
- package/dist/atlas/physjs-ref.d.ts +151 -117
- package/dist/atlas/physjs-ref.d.ts.map +1 -1
- package/dist/atlas/physjs-ref.js +244 -211
- package/dist/atlas/physjs-ref.js.map +1 -1
- package/dist/atlas/physjs-reviewed.d.ts +31 -0
- package/dist/atlas/physjs-reviewed.d.ts.map +1 -0
- package/dist/atlas/physjs-reviewed.js +194 -0
- package/dist/atlas/physjs-reviewed.js.map +1 -0
- package/dist/atlas/poster/associations.js.map +1 -1
- package/dist/atlas/poster/derivations.js.map +1 -1
- package/dist/atlas/poster/statements.js.map +1 -1
- package/dist/atlas/proof-target.d.ts +16 -8
- package/dist/atlas/proof-target.d.ts.map +1 -1
- package/dist/atlas/proof-target.js +34 -31
- package/dist/atlas/proof-target.js.map +1 -1
- package/dist/atlas/public.d.ts +2 -1
- package/dist/atlas/public.d.ts.map +1 -1
- package/dist/atlas/public.js +2 -1
- package/dist/atlas/public.js.map +1 -1
- package/dist/atlas/regime.js.map +1 -1
- package/dist/atlas/serialize.d.ts +18 -12
- package/dist/atlas/serialize.d.ts.map +1 -1
- package/dist/atlas/serialize.js +28 -18
- package/dist/atlas/serialize.js.map +1 -1
- package/dist/atlas/statement.js.map +1 -1
- package/dist/atlas/translation-registry.js.map +1 -1
- package/dist/atlas/translation.js.map +1 -1
- package/dist/atlas/types.d.ts +9 -2
- package/dist/atlas/types.d.ts.map +1 -1
- package/dist/atlas/types.js +1 -1
- package/dist/atlas/types.js.map +1 -1
- package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/waves/bridges-closure.js +0 -3
- 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 +0 -4
- package/dist/atlas/waves/bridges.js.map +1 -1
- package/dist/atlas/waves/index.d.ts +1 -1
- package/dist/atlas/waves/index.d.ts.map +1 -1
- package/dist/atlas/waves/index.js.map +1 -1
- package/dist/atlas/waves/models.js.map +1 -1
- package/dist/atlas/waves/numerics.js.map +1 -1
- package/dist/atlas/witness-artifact.js.map +1 -1
- package/dist/atlas/witness-dominance.d.ts +4 -3
- package/dist/atlas/witness-dominance.d.ts.map +1 -1
- package/dist/atlas/witness-dominance.js +15 -5
- package/dist/atlas/witness-dominance.js.map +1 -1
- package/dist/atlas/witness-numeric.d.ts +8 -4
- package/dist/atlas/witness-numeric.d.ts.map +1 -1
- package/dist/atlas/witness-numeric.js +27 -2
- package/dist/atlas/witness-numeric.js.map +1 -1
- package/dist/atlas/witness-result.d.ts +7 -1
- package/dist/atlas/witness-result.d.ts.map +1 -1
- package/dist/atlas/witness-result.js.map +1 -1
- package/dist/atlas/witness-specs.js.map +1 -1
- package/dist/atlas/witness-symbolic.js.map +1 -1
- package/dist/atlas/witnesses/quantum-support.js.map +1 -1
- package/dist/bridges/caller-table.d.ts +1 -1
- package/dist/bridges/caller-table.d.ts.map +1 -1
- package/dist/bridges/caller-table.js.map +1 -1
- package/dist/bridges/carrier-sign.d.ts.map +1 -1
- package/dist/bridges/carrier-sign.js +8 -3
- package/dist/bridges/carrier-sign.js.map +1 -1
- package/dist/bridges/catalog-adapter.d.ts +12 -3
- package/dist/bridges/catalog-adapter.d.ts.map +1 -1
- package/dist/bridges/catalog-adapter.js +22 -14
- package/dist/bridges/catalog-adapter.js.map +1 -1
- package/dist/bridges/catalog-load.d.ts +19 -2
- package/dist/bridges/catalog-load.d.ts.map +1 -1
- package/dist/bridges/catalog-load.js +233 -14
- package/dist/bridges/catalog-load.js.map +1 -1
- package/dist/bridges/catalog-types.d.ts +96 -27
- package/dist/bridges/catalog-types.d.ts.map +1 -1
- package/dist/bridges/catalog-types.js.map +1 -1
- package/dist/bridges/coefficient-statement.js +1 -5
- package/dist/bridges/coefficient-statement.js.map +1 -1
- package/dist/bridges/confrontation-coverage.js.map +1 -1
- package/dist/bridges/confrontations.d.ts +1 -1
- package/dist/bridges/confrontations.d.ts.map +1 -1
- package/dist/bridges/confrontations.js +1 -1
- package/dist/bridges/confrontations.js.map +1 -1
- package/dist/bridges/evaluation-errors.d.ts +89 -0
- package/dist/bridges/evaluation-errors.d.ts.map +1 -0
- package/dist/bridges/evaluation-errors.js +136 -0
- package/dist/bridges/evaluation-errors.js.map +1 -0
- package/dist/bridges/evaluator-inputs.d.ts +5 -3
- package/dist/bridges/evaluator-inputs.d.ts.map +1 -1
- package/dist/bridges/evaluator-inputs.js +24 -24
- package/dist/bridges/evaluator-inputs.js.map +1 -1
- package/dist/bridges/evaluators.d.ts +48 -8
- package/dist/bridges/evaluators.d.ts.map +1 -1
- package/dist/bridges/evaluators.js +173 -38
- package/dist/bridges/evaluators.js.map +1 -1
- package/dist/bridges/expr-parse.d.ts +38 -7
- package/dist/bridges/expr-parse.d.ts.map +1 -1
- package/dist/bridges/expr-parse.js +129 -156
- package/dist/bridges/expr-parse.js.map +1 -1
- package/dist/bridges/holds.d.ts +16 -8
- package/dist/bridges/holds.d.ts.map +1 -1
- package/dist/bridges/holds.js +130 -236
- package/dist/bridges/holds.js.map +1 -1
- package/dist/bridges/index.d.ts +15 -14
- package/dist/bridges/index.d.ts.map +1 -1
- package/dist/bridges/index.js +14 -15
- package/dist/bridges/index.js.map +1 -1
- package/dist/bridges/input-contract.d.ts +65 -0
- package/dist/bridges/input-contract.d.ts.map +1 -0
- package/dist/bridges/input-contract.js +97 -0
- package/dist/bridges/input-contract.js.map +1 -0
- package/dist/bridges/membership.d.ts +5 -3
- package/dist/bridges/membership.d.ts.map +1 -1
- package/dist/bridges/membership.js +5 -6
- package/dist/bridges/membership.js.map +1 -1
- package/dist/bridges/notices.d.ts +11 -0
- package/dist/bridges/notices.d.ts.map +1 -0
- package/dist/bridges/notices.js +22 -0
- package/dist/bridges/notices.js.map +1 -0
- package/dist/bridges/observations/types.js.map +1 -1
- package/dist/bridges/rejected.d.ts +11 -17
- package/dist/bridges/rejected.d.ts.map +1 -1
- package/dist/bridges/rejected.js +13 -68
- package/dist/bridges/rejected.js.map +1 -1
- package/dist/bridges/relation-eval.d.ts +5 -6
- package/dist/bridges/relation-eval.d.ts.map +1 -1
- package/dist/bridges/relation-eval.js +9 -38
- package/dist/bridges/relation-eval.js.map +1 -1
- package/dist/bridges/rhs-registry.js.map +1 -1
- package/dist/bridges/sensitivity.d.ts +11 -3
- package/dist/bridges/sensitivity.d.ts.map +1 -1
- package/dist/bridges/sensitivity.js +24 -10
- package/dist/bridges/sensitivity.js.map +1 -1
- package/dist/bridges/tensor-index.js.map +1 -1
- package/dist/bridges/types.d.ts +1 -7
- package/dist/bridges/types.d.ts.map +1 -1
- package/dist/bridges/types.js +1 -4
- package/dist/bridges/types.js.map +1 -1
- package/dist/canonical/canonical-equation.d.ts +31 -0
- package/dist/canonical/canonical-equation.d.ts.map +1 -1
- package/dist/canonical/canonical-equation.js.map +1 -1
- package/dist/canonical/dimensional-fields.js.map +1 -1
- package/dist/canonical/entries/_l1-build.js.map +1 -1
- package/dist/canonical/entries/atomic.d.ts.map +1 -1
- package/dist/canonical/entries/atomic.js +11 -1
- 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 +7 -4
- 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 +50 -2
- 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 +32 -2
- 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 +34 -0
- 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 +24 -0
- 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 +42 -24
- 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 -0
- package/dist/canonical/entries/relativity.js.map +1 -1
- package/dist/canonical/entries/statistical-mechanics.d.ts.map +1 -1
- package/dist/canonical/entries/statistical-mechanics.js +24 -5
- package/dist/canonical/entries/statistical-mechanics.js.map +1 -1
- package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts.map +1 -1
- package/dist/canonical/entries/thermo-nuclear-cosmo.js +15 -0
- package/dist/canonical/entries/thermo-nuclear-cosmo.js.map +1 -1
- package/dist/canonical/linkage.d.ts +29 -4
- package/dist/canonical/linkage.d.ts.map +1 -1
- package/dist/canonical/linkage.js +31 -29
- package/dist/canonical/linkage.js.map +1 -1
- package/dist/canonical/normal-form.d.ts +0 -8
- package/dist/canonical/normal-form.d.ts.map +1 -1
- package/dist/canonical/normal-form.js +17 -12
- package/dist/canonical/normal-form.js.map +1 -1
- package/dist/canonical/registry.js.map +1 -1
- package/dist/canonical/residual.js.map +1 -1
- package/dist/canonical/seed-l-layer.d.ts +7 -1
- package/dist/canonical/seed-l-layer.d.ts.map +1 -1
- package/dist/canonical/seed-l-layer.js +7 -1
- package/dist/canonical/seed-l-layer.js.map +1 -1
- package/dist/canonical/structural.d.ts +21 -0
- package/dist/canonical/structural.d.ts.map +1 -1
- package/dist/canonical/structural.js +24 -4
- package/dist/canonical/structural.js.map +1 -1
- package/dist/cases/brownian-sphere.js +4 -4
- package/dist/cases/brownian-sphere.js.map +1 -1
- package/dist/cases/damped-resonator.js +2 -2
- package/dist/cases/damped-resonator.js.map +1 -1
- package/dist/cases/index.d.ts +9 -2
- package/dist/cases/index.d.ts.map +1 -1
- package/dist/cases/index.js +26 -7
- package/dist/cases/index.js.map +1 -1
- package/dist/cases/kepler-rv.js +6 -6
- package/dist/cases/kepler-rv.js.map +1 -1
- package/dist/cases/lumped-cooling.js +1 -1
- package/dist/cases/lumped-cooling.js.map +1 -1
- package/dist/cases/quadrature.js.map +1 -1
- package/dist/cases/resistor-noise.js +3 -3
- package/dist/cases/resistor-noise.js.map +1 -1
- package/dist/cases/skin-depth.js.map +1 -1
- package/dist/cases/types.js.map +1 -1
- package/dist/cli/args.d.ts +7 -2
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +18 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/bindings.d.ts +13 -0
- package/dist/cli/bindings.d.ts.map +1 -0
- package/dist/cli/bindings.js +32 -0
- package/dist/cli/bindings.js.map +1 -0
- package/dist/cli/closed-form-range.js.map +1 -1
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/commands/_atlas-map.d.ts +3 -3
- package/dist/cli/commands/_atlas-map.d.ts.map +1 -1
- package/dist/cli/commands/_atlas-map.js +43 -18
- package/dist/cli/commands/_atlas-map.js.map +1 -1
- package/dist/cli/commands/_atlas-route.js.map +1 -1
- package/dist/cli/commands/_discovery-opts.d.ts +2 -1
- package/dist/cli/commands/_discovery-opts.d.ts.map +1 -1
- package/dist/cli/commands/_discovery-opts.js +48 -18
- 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 +7 -12
- 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 +13 -21
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/axes.js.map +1 -1
- package/dist/cli/commands/candidates.d.ts.map +1 -1
- package/dist/cli/commands/candidates.js +16 -8
- package/dist/cli/commands/candidates.js.map +1 -1
- package/dist/cli/commands/canonical.js.map +1 -1
- package/dist/cli/commands/chain.js +1 -1
- package/dist/cli/commands/chain.js.map +1 -1
- package/dist/cli/commands/confront.d.ts.map +1 -1
- package/dist/cli/commands/confront.js +22 -14
- package/dist/cli/commands/confront.js.map +1 -1
- package/dist/cli/commands/connectors.d.ts.map +1 -1
- package/dist/cli/commands/connectors.js +8 -9
- package/dist/cli/commands/connectors.js.map +1 -1
- package/dist/cli/commands/coverage.js.map +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +50 -26
- 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 +18 -13
- 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 +29 -26
- package/dist/cli/commands/eval.js.map +1 -1
- package/dist/cli/commands/evaluate.d.ts +1 -35
- package/dist/cli/commands/evaluate.d.ts.map +1 -1
- package/dist/cli/commands/evaluate.js +99 -208
- 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 +57 -45
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/frontier.js.map +1 -1
- package/dist/cli/commands/ground.d.ts.map +1 -1
- package/dist/cli/commands/ground.js +41 -11
- package/dist/cli/commands/ground.js.map +1 -1
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/map.d.ts.map +1 -1
- package/dist/cli/commands/map.js +84 -92
- 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 +53 -15
- package/dist/cli/commands/metric.js.map +1 -1
- package/dist/cli/commands/path.js +4 -4
- package/dist/cli/commands/path.js.map +1 -1
- package/dist/cli/commands/predict.js.map +1 -1
- package/dist/cli/commands/priority.js.map +1 -1
- package/dist/cli/commands/probe.d.ts.map +1 -1
- package/dist/cli/commands/probe.js +50 -26
- package/dist/cli/commands/probe.js.map +1 -1
- package/dist/cli/commands/recover.js +1 -1
- package/dist/cli/commands/recover.js.map +1 -1
- package/dist/cli/commands/regime.d.ts +5 -4
- package/dist/cli/commands/regime.d.ts.map +1 -1
- package/dist/cli/commands/regime.js +25 -27
- 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 +22 -14
- 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 +8 -4
- 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 +14 -7
- package/dist/cli/commands/symbolic.js.map +1 -1
- package/dist/cli/commands/testplan.js +4 -4
- package/dist/cli/commands/testplan.js.map +1 -1
- package/dist/cli/conventions.d.ts +6 -7
- package/dist/cli/conventions.d.ts.map +1 -1
- package/dist/cli/conventions.js +19 -28
- package/dist/cli/conventions.js.map +1 -1
- package/dist/cli/determination.js.map +1 -1
- package/dist/cli/errors.js.map +1 -1
- package/dist/cli/euler-guard.d.ts +13 -2
- package/dist/cli/euler-guard.d.ts.map +1 -1
- package/dist/cli/euler-guard.js +17 -3
- package/dist/cli/euler-guard.js.map +1 -1
- package/dist/cli/eval-numbers.d.ts +4 -9
- package/dist/cli/eval-numbers.d.ts.map +1 -1
- package/dist/cli/eval-numbers.js +11 -41
- package/dist/cli/eval-numbers.js.map +1 -1
- package/dist/cli/expr-print.d.ts +29 -2
- package/dist/cli/expr-print.d.ts.map +1 -1
- package/dist/cli/expr-print.js +46 -2
- package/dist/cli/expr-print.js.map +1 -1
- package/dist/cli/flag-help.js.map +1 -1
- package/dist/cli/graphs.js.map +1 -1
- package/dist/cli/library-defaults.d.ts +19 -0
- package/dist/cli/library-defaults.d.ts.map +1 -0
- package/dist/cli/library-defaults.js +22 -0
- package/dist/cli/library-defaults.js.map +1 -0
- package/dist/cli/main.js +7 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/map-evidence.js.map +1 -1
- package/dist/cli/output.d.ts +3 -6
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/published-url.d.ts +2 -0
- package/dist/cli/published-url.d.ts.map +1 -1
- package/dist/cli/published-url.js +5 -0
- package/dist/cli/published-url.js.map +1 -1
- package/dist/cli/record-reach.d.ts +6 -0
- package/dist/cli/record-reach.d.ts.map +1 -1
- package/dist/cli/record-reach.js +16 -10
- package/dist/cli/record-reach.js.map +1 -1
- package/dist/cli/record-tables.d.ts +2 -1
- package/dist/cli/record-tables.d.ts.map +1 -1
- package/dist/cli/record-tables.js +8 -3
- package/dist/cli/record-tables.js.map +1 -1
- package/dist/cli/record.d.ts.map +1 -1
- package/dist/cli/record.js +31 -12
- package/dist/cli/record.js.map +1 -1
- package/dist/cli/search-index.d.ts +5 -0
- package/dist/cli/search-index.d.ts.map +1 -1
- package/dist/cli/search-index.js +12 -1
- package/dist/cli/search-index.js.map +1 -1
- package/dist/cli/statuses.js.map +1 -1
- package/dist/cli/top-level-help.js.map +1 -1
- package/dist/cli/version.js.map +1 -1
- package/dist/cli-api.d.ts +57 -18
- package/dist/cli-api.d.ts.map +1 -1
- package/dist/cli-api.js +49 -21
- package/dist/cli-api.js.map +1 -1
- package/dist/composition/adjudication.d.ts +8 -30
- package/dist/composition/adjudication.d.ts.map +1 -1
- package/dist/composition/adjudication.js +15 -67
- package/dist/composition/adjudication.js.map +1 -1
- package/dist/composition/aliases.d.ts +1 -1
- package/dist/composition/aliases.d.ts.map +1 -1
- package/dist/composition/aliases.js +10 -20
- package/dist/composition/aliases.js.map +1 -1
- package/dist/composition/audit-coverage.d.ts +2 -0
- package/dist/composition/audit-coverage.d.ts.map +1 -1
- package/dist/composition/audit-coverage.js.map +1 -1
- package/dist/composition/axes.d.ts +12 -0
- package/dist/composition/axes.d.ts.map +1 -1
- package/dist/composition/axes.js +18 -6
- package/dist/composition/axes.js.map +1 -1
- package/dist/composition/axis-audit.js.map +1 -1
- package/dist/composition/bridge-analysis.d.ts +0 -14
- package/dist/composition/bridge-analysis.d.ts.map +1 -1
- package/dist/composition/bridge-analysis.js +66 -57
- package/dist/composition/bridge-analysis.js.map +1 -1
- package/dist/composition/bridge-prediction.d.ts +5 -1
- package/dist/composition/bridge-prediction.d.ts.map +1 -1
- package/dist/composition/bridge-prediction.js +12 -16
- package/dist/composition/bridge-prediction.js.map +1 -1
- package/dist/composition/buckingham-filter.js.map +1 -1
- package/dist/composition/canonical-compare.d.ts.map +1 -1
- package/dist/composition/canonical-compare.js +12 -2
- package/dist/composition/canonical-compare.js.map +1 -1
- package/dist/composition/canonical-graph.d.ts +15 -18
- package/dist/composition/canonical-graph.d.ts.map +1 -1
- package/dist/composition/canonical-graph.js +59 -85
- package/dist/composition/canonical-graph.js.map +1 -1
- package/dist/composition/canonical-json.js.map +1 -1
- package/dist/composition/canonical-prefactors.d.ts +10 -29
- package/dist/composition/canonical-prefactors.d.ts.map +1 -1
- package/dist/composition/canonical-prefactors.js +15 -202
- package/dist/composition/canonical-prefactors.js.map +1 -1
- package/dist/composition/catalog-graph.d.ts.map +1 -1
- package/dist/composition/catalog-graph.js +6 -20
- package/dist/composition/catalog-graph.js.map +1 -1
- package/dist/composition/chain-candidate.d.ts +2 -0
- package/dist/composition/chain-candidate.d.ts.map +1 -1
- package/dist/composition/chain-candidate.js +2 -0
- package/dist/composition/chain-candidate.js.map +1 -1
- package/dist/composition/chain-match.js.map +1 -1
- package/dist/composition/chain-regime.js.map +1 -1
- package/dist/composition/chain-result.js.map +1 -1
- package/dist/composition/compose-surface.js.map +1 -1
- package/dist/composition/compose-symbolic.js.map +1 -1
- package/dist/composition/compose.d.ts.map +1 -1
- package/dist/composition/compose.js +154 -36
- package/dist/composition/compose.js.map +1 -1
- package/dist/composition/composition-recovery.js.map +1 -1
- package/dist/composition/consequence.d.ts.map +1 -1
- package/dist/composition/consequence.js +15 -6
- package/dist/composition/consequence.js.map +1 -1
- package/dist/composition/consistency.js.map +1 -1
- package/dist/composition/descriptor.d.ts +1 -1
- package/dist/composition/descriptor.d.ts.map +1 -1
- package/dist/composition/descriptor.js.map +1 -1
- package/dist/composition/dimension-adjacency.js.map +1 -1
- package/dist/composition/discovery.d.ts +67 -7
- package/dist/composition/discovery.d.ts.map +1 -1
- package/dist/composition/discovery.js +83 -23
- package/dist/composition/discovery.js.map +1 -1
- package/dist/composition/edge.d.ts +19 -22
- package/dist/composition/edge.d.ts.map +1 -1
- package/dist/composition/edge.js +25 -28
- package/dist/composition/edge.js.map +1 -1
- package/dist/composition/enumerate.d.ts +2 -2
- package/dist/composition/enumerate.d.ts.map +1 -1
- package/dist/composition/enumerate.js.map +1 -1
- package/dist/composition/evaluate-relation.d.ts +29 -5
- package/dist/composition/evaluate-relation.d.ts.map +1 -1
- package/dist/composition/evaluate-relation.js +100 -72
- package/dist/composition/evaluate-relation.js.map +1 -1
- package/dist/composition/explain.d.ts +14 -4
- package/dist/composition/explain.d.ts.map +1 -1
- package/dist/composition/explain.js +53 -19
- package/dist/composition/explain.js.map +1 -1
- package/dist/composition/expr-eval.d.ts.map +1 -1
- package/dist/composition/expr-eval.js +2 -1
- package/dist/composition/expr-eval.js.map +1 -1
- package/dist/composition/expr-simplify.d.ts.map +1 -1
- package/dist/composition/expr-simplify.js +9 -39
- package/dist/composition/expr-simplify.js.map +1 -1
- package/dist/composition/expr-subst.js.map +1 -1
- package/dist/composition/formula-shape.d.ts +9 -0
- package/dist/composition/formula-shape.d.ts.map +1 -1
- package/dist/composition/formula-shape.js +54 -0
- package/dist/composition/formula-shape.js.map +1 -1
- package/dist/composition/frontier-account.d.ts +3 -2
- package/dist/composition/frontier-account.d.ts.map +1 -1
- package/dist/composition/frontier-account.js +7 -3
- package/dist/composition/frontier-account.js.map +1 -1
- package/dist/composition/graph-viz-svg.js.map +1 -1
- package/dist/composition/graph-viz.js.map +1 -1
- package/dist/composition/grounding.js.map +1 -1
- package/dist/composition/identifiability.js.map +1 -1
- package/dist/composition/index.d.ts +9 -5
- package/dist/composition/index.d.ts.map +1 -1
- package/dist/composition/index.js +7 -4
- package/dist/composition/index.js.map +1 -1
- package/dist/composition/mathts-quiet.d.ts +28 -0
- package/dist/composition/mathts-quiet.d.ts.map +1 -0
- package/dist/composition/mathts-quiet.js +56 -0
- package/dist/composition/mathts-quiet.js.map +1 -0
- package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -1
- package/dist/composition/mathts-scalar-symbols.js +18 -34
- package/dist/composition/mathts-scalar-symbols.js.map +1 -1
- package/dist/composition/not-composable-seeds.d.ts +3 -1
- package/dist/composition/not-composable-seeds.d.ts.map +1 -1
- package/dist/composition/not-composable-seeds.js +2 -0
- package/dist/composition/not-composable-seeds.js.map +1 -1
- package/dist/composition/probe/backend-protocol.js.map +1 -1
- package/dist/composition/probe/candidate-store.js.map +1 -1
- package/dist/composition/probe/corpus.js.map +1 -1
- package/dist/composition/probe/dataset.js.map +1 -1
- package/dist/composition/probe/experiment-design.js.map +1 -1
- package/dist/composition/probe/expression-gaps.js.map +1 -1
- package/dist/composition/probe/falsify.d.ts +14 -3
- package/dist/composition/probe/falsify.d.ts.map +1 -1
- package/dist/composition/probe/falsify.js +14 -27
- package/dist/composition/probe/falsify.js.map +1 -1
- package/dist/composition/probe/fingerprint.js.map +1 -1
- package/dist/composition/probe/fit.d.ts +1 -1
- package/dist/composition/probe/fit.d.ts.map +1 -1
- package/dist/composition/probe/fit.js +2 -1
- package/dist/composition/probe/fit.js.map +1 -1
- package/dist/composition/probe/frontier.js.map +1 -1
- package/dist/composition/probe/generator.js.map +1 -1
- package/dist/composition/probe/index.d.ts +4 -2
- package/dist/composition/probe/index.d.ts.map +1 -1
- package/dist/composition/probe/index.js +4 -2
- package/dist/composition/probe/index.js.map +1 -1
- package/dist/composition/probe/limits.js.map +1 -1
- package/dist/composition/probe/metadata.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 +13 -6
- package/dist/composition/probe/pipeline.js.map +1 -1
- package/dist/composition/probe/problem.d.ts +8 -0
- package/dist/composition/probe/problem.d.ts.map +1 -1
- package/dist/composition/probe/problem.js +78 -12
- package/dist/composition/probe/problem.js.map +1 -1
- package/dist/composition/probe/report.js.map +1 -1
- package/dist/composition/probe/residual.js.map +1 -1
- package/dist/composition/probe/run-manifest.js +2 -2
- package/dist/composition/probe/run-manifest.js.map +1 -1
- package/dist/composition/probe/scoring.d.ts +2 -1
- package/dist/composition/probe/scoring.d.ts.map +1 -1
- package/dist/composition/probe/scoring.js +21 -7
- package/dist/composition/probe/scoring.js.map +1 -1
- package/dist/composition/probe/search-budget.js.map +1 -1
- package/dist/composition/probe/serialize.js.map +1 -1
- package/dist/composition/probe/structure.js.map +1 -1
- package/dist/composition/probe/study.d.ts +4 -3
- package/dist/composition/probe/study.d.ts.map +1 -1
- package/dist/composition/probe/study.js +5 -3
- package/dist/composition/probe/study.js.map +1 -1
- package/dist/composition/probe/types.d.ts +3 -1
- package/dist/composition/probe/types.d.ts.map +1 -1
- package/dist/composition/probe/types.js +2 -0
- package/dist/composition/probe/types.js.map +1 -1
- package/dist/composition/proposed-bridges.d.ts +11 -4
- package/dist/composition/proposed-bridges.d.ts.map +1 -1
- package/dist/composition/proposed-bridges.js +14 -6
- package/dist/composition/proposed-bridges.js.map +1 -1
- package/dist/composition/quantities.d.ts +0 -4
- package/dist/composition/quantities.d.ts.map +1 -1
- package/dist/composition/quantities.js +5 -5
- package/dist/composition/quantities.js.map +1 -1
- package/dist/composition/quantity.d.ts +18 -2
- package/dist/composition/quantity.d.ts.map +1 -1
- package/dist/composition/quantity.js +35 -6
- package/dist/composition/quantity.js.map +1 -1
- package/dist/composition/representative-values.js.map +1 -1
- package/dist/composition/retrodiction.d.ts +18 -0
- package/dist/composition/retrodiction.d.ts.map +1 -1
- package/dist/composition/retrodiction.js +37 -7
- package/dist/composition/retrodiction.js.map +1 -1
- package/dist/composition/uncertainty.js.map +1 -1
- package/dist/composition/user-equation.d.ts +11 -7
- package/dist/composition/user-equation.d.ts.map +1 -1
- package/dist/composition/user-equation.js +24 -26
- package/dist/composition/user-equation.js.map +1 -1
- package/dist/core/axes-registry.d.ts +8 -5
- package/dist/core/axes-registry.d.ts.map +1 -1
- package/dist/core/axes-registry.js.map +1 -1
- package/dist/core/cell.js.map +1 -1
- package/dist/core/constants.d.ts +35 -12
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +46 -15
- package/dist/core/constants.js.map +1 -1
- package/dist/core/data-file.d.ts +27 -0
- package/dist/core/data-file.d.ts.map +1 -0
- package/dist/core/data-file.js +48 -0
- package/dist/core/data-file.js.map +1 -0
- package/dist/core/flux-rules.js +1 -1
- package/dist/core/flux-rules.js.map +1 -1
- package/dist/core/json-schema.d.ts +27 -0
- package/dist/core/json-schema.d.ts.map +1 -0
- package/dist/core/json-schema.js +177 -0
- package/dist/core/json-schema.js.map +1 -0
- package/dist/core/labeled-tensor.d.ts +6 -1
- package/dist/core/labeled-tensor.d.ts.map +1 -1
- package/dist/core/labeled-tensor.js +18 -8
- package/dist/core/labeled-tensor.js.map +1 -1
- package/dist/core/regime-registry.d.ts +6 -2
- package/dist/core/regime-registry.d.ts.map +1 -1
- package/dist/core/regime-registry.js.map +1 -1
- package/dist/core/regime-rule-install.js.map +1 -1
- package/dist/core/regimes-builtins.js.map +1 -1
- package/dist/core/tensor.d.ts +7 -4
- package/dist/core/tensor.d.ts.map +1 -1
- package/dist/core/tensor.js +40 -8
- package/dist/core/tensor.js.map +1 -1
- package/dist/core/types.d.ts +3 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +16 -14
- package/dist/core/types.js.map +1 -1
- package/dist/core/universal-index.js.map +1 -1
- package/dist/diff/bridge-ast-gradient.d.ts +4 -5
- package/dist/diff/bridge-ast-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-ast-gradient.js +16 -23
- package/dist/diff/bridge-ast-gradient.js.map +1 -1
- package/dist/diff/bridge-gradient.d.ts +24 -80
- package/dist/diff/bridge-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-gradient.js +21 -98
- package/dist/diff/bridge-gradient.js.map +1 -1
- package/dist/diff/bridge-specs.d.ts +18 -6
- package/dist/diff/bridge-specs.d.ts.map +1 -1
- package/dist/diff/bridge-specs.js +17 -5
- package/dist/diff/bridge-specs.js.map +1 -1
- package/dist/dimensional/algebra.js.map +1 -1
- package/dist/dimensional/ast-builders.d.ts +5 -4
- package/dist/dimensional/ast-builders.d.ts.map +1 -1
- package/dist/dimensional/ast-builders.js +6 -5
- package/dist/dimensional/ast-builders.js.map +1 -1
- package/dist/dimensional/ast-types.js.map +1 -1
- package/dist/dimensional/bridge-check.d.ts.map +1 -1
- package/dist/dimensional/bridge-check.js +3 -5
- package/dist/dimensional/bridge-check.js.map +1 -1
- package/dist/dimensional/buckingham.js.map +1 -1
- package/dist/dimensional/connection-validators.d.ts +2 -1
- package/dist/dimensional/connection-validators.d.ts.map +1 -1
- package/dist/dimensional/connection-validators.js.map +1 -1
- package/dist/dimensional/connection.js.map +1 -1
- package/dist/dimensional/constant-rows.d.ts +54 -0
- package/dist/dimensional/constant-rows.d.ts.map +1 -0
- package/dist/dimensional/constant-rows.js +115 -0
- package/dist/dimensional/constant-rows.js.map +1 -0
- package/dist/dimensional/constants.d.ts +7 -17
- package/dist/dimensional/constants.d.ts.map +1 -1
- package/dist/dimensional/constants.js +12 -21
- package/dist/dimensional/constants.js.map +1 -1
- package/dist/dimensional/curvature-composite.js.map +1 -1
- package/dist/dimensional/curvature-invariants.js.map +1 -1
- package/dist/dimensional/curvature.js.map +1 -1
- package/dist/dimensional/dimension-inference.js.map +1 -1
- package/dist/dimensional/dimension-spec.d.ts +21 -6
- package/dist/dimensional/dimension-spec.d.ts.map +1 -1
- package/dist/dimensional/dimension-spec.js +150 -160
- package/dist/dimensional/dimension-spec.js.map +1 -1
- package/dist/dimensional/einstein-equation.js.map +1 -1
- package/dist/dimensional/errors.d.ts +3 -1
- package/dist/dimensional/errors.d.ts.map +1 -1
- package/dist/dimensional/errors.js +2 -2
- package/dist/dimensional/errors.js.map +1 -1
- package/dist/dimensional/exact-scale.d.ts +79 -0
- package/dist/dimensional/exact-scale.d.ts.map +1 -0
- package/dist/dimensional/exact-scale.js +222 -0
- package/dist/dimensional/exact-scale.js.map +1 -0
- package/dist/dimensional/field-equation-helpers.js.map +1 -1
- package/dist/dimensional/formula-names.d.ts +13 -12
- package/dist/dimensional/formula-names.d.ts.map +1 -1
- package/dist/dimensional/formula-names.js +28 -51
- package/dist/dimensional/formula-names.js.map +1 -1
- package/dist/dimensional/fresh-label.js.map +1 -1
- package/dist/dimensional/friedmann-equation.d.ts +3 -3
- package/dist/dimensional/friedmann-equation.js +3 -3
- package/dist/dimensional/friedmann-equation.js.map +1 -1
- package/dist/dimensional/gauge-field.d.ts +2 -3
- package/dist/dimensional/gauge-field.d.ts.map +1 -1
- package/dist/dimensional/gauge-field.js +0 -1
- package/dist/dimensional/gauge-field.js.map +1 -1
- package/dist/dimensional/hyphen-names.d.ts.map +1 -1
- package/dist/dimensional/hyphen-names.js +8 -0
- package/dist/dimensional/hyphen-names.js.map +1 -1
- package/dist/dimensional/killing-validators.js.map +1 -1
- package/dist/dimensional/klein-gordon-equation.js.map +1 -1
- package/dist/dimensional/metric-validators.d.ts +2 -1
- package/dist/dimensional/metric-validators.d.ts.map +1 -1
- package/dist/dimensional/metric-validators.js.map +1 -1
- package/dist/dimensional/metric.js.map +1 -1
- package/dist/dimensional/natural-units.js.map +1 -1
- package/dist/dimensional/quantity-registry.d.ts +23 -1
- package/dist/dimensional/quantity-registry.d.ts.map +1 -1
- package/dist/dimensional/quantity-registry.js +55 -18
- package/dist/dimensional/quantity-registry.js.map +1 -1
- package/dist/dimensional/rg-flow.js.map +1 -1
- package/dist/dimensional/stress-energy-validators.js.map +1 -1
- package/dist/dimensional/symbolic-constants.d.ts +63 -19
- package/dist/dimensional/symbolic-constants.d.ts.map +1 -1
- package/dist/dimensional/symbolic-constants.js +114 -92
- package/dist/dimensional/symbolic-constants.js.map +1 -1
- package/dist/dimensional/tensor-trace.js.map +1 -1
- package/dist/dimensional/tensor.js.map +1 -1
- package/dist/dimensional/types.js.map +1 -1
- package/dist/dimensional/unit-convention.d.ts +0 -2
- package/dist/dimensional/unit-convention.d.ts.map +1 -1
- package/dist/dimensional/unit-convention.js +2 -2
- package/dist/dimensional/unit-convention.js.map +1 -1
- package/dist/dimensional/unit-data.d.ts +70 -0
- package/dist/dimensional/unit-data.d.ts.map +1 -0
- package/dist/dimensional/unit-data.js +139 -0
- package/dist/dimensional/unit-data.js.map +1 -0
- package/dist/dimensional/units.d.ts +87 -24
- package/dist/dimensional/units.d.ts.map +1 -1
- package/dist/dimensional/units.js +290 -295
- package/dist/dimensional/units.js.map +1 -1
- package/dist/dimensional/validator-registry.js.map +1 -1
- package/dist/dimensional/validator.d.ts +0 -16
- package/dist/dimensional/validator.d.ts.map +1 -1
- package/dist/dimensional/validator.js +65 -29
- package/dist/dimensional/validator.js.map +1 -1
- package/dist/dimensional/weyl-validators.js.map +1 -1
- package/dist/index.d.ts +65 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -24
- package/dist/index.js.map +1 -1
- package/dist/numerical/bianchi-residual.js.map +1 -1
- package/dist/numerical/binding-value.d.ts +32 -7
- package/dist/numerical/binding-value.d.ts.map +1 -1
- package/dist/numerical/binding-value.js +218 -209
- package/dist/numerical/binding-value.js.map +1 -1
- package/dist/numerical/christoffel-flat.js.map +1 -1
- 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 +2 -2
- package/dist/numerical/covariant-eikonal.js.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.d.ts +20 -0
- package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.js +6 -3
- package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
- package/dist/numerical/derivative-lowering.js.map +1 -1
- package/dist/numerical/einstein-equation.js.map +1 -1
- package/dist/numerical/engine-registry.js.map +1 -1
- package/dist/numerical/errors.d.ts +7 -3
- package/dist/numerical/errors.d.ts.map +1 -1
- package/dist/numerical/errors.js +5 -5
- package/dist/numerical/errors.js.map +1 -1
- package/dist/numerical/evaluator-uncertainty.d.ts +34 -0
- package/dist/numerical/evaluator-uncertainty.d.ts.map +1 -0
- package/dist/numerical/evaluator-uncertainty.js +134 -0
- package/dist/numerical/evaluator-uncertainty.js.map +1 -0
- package/dist/numerical/formula-contract.d.ts +67 -7
- package/dist/numerical/formula-contract.d.ts.map +1 -1
- package/dist/numerical/formula-contract.js +68 -42
- package/dist/numerical/formula-contract.js.map +1 -1
- package/dist/numerical/formula-dimension.d.ts +17 -7
- package/dist/numerical/formula-dimension.d.ts.map +1 -1
- package/dist/numerical/formula-dimension.js +120 -44
- package/dist/numerical/formula-dimension.js.map +1 -1
- package/dist/numerical/formula-mathts.d.ts.map +1 -1
- package/dist/numerical/formula-mathts.js +10 -3
- package/dist/numerical/formula-mathts.js.map +1 -1
- package/dist/numerical/formula-registry.d.ts +13 -3
- package/dist/numerical/formula-registry.d.ts.map +1 -1
- package/dist/numerical/formula-registry.js +7 -2
- package/dist/numerical/formula-registry.js.map +1 -1
- package/dist/numerical/geodesic-integrator.js.map +1 -1
- package/dist/numerical/geometrized.js.map +1 -1
- package/dist/numerical/gl4-integrator.d.ts +28 -27
- package/dist/numerical/gl4-integrator.d.ts.map +1 -1
- package/dist/numerical/gl4-integrator.js +44 -45
- package/dist/numerical/gl4-integrator.js.map +1 -1
- package/dist/numerical/grid-field.js.map +1 -1
- package/dist/numerical/index.js.map +1 -1
- package/dist/numerical/input-validation.d.ts +3 -6
- package/dist/numerical/input-validation.d.ts.map +1 -1
- package/dist/numerical/input-validation.js +4 -8
- package/dist/numerical/input-validation.js.map +1 -1
- package/dist/numerical/killing.d.ts +8 -5
- package/dist/numerical/killing.d.ts.map +1 -1
- package/dist/numerical/killing.js.map +1 -1
- package/dist/numerical/klein-gordon.js.map +1 -1
- package/dist/numerical/kretschmann.js.map +1 -1
- package/dist/numerical/lowering-utils.js.map +1 -1
- package/dist/numerical/lowering.d.ts.map +1 -1
- package/dist/numerical/lowering.js +7 -17
- package/dist/numerical/lowering.js.map +1 -1
- package/dist/numerical/mathts-engine.d.ts.map +1 -1
- package/dist/numerical/mathts-engine.js +11 -6
- package/dist/numerical/mathts-engine.js.map +1 -1
- package/dist/numerical/metric-inverse.js.map +1 -1
- package/dist/numerical/null-ic.js.map +1 -1
- package/dist/numerical/null-ray-integrator.js +4 -4
- package/dist/numerical/null-ray-integrator.js.map +1 -1
- package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
- package/dist/numerical/pderiv.d.ts.map +1 -1
- package/dist/numerical/pderiv.js +9 -2
- package/dist/numerical/pderiv.js.map +1 -1
- package/dist/numerical/perihelion-finder.js.map +1 -1
- package/dist/numerical/quadrature.d.ts +5 -2
- package/dist/numerical/quadrature.d.ts.map +1 -1
- package/dist/numerical/quadrature.js +20 -3
- package/dist/numerical/quadrature.js.map +1 -1
- package/dist/numerical/spacetime-metrics.d.ts +17 -19
- package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
- package/dist/numerical/spacetime-metrics.js +158 -250
- package/dist/numerical/spacetime-metrics.js.map +1 -1
- package/dist/numerical/strides.js.map +1 -1
- package/dist/numerical/tensor-engine.d.ts +9 -5
- package/dist/numerical/tensor-engine.d.ts.map +1 -1
- package/dist/numerical/tensor-engine.js.map +1 -1
- package/dist/numerical/types.js.map +1 -1
- package/dist/numerical/weyl-lowering.js.map +1 -1
- package/dist/relations/category.js.map +1 -1
- package/dist/relations/composition-table.d.ts +4 -4
- package/dist/relations/composition-table.js +4 -4
- package/dist/relations/composition-table.js.map +1 -1
- package/dist/relations/conventions.js.map +1 -1
- package/dist/relations/domain-regimes.js.map +1 -1
- package/dist/relations/regime-registration.js.map +1 -1
- package/dist/relations/regime-vocabularies.js.map +1 -1
- package/dist/relations/regime.d.ts +18 -8
- package/dist/relations/regime.d.ts.map +1 -1
- package/dist/relations/regime.js +26 -14
- package/dist/relations/regime.js.map +1 -1
- package/dist/relations/types.d.ts +26 -6
- package/dist/relations/types.d.ts.map +1 -1
- package/dist/relations/types.js +15 -3
- package/dist/relations/types.js.map +1 -1
- package/package.json +10 -14
- package/dist/bridges/registry.d.ts +0 -60
- package/dist/bridges/registry.d.ts.map +0 -1
- package/dist/bridges/registry.js +0 -87
- package/dist/bridges/registry.js.map +0 -1
- package/dist/cli/poster-source.d.ts +0 -154
- package/dist/cli/poster-source.d.ts.map +0 -1
- package/dist/cli/poster-source.js +0 -184
- package/dist/cli/poster-source.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tensor-trace.js","sourceRoot":"","sources":["../../src/dimensional/tensor-trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AA4FrC,kEAAkE;AAClE,MAAM,iBAAiB,GAAc;IACnC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;CAC7C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAqB,EACrB,OAAO,GAAuB,EAAE;IAEhC,MAAM,gBAAgB,GAAG,OAAO,CAAC,sBAAsB,IAAI,WAAW,CAAC;IAEvE,uCAAuC;IACvC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B,CACpB,iBAAiB,EACjB,QAAQ,EACR,IAAI,CAAC,MAAM,CAAC,QAAQ,EACpB,gBAAgB,EAChB,uEAAuE,gBAAgB,GAAG,CAC3F,CAAC;IAEF,OAAO;QACL,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;QAC7B,WAAW,EAAE,IAAI,GAAG,EAAE;KACvB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * TensorTraceNode — structural tensor-trace operator for rank-2 tensors.\n *\n * Per `docs/architecture/archive/v0.7-be-x-reencoding-design-note.md` §\"BE-13 —\n * TensorTraceNode for the Einstein trace\". First of four BE-X re-encoding\n * primitives planned for the v0.7 sprint.\n *\n * Represents the contraction\n *\n * T = T^μ_μ = g^μν T_μν\n *\n * where `g^μν` is the inverse metric (upper-upper, dimensionless) and\n * `T_μν` is a rank-2 lower-lower tensor (e.g., the stress-energy tensor).\n * The result is a scalar whose SI dimension equals the component dimension\n * of the tensor being traced (the inverse metric is dimensionless, so it\n * passes the tensor's dimension through unchanged).\n *\n * This node is a PREDICATE node in the same family as\n * `EinsteinFieldEquationNode` and `KleinGordonEquationNode` — not a\n * value-producing expression. It documents the structural relationship\n * \"this scalar arose by contracting a rank-2 tensor with the inverse\n * metric\" so that downstream symbolic consumers (bridge cross-validators,\n * dimensional-signature catalog round-trips) can inspect the trace\n * structure rather than treating it as an opaque stub symbol.\n *\n * @module dimensional/tensor-trace\n */\n\nimport type { Dimension } from './types.js';\nimport type { MetricTensorNode } from './metric-validators.js';\nimport {\n validateComponentDimension,\n validateTensorSymmetry,\n} from './field-equation-helpers.js';\n\n// ---------------------------------------------------------------------------\n// TracableTensorNode — minimal structural interface\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal interface for rank-2 tensors that can be traced via\n * `TensorTraceNode`. Any rank-2 lower-lower node satisfies this:\n * `TensorSymbolNode` (with `.dim` aliased to `componentDim` by callers),\n * `StressEnergyTensorNode`, or custom rank-2 nodes.\n *\n * Fields:\n * - `indices` — Exactly two index slots; each must carry `variance: 'lower'`.\n * - `componentDim` — SI dimension of a single component of the tensor.\n * - `symmetry` — Symmetry tag (`'symmetric'`, `'antisymmetric'`,\n * `'none'`, or other string). Checked to be\n * `'symmetric'` by `validateTensorTrace`'s default\n * predicate (physical stress-energy and Ricci tensors\n * are symmetric; caller may override via the options\n * argument if tracing a non-symmetric rank-2 tensor).\n *\n * @public\n */\nexport interface TracableTensorNode {\n readonly indices: ReadonlyArray<{ readonly variance: string }>;\n readonly componentDim: Dimension;\n readonly symmetry: string;\n}\n\n// ---------------------------------------------------------------------------\n// TensorTraceNode\n// ---------------------------------------------------------------------------\n\n/**\n * AST node for the trace operation `T = g^μν T_μν`.\n *\n * Fields:\n * - `tensor` — The rank-2 lower-lower tensor being traced (e.g., `T_μν`).\n * - `metric` — The inverse metric `g^μν` (rank-2 upper-upper,\n * dimensionless) used for the contraction.\n *\n * The resulting scalar has `dim = tensor.componentDim` (the inverse metric\n * is dimensionless, so the trace carries the tensor's component dimension\n * unchanged).\n *\n * @public\n */\nexport interface TensorTraceNode {\n /** Discriminator: 'tensor-trace'. */\n readonly kind: 'tensor-trace';\n /** The rank-2 lower-lower tensor being traced. */\n readonly tensor: TracableTensorNode;\n /** The inverse metric `g^μν` supplying the upper-upper contraction. */\n readonly metric: MetricTensorNode;\n}\n\n// ---------------------------------------------------------------------------\n// TensorTraceValidationResult\n// ---------------------------------------------------------------------------\n\n/**\n * Result of validating a `TensorTraceNode`. The trace collapses all\n * free indices — the result is a scalar.\n *\n * @public\n */\nexport interface TensorTraceValidationResult {\n /** SI dimension of the resulting scalar. Equals `tensor.componentDim`. */\n readonly dim: Dimension;\n /** Empty free-indices map (trace is rank-0). */\n readonly freeIndices: Map<string, { upper: number; lower: number }>;\n}\n\n// ---------------------------------------------------------------------------\n// validateTensorTrace\n// ---------------------------------------------------------------------------\n\n/**\n * Options for `validateTensorTrace`.\n *\n * @public\n */\nexport interface TensorTraceOptions {\n /**\n * Expected symmetry of the tensor being traced. Defaults to\n * `'symmetric'` (appropriate for T_μν, R_μν, G_μν, etc.). Pass a\n * different value if tracing a non-symmetric rank-2 tensor.\n */\n readonly expectedTensorSymmetry?: string;\n}\n\n/** The SI dimension of a dimensionless metric g^μν: all zeros. */\nconst DIMENSIONLESS_DIM: Dimension = {\n L: 0, M: 0, T: 0, I: 0, Theta: 0, N: 0, J: 0,\n};\n\n/**\n * Validate a `tensor-trace` node.\n *\n * Three structural predicates (using the field-equation-helpers pattern):\n *\n * 1. **Index variance** — `tensor.indices` must be exactly 2, each\n * `variance === 'lower'` (rank-2 lower-lower). Error keyword: `\"index\"`.\n * 2. **Metric variance** — `metric.indices` must be exactly 2, each\n * `variance === 'upper'` (rank-2 upper-upper inverse form). The metric\n * must be dimensionless; error keyword: `\"dimension\"`.\n * 3. **Tensor symmetry** — `tensor.symmetry` must equal the expected\n * symmetry (default `'symmetric'`). Error keyword: `\"symmetry\"`.\n *\n * Returns the scalar result dimension (`tensor.componentDim`) with an\n * empty `freeIndices` map.\n *\n * Errors carry the keywords `\"index\"`, `\"dimension\"`, or `\"symmetry\"` per\n * the field-equation-helpers error-vocabulary convention, so consumer\n * pattern-matching on those strings stays consistent across equation nodes.\n *\n * @public\n */\nexport function validateTensorTrace(\n node: TensorTraceNode,\n options: TensorTraceOptions = {},\n): TensorTraceValidationResult {\n const expectedSymmetry = options.expectedTensorSymmetry ?? 'symmetric';\n\n // Predicate 1a: tensor must be rank-2.\n if (node.tensor.indices.length !== 2) {\n throw new Error(\n `TensorTraceNode: index rank error — tensor must be rank-2 ` +\n `(got rank-${node.tensor.indices.length}). ` +\n `Only rank-2 lower-lower tensors can be traced via g^μν contraction.`,\n );\n }\n\n // Predicate 1b: both tensor index slots must be lower.\n for (let i = 0; i < node.tensor.indices.length; i++) {\n const idx = node.tensor.indices[i];\n if (idx.variance !== 'lower') {\n throw new Error(\n `TensorTraceNode: index variance error — tensor.indices[${i}] ` +\n `must have variance 'lower' (got '${idx.variance}'). ` +\n `The trace g^μν T_μν requires T to be lower-lower.`,\n );\n }\n }\n\n // Predicate 2a: metric must be rank-2.\n if (node.metric.indices.length !== 2) {\n throw new Error(\n `TensorTraceNode: index rank error — metric must be rank-2 ` +\n `(got rank-${node.metric.indices.length}).`,\n );\n }\n\n // Predicate 2b: both metric index slots must be upper.\n for (let i = 0; i < node.metric.indices.length; i++) {\n const idx = node.metric.indices[i];\n if (idx.variance !== 'upper') {\n throw new Error(\n `TensorTraceNode: index variance error — metric.indices[${i}] ` +\n `must have variance 'upper' (got '${idx.variance}'). ` +\n `The inverse metric g^μν must be upper-upper for the contraction.`,\n );\n }\n }\n\n // Predicate 2c: the inverse metric must be dimensionless.\n validateComponentDimension(\n 'TensorTraceNode',\n 'metric (g^μν) dim',\n node.metric.dim,\n DIMENSIONLESS_DIM,\n 'The inverse metric g^μν is dimensionless; the trace dimension equals the tensor component dimension.',\n );\n\n // Predicate 3: tensor symmetry check.\n validateTensorSymmetry(\n 'TensorTraceNode',\n 'tensor',\n node.tensor.symmetry,\n expectedSymmetry,\n `Physical rank-2 tensors eligible for Einstein-trace contraction are ${expectedSymmetry}.`,\n );\n\n return {\n dim: node.tensor.componentDim,\n freeIndices: new Map(),\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tensor.js","sourceRoot":"","sources":["../../src/dimensional/tensor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAaxC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAyBrB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAsB;IAEtB,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4C,CAAC;IACxE,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,I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E,OAAO,EAAE,GAAG,EAAE,CAAC;IAClD,IAAI,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACzC,IAAI,aAAa,KAAK,SAAS;QAAE,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACpE,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;cAEc;AACd,MAAM,UAAU,KAAK,CAAC,MAAgB,EAAE,MAAgB;IACtD,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;AAC5D,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,QAAQ,CAAC,GAAG,IAAgB;IAC1C,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;AAC1C,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,IAAI,CAAC,GAAG,IAAgB;IACtC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACvC,CAAC","sourcesContent":["/**\n * Tensor AST node types and helpers — v0.2.0 algebra layer.\n *\n * Adds the two new ExprNode discriminated-union variants:\n * - 'tensor-symbol': a named tensor with variance-typed indices\n * - 'tensor-product': Einstein-summation product over tensor and scalar operands\n *\n * Per docs/specification/Part-VII-Tensor-Algebra.md §VII.1 and §VII.4.\n *\n * @module dimensional/tensor\n */\n\nimport type { Dimension } from './types.js';\nimport { DIMENSIONLESS } from './types.js';\nimport { multiply } from './algebra.js';\n// ExprNode and the tensor node/index types now live in the leaf `ast-types.ts`\n// — no longer imported from validator.ts, whose back-edge (validator imports\n// tensor types; tensor imported ExprNode) formed a type-only cycle. The tensor\n// types are re-exported below so existing importers of `… from './tensor.js'`\n// are unchanged.\nimport type {\n ExprNode,\n Role,\n TensorIndex,\n TensorSymbolNode,\n TensorProductNode,\n} from './ast-types.js';\nimport {\n DuplicateIndexLabelError,\n IndexLabelCollisionError,\n VarianceMismatchError,\n} from './errors.js';\n\nexport type {\n Variance,\n Role,\n TensorIndex,\n TensorSymbolNode,\n TensorProductNode,\n} from './ast-types.js';\n\n/**\n * Result shape returned by `validateTensorSymbol`. A minimal carrier for\n * the inferred per-component dimension plus the free-indices map built\n * from the declared indices. The validator's `infer()` adapts this back\n * into its `Dimension | null` return shape and merges `freeIndices` into\n * the outer accumulator.\n */\n// v0.6.1: dropped `export` — internal-only validation-result shape.\n// `validateTensorSymbol` still returns this shape via inference; no\n// external consumer references the named type.\ninterface TensorSymbolValidationResult {\n readonly dim: Dimension;\n readonly freeIndices: Map<string, { upper: number; lower: number }>;\n}\n\n/**\n * Validate a tensor-symbol node. Builds the freeIndices map from the\n * declared indices, with one upper / one lower count per label.\n *\n * Throws `DuplicateIndexLabelError` if the indices list contains the same\n * label more than once (e.g., T^μ_μ_μ). Per Part-VII §VII.4\n * (repeated-dummy-label-in-tensor-symbol-rejected TENSOR-RULE).\n *\n * The function is pure: no I/O, no shared state, total over its input\n * (modulo the documented throw). Callers (validator.ts `infer()`) thread\n * the returned freeIndices map up into their accumulator.\n */\nexport function validateTensorSymbol(\n node: TensorSymbolNode,\n): TensorSymbolValidationResult {\n const freeIndices = new Map<string, { upper: number; lower: number }>();\n for (const idx of node.indices) {\n if (freeIndices.has(idx.label)) {\n throw new DuplicateIndexLabelError(node.name, idx.label);\n }\n freeIndices.set(idx.label, {\n upper: idx.variance === 'upper' ? 1 : 0,\n lower: idx.variance === 'lower' ? 1 : 0,\n });\n }\n return { dim: node.dim, freeIndices };\n}\n\n/**\n * Result of a tensor-product contraction over a set of operands.\n *\n * Re-exported as part of v0.2.0's TensorJS forward-compatibility contract\n * (§14.2 of v0.2.0-Design.md). The future mathjs / TensorJS numerical\n * backend will call `computeContraction` with the same operand list, pair\n * the returned `contractionPairs` with its own einsum-pattern compiler,\n * and multiply concrete numerical tensors using its dimensions.\n */\n// v0.6.1: dropped `export` — internal-only contraction-result shape.\n// `computeContraction` returns this shape via inference; no external\n// consumer references the named type.\ninterface ContractionResult {\n /** Resulting per-component dimension (product of operand dims). */\n readonly dim: Dimension;\n /** Free indices remaining after Einstein contraction. */\n readonly freeIndices: Map<string, { upper: number; lower: number }>;\n /** Labels that were contracted (one upper + one lower pair per entry). */\n readonly contractionPairs: ReadonlyArray<{ label: string }>;\n}\n\n/**\n * Per-child validation result the caller of `computeContraction` must\n * supply through the `validateChild` callback. Mirrors the local-Map\n * convention pioneered by `validateTensorSymbol`: the child reports its\n * inferred dimension plus a map of label → {upper, lower} counts that\n * `computeContraction` merges and reduces.\n */\nexport interface ChildValidationResult {\n readonly dim: Dimension;\n readonly freeIndices: Map<string, { upper: number; lower: number }>;\n}\n\n/**\n * Pure function that computes the dimension, free-indices map, and\n * contraction pairs for a tensor-product over the given operands.\n *\n * The function is pure and module-cycle-free: it does NOT import\n * `validator.ts`. Recursion is injected via the `validateChild` callback\n * — the caller (typically validator.ts's `infer()` dispatch) supplies a\n * resolver that returns `{dim, freeIndices}` for each child node. The\n * caller is responsible for handling all `ExprNode` kinds in its callback\n * (scalars, tensor-symbols, nested tensor-products, etc.).\n *\n * Critically, the per-child freeIndices maps returned by `validateChild`\n * MUST be local to that child (not shared mutable state). This is what\n * makes nested tensor-products safe: an inner tensor-product reports its\n * post-contraction residual free indices as a local map, and the outer\n * call merges those without ever touching shared accumulator state.\n *\n * Re-exported for the future mathjs backend per v0.2.0-Design.md §14.2.\n *\n * **v0.2.0 limitation — implicit identity metric.** The contraction\n * mechanism here assumes one upper index `μ` paired with one lower index\n * `μ` annihilate (Kronecker delta convention). v0.3.0's metric layer\n * will introduce explicit g_μν / g^μν for raising and lowering — at\n * which point this function's hard-coded pairing rule must generalize\n * to \"find labels with mismatched variance, raise/lower via the metric,\n * then contract.\" Forward-compat callers should NOT assume the v0.2.0\n * rule is permanent.\n *\n * Throws:\n * - IndexLabelCollisionError if any label appears > 2 times total.\n * - VarianceMismatchError if a label appears twice with same variance.\n */\nexport function computeContraction(\n args: ReadonlyArray<ExprNode>,\n validateChild: (node: ExprNode) => ChildValidationResult,\n): ContractionResult {\n // Step A: Recursively validate each arg via the injected callback,\n // accumulating product-dimension and merging local freeIndices maps.\n let dim: Dimension = DIMENSIONLESS;\n const merged = new Map<string, { upper: number; lower: number }>();\n\n for (const arg of args) {\n const child = validateChild(arg);\n dim = multiply(dim, child.dim);\n for (const [label, counts] of child.freeIndices) {\n const existing = merged.get(label) ?? { upper: 0, lower: 0 };\n merged.set(label, {\n upper: existing.upper + counts.upper,\n lower: existing.lower + counts.lower,\n });\n }\n }\n\n // Step B: Validate label counts (≤2) and pair upper/lower for contraction.\n const contractionPairs: { label: string }[] = [];\n for (const [label, counts] of merged) {\n const total = counts.upper + counts.lower;\n if (total > 2) {\n throw new IndexLabelCollisionError(label, total);\n }\n if (total === 2 && (counts.upper === 0 || counts.lower === 0)) {\n const variance = counts.upper === 2 ? 'upper' : 'lower';\n throw new VarianceMismatchError(label, variance);\n }\n if (counts.upper > 0 && counts.lower > 0) {\n const pairs = Math.min(counts.upper, counts.lower);\n for (let i = 0; i < pairs; i++) contractionPairs.push({ label });\n merged.set(label, {\n upper: counts.upper - pairs,\n lower: counts.lower - pairs,\n });\n }\n }\n\n // Step C: Drop fully-contracted labels (both counts zero) from the\n // outgoing freeIndices map so callers don't see phantom dummies.\n // Collect keys first; delete in a second pass to avoid modifying the\n // Map during iteration (allocates only the small set of contracted labels).\n const toDelete: string[] = [];\n for (const [label, counts] of merged) {\n if (counts.upper === 0 && counts.lower === 0) toDelete.push(label);\n }\n for (const label of toDelete) merged.delete(label);\n\n return { dim, freeIndices: merged, contractionPairs };\n}\n\n/** Construct a tensor-symbol node. */\nexport function tsym(\n name: string,\n indices: ReadonlyArray<TensorIndex>,\n dim: Dimension,\n role?: Role,\n numericalForm?: 'symbolic' | 'numerical-fn' | 'grid',\n): TensorSymbolNode {\n const node: {\n kind: 'tensor-symbol';\n name: string;\n indices: ReadonlyArray<TensorIndex>;\n dim: Dimension;\n role?: Role;\n numericalForm?: 'symbolic' | 'numerical-fn' | 'grid';\n } = { kind: 'tensor-symbol', name, indices, dim };\n if (role !== undefined) node.role = role;\n if (numericalForm !== undefined) node.numericalForm = numericalForm;\n return node;\n}\n\n/** Scale a tensor by a scalar coefficient. Returns a tensor-product.\n *\n * @public */\nexport function scale(scalar: ExprNode, tensor: ExprNode): TensorProductNode {\n return { kind: 'tensor-product', args: [scalar, tensor] };\n}\n\n/** Contract any number of operands. Returns a tensor-product. */\nexport function contract(...args: ExprNode[]): TensorProductNode {\n return { kind: 'tensor-product', args };\n}\n\n/** Tensor sum via op '+'. Validator enforces matching free indices. */\nexport function tsum(...args: ExprNode[]): ExprNode {\n return { kind: 'op', op: '+', args };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/dimensional/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAmBH,MAAM,CAAC,MAAM,aAAa,GAAc,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAEzF,oBAAoB;AACpB,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,oEAAoE;AACpE,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,oCAAoC;AACpC,MAAM,CAAC,MAAM,MAAM,GAAqB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACzF,MAAM,CAAC,MAAM,IAAI,GAAuB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAA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,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM;AAElG,gCAAgC;AAChC,MAAM,CAAC,MAAM,MAAM,GAAqB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,gBAAgB;AAE1G,gFAAgF;AAChF,mEAAmE;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAgD;IAC3E,CAAC,eAAe,EAAE,aAAa,CAAC;IAChC,CAAC,QAAQ,EAAE,MAAM,CAAC;IAClB,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,WAAW,EAAE,SAAS,CAAC;IACxB,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,UAAU,EAAE,QAAQ,CAAC;IACtB,CAAC,cAAc,EAAE,YAAY,CAAC;IAC9B,sEAAsE;IACtE,sEAAsE;IACtE,mBAAmB;IACnB,CAAC,QAAQ,EAAE,MAAM,CAAC;IAClB,CAAC,OAAO,EAAE,KAAK,CAAC;IAChB,CAAC,QAAQ,EAAE,MAAM,CAAC;IAClB,CAAC,OAAO,EAAE,KAAK,CAAC;IAChB,CAAC,aAAa,EAAE,WAAW,CAAC;IAC5B,CAAC,SAAS,EAAE,OAAO,CAAC;IACpB,CAAC,QAAQ,EAAE,MAAM,CAAC;CACnB,CAAC","sourcesContent":["/**\n * SI dimensional types.\n *\n * Base dimensions per BIPM SI Brochure, 9th edition (2019), Table 3:\n * length L, mass M, time T, electric current I, thermodynamic temperature Theta,\n * amount of substance N, luminous intensity J.\n *\n * Named-dimension constants below are derived per NIST SP 811 (2008) §4\n * (derived SI units) and standard physics references:\n * - Goldstein, \"Classical Mechanics\" 3rd ed.\n * - Sakurai, \"Modern Quantum Mechanics\" 2nd ed.\n * - Wald, \"General Relativity\" (1984)\n *\n * All exponents are stored as `number` (allowing rational e.g. 1/2 if needed).\n *\n * @module dimensional/types\n */\n\nexport interface Dimension {\n /** Length (metre, m). */\n L: number;\n /** Mass (kilogram, kg). */\n M: number;\n /** Time (second, s). */\n T: number;\n /** Electric current (ampere, A). */\n I: number;\n /** Thermodynamic temperature (kelvin, K). */\n Theta: number;\n /** Amount of substance (mole, mol). */\n N: number;\n /** Luminous intensity (candela, cd). */\n J: number;\n}\n\nexport const DIMENSIONLESS: Dimension = { L: 0, M: 0, T: 0, I: 0, Theta: 0, N: 0, J: 0 };\n\n// --- Mechanics ---\n//\n// Named-dimension constants are exported only when there is at least one\n// real consumer (a bridge encoding, a constant, or an active test). The\n// previously-exported VOLUME, MOMENTUM, ANGULAR_MOMENTUM, PRESSURE,\n// DENSITY, VOLTAGE, ELECTRIC_FIELD, MAGNETIC_FIELD were unreferenced and\n// were removed 2026-05-04 per simplifier F-01 (no flexibility/configura-\n// bility that wasn't requested). Re-add them precisely when a bridge\n// encoding or test references them.\nexport const LENGTH: Dimension = { L: 1, M: 0, T: 0, I: 0, Theta: 0, N: 0, J: 0 };\nexport const AREA: Dimension = { L: 2, M: 0, T: 0, I: 0, Theta: 0, N: 0, J: 0 };\nexport const TIME: Dimension = { L: 0, M: 0, T: 1, I: 0, Theta: 0, N: 0, J: 0 };\nexport const FREQUENCY: Dimension = { L: 0, M: 0, T: -1, I: 0, Theta: 0, N: 0, J: 0 };\nexport const MASS: Dimension = { L: 0, M: 1, T: 0, I: 0, Theta: 0, N: 0, J: 0 };\n/** Mass density, kilogram per cubic metre. */\nexport const MASS_DENSITY: Dimension = { L: -3, M: 1, T: 0, I: 0, Theta: 0, N: 0, J: 0 };\nexport const VELOCITY: Dimension = { L: 1, M: 0, T: -1, I: 0, Theta: 0, N: 0, J: 0 };\nexport const ACCELERATION: Dimension = { L: 1, M: 0, T: -2, I: 0, Theta: 0, N: 0, J: 0 };\nexport const FORCE: Dimension = { L: 1, M: 1, T: -2, I: 0, Theta: 0, N: 0, J: 0 }; // newton\nexport const ENERGY: Dimension = { L: 2, M: 1, T: -2, I: 0, Theta: 0, N: 0, J: 0 }; // joule\nexport const POWER: Dimension = { L: 2, M: 1, T: -3, I: 0, Theta: 0, N: 0, J: 0 }; // watt\nexport const ACTION: Dimension = { L: 2, M: 1, T: -1, I: 0, Theta: 0, N: 0, J: 0 }; // J·s\n\n// --- Thermodynamics ---\nexport const TEMPERATURE: Dimension = { L: 0, M: 0, T: 0, I: 0, Theta: 1, N: 0, J: 0 };\nexport const ENTROPY: Dimension = { L: 2, M: 1, T: -2, I: 0, Theta: -1, N: 0, J: 0 }; // J/K\n\n// --- Electromagnetism (SI) ---\nexport const CHARGE: Dimension = { L: 0, M: 0, T: 1, I: 1, Theta: 0, N: 0, J: 0 }; // coulomb = A·s\n\n// --- Curated lookup table for `format()` to recognize named SI dimensions. ---\n// Order matters only for tie-breaks; the first matching name wins.\nexport const NAMED_DIMENSIONS: ReadonlyArray<readonly [string, Dimension]> = [\n ['dimensionless', DIMENSIONLESS],\n ['length', LENGTH],\n ['area', AREA],\n ['time', TIME],\n ['frequency', FREQUENCY],\n ['mass', MASS],\n ['velocity', VELOCITY],\n ['acceleration', ACCELERATION],\n // action carries the same SI shape (J·s) as angular momentum; we keep\n // 'action' as the canonical name since hbar (the only consumer today)\n // is action-typed.\n ['action', ACTION],\n ['force', FORCE],\n ['energy', ENERGY],\n ['power', POWER],\n ['temperature', TEMPERATURE],\n ['entropy', ENTROPY],\n ['charge', CHARGE],\n];\n"]}
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
* @module dimensional/unit-convention
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
|
-
/** Quantity name → the unit its evaluator speaks. @internal */
|
|
17
|
-
export declare const QUANTITY_CONVENTION_UNIT: ReadonlyMap<string, string>;
|
|
18
16
|
/** The unit a quantity's evaluator speaks, or undefined when that unit is SI. @internal */
|
|
19
17
|
export declare function quantityConventionUnit(name: string): string | undefined;
|
|
20
18
|
/** Scale a quantity's evaluator-unit value into SI. @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unit-convention.d.ts","sourceRoot":"","sources":["../../src/dimensional/unit-convention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"unit-convention.d.ts","sourceRoot":"","sources":["../../src/dimensional/unit-convention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAkBH,2FAA2F;AAC3F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvE;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGxD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAajE"}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { equals } from './algebra.js';
|
|
17
17
|
import { parseUnit } from './units.js';
|
|
18
|
-
/** Quantity name → the unit its evaluator speaks
|
|
19
|
-
|
|
18
|
+
/** Quantity name → the unit its evaluator speaks; read through {@link quantityConventionUnit}. */
|
|
19
|
+
const QUANTITY_CONVENTION_UNIT = new Map([
|
|
20
20
|
['vacuum-expectation-value', 'GeV'],
|
|
21
21
|
['dark-fermion-mass', 'GeV'],
|
|
22
22
|
['planck-mass-energy', 'GeV'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unit-convention.js","sourceRoot":"","sources":["../../src/dimensional/unit-convention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;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,QAAQ,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,CAAC,CAAC;IAC7D,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACvE,MAAM,QAAQ,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjE,IAAI,UAAU,KAAK,IAAI,IAAI,QAAQ,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACtF,MAAM,IAAI,KAAK,CACb,qBAAqB,IAAI,QAAQ,QAAQ,SAAS,EAAE,QAAQ,MAAM,yBAAyB,CAC5F,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,UAAU,EAAE,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["/**\n * Per-quantity unit convention for the quantities whose dimension does not\n * decide the unit. Energy nodes here are GeV; the rest of the energy graph\n * is joules. Information nodes here are bits or nats; both are\n * dimensionless, and a bit is ln 2 nat. Entropy in J/K is dimensionally\n * distinct and tagged so a bit is not accepted as that entropy.\n *\n * A name absent from this table is read in SI, which is what\n * {@link readBinding} already returns. Representative magnitudes in\n * `representative-values.ts` stay in SI joules and are not read through\n * this table.\n *\n * @module dimensional/unit-convention\n * @internal\n */\n\nimport { equals } from './algebra.js';\nimport { parseUnit } from './units.js';\n\n/** Quantity name → the unit its evaluator speaks; read through {@link quantityConventionUnit}. */\nconst QUANTITY_CONVENTION_UNIT: ReadonlyMap<string, string> = new Map([\n ['vacuum-expectation-value', 'GeV'],\n ['dark-fermion-mass', 'GeV'],\n ['planck-mass-energy', 'GeV'],\n ['inflation-hubble-energy', 'GeV'],\n ['intrinsic-information', 'bit'],\n ['subsystem-entanglement-entropy', 'nat'],\n ['modular-hamiltonian-variation', 'nat'],\n ['entanglement-entropy-variation', 'nat'],\n ['wormhole-entanglement-entropy', 'J/K'],\n]);\n\n/** The unit a quantity's evaluator speaks, or undefined when that unit is SI. @internal */\nexport function quantityConventionUnit(name: string): string | undefined {\n return QUANTITY_CONVENTION_UNIT.get(name);\n}\n\n/** Scale a quantity's evaluator-unit value into SI. @internal */\nexport function conventionScaleToSI(name: string): number {\n const unit = QUANTITY_CONVENTION_UNIT.get(name);\n return unit === undefined ? 1 : parseUnit(unit).scale;\n}\n\n/**\n * Multiply a value in `from`'s convention to obtain the value in `to`'s\n * convention. Two untagged names, or two names with the same unit, are 1.\n * An untagged name is SI. Two tagged names whose dimensions differ throw:\n * copying the number would type-check and be meaningless.\n * @internal\n */\nexport function conventionFactor(from: string, to: string): number {\n const fromUnit = QUANTITY_CONVENTION_UNIT.get(from);\n const toUnit = QUANTITY_CONVENTION_UNIT.get(to);\n if (fromUnit === undefined && toUnit === undefined) return 1;\n if (fromUnit === toUnit) return 1;\n const fromParsed = fromUnit === undefined ? null : parseUnit(fromUnit);\n const toParsed = toUnit === undefined ? null : parseUnit(toUnit);\n if (fromParsed !== null && toParsed !== null && !equals(fromParsed.dim, toParsed.dim)) {\n throw new Error(\n `unit convention: '${from}' is ${fromUnit} and '${to}' is ${toUnit}; the dimensions differ`,\n );\n }\n return (fromParsed?.scale ?? 1) / (toParsed?.scale ?? 1);\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The unit table, loaded from `data/units.json` and validated once.
|
|
3
|
+
*
|
|
4
|
+
* The file is checked against `data/units.schema.json` when this module
|
|
5
|
+
* loads (`core/data-file`), then against the rules a schema cannot state:
|
|
6
|
+
* every scale expression reads, a symbol is spelled by one row, a refused
|
|
7
|
+
* spelling and an affine spelling are not also a unit, every prefix letter is
|
|
8
|
+
* both a prefix and a unit, and every `{NAME}` in a note is a constant. A
|
|
9
|
+
* file that breaks one throws here, so `units.ts` never reads a half-valid table.
|
|
10
|
+
*
|
|
11
|
+
* A scale is an exact expression, read by `exact-scale.ts`. A name in it is a
|
|
12
|
+
* shared scale from the file's `scales`, `pi`, or a constant under its registry
|
|
13
|
+
* spelling (`c`, `e`, `m_u`, `M_sun`, `Msun_iau`, `ln2`; `constant-rows.ts`),
|
|
14
|
+
* the same spelling a `{NAME}` note placeholder uses. A constant is read through
|
|
15
|
+
* its shortest decimal (`scaleOf`), or as the irrational factor when its row is
|
|
16
|
+
* `irrational`. A shared scale may not reuse a constant's spelling, so a name
|
|
17
|
+
* has one meaning. The raw rows are strings and integer exponents, so another
|
|
18
|
+
* exact reader (MathTS) replaces this loader without touching the file.
|
|
19
|
+
*
|
|
20
|
+
* @module dimensional/unit-data
|
|
21
|
+
*/
|
|
22
|
+
import type { JsonSchema } from '../core/json-schema.js';
|
|
23
|
+
import type { Dimension } from './types.js';
|
|
24
|
+
import { type ExactScale } from './exact-scale.js';
|
|
25
|
+
/** One unit symbol, read exactly. @internal */
|
|
26
|
+
export interface UnitRow {
|
|
27
|
+
/** Exact scale to SI base units. */
|
|
28
|
+
readonly scale: ExactScale;
|
|
29
|
+
readonly dim: Dimension;
|
|
30
|
+
/** Takes an SI prefix. */
|
|
31
|
+
readonly prefixable: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The unit counts cycles (turns), not radians. An angular-frequency input in
|
|
34
|
+
* rad/s takes 2π per cycle; the radian itself does not.
|
|
35
|
+
*/
|
|
36
|
+
readonly cycles?: true;
|
|
37
|
+
}
|
|
38
|
+
/** One affine temperature scale, read exactly. @internal */
|
|
39
|
+
export interface AffineRow {
|
|
40
|
+
readonly id: string;
|
|
41
|
+
/** Kelvin per degree, exactly. */
|
|
42
|
+
readonly scale: ExactScale;
|
|
43
|
+
/** The reading at the ice point (0 °C, 273.15 K), exactly. */
|
|
44
|
+
readonly icePoint: ExactScale;
|
|
45
|
+
readonly symbols: readonly string[];
|
|
46
|
+
}
|
|
47
|
+
/** The unit table `units.ts` reads. @internal */
|
|
48
|
+
export interface UnitTableData {
|
|
49
|
+
readonly units: ReadonlyMap<string, UnitRow>;
|
|
50
|
+
readonly prefixes: ReadonlyMap<string, ExactScale>;
|
|
51
|
+
/** Refused spelling → the message it prints. */
|
|
52
|
+
readonly refused: ReadonlyMap<string, string>;
|
|
53
|
+
readonly prefixLetterUnits: ReadonlySet<string>;
|
|
54
|
+
/** Kelvin at 0 °C, exactly. */
|
|
55
|
+
readonly iceKelvin: ExactScale;
|
|
56
|
+
readonly affine: readonly AffineRow[];
|
|
57
|
+
/** Spelling → its note, with every `{NAME}` replaced by that constant. */
|
|
58
|
+
readonly spellingNotes: ReadonlyMap<string, string>;
|
|
59
|
+
/** SHA-256 of `data/units.json` with line endings as LF, for the CLI record fingerprint. */
|
|
60
|
+
readonly sha256: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Validate and read `text`, the contents of `data/units.json`, against `schema`.
|
|
64
|
+
* Throws on a file the schema or the table rules reject. A test passes a broken copy.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
export declare function readUnitFile(text: string, schema: JsonSchema): UnitTableData;
|
|
68
|
+
/** The unit table, read once from `data/units.json`. @internal */
|
|
69
|
+
export declare const UNIT_DATA: UnitTableData;
|
|
70
|
+
//# sourceMappingURL=unit-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit-data.d.ts","sourceRoot":"","sources":["../../src/dimensional/unit-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAA+D,KAAK,UAAU,EAAE,MAAM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M,EAAE,UAAU,GAAG,aAAa,CA8E5E;AAED,kEAAkE;AAClE,eAAO,MAAM,SAAS,EAAE,aAA8E,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The unit table, loaded from `data/units.json` and validated once.
|
|
3
|
+
*
|
|
4
|
+
* The file is checked against `data/units.schema.json` when this module
|
|
5
|
+
* loads (`core/data-file`), then against the rules a schema cannot state:
|
|
6
|
+
* every scale expression reads, a symbol is spelled by one row, a refused
|
|
7
|
+
* spelling and an affine spelling are not also a unit, every prefix letter is
|
|
8
|
+
* both a prefix and a unit, and every `{NAME}` in a note is a constant. A
|
|
9
|
+
* file that breaks one throws here, so `units.ts` never reads a half-valid table.
|
|
10
|
+
*
|
|
11
|
+
* A scale is an exact expression, read by `exact-scale.ts`. A name in it is a
|
|
12
|
+
* shared scale from the file's `scales`, `pi`, or a constant under its registry
|
|
13
|
+
* spelling (`c`, `e`, `m_u`, `M_sun`, `Msun_iau`, `ln2`; `constant-rows.ts`),
|
|
14
|
+
* the same spelling a `{NAME}` note placeholder uses. A constant is read through
|
|
15
|
+
* its shortest decimal (`scaleOf`), or as the irrational factor when its row is
|
|
16
|
+
* `irrational`. A shared scale may not reuse a constant's spelling, so a name
|
|
17
|
+
* has one meaning. The raw rows are strings and integer exponents, so another
|
|
18
|
+
* exact reader (MathTS) replaces this loader without touching the file.
|
|
19
|
+
*
|
|
20
|
+
* @module dimensional/unit-data
|
|
21
|
+
*/
|
|
22
|
+
import { createHash } from 'node:crypto';
|
|
23
|
+
import { dataSchema, dataText, parseDataFile } from '../core/data-file.js';
|
|
24
|
+
import { constantRow } from './constant-rows.js';
|
|
25
|
+
import { decimalScale, irrationalScale, readScaleExpression, scaleOf } from './exact-scale.js';
|
|
26
|
+
/** π, which the registry does not spell (a formula scope adds `pi` itself), as the irrational factor. */
|
|
27
|
+
const PI = 'pi';
|
|
28
|
+
const PI_SCALE = irrationalScale(Math.PI);
|
|
29
|
+
/** The registered constant `name` spells, exactly: its irrational factor or its shortest decimal; undefined when no constant has that spelling. */
|
|
30
|
+
function constantScale(name) {
|
|
31
|
+
const constant = constantRow(name);
|
|
32
|
+
if (constant === undefined)
|
|
33
|
+
return undefined;
|
|
34
|
+
return constant.irrational === true ? irrationalScale(constant.value) : scaleOf(constant.value);
|
|
35
|
+
}
|
|
36
|
+
function dimension(d) {
|
|
37
|
+
return {
|
|
38
|
+
L: d.L ?? 0,
|
|
39
|
+
M: d.M ?? 0,
|
|
40
|
+
T: d.T ?? 0,
|
|
41
|
+
I: d.I ?? 0,
|
|
42
|
+
Theta: d.Theta ?? 0,
|
|
43
|
+
N: d.N ?? 0,
|
|
44
|
+
J: d.J ?? 0,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Validate and read `text`, the contents of `data/units.json`, against `schema`.
|
|
49
|
+
* Throws on a file the schema or the table rules reject. A test passes a broken copy.
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export function readUnitFile(text, schema) {
|
|
53
|
+
const file = parseDataFile('units.json', text, schema);
|
|
54
|
+
for (const name of Object.keys(file.scales)) {
|
|
55
|
+
if (name === PI || constantRow(name) !== undefined) {
|
|
56
|
+
throw new Error(`data/units.json: shared scale '${name}' is also ${name === PI ? 'π' : 'a registered constant'}; a name has one meaning`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const named = new Map();
|
|
60
|
+
const reading = new Set();
|
|
61
|
+
const resolve = (name) => {
|
|
62
|
+
if (name === PI)
|
|
63
|
+
return PI_SCALE;
|
|
64
|
+
const shared = file.scales[name];
|
|
65
|
+
if (shared !== undefined) {
|
|
66
|
+
const done = named.get(name);
|
|
67
|
+
if (done !== undefined)
|
|
68
|
+
return done;
|
|
69
|
+
if (reading.has(name))
|
|
70
|
+
throw new Error(`data/units.json: scale '${name}' is defined in terms of itself`);
|
|
71
|
+
reading.add(name);
|
|
72
|
+
const scale = readScaleExpression(shared, resolve);
|
|
73
|
+
reading.delete(name);
|
|
74
|
+
named.set(name, scale);
|
|
75
|
+
return scale;
|
|
76
|
+
}
|
|
77
|
+
return constantScale(name);
|
|
78
|
+
};
|
|
79
|
+
const read = (text, where) => {
|
|
80
|
+
try {
|
|
81
|
+
return readScaleExpression(text, resolve);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
throw new Error(`data/units.json ${where}: ${error.message}`);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const prefixes = new Map(Object.entries(file.prefixes).map(([prefix, text]) => [prefix, decimalScale(text)]));
|
|
88
|
+
const units = new Map();
|
|
89
|
+
for (const row of file.units) {
|
|
90
|
+
const scale = read(row.scale, `unit ${row.symbols[0]}`);
|
|
91
|
+
const unit = { scale, dim: dimension(row.dimension), prefixable: row.prefixable, ...(row.cycles ? { cycles: true } : {}) };
|
|
92
|
+
for (const symbol of row.symbols) {
|
|
93
|
+
if (units.has(symbol))
|
|
94
|
+
throw new Error(`data/units.json: unit '${symbol}' is spelled by two rows`);
|
|
95
|
+
units.set(symbol, unit);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const refused = new Map();
|
|
99
|
+
for (const { symbol, reason } of file.refused) {
|
|
100
|
+
if (units.has(symbol) || refused.has(symbol))
|
|
101
|
+
throw new Error(`data/units.json: refused '${symbol}' is also a unit or refused twice`);
|
|
102
|
+
refused.set(symbol, reason);
|
|
103
|
+
}
|
|
104
|
+
for (const letter of file.prefixLetterUnits.letters) {
|
|
105
|
+
if (!prefixes.has(letter) || !units.has(letter)) {
|
|
106
|
+
throw new Error(`data/units.json: prefix letter '${letter}' is not both a prefix and a unit`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const affine = file.affine.scales.map((row) => {
|
|
110
|
+
for (const symbol of row.symbols) {
|
|
111
|
+
if (units.has(symbol) || refused.has(symbol))
|
|
112
|
+
throw new Error(`data/units.json: affine '${symbol}' is also a unit or refused`);
|
|
113
|
+
}
|
|
114
|
+
return { id: row.id, scale: read(row.scale, `affine ${row.id}`), icePoint: read(row.icePoint, `affine ${row.id}`), symbols: row.symbols };
|
|
115
|
+
});
|
|
116
|
+
const spellingNotes = new Map();
|
|
117
|
+
for (const { spelling, note } of file.spellingNotes) {
|
|
118
|
+
const filled = note.replace(/\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, name) => {
|
|
119
|
+
const constant = constantRow(name);
|
|
120
|
+
if (constant === undefined)
|
|
121
|
+
throw new Error(`data/units.json: note for '${spelling}' names '${name}', which is not a registered constant`);
|
|
122
|
+
return String(constant.value);
|
|
123
|
+
});
|
|
124
|
+
spellingNotes.set(spelling, filled);
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
units,
|
|
128
|
+
prefixes,
|
|
129
|
+
refused,
|
|
130
|
+
prefixLetterUnits: new Set(file.prefixLetterUnits.letters),
|
|
131
|
+
iceKelvin: read(file.affine.iceKelvin, 'affine iceKelvin'),
|
|
132
|
+
affine,
|
|
133
|
+
spellingNotes,
|
|
134
|
+
sha256: createHash('sha256').update(text.replace(/\r\n/g, '\n')).digest('hex'),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/** The unit table, read once from `data/units.json`. @internal */
|
|
138
|
+
export const UNIT_DATA = readUnitFile(dataText('units.json'), dataSchema('units.json'));
|
|
139
|
+
//# sourceMappingURL=unit-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit-data.js","sourceRoot":"","sources":["../../src/dimensional/unit-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,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,IAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE,CAAC,CAAC,EAAE,IAAY,EAAE,EAAE;YAC/E,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,QAAQ,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,YAAY,IAAI,uCAAuC,CAAC,CAAC;YAC3I,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IACD,OAAO;QACL,KAAK;QACL,QAAQ;QACR,OAAO;QACP,iBAAiB,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;QAC1D,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC;QAC1D,MAAM;QACN,aAAa;QACb,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;KAC/E,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,MAAM,CAAC,MAAM,SAAS,GAAkB,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC","sourcesContent":["/**\n * The unit table, loaded from `data/units.json` and validated once.\n *\n * The file is checked against `data/units.schema.json` when this module\n * loads (`core/data-file`), then against the rules a schema cannot state:\n * every scale expression reads, a symbol is spelled by one row, a refused\n * spelling and an affine spelling are not also a unit, every prefix letter is\n * both a prefix and a unit, and every `{NAME}` in a note is a constant. A\n * file that breaks one throws here, so `units.ts` never reads a half-valid table.\n *\n * A scale is an exact expression, read by `exact-scale.ts`. A name in it is a\n * shared scale from the file's `scales`, `pi`, or a constant under its registry\n * spelling (`c`, `e`, `m_u`, `M_sun`, `Msun_iau`, `ln2`; `constant-rows.ts`),\n * the same spelling a `{NAME}` note placeholder uses. A constant is read through\n * its shortest decimal (`scaleOf`), or as the irrational factor when its row is\n * `irrational`. A shared scale may not reuse a constant's spelling, so a name\n * has one meaning. The raw rows are strings and integer exponents, so another\n * exact reader (MathTS) replaces this loader without touching the file.\n *\n * @module dimensional/unit-data\n */\n\nimport { createHash } from 'node:crypto';\nimport { dataSchema, dataText, parseDataFile } from '../core/data-file.js';\nimport type { JsonSchema } from '../core/json-schema.js';\nimport { constantRow } from './constant-rows.js';\nimport type { Dimension } from './types.js';\nimport { decimalScale, irrationalScale, readScaleExpression, scaleOf, type ExactScale } from './exact-scale.js';\n\ntype DimensionFile = Partial<Record<keyof Dimension, number>>;\n\ninterface UnitFileRow {\n readonly symbols: readonly string[];\n readonly scale: string;\n readonly dimension: DimensionFile;\n readonly prefixable: boolean;\n readonly cycles?: true;\n}\n\ninterface AffineFileRow {\n readonly id: string;\n readonly scale: string;\n readonly icePoint: string;\n readonly symbols: readonly string[];\n}\n\ninterface UnitFile {\n readonly scales: Readonly<Record<string, string>>;\n readonly prefixes: Readonly<Record<string, string>>;\n readonly units: readonly UnitFileRow[];\n readonly refused: readonly { readonly symbol: string; readonly reason: string }[];\n readonly prefixLetterUnits: { readonly letters: readonly string[] };\n readonly affine: { readonly iceKelvin: string; readonly scales: readonly AffineFileRow[] };\n readonly spellingNotes: readonly { readonly spelling: string; readonly note: string }[];\n}\n\n/** One unit symbol, read exactly. @internal */\nexport interface UnitRow {\n /** Exact scale to SI base units. */\n readonly scale: ExactScale;\n readonly dim: Dimension;\n /** Takes an SI prefix. */\n readonly prefixable: boolean;\n /**\n * The unit counts cycles (turns), not radians. An angular-frequency input in\n * rad/s takes 2π per cycle; the radian itself does not.\n */\n readonly cycles?: true;\n}\n\n/** One affine temperature scale, read exactly. @internal */\nexport interface AffineRow {\n readonly id: string;\n /** Kelvin per degree, exactly. */\n readonly scale: ExactScale;\n /** The reading at the ice point (0 °C, 273.15 K), exactly. */\n readonly icePoint: ExactScale;\n readonly symbols: readonly string[];\n}\n\n/** The unit table `units.ts` reads. @internal */\nexport interface UnitTableData {\n readonly units: ReadonlyMap<string, UnitRow>;\n readonly prefixes: ReadonlyMap<string, ExactScale>;\n /** Refused spelling → the message it prints. */\n readonly refused: ReadonlyMap<string, string>;\n readonly prefixLetterUnits: ReadonlySet<string>;\n /** Kelvin at 0 °C, exactly. */\n readonly iceKelvin: ExactScale;\n readonly affine: readonly AffineRow[];\n /** Spelling → its note, with every `{NAME}` replaced by that constant. */\n readonly spellingNotes: ReadonlyMap<string, string>;\n /** SHA-256 of `data/units.json` with line endings as LF, for the CLI record fingerprint. */\n readonly sha256: string;\n}\n\n/** π, which the registry does not spell (a formula scope adds `pi` itself), as the irrational factor. */\nconst PI = 'pi';\nconst PI_SCALE = irrationalScale(Math.PI);\n\n/** The registered constant `name` spells, exactly: its irrational factor or its shortest decimal; undefined when no constant has that spelling. */\nfunction constantScale(name: string): ExactScale | undefined {\n const constant = constantRow(name);\n if (constant === undefined) return undefined;\n return constant.irrational === true ? irrationalScale(constant.value) : scaleOf(constant.value);\n}\n\nfunction dimension(d: DimensionFile): Dimension {\n return {\n L: d.L ?? 0,\n M: d.M ?? 0,\n T: d.T ?? 0,\n I: d.I ?? 0,\n Theta: d.Theta ?? 0,\n N: d.N ?? 0,\n J: d.J ?? 0,\n };\n}\n\n/**\n * Validate and read `text`, the contents of `data/units.json`, against `schema`.\n * Throws on a file the schema or the table rules reject. A test passes a broken copy.\n * @internal\n */\nexport function readUnitFile(text: string, schema: JsonSchema): UnitTableData {\n const file = parseDataFile('units.json', text, schema) as UnitFile;\n for (const name of Object.keys(file.scales)) {\n if (name === PI || constantRow(name) !== undefined) {\n throw new Error(`data/units.json: shared scale '${name}' is also ${name === PI ? 'π' : 'a registered constant'}; a name has one meaning`);\n }\n }\n\n const named = new Map<string, ExactScale>();\n const reading = new Set<string>();\n const resolve = (name: string): ExactScale | undefined => {\n if (name === PI) return PI_SCALE;\n const shared = file.scales[name];\n if (shared !== undefined) {\n const done = named.get(name);\n if (done !== undefined) return done;\n if (reading.has(name)) throw new Error(`data/units.json: scale '${name}' is defined in terms of itself`);\n reading.add(name);\n const scale = readScaleExpression(shared, resolve);\n reading.delete(name);\n named.set(name, scale);\n return scale;\n }\n return constantScale(name);\n };\n const read = (text: string, where: string): ExactScale => {\n try {\n return readScaleExpression(text, resolve);\n } catch (error) {\n throw new Error(`data/units.json ${where}: ${(error as Error).message}`);\n }\n };\n\n const prefixes = new Map(Object.entries(file.prefixes).map(([prefix, text]) => [prefix, decimalScale(text)!] as const));\n const units = new Map<string, UnitRow>();\n for (const row of file.units) {\n const scale = read(row.scale, `unit ${row.symbols[0]}`);\n const unit: UnitRow = { scale, dim: dimension(row.dimension), prefixable: row.prefixable, ...(row.cycles ? { cycles: true as const } : {}) };\n for (const symbol of row.symbols) {\n if (units.has(symbol)) throw new Error(`data/units.json: unit '${symbol}' is spelled by two rows`);\n units.set(symbol, unit);\n }\n }\n const refused = new Map<string, string>();\n for (const { symbol, reason } of file.refused) {\n if (units.has(symbol) || refused.has(symbol)) throw new Error(`data/units.json: refused '${symbol}' is also a unit or refused twice`);\n refused.set(symbol, reason);\n }\n for (const letter of file.prefixLetterUnits.letters) {\n if (!prefixes.has(letter) || !units.has(letter)) {\n throw new Error(`data/units.json: prefix letter '${letter}' is not both a prefix and a unit`);\n }\n }\n const affine = file.affine.scales.map((row) => {\n for (const symbol of row.symbols) {\n if (units.has(symbol) || refused.has(symbol)) throw new Error(`data/units.json: affine '${symbol}' is also a unit or refused`);\n }\n return { id: row.id, scale: read(row.scale, `affine ${row.id}`), icePoint: read(row.icePoint, `affine ${row.id}`), symbols: row.symbols };\n });\n const spellingNotes = new Map<string, string>();\n for (const { spelling, note } of file.spellingNotes) {\n const filled = note.replace(/\\{([A-Za-z_][A-Za-z0-9_]*)\\}/g, (_, name: string) => {\n const constant = constantRow(name);\n if (constant === undefined) throw new Error(`data/units.json: note for '${spelling}' names '${name}', which is not a registered constant`);\n return String(constant.value);\n });\n spellingNotes.set(spelling, filled);\n }\n return {\n units,\n prefixes,\n refused,\n prefixLetterUnits: new Set(file.prefixLetterUnits.letters),\n iceKelvin: read(file.affine.iceKelvin, 'affine iceKelvin'),\n affine,\n spellingNotes,\n sha256: createHash('sha256').update(text.replace(/\\r\\n/g, '\\n')).digest('hex'),\n };\n}\n\n/** The unit table, read once from `data/units.json`. @internal */\nexport const UNIT_DATA: UnitTableData = readUnitFile(dataText('units.json'), dataSchema('units.json'));\n"]}
|
|
@@ -1,58 +1,121 @@
|
|
|
1
1
|
import type { Dimension } from './types.js';
|
|
2
|
+
import { type ExactScale } from './exact-scale.js';
|
|
3
|
+
/** An affine temperature scale: a lone `degC` or `degF`. @public */
|
|
4
|
+
export type AffineTemperature = 'celsius' | 'fahrenheit';
|
|
2
5
|
/** A unit, as a scale to SI base units and a dimension. @public */
|
|
3
6
|
export interface ParsedUnit {
|
|
4
7
|
readonly scale: number;
|
|
5
8
|
readonly dim: Dimension;
|
|
6
9
|
/** Set only for a lone affine temperature, which needs a reading. */
|
|
7
|
-
readonly affine?:
|
|
10
|
+
readonly affine?: AffineTemperature;
|
|
8
11
|
}
|
|
9
12
|
/** Thrown for any input that does not parse as a value with a known unit. @public */
|
|
10
13
|
export declare class UnitError extends Error {
|
|
11
14
|
constructor(message: string);
|
|
12
15
|
}
|
|
16
|
+
/** A symbol no table row and no prefix spells. @public */
|
|
17
|
+
export declare class UnknownUnitError extends UnitError {
|
|
18
|
+
readonly symbol: string;
|
|
19
|
+
constructor(symbol: string);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A unit the reader recognizes and refuses: a logarithmic or ratio unit, an
|
|
23
|
+
* ambiguous name such as `ton`, or an affine temperature inside a compound.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare class UnitRefusedError extends UnitError {
|
|
27
|
+
constructor(message: string);
|
|
28
|
+
}
|
|
29
|
+
/** A unit expression with more than one dimensionally distinct reading. @public */
|
|
30
|
+
export declare class AmbiguousUnitError extends UnitError {
|
|
31
|
+
readonly text: string;
|
|
32
|
+
readonly readings: readonly string[];
|
|
33
|
+
constructor(text: string, readings: readonly string[]);
|
|
34
|
+
}
|
|
13
35
|
/**
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
36
|
+
* How a reading on an affine scale becomes kelvin, from the row's scale and
|
|
37
|
+
* ice point: `absolute: (degF − 32) × 5/9 + 273.15`, `a difference: × 5/9, no offset`.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export declare function affineReadingNote(affine: AffineTemperature, reading: TemperatureReading): string;
|
|
41
|
+
/** One reading of a unit expression, with its exact scale. @internal */
|
|
42
|
+
export interface UnitReading extends ParsedUnit {
|
|
43
|
+
readonly label: string;
|
|
44
|
+
readonly exact: ExactScale;
|
|
45
|
+
/** Net power of cycle-counting units (Hz, rpm): 1 for a lone `kHz`, 0 for `1/s`. */
|
|
46
|
+
readonly cycles: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Spellings that convert correctly and still mean something else to a reader:
|
|
50
|
+
* the `spellingNotes` of `data/units.json` for each symbol in `given`, in file
|
|
51
|
+
* order. `myr` is a milliyear, bare `G` is the gauss, bare `A` the ampere.
|
|
17
52
|
* @internal
|
|
18
53
|
*/
|
|
19
54
|
export declare function unitConventionNotes(given: string): string[];
|
|
55
|
+
/** The one reading of a unit expression; more than one is refused. @internal */
|
|
56
|
+
export declare function readUnit(text: string): UnitReading;
|
|
20
57
|
/** Parse a unit expression; the empty string is dimensionless. @public */
|
|
21
58
|
export declare function parseUnit(text: string): ParsedUnit;
|
|
22
59
|
/** How a temperature value is read: as a point on the scale, or as a difference. @public */
|
|
23
60
|
export type TemperatureReading = 'absolute' | 'difference';
|
|
24
|
-
/**
|
|
25
|
-
export
|
|
61
|
+
/** A number with a unit, read exactly and rounded once. @internal */
|
|
62
|
+
export interface QuantityLiteral {
|
|
63
|
+
/** SI value; a bare number is unchanged. */
|
|
64
|
+
readonly value: number;
|
|
65
|
+
readonly dim: Dimension;
|
|
66
|
+
/** The unit text as given; `''` for a bare number. */
|
|
67
|
+
readonly unit: string;
|
|
68
|
+
readonly cycles: number;
|
|
69
|
+
readonly affine?: AffineTemperature;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Read `raw` as one number with an optional unit, in SI. Null when `raw` is
|
|
73
|
+
* not that form or names a unit no row spells, so the caller can read it as
|
|
74
|
+
* an expression. A refused unit and an ambiguous one throw. The value may be
|
|
75
|
+
* non-finite (`1e999`); the caller owns that refusal and its error class.
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
export declare function readQuantityLiteral(raw: string, temperature?: TemperatureReading): QuantityLiteral | null;
|
|
79
|
+
/** A value converted into a declared unit. @public */
|
|
80
|
+
export interface ConvertedValue {
|
|
81
|
+
readonly value: number;
|
|
82
|
+
/** The unit the user gave; `''` for a bare number. */
|
|
83
|
+
readonly given: string;
|
|
84
|
+
/** Net power of cycle-counting units in `given` (1 for `Hz` or `rpm`); absent when 0. */
|
|
85
|
+
readonly cycles?: number;
|
|
86
|
+
/** Set when `given` is a lone affine temperature. */
|
|
87
|
+
readonly affine?: AffineTemperature;
|
|
88
|
+
}
|
|
26
89
|
/**
|
|
27
90
|
* Convert `raw` (`<number>[unit]`) into `target` (a unit expression). A bare
|
|
28
91
|
* number is taken to be in `target` already. The dimensions must agree.
|
|
29
92
|
*
|
|
93
|
+
* The magnitude, the unit scales and the target scale are multiplied as
|
|
94
|
+
* exact rationals and rounded once, so `1 g/cm^3` in `kg/m^3` is 1000.
|
|
95
|
+
*
|
|
30
96
|
* @returns the value in `target`, and the unit the user gave (`''` for none).
|
|
31
97
|
* @public
|
|
32
98
|
*/
|
|
33
|
-
export declare function convertValue(raw: string, target: string,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
99
|
+
export declare function convertValue(raw: string, target: string, temperature?: TemperatureReading): ConvertedValue;
|
|
100
|
+
/** The dimension of a declared unit expression. @internal */
|
|
101
|
+
export declare function unitDimension(unit: string): Dimension;
|
|
102
|
+
/** The symbols the unit table spells, with their exact scales, for the agreement test against MathTS. @internal */
|
|
103
|
+
export declare function unitRows(): ReadonlyMap<string, {
|
|
104
|
+
readonly scale: ExactScale;
|
|
105
|
+
readonly dim: Dimension;
|
|
106
|
+
readonly prefixable: boolean;
|
|
107
|
+
}>;
|
|
37
108
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* undefined so the caller keeps the local table.
|
|
43
|
-
*
|
|
109
|
+
* The tables conversion reads, for the CLI record's fingerprint (`src/cli/record-tables.ts`):
|
|
110
|
+
* each row's scale, dimension, prefixability and `cycles` flag (which multiplies an angular
|
|
111
|
+
* input by 2π), the prefixes, the Celsius offset, and the SHA-256 of `data/units.json`, so a
|
|
112
|
+
* refused spelling, a prefix letter, an affine row or a note that changes changes the fingerprint too.
|
|
44
113
|
* @internal
|
|
45
114
|
*/
|
|
46
|
-
export declare function mathTsAgreedQuantity(magnitude: number, unitText: string, local: ParsedUnit): {
|
|
47
|
-
value: number;
|
|
48
|
-
dim: Dimension;
|
|
49
|
-
} | undefined;
|
|
50
|
-
/** The dimension of a declared unit expression. @internal */
|
|
51
|
-
export declare function unitDimension(unit: string): Dimension;
|
|
52
|
-
/** The tables conversion reads, for the CLI record's fingerprint (`src/cli/record-tables.ts`). @internal */
|
|
53
115
|
export declare function unitTables(): {
|
|
54
|
-
units: ReadonlyMap<string, readonly [number, Dimension, boolean]>;
|
|
116
|
+
units: ReadonlyMap<string, readonly [number, Dimension, boolean, boolean]>;
|
|
55
117
|
prefixes: ReadonlyMap<string, number>;
|
|
56
118
|
celsiusOffsetK: number;
|
|
119
|
+
sourceSha256: string;
|
|
57
120
|
};
|
|
58
121
|
//# sourceMappingURL=units.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/dimensional/units.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/dimensional/units.ts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAUL,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAG1B,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,YAAY,CAAC;AAEzD,mEAAmE;AACnE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC;CACrC;AAED,qFAAqF;AACrF,qBAAa,SAAU,SAAQ,KAAK;IAClC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,0DAA0D;AAC1D,qBAAa,gBAAiB,SAAQ,SAAS;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAnC,YAAqB,MAAM,EAAE,MAAM,EAGlC;CACF;AAED;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,mFAAmF;AACnF,qBAAa,kBAAmB,SAAQ,SAAS;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE;IAAvE,YAAqB,IAAI,EAAE,MAAM,EAAW,QAAQ,EAAE,SAAS,MAAM,EAAE,EAGtE;CACF;AAuCD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAQhG;AAqJD,wEA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