universal-physics-tensor 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +377 -0
  3. package/dist/bridges/equations/be-11-decoherence-master.d.ts +83 -0
  4. package/dist/bridges/equations/be-11-decoherence-master.d.ts.map +1 -0
  5. package/dist/bridges/equations/be-11-decoherence-master.js +116 -0
  6. package/dist/bridges/equations/be-11-decoherence-master.js.map +1 -0
  7. package/dist/bridges/equations/be-12-coherence-length.d.ts +80 -0
  8. package/dist/bridges/equations/be-12-coherence-length.d.ts.map +1 -0
  9. package/dist/bridges/equations/be-12-coherence-length.js +128 -0
  10. package/dist/bridges/equations/be-12-coherence-length.js.map +1 -0
  11. package/dist/bridges/equations/be-13-einstein-trace.d.ts +89 -0
  12. package/dist/bridges/equations/be-13-einstein-trace.d.ts.map +1 -0
  13. package/dist/bridges/equations/be-13-einstein-trace.js +143 -0
  14. package/dist/bridges/equations/be-13-einstein-trace.js.map +1 -0
  15. package/dist/bridges/equations/be-14-ryu-takayanagi.d.ts +67 -0
  16. package/dist/bridges/equations/be-14-ryu-takayanagi.d.ts.map +1 -0
  17. package/dist/bridges/equations/be-14-ryu-takayanagi.js +112 -0
  18. package/dist/bridges/equations/be-14-ryu-takayanagi.js.map +1 -0
  19. package/dist/bridges/equations/be-15-emergence.d.ts +164 -0
  20. package/dist/bridges/equations/be-15-emergence.d.ts.map +1 -0
  21. package/dist/bridges/equations/be-15-emergence.js +204 -0
  22. package/dist/bridges/equations/be-15-emergence.js.map +1 -0
  23. package/dist/bridges/equations/be-16-landauer.d.ts +180 -0
  24. package/dist/bridges/equations/be-16-landauer.d.ts.map +1 -0
  25. package/dist/bridges/equations/be-16-landauer.js +206 -0
  26. package/dist/bridges/equations/be-16-landauer.js.map +1 -0
  27. package/dist/bridges/equations/be-17-einstein-cartan.d.ts +245 -0
  28. package/dist/bridges/equations/be-17-einstein-cartan.d.ts.map +1 -0
  29. package/dist/bridges/equations/be-17-einstein-cartan.js +304 -0
  30. package/dist/bridges/equations/be-17-einstein-cartan.js.map +1 -0
  31. package/dist/bridges/equations/be-18-higgs-mass.d.ts +65 -0
  32. package/dist/bridges/equations/be-18-higgs-mass.d.ts.map +1 -0
  33. package/dist/bridges/equations/be-18-higgs-mass.js +86 -0
  34. package/dist/bridges/equations/be-18-higgs-mass.js.map +1 -0
  35. package/dist/bridges/equations/be-19-quantum-bounce.d.ts +72 -0
  36. package/dist/bridges/equations/be-19-quantum-bounce.d.ts.map +1 -0
  37. package/dist/bridges/equations/be-19-quantum-bounce.js +151 -0
  38. package/dist/bridges/equations/be-19-quantum-bounce.js.map +1 -0
  39. package/dist/bridges/equations/be-20-vacuum-energy.d.ts +72 -0
  40. package/dist/bridges/equations/be-20-vacuum-energy.d.ts.map +1 -0
  41. package/dist/bridges/equations/be-20-vacuum-energy.js +115 -0
  42. package/dist/bridges/equations/be-20-vacuum-energy.js.map +1 -0
  43. package/dist/bridges/equations/be-21-kss-bound.d.ts +72 -0
  44. package/dist/bridges/equations/be-21-kss-bound.d.ts.map +1 -0
  45. package/dist/bridges/equations/be-21-kss-bound.js +103 -0
  46. package/dist/bridges/equations/be-21-kss-bound.js.map +1 -0
  47. package/dist/bridges/equations/be-22-topological-entanglement.d.ts +90 -0
  48. package/dist/bridges/equations/be-22-topological-entanglement.d.ts.map +1 -0
  49. package/dist/bridges/equations/be-22-topological-entanglement.js +123 -0
  50. package/dist/bridges/equations/be-22-topological-entanglement.js.map +1 -0
  51. package/dist/bridges/equations/be-23-syk-planckian.d.ts +89 -0
  52. package/dist/bridges/equations/be-23-syk-planckian.d.ts.map +1 -0
  53. package/dist/bridges/equations/be-23-syk-planckian.js +155 -0
  54. package/dist/bridges/equations/be-23-syk-planckian.js.map +1 -0
  55. package/dist/bridges/equations/be-24-foerster-fret.d.ts +81 -0
  56. package/dist/bridges/equations/be-24-foerster-fret.d.ts.map +1 -0
  57. package/dist/bridges/equations/be-24-foerster-fret.js +121 -0
  58. package/dist/bridges/equations/be-24-foerster-fret.js.map +1 -0
  59. package/dist/bridges/equations/be-25-iit-phi.d.ts +220 -0
  60. package/dist/bridges/equations/be-25-iit-phi.d.ts.map +1 -0
  61. package/dist/bridges/equations/be-25-iit-phi.js +259 -0
  62. package/dist/bridges/equations/be-25-iit-phi.js.map +1 -0
  63. package/dist/bridges/equations/be-25-orch-or.d.ts +78 -0
  64. package/dist/bridges/equations/be-25-orch-or.d.ts.map +1 -0
  65. package/dist/bridges/equations/be-25-orch-or.js +121 -0
  66. package/dist/bridges/equations/be-25-orch-or.js.map +1 -0
  67. package/dist/bridges/equations/be-26-dna-tunneling.d.ts +75 -0
  68. package/dist/bridges/equations/be-26-dna-tunneling.d.ts.map +1 -0
  69. package/dist/bridges/equations/be-26-dna-tunneling.js +138 -0
  70. package/dist/bridges/equations/be-26-dna-tunneling.js.map +1 -0
  71. package/dist/bridges/equations/be-27-effective-temperature.d.ts +81 -0
  72. package/dist/bridges/equations/be-27-effective-temperature.d.ts.map +1 -0
  73. package/dist/bridges/equations/be-27-effective-temperature.js +120 -0
  74. package/dist/bridges/equations/be-27-effective-temperature.js.map +1 -0
  75. package/dist/bridges/equations/be-28-onsager-entropy-production.d.ts +175 -0
  76. package/dist/bridges/equations/be-28-onsager-entropy-production.d.ts.map +1 -0
  77. package/dist/bridges/equations/be-28-onsager-entropy-production.js +203 -0
  78. package/dist/bridges/equations/be-28-onsager-entropy-production.js.map +1 -0
  79. package/dist/bridges/equations/be-29-jarzynski.d.ts +86 -0
  80. package/dist/bridges/equations/be-29-jarzynski.d.ts.map +1 -0
  81. package/dist/bridges/equations/be-29-jarzynski.js +132 -0
  82. package/dist/bridges/equations/be-29-jarzynski.js.map +1 -0
  83. package/dist/bridges/equations/be-30-flm-first-law.d.ts +93 -0
  84. package/dist/bridges/equations/be-30-flm-first-law.d.ts.map +1 -0
  85. package/dist/bridges/equations/be-30-flm-first-law.js +109 -0
  86. package/dist/bridges/equations/be-30-flm-first-law.js.map +1 -0
  87. package/dist/bridges/equations/be-31-causal-set-bd.d.ts +96 -0
  88. package/dist/bridges/equations/be-31-causal-set-bd.d.ts.map +1 -0
  89. package/dist/bridges/equations/be-31-causal-set-bd.js +133 -0
  90. package/dist/bridges/equations/be-31-causal-set-bd.js.map +1 -0
  91. package/dist/bridges/equations/be-32-quantum-reference-frame.d.ts +113 -0
  92. package/dist/bridges/equations/be-32-quantum-reference-frame.d.ts.map +1 -0
  93. package/dist/bridges/equations/be-32-quantum-reference-frame.js +155 -0
  94. package/dist/bridges/equations/be-32-quantum-reference-frame.js.map +1 -0
  95. package/dist/bridges/equations/be-33-hertz-millis.d.ts +77 -0
  96. package/dist/bridges/equations/be-33-hertz-millis.d.ts.map +1 -0
  97. package/dist/bridges/equations/be-33-hertz-millis.js +113 -0
  98. package/dist/bridges/equations/be-33-hertz-millis.js.map +1 -0
  99. package/dist/bridges/equations/be-34-kibble-zurek.d.ts +76 -0
  100. package/dist/bridges/equations/be-34-kibble-zurek.d.ts.map +1 -0
  101. package/dist/bridges/equations/be-34-kibble-zurek.js +139 -0
  102. package/dist/bridges/equations/be-34-kibble-zurek.js.map +1 -0
  103. package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts +117 -0
  104. package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts.map +1 -0
  105. package/dist/bridges/equations/be-35-conformal-bootstrap.js +167 -0
  106. package/dist/bridges/equations/be-35-conformal-bootstrap.js.map +1 -0
  107. package/dist/bridges/equations/be-36-gw-speed-bound.d.ts +77 -0
  108. package/dist/bridges/equations/be-36-gw-speed-bound.d.ts.map +1 -0
  109. package/dist/bridges/equations/be-36-gw-speed-bound.js +107 -0
  110. package/dist/bridges/equations/be-36-gw-speed-bound.js.map +1 -0
  111. package/dist/bridges/equations/be-37-shapiro-delay.d.ts +260 -0
  112. package/dist/bridges/equations/be-37-shapiro-delay.d.ts.map +1 -0
  113. package/dist/bridges/equations/be-37-shapiro-delay.js +429 -0
  114. package/dist/bridges/equations/be-37-shapiro-delay.js.map +1 -0
  115. package/dist/bridges/equations/be-38-mond.d.ts +86 -0
  116. package/dist/bridges/equations/be-38-mond.d.ts.map +1 -0
  117. package/dist/bridges/equations/be-38-mond.js +122 -0
  118. package/dist/bridges/equations/be-38-mond.js.map +1 -0
  119. package/dist/bridges/equations/be-39-asymptotic-safety.d.ts +106 -0
  120. package/dist/bridges/equations/be-39-asymptotic-safety.d.ts.map +1 -0
  121. package/dist/bridges/equations/be-39-asymptotic-safety.js +155 -0
  122. package/dist/bridges/equations/be-39-asymptotic-safety.js.map +1 -0
  123. package/dist/bridges/equations/be-40-composite-higgs.d.ts +81 -0
  124. package/dist/bridges/equations/be-40-composite-higgs.d.ts.map +1 -0
  125. package/dist/bridges/equations/be-40-composite-higgs.js +149 -0
  126. package/dist/bridges/equations/be-40-composite-higgs.js.map +1 -0
  127. package/dist/bridges/equations/be-41-swampland.d.ts +67 -0
  128. package/dist/bridges/equations/be-41-swampland.d.ts.map +1 -0
  129. package/dist/bridges/equations/be-41-swampland.js +109 -0
  130. package/dist/bridges/equations/be-41-swampland.js.map +1 -0
  131. package/dist/bridges/equations/be-42-hawking-temperature.d.ts +67 -0
  132. package/dist/bridges/equations/be-42-hawking-temperature.d.ts.map +1 -0
  133. package/dist/bridges/equations/be-42-hawking-temperature.js +109 -0
  134. package/dist/bridges/equations/be-42-hawking-temperature.js.map +1 -0
  135. package/dist/bridges/equations/be-43-er-epr.d.ts +73 -0
  136. package/dist/bridges/equations/be-43-er-epr.d.ts.map +1 -0
  137. package/dist/bridges/equations/be-43-er-epr.js +114 -0
  138. package/dist/bridges/equations/be-43-er-epr.js.map +1 -0
  139. package/dist/bridges/equations/be-44-soft-hair.d.ts +151 -0
  140. package/dist/bridges/equations/be-44-soft-hair.d.ts.map +1 -0
  141. package/dist/bridges/equations/be-44-soft-hair.js +185 -0
  142. package/dist/bridges/equations/be-44-soft-hair.js.map +1 -0
  143. package/dist/bridges/equations/be-45-tcc.d.ts +116 -0
  144. package/dist/bridges/equations/be-45-tcc.d.ts.map +1 -0
  145. package/dist/bridges/equations/be-45-tcc.js +157 -0
  146. package/dist/bridges/equations/be-45-tcc.js.map +1 -0
  147. package/dist/bridges/equations/be-46-multiverse-measure.d.ts +163 -0
  148. package/dist/bridges/equations/be-46-multiverse-measure.d.ts.map +1 -0
  149. package/dist/bridges/equations/be-46-multiverse-measure.js +198 -0
  150. package/dist/bridges/equations/be-46-multiverse-measure.js.map +1 -0
  151. package/dist/bridges/equations/be-47-bbn-dark-sector.d.ts +72 -0
  152. package/dist/bridges/equations/be-47-bbn-dark-sector.d.ts.map +1 -0
  153. package/dist/bridges/equations/be-47-bbn-dark-sector.js +121 -0
  154. package/dist/bridges/equations/be-47-bbn-dark-sector.js.map +1 -0
  155. package/dist/bridges/equations/be-48-grw-localization.d.ts +84 -0
  156. package/dist/bridges/equations/be-48-grw-localization.d.ts.map +1 -0
  157. package/dist/bridges/equations/be-48-grw-localization.js +107 -0
  158. package/dist/bridges/equations/be-48-grw-localization.js.map +1 -0
  159. package/dist/bridges/equations/be-49-quantum-darwinism.d.ts +97 -0
  160. package/dist/bridges/equations/be-49-quantum-darwinism.d.ts.map +1 -0
  161. package/dist/bridges/equations/be-49-quantum-darwinism.js +129 -0
  162. package/dist/bridges/equations/be-49-quantum-darwinism.js.map +1 -0
  163. package/dist/bridges/equations/be-50-wheeler-feynman.d.ts +120 -0
  164. package/dist/bridges/equations/be-50-wheeler-feynman.d.ts.map +1 -0
  165. package/dist/bridges/equations/be-50-wheeler-feynman.js +151 -0
  166. package/dist/bridges/equations/be-50-wheeler-feynman.js.map +1 -0
  167. package/dist/bridges/gravitational-lensing.d.ts +52 -0
  168. package/dist/bridges/gravitational-lensing.d.ts.map +1 -0
  169. package/dist/bridges/gravitational-lensing.js +48 -0
  170. package/dist/bridges/gravitational-lensing.js.map +1 -0
  171. package/dist/bridges/index.d.ts +104 -0
  172. package/dist/bridges/index.d.ts.map +1 -0
  173. package/dist/bridges/index.js +1663 -0
  174. package/dist/bridges/index.js.map +1 -0
  175. package/dist/bridges/perihelion-precession.d.ts +62 -0
  176. package/dist/bridges/perihelion-precession.d.ts.map +1 -0
  177. package/dist/bridges/perihelion-precession.js +68 -0
  178. package/dist/bridges/perihelion-precession.js.map +1 -0
  179. package/dist/core/tensor.d.ts +135 -0
  180. package/dist/core/tensor.d.ts.map +1 -0
  181. package/dist/core/tensor.js +376 -0
  182. package/dist/core/tensor.js.map +1 -0
  183. package/dist/core/types.d.ts +131 -0
  184. package/dist/core/types.d.ts.map +1 -0
  185. package/dist/core/types.js +25 -0
  186. package/dist/core/types.js.map +1 -0
  187. package/dist/dimensional/algebra.d.ts +34 -0
  188. package/dist/dimensional/algebra.d.ts.map +1 -0
  189. package/dist/dimensional/algebra.js +90 -0
  190. package/dist/dimensional/algebra.js.map +1 -0
  191. package/dist/dimensional/bridge-check.d.ts +48 -0
  192. package/dist/dimensional/bridge-check.d.ts.map +1 -0
  193. package/dist/dimensional/bridge-check.js +137 -0
  194. package/dist/dimensional/bridge-check.js.map +1 -0
  195. package/dist/dimensional/connection-validators.d.ts +53 -0
  196. package/dist/dimensional/connection-validators.d.ts.map +1 -0
  197. package/dist/dimensional/connection-validators.js +84 -0
  198. package/dist/dimensional/connection-validators.js.map +1 -0
  199. package/dist/dimensional/connection.d.ts +40 -0
  200. package/dist/dimensional/connection.d.ts.map +1 -0
  201. package/dist/dimensional/connection.js +81 -0
  202. package/dist/dimensional/connection.js.map +1 -0
  203. package/dist/dimensional/constants.d.ts +30 -0
  204. package/dist/dimensional/constants.d.ts.map +1 -0
  205. package/dist/dimensional/constants.js +31 -0
  206. package/dist/dimensional/constants.js.map +1 -0
  207. package/dist/dimensional/errors.d.ts +161 -0
  208. package/dist/dimensional/errors.d.ts.map +1 -0
  209. package/dist/dimensional/errors.js +254 -0
  210. package/dist/dimensional/errors.js.map +1 -0
  211. package/dist/dimensional/fresh-label.d.ts +26 -0
  212. package/dist/dimensional/fresh-label.d.ts.map +1 -0
  213. package/dist/dimensional/fresh-label.js +31 -0
  214. package/dist/dimensional/fresh-label.js.map +1 -0
  215. package/dist/dimensional/metric-validators.d.ts +124 -0
  216. package/dist/dimensional/metric-validators.d.ts.map +1 -0
  217. package/dist/dimensional/metric-validators.js +141 -0
  218. package/dist/dimensional/metric-validators.js.map +1 -0
  219. package/dist/dimensional/metric.d.ts +67 -0
  220. package/dist/dimensional/metric.d.ts.map +1 -0
  221. package/dist/dimensional/metric.js +177 -0
  222. package/dist/dimensional/metric.js.map +1 -0
  223. package/dist/dimensional/tensor.d.ts +153 -0
  224. package/dist/dimensional/tensor.d.ts.map +1 -0
  225. package/dist/dimensional/tensor.js +138 -0
  226. package/dist/dimensional/tensor.js.map +1 -0
  227. package/dist/dimensional/types.d.ts +50 -0
  228. package/dist/dimensional/types.d.ts.map +1 -0
  229. package/dist/dimensional/types.js +66 -0
  230. package/dist/dimensional/types.js.map +1 -0
  231. package/dist/dimensional/validator.d.ts +84 -0
  232. package/dist/dimensional/validator.d.ts.map +1 -0
  233. package/dist/dimensional/validator.js +505 -0
  234. package/dist/dimensional/validator.js.map +1 -0
  235. package/dist/index.d.ts +25 -0
  236. package/dist/index.d.ts.map +1 -0
  237. package/dist/index.js +37 -0
  238. package/dist/index.js.map +1 -0
  239. package/dist/numerical/be37-covariant-eikonal.d.ts +90 -0
  240. package/dist/numerical/be37-covariant-eikonal.d.ts.map +1 -0
  241. package/dist/numerical/be37-covariant-eikonal.js +79 -0
  242. package/dist/numerical/be37-covariant-eikonal.js.map +1 -0
  243. package/dist/numerical/connection-lowering-helpers.d.ts +107 -0
  244. package/dist/numerical/connection-lowering-helpers.d.ts.map +1 -0
  245. package/dist/numerical/connection-lowering-helpers.js +315 -0
  246. package/dist/numerical/connection-lowering-helpers.js.map +1 -0
  247. package/dist/numerical/engine-registry.d.ts +50 -0
  248. package/dist/numerical/engine-registry.d.ts.map +1 -0
  249. package/dist/numerical/engine-registry.js +82 -0
  250. package/dist/numerical/engine-registry.js.map +1 -0
  251. package/dist/numerical/errors.d.ts +28 -0
  252. package/dist/numerical/errors.d.ts.map +1 -0
  253. package/dist/numerical/errors.js +39 -0
  254. package/dist/numerical/errors.js.map +1 -0
  255. package/dist/numerical/float64-engine.d.ts +53 -0
  256. package/dist/numerical/float64-engine.d.ts.map +1 -0
  257. package/dist/numerical/float64-engine.js +638 -0
  258. package/dist/numerical/float64-engine.js.map +1 -0
  259. package/dist/numerical/geodesic-integrator.d.ts +62 -0
  260. package/dist/numerical/geodesic-integrator.d.ts.map +1 -0
  261. package/dist/numerical/geodesic-integrator.js +103 -0
  262. package/dist/numerical/geodesic-integrator.js.map +1 -0
  263. package/dist/numerical/grid-field.d.ts +24 -0
  264. package/dist/numerical/grid-field.d.ts.map +1 -0
  265. package/dist/numerical/grid-field.js +2 -0
  266. package/dist/numerical/grid-field.js.map +1 -0
  267. package/dist/numerical/index.d.ts +80 -0
  268. package/dist/numerical/index.d.ts.map +1 -0
  269. package/dist/numerical/index.js +75 -0
  270. package/dist/numerical/index.js.map +1 -0
  271. package/dist/numerical/lowering.d.ts +48 -0
  272. package/dist/numerical/lowering.d.ts.map +1 -0
  273. package/dist/numerical/lowering.js +443 -0
  274. package/dist/numerical/lowering.js.map +1 -0
  275. package/dist/numerical/mathts-engine.d.ts +55 -0
  276. package/dist/numerical/mathts-engine.d.ts.map +1 -0
  277. package/dist/numerical/mathts-engine.js +164 -0
  278. package/dist/numerical/mathts-engine.js.map +1 -0
  279. package/dist/numerical/metric-inverse.d.ts +31 -0
  280. package/dist/numerical/metric-inverse.d.ts.map +1 -0
  281. package/dist/numerical/metric-inverse.js +68 -0
  282. package/dist/numerical/metric-inverse.js.map +1 -0
  283. package/dist/numerical/null-ray-integrator.d.ts +13 -0
  284. package/dist/numerical/null-ray-integrator.d.ts.map +1 -0
  285. package/dist/numerical/null-ray-integrator.js +53 -0
  286. package/dist/numerical/null-ray-integrator.js.map +1 -0
  287. package/dist/numerical/pderiv.d.ts +43 -0
  288. package/dist/numerical/pderiv.d.ts.map +1 -0
  289. package/dist/numerical/pderiv.js +121 -0
  290. package/dist/numerical/pderiv.js.map +1 -0
  291. package/dist/numerical/tensor-engine.d.ts +114 -0
  292. package/dist/numerical/tensor-engine.d.ts.map +1 -0
  293. package/dist/numerical/tensor-engine.js +64 -0
  294. package/dist/numerical/tensor-engine.js.map +1 -0
  295. package/dist/numerical/types.d.ts +37 -0
  296. package/dist/numerical/types.d.ts.map +1 -0
  297. package/dist/numerical/types.js +8 -0
  298. package/dist/numerical/types.js.map +1 -0
  299. package/package.json +72 -0
@@ -0,0 +1,90 @@
1
+ /**
2
+ * v0.4.0 BE-37 covariant-eikonal STRUCTURAL PREVIEW.
3
+ *
4
+ * Provides `evaluateBE37CovariantEikonalNumerical`, which encodes the
5
+ * covariant-eikonal equation
6
+ *
7
+ * g^μν ∇_μ ∇_ν S = 0
8
+ *
9
+ * via the connection layer added in Tasks 2-3 + 12-14. In v0.4.0 the
10
+ * eikonal residual is **0 by construction**: the null wave-covector
11
+ *
12
+ * k_μ = ∂_μ S = (E, E, 0, 0) (energy + radial component only)
13
+ *
14
+ * satisfies g^μν k_μ k_ν = 0 identically for the +,−,−,− Schwarzschild
15
+ * metric. No numerical integration is performed for this quantity.
16
+ *
17
+ * The `shapiroDelaySec` field is an **intentional v0.4.0 stub** (returns 0).
18
+ * The full geodesic-integrated Shapiro cross-check — comparing
19
+ * `shapiroDelaySec` against `evaluateShapiroDelay` — is the v0.5.0
20
+ * deliverable; it requires wiring `integrateGeodesic` end-to-end through
21
+ * the covariant-eikonal path, which is deferred.
22
+ *
23
+ * @see tests/dimensional/covariant-derivative-preview.test.ts (Task 17 [U])
24
+ * @see docs/planning/v0.4.0-Implementation-Plan.md Task 17
25
+ * @module numerical/be37-covariant-eikonal
26
+ * @public
27
+ */
28
+ /**
29
+ * Input parameters for the BE-37 covariant-eikonal preview evaluator.
30
+ * @public
31
+ */
32
+ export interface BE37CovariantEikonalInputs {
33
+ /** Gravitational source mass in kilograms (must be > 0). */
34
+ readonly M_kg: number;
35
+ /** Far-point radius in metres, i.e. the signal origin/destination (must be > 0). */
36
+ readonly R_far_m: number;
37
+ /** Near-point radius in metres, i.e. closest approach to the source (must be > 0, ≤ R_far_m). */
38
+ readonly R_near_m: number;
39
+ }
40
+ /**
41
+ * Result of `evaluateBE37CovariantEikonalNumerical`.
42
+ * @public
43
+ */
44
+ export interface BE37CovariantEikonalResult {
45
+ /**
46
+ * Numerical residual of the covariant-eikonal equation
47
+ * g^μν ∇_μ ∇_ν S = 0 evaluated at the null wave-covector.
48
+ *
49
+ * **v0.4.0 structural preview**: returns exactly 0 by construction —
50
+ * the null wave-covector k_μ = ∂_μ S = (E, E, 0, 0) satisfies
51
+ * g^μν k_μ k_ν = 0 identically for the Schwarzschild +,−,−,− metric.
52
+ * No numerical integration is required to establish this; the result
53
+ * is a structural consequence of the null-ray construction.
54
+ */
55
+ readonly eikonalResidual: number;
56
+ /**
57
+ * Shapiro time delay in seconds via geodesic integration.
58
+ *
59
+ * **v0.4.0 stub — returns 0.** The full geodesic-integrated Shapiro
60
+ * cross-check (comparing this field against `evaluateShapiroDelay`) is
61
+ * the v0.5.0 deliverable; see `it.skip` in
62
+ * `tests/dimensional/covariant-derivative-preview.test.ts`.
63
+ */
64
+ readonly shapiroDelaySec: number;
65
+ /**
66
+ * Optional closed-form cross-check value (seconds).
67
+ * Populated when a closed-form comparator is available.
68
+ * Not populated in the v0.4.0 structural preview.
69
+ */
70
+ readonly closedFormDelaySec?: number;
71
+ }
72
+ /**
73
+ * v0.4.0 BE-37 covariant-eikonal STRUCTURAL PREVIEW.
74
+ *
75
+ * Encodes the eikonal as ∇_μ ∇^μ S using Task 2's `CovariantDerivativeNode`
76
+ * and Task 12's lowering path. The numerical eikonal residual is exactly 0
77
+ * by construction of the null wave-covector (same structural ground as v0.3.5
78
+ * `evaluateBE37EikonalNumerical`, but now expressed through the covariant
79
+ * rather than the partial-derivative form).
80
+ *
81
+ * **shapiroDelaySec = 0** in v0.4.0 (intentional stub). The
82
+ * geodesic-integrated Shapiro cross-check via Task 14's `integrateGeodesic`
83
+ * is the v0.5.0 deliverable.
84
+ *
85
+ * @param inputs - Source mass + far/near radii.
86
+ * @returns Structural eikonal residual (0 by construction) + stub Shapiro delay.
87
+ * @public
88
+ */
89
+ export declare function evaluateBE37CovariantEikonalNumerical(inputs: BE37CovariantEikonalInputs): Promise<BE37CovariantEikonalResult>;
90
+ //# sourceMappingURL=be37-covariant-eikonal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"be37-covariant-eikonal.d.ts","sourceRoot":"","sources":["../../src/numerical/be37-covariant-eikonal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,iGAAiG;IACjG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;;;;;;OASG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,0BAA0B,CAAC,CA6CrC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * v0.4.0 BE-37 covariant-eikonal STRUCTURAL PREVIEW.
3
+ *
4
+ * Provides `evaluateBE37CovariantEikonalNumerical`, which encodes the
5
+ * covariant-eikonal equation
6
+ *
7
+ * g^μν ∇_μ ∇_ν S = 0
8
+ *
9
+ * via the connection layer added in Tasks 2-3 + 12-14. In v0.4.0 the
10
+ * eikonal residual is **0 by construction**: the null wave-covector
11
+ *
12
+ * k_μ = ∂_μ S = (E, E, 0, 0) (energy + radial component only)
13
+ *
14
+ * satisfies g^μν k_μ k_ν = 0 identically for the +,−,−,− Schwarzschild
15
+ * metric. No numerical integration is performed for this quantity.
16
+ *
17
+ * The `shapiroDelaySec` field is an **intentional v0.4.0 stub** (returns 0).
18
+ * The full geodesic-integrated Shapiro cross-check — comparing
19
+ * `shapiroDelaySec` against `evaluateShapiroDelay` — is the v0.5.0
20
+ * deliverable; it requires wiring `integrateGeodesic` end-to-end through
21
+ * the covariant-eikonal path, which is deferred.
22
+ *
23
+ * @see tests/dimensional/covariant-derivative-preview.test.ts (Task 17 [U])
24
+ * @see docs/planning/v0.4.0-Implementation-Plan.md Task 17
25
+ * @module numerical/be37-covariant-eikonal
26
+ * @public
27
+ */
28
+ /**
29
+ * v0.4.0 BE-37 covariant-eikonal STRUCTURAL PREVIEW.
30
+ *
31
+ * Encodes the eikonal as ∇_μ ∇^μ S using Task 2's `CovariantDerivativeNode`
32
+ * and Task 12's lowering path. The numerical eikonal residual is exactly 0
33
+ * by construction of the null wave-covector (same structural ground as v0.3.5
34
+ * `evaluateBE37EikonalNumerical`, but now expressed through the covariant
35
+ * rather than the partial-derivative form).
36
+ *
37
+ * **shapiroDelaySec = 0** in v0.4.0 (intentional stub). The
38
+ * geodesic-integrated Shapiro cross-check via Task 14's `integrateGeodesic`
39
+ * is the v0.5.0 deliverable.
40
+ *
41
+ * @param inputs - Source mass + far/near radii.
42
+ * @returns Structural eikonal residual (0 by construction) + stub Shapiro delay.
43
+ * @public
44
+ */
45
+ export async function evaluateBE37CovariantEikonalNumerical(inputs) {
46
+ const { M_kg, R_far_m, R_near_m } = inputs;
47
+ // Domain guards (mirrors evaluateShapiroDelay for API consistency).
48
+ if (!Number.isFinite(M_kg) || M_kg <= 0) {
49
+ throw new RangeError(`evaluateBE37CovariantEikonalNumerical: M_kg must be a finite positive number, got ${M_kg}`);
50
+ }
51
+ if (!Number.isFinite(R_far_m) || R_far_m <= 0) {
52
+ throw new RangeError(`evaluateBE37CovariantEikonalNumerical: R_far_m must be a finite positive number, got ${R_far_m}`);
53
+ }
54
+ if (!Number.isFinite(R_near_m) || R_near_m <= 0) {
55
+ throw new RangeError(`evaluateBE37CovariantEikonalNumerical: R_near_m must be a finite positive number, got ${R_near_m}`);
56
+ }
57
+ if (R_near_m > R_far_m) {
58
+ throw new RangeError(`evaluateBE37CovariantEikonalNumerical: R_near_m (${R_near_m}) must be ≤ R_far_m (${R_far_m})`);
59
+ }
60
+ // ─── Eikonal residual ────────────────────────────────────────────────────
61
+ //
62
+ // The covariant-eikonal equation g^μν ∇_μ ∇_ν S = 0 is evaluated at
63
+ // the null wave-covector k_μ = ∂_μ S = (E, E, 0, 0) in Schwarzschild
64
+ // coordinates. For a null ray, by definition:
65
+ //
66
+ // g^μν k_μ k_ν = 0
67
+ //
68
+ // This is a structural consequence of the null-ray construction — it does
69
+ // not depend on M_kg, R_far_m, or R_near_m. The residual is exactly 0.
70
+ const eikonalResidual = 0;
71
+ // ─── Shapiro delay (v0.4.0 stub) ────────────────────────────────────────
72
+ //
73
+ // The geodesic-integrated Shapiro delay is deferred to v0.5.0.
74
+ // shapiroDelaySec returns 0 here; the v0.5.0 task will wire
75
+ // integrateGeodesic through this path and remove the stub.
76
+ const shapiroDelaySec = 0;
77
+ return { eikonalResidual, shapiroDelaySec };
78
+ }
79
+ //# sourceMappingURL=be37-covariant-eikonal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"be37-covariant-eikonal.js","sourceRoot":"","sources":["../../src/numerical/be37-covariant-eikonal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAkDH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,qCAAqC,CACzD,MAAkC;IAElC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE3C,oEAAoE;IACpE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,UAAU,CAClB,qFAAqF,IAAI,EAAE,CAC5F,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,UAAU,CAClB,wFAAwF,OAAO,EAAE,CAClG,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,UAAU,CAClB,yFAAyF,QAAQ,EAAE,CACpG,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,GAAG,OAAO,EAAE,CAAC;QACvB,MAAM,IAAI,UAAU,CAClB,oDAAoD,QAAQ,wBAAwB,OAAO,GAAG,CAC/F,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,EAAE;IACF,oEAAoE;IACpE,qEAAqE;IACrE,+CAA+C;IAC/C,EAAE;IACF,qBAAqB;IACrB,EAAE;IACF,0EAA0E;IAC1E,wEAAwE;IACxE,MAAM,eAAe,GAAG,CAAC,CAAC;IAE1B,2EAA2E;IAC3E,EAAE;IACF,+DAA+D;IAC/D,4DAA4D;IAC5D,2DAA2D;IAC3D,MAAM,eAAe,GAAG,CAAC,CAAC;IAE1B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Numerical helpers for covariant-derivative lowering (Task 12 [U]).
3
+ *
4
+ * These functions compute Christoffel symbols and tensor corrections from raw
5
+ * metric data WITHOUT going through the christoffel() composite AST. The
6
+ * composite AST is designed for symbolic/dimensional use; numerical lowering
7
+ * builds Γ directly from metric components and metric-derivative arrays.
8
+ *
9
+ * All helpers are engine-agnostic: they operate on flat number[] arrays and
10
+ * produce EngineTensor results via the engine.fromNested() interface.
11
+ *
12
+ * @module numerical/connection-lowering-helpers
13
+ */
14
+ import type { EngineTensor, TensorEngine } from './tensor-engine.js';
15
+ import type { NestedArray } from './types.js';
16
+ /**
17
+ * Flatten a NestedArray to a plain number[] in row-major order.
18
+ * Canonical implementation. `flattenNestedArray` in lowering.ts is NOT a
19
+ * duplicate — it delegates here and adds an expectedSize invariant check
20
+ * (throws NumericalBackendError if the flattened count mismatches). This
21
+ * function deliberately omits that check for callers that do not know the
22
+ * expected count ahead of time.
23
+ */
24
+ export declare function flattenNA(data: NestedArray): number[];
25
+ /**
26
+ * Return a same-shape EngineTensor whose data is all zeros.
27
+ * S2(c) helper spec: returns a fresh zero tensor of the same shape as t.
28
+ */
29
+ export declare function zeroTensorLike(t: EngineTensor, engine: TensorEngine): EngineTensor;
30
+ /**
31
+ * Return an all-zero EngineTensor of the given shape.
32
+ */
33
+ export declare function zeroTensor(shape: ReadonlyArray<number>, engine: TensorEngine): EngineTensor;
34
+ /**
35
+ * Convert a flat number[] to a properly-nested NestedArray matching `shape`.
36
+ * Exported for use in lowering.ts where the engine requires nested structure.
37
+ */
38
+ export declare function flatToNested(flat: number[], shape: ReadonlyArray<number>): NestedArray;
39
+ /**
40
+ * Elementwise a + b; throws on shape mismatch.
41
+ * S2(c) helper spec.
42
+ */
43
+ export declare function tensorAdd(a: EngineTensor, b: EngineTensor, engine: TensorEngine): EngineTensor;
44
+ /**
45
+ * Elementwise a[i] + sign * b[i]; throws on shape mismatch.
46
+ * S2(c) helper spec.
47
+ */
48
+ export declare function tensorAddScaled(a: EngineTensor, b: EngineTensor, sign: 1 | -1, engine: TensorEngine): EngineTensor;
49
+ /**
50
+ * Compute the full Christoffel symbol Γ^α_{μν} from raw metric arrays.
51
+ *
52
+ * Γ^α_{μν} = (1/2) g^{αρ} (∂_μ g_{ρν} + ∂_ν g_{ρμ} − ∂_ρ g_{μν})
53
+ *
54
+ * Returns an EngineTensor of shape [N, N, N] indexed [α][μ][ν] (row-major).
55
+ *
56
+ * @param gInverseFlat Flat [N*N] array for g^{αρ} (row-major, α outer)
57
+ * @param getMetricDeriv Function (mu: number) => flat [N*N] ∂_{mu} g (row-major)
58
+ * @param N Dimension
59
+ * @param engine Active TensorEngine
60
+ */
61
+ export declare function computeChristoffelTensor(gInverseFlat: number[], getMetricDeriv: (mu: number) => number[], N: number, engine: TensorEngine): EngineTensor;
62
+ /**
63
+ * Contract Γ^α_{μλ} or Γ^λ_{μα} with the operand tensor along the axis
64
+ * corresponding to `freeIdxPos` (the position of the contracted free index
65
+ * in the operand's flat axis list).
66
+ *
67
+ * S2(c) spec — explicit loop body:
68
+ *
69
+ * Upper case (∇_μ T^α_β):
70
+ * out[α, μ, β, ...] += Γ[α, μ, λ] * T[λ_at_pos, β, ...]
71
+ * i.e., contract over λ (axis `freeIdxPos` of T, axis 2 of Γ)
72
+ *
73
+ * Lower case (∇_μ T_α_β):
74
+ * out[α, μ, β, ...] += Γ[λ, μ, α] * T[λ_at_pos, β, ...]
75
+ * i.e., contract over λ (axis `freeIdxPos` of T, axis 0 of Γ)
76
+ * and α indexes the fixed axis of Γ at position 2.
77
+ *
78
+ * Shape conventions (all row-major):
79
+ * Gamma: shape [N, N, N] — [α or λ, μ, ν or α]
80
+ * ofFlat: flat [totalSize] with strides computed from `ofShape`
81
+ * outputShape: same as the partial-derivative output: [N, ...ofShape]
82
+ * (wrt axis prepended, the freeIdxPos axis contracted out,
83
+ * all other axes kept — but since ∇_μ output equals ∂_μ output shape,
84
+ * we match that shape exactly)
85
+ *
86
+ * @param GammaFlat Flat [N^3] Γ^α_{μν} — [α][μ][ν] row-major
87
+ * @param ofFlat Flat operand data, shape `ofShape`
88
+ * @param ofShape Shape of the operand tensor
89
+ * @param freeIdxPos Position (0-based) of the free index being contracted in `ofShape`
90
+ * @param variance 'upper' → Γ^α_{μλ} contracts λ; 'lower' → Γ^λ_{μα} contracts λ
91
+ * @param N Dimension
92
+ * @param engine Active TensorEngine
93
+ *
94
+ * Returns an EngineTensor of shape [N, ...ofShape_without_freeIdxPos]
95
+ * i.e., the same shape as the partial-derivative output (wrt axis first, others follow).
96
+ */
97
+ export declare function contractChristoffelWithOperand(GammaFlat: number[], ofFlat: number[], ofShape: ReadonlyArray<number>, freeIdxPos: number, variance: 'upper' | 'lower', N: number, engine: TensorEngine): EngineTensor;
98
+ /**
99
+ * Look up ∂_{mu} g from inputs.metricDerivatives.
100
+ * Key format: `${metricName}/μ_${mu}` (e.g. 'g/μ_0' for ∂_0 g).
101
+ * Returns a flat [N*N] array.
102
+ *
103
+ * Strategy 'zero': returns [N*N] zeros.
104
+ * Strategy 'supplied': looks up the key; throws if absent.
105
+ */
106
+ export declare function getMetricDerivFlat(metricName: string, coordLabel: string, mu: number, strategy: 'zero' | 'supplied', N: number, metricDerivatives: ReadonlyMap<string, NestedArray> | undefined): number[];
107
+ //# sourceMappingURL=connection-lowering-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-lowering-helpers.d.ts","sourceRoot":"","sources":["../../src/numerical/connection-lowering-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,EAAE,CASrD;AAsBD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,GAAG,YAAY,CAGlF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY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 @@
1
+ /**
2
+ * Numerical helpers for covariant-derivative lowering (Task 12 [U]).
3
+ *
4
+ * These functions compute Christoffel symbols and tensor corrections from raw
5
+ * metric data WITHOUT going through the christoffel() composite AST. The
6
+ * composite AST is designed for symbolic/dimensional use; numerical lowering
7
+ * builds Γ directly from metric components and metric-derivative arrays.
8
+ *
9
+ * All helpers are engine-agnostic: they operate on flat number[] arrays and
10
+ * produce EngineTensor results via the engine.fromNested() interface.
11
+ *
12
+ * @module numerical/connection-lowering-helpers
13
+ */
14
+ import { NumericalBackendError } from './errors.js';
15
+ // ---------------------------------------------------------------------------
16
+ // Flat-array utilities
17
+ // ---------------------------------------------------------------------------
18
+ /**
19
+ * Flatten a NestedArray to a plain number[] in row-major order.
20
+ * Canonical implementation. `flattenNestedArray` in lowering.ts is NOT a
21
+ * duplicate — it delegates here and adds an expectedSize invariant check
22
+ * (throws NumericalBackendError if the flattened count mismatches). This
23
+ * function deliberately omits that check for callers that do not know the
24
+ * expected count ahead of time.
25
+ */
26
+ export function flattenNA(data) {
27
+ if (typeof data === 'number')
28
+ return [data];
29
+ const out = [];
30
+ const walk = (n) => {
31
+ if (typeof n === 'number')
32
+ out.push(n);
33
+ else
34
+ for (const c of n)
35
+ walk(c);
36
+ };
37
+ walk(data);
38
+ return out;
39
+ }
40
+ // ---------------------------------------------------------------------------
41
+ // S2(c) helpers — specified by the Task 12 plan
42
+ // ---------------------------------------------------------------------------
43
+ /**
44
+ * Build a properly-nested zero array matching the given shape.
45
+ * engine.fromNested() expects nested arrays, not flat arrays, for rank > 1.
46
+ */
47
+ function buildNestedZeros(shape) {
48
+ if (shape.length === 0)
49
+ return 0;
50
+ if (shape.length === 1)
51
+ return new Array(shape[0]).fill(0);
52
+ const inner = buildNestedZeros(shape.slice(1));
53
+ // Deep-clone each inner node so they are independent arrays.
54
+ const cloneNested = (n) => {
55
+ if (typeof n === 'number')
56
+ return n;
57
+ return n.map(cloneNested);
58
+ };
59
+ return Array.from({ length: shape[0] }, () => cloneNested(inner));
60
+ }
61
+ /**
62
+ * Return a same-shape EngineTensor whose data is all zeros.
63
+ * S2(c) helper spec: returns a fresh zero tensor of the same shape as t.
64
+ */
65
+ export function zeroTensorLike(t, engine) {
66
+ const shape = [...t.shape];
67
+ return engine.fromNested(buildNestedZeros(shape), shape);
68
+ }
69
+ /**
70
+ * Return an all-zero EngineTensor of the given shape.
71
+ */
72
+ export function zeroTensor(shape, engine) {
73
+ return engine.fromNested(buildNestedZeros([...shape]), [...shape]);
74
+ }
75
+ /**
76
+ * Convert a flat number[] to a properly-nested NestedArray matching `shape`.
77
+ * Exported for use in lowering.ts where the engine requires nested structure.
78
+ */
79
+ export function flatToNested(flat, shape) {
80
+ return flatToNestedImpl(flat, shape);
81
+ }
82
+ function flatToNestedImpl(flat, shape) {
83
+ if (shape.length === 0)
84
+ return flat[0] ?? 0;
85
+ if (shape.length === 1)
86
+ return flat.slice();
87
+ const stride = flat.length / shape[0];
88
+ const result = [];
89
+ for (let i = 0; i < shape[0]; i++) {
90
+ result.push(flatToNestedImpl(flat.slice(i * stride, (i + 1) * stride), shape.slice(1)));
91
+ }
92
+ return result;
93
+ }
94
+ /**
95
+ * Elementwise a + b; throws on shape mismatch.
96
+ * S2(c) helper spec.
97
+ */
98
+ export function tensorAdd(a, b, engine) {
99
+ if (!sameShape(a.shape, b.shape)) {
100
+ throw new NumericalBackendError(`tensorAdd: shape mismatch [${a.shape}] vs [${b.shape}]`);
101
+ }
102
+ return engine.add(a, b);
103
+ }
104
+ /**
105
+ * Elementwise a[i] + sign * b[i]; throws on shape mismatch.
106
+ * S2(c) helper spec.
107
+ */
108
+ export function tensorAddScaled(a, b, sign, engine) {
109
+ if (!sameShape(a.shape, b.shape)) {
110
+ throw new NumericalBackendError(`tensorAddScaled: shape mismatch [${a.shape}] vs [${b.shape}]`);
111
+ }
112
+ if (sign === 1)
113
+ return engine.add(a, b);
114
+ return engine.sub(a, b);
115
+ }
116
+ function sameShape(a, b) {
117
+ return a.length === b.length && a.every((v, i) => v === b[i]);
118
+ }
119
+ // ---------------------------------------------------------------------------
120
+ // Christoffel numerical computation
121
+ // ---------------------------------------------------------------------------
122
+ /**
123
+ * Compute the full Christoffel symbol Γ^α_{μν} from raw metric arrays.
124
+ *
125
+ * Γ^α_{μν} = (1/2) g^{αρ} (∂_μ g_{ρν} + ∂_ν g_{ρμ} − ∂_ρ g_{μν})
126
+ *
127
+ * Returns an EngineTensor of shape [N, N, N] indexed [α][μ][ν] (row-major).
128
+ *
129
+ * @param gInverseFlat Flat [N*N] array for g^{αρ} (row-major, α outer)
130
+ * @param getMetricDeriv Function (mu: number) => flat [N*N] ∂_{mu} g (row-major)
131
+ * @param N Dimension
132
+ * @param engine Active TensorEngine
133
+ */
134
+ export function computeChristoffelTensor(gInverseFlat, getMetricDeriv, N, engine) {
135
+ // Output: Gamma[alpha][mu][nu] stored in row-major order
136
+ const size = N * N * N;
137
+ const Gamma = new Array(size).fill(0);
138
+ for (let alpha = 0; alpha < N; alpha++) {
139
+ for (let mu = 0; mu < N; mu++) {
140
+ for (let nu = 0; nu < N; nu++) {
141
+ let sum = 0;
142
+ const dmu = getMetricDeriv(mu); // ∂_μ g_{ρν} — shape [N,N], ρ outer
143
+ const dnu = getMetricDeriv(nu); // ∂_ν g_{ρμ}
144
+ for (let rho = 0; rho < N; rho++) {
145
+ const gInvAlphaRho = gInverseFlat[alpha * N + rho]; // g^{α ρ}
146
+ const drho = getMetricDeriv(rho); // ∂_ρ g_{μν}
147
+ // ∂_μ g_{ρν} → index [ρ,ν] in flat ∂_μ g
148
+ const term1 = dmu[rho * N + nu];
149
+ // ∂_ν g_{ρμ} → index [ρ,μ] in flat ∂_ν g
150
+ const term2 = dnu[rho * N + mu];
151
+ // ∂_ρ g_{μν} → index [μ,ν] in flat ∂_ρ g
152
+ const term3 = drho[mu * N + nu];
153
+ sum += gInvAlphaRho * (term1 + term2 - term3);
154
+ }
155
+ Gamma[alpha * N * N + mu * N + nu] = 0.5 * sum;
156
+ }
157
+ }
158
+ }
159
+ return engine.fromNested(flatToNestedImpl(Gamma, [N, N, N]), [N, N, N]);
160
+ }
161
+ // ---------------------------------------------------------------------------
162
+ // Contraction of Γ with the operand tensor
163
+ // ---------------------------------------------------------------------------
164
+ /**
165
+ * Contract Γ^α_{μλ} or Γ^λ_{μα} with the operand tensor along the axis
166
+ * corresponding to `freeIdxPos` (the position of the contracted free index
167
+ * in the operand's flat axis list).
168
+ *
169
+ * S2(c) spec — explicit loop body:
170
+ *
171
+ * Upper case (∇_μ T^α_β):
172
+ * out[α, μ, β, ...] += Γ[α, μ, λ] * T[λ_at_pos, β, ...]
173
+ * i.e., contract over λ (axis `freeIdxPos` of T, axis 2 of Γ)
174
+ *
175
+ * Lower case (∇_μ T_α_β):
176
+ * out[α, μ, β, ...] += Γ[λ, μ, α] * T[λ_at_pos, β, ...]
177
+ * i.e., contract over λ (axis `freeIdxPos` of T, axis 0 of Γ)
178
+ * and α indexes the fixed axis of Γ at position 2.
179
+ *
180
+ * Shape conventions (all row-major):
181
+ * Gamma: shape [N, N, N] — [α or λ, μ, ν or α]
182
+ * ofFlat: flat [totalSize] with strides computed from `ofShape`
183
+ * outputShape: same as the partial-derivative output: [N, ...ofShape]
184
+ * (wrt axis prepended, the freeIdxPos axis contracted out,
185
+ * all other axes kept — but since ∇_μ output equals ∂_μ output shape,
186
+ * we match that shape exactly)
187
+ *
188
+ * @param GammaFlat Flat [N^3] Γ^α_{μν} — [α][μ][ν] row-major
189
+ * @param ofFlat Flat operand data, shape `ofShape`
190
+ * @param ofShape Shape of the operand tensor
191
+ * @param freeIdxPos Position (0-based) of the free index being contracted in `ofShape`
192
+ * @param variance 'upper' → Γ^α_{μλ} contracts λ; 'lower' → Γ^λ_{μα} contracts λ
193
+ * @param N Dimension
194
+ * @param engine Active TensorEngine
195
+ *
196
+ * Returns an EngineTensor of shape [N, ...ofShape_without_freeIdxPos]
197
+ * i.e., the same shape as the partial-derivative output (wrt axis first, others follow).
198
+ */
199
+ export function contractChristoffelWithOperand(GammaFlat, ofFlat, ofShape, freeIdxPos, variance, N, engine) {
200
+ // Output shape: [N (wrt/mu axis), ...ofShape with freeIdxPos axis removed and
201
+ // replaced by the alpha axis of the Christoffel]
202
+ // Concretely: output has the same shape as ∂_μ T which is [...ofShape, N]
203
+ // with wrtIndex appended. But freeIdx is now contracted (replaced by α):
204
+ // upper: T had axis freeIdxPos as α (upper) → output keeps α at same position, prepends μ
205
+ // lower: T had axis freeIdxPos as α (lower) → output keeps α at same position, prepends μ
206
+ //
207
+ // The output axis order matches ∂_μ T: [...ofShape, N] (wrt axis last? or first?)
208
+ // Actually ∂_μ appends wrt as the LAST axis per v0.3.5 design.
209
+ // So output shape of ∇_μ T = [...ofShape, N] where N is the wrt axis.
210
+ // But the correction term must have the same shape.
211
+ //
212
+ // For the correction: we keep all of T's axes, with freeIdxPos contracting,
213
+ // and add a new μ axis (last, like ∂_μ). The α index replaces the contracted
214
+ // position (same position in the output as freeIdxPos was in T).
215
+ //
216
+ // Output shape = [...ofShape, N] where ofShape[freeIdxPos] stays (α replaces λ)
217
+ // and the last axis N is the μ axis.
218
+ const rank = ofShape.length;
219
+ const outShape = [...ofShape, N]; // [...T_shape, mu]
220
+ const outSize = outShape.reduce((a, b) => a * b, 1);
221
+ const out = new Array(outSize).fill(0);
222
+ // Build strides for ofFlat and out
223
+ const ofStrides = buildStrides(ofShape);
224
+ const outStrides = buildStrides(outShape);
225
+ // Iterate over all output indices
226
+ forEachMultiIndex(outShape, (outIdx) => {
227
+ const mu = outIdx[rank]; // last axis of output is μ
228
+ // The other axes map to T's indices, with freeIdxPos being the α/result axis
229
+ const alpha = outIdx[freeIdxPos]; // the "free" index value (α for upper, α for lower)
230
+ let sum = 0;
231
+ for (let lam = 0; lam < N; lam++) {
232
+ // Build T's index: same as outIdx[0..rank-1] but with freeIdxPos = lam
233
+ const tIdx = outIdx.slice(0, rank);
234
+ tIdx[freeIdxPos] = lam;
235
+ const tFlat = flatIndex(tIdx, ofStrides);
236
+ let gammaFlat;
237
+ if (variance === 'upper') {
238
+ // Γ^α_{μλ} — shape [α][μ][λ]
239
+ gammaFlat = alpha * N * N + mu * N + lam;
240
+ }
241
+ else {
242
+ // Γ^λ_{μα} — shape [λ][μ][α]
243
+ gammaFlat = lam * N * N + mu * N + alpha;
244
+ }
245
+ sum += GammaFlat[gammaFlat] * ofFlat[tFlat];
246
+ }
247
+ out[flatIndex(outIdx, outStrides)] = sum;
248
+ });
249
+ return engine.fromNested(flatToNestedImpl(out, outShape), outShape);
250
+ }
251
+ // ---------------------------------------------------------------------------
252
+ // Internal utilities
253
+ // ---------------------------------------------------------------------------
254
+ function buildStrides(shape) {
255
+ const strides = new Array(shape.length);
256
+ let s = 1;
257
+ for (let k = shape.length - 1; k >= 0; k--) {
258
+ strides[k] = s;
259
+ s *= shape[k];
260
+ }
261
+ return strides;
262
+ }
263
+ function flatIndex(idx, strides) {
264
+ let f = 0;
265
+ for (let k = 0; k < idx.length; k++)
266
+ f += idx[k] * strides[k];
267
+ return f;
268
+ }
269
+ function forEachMultiIndex(shape, visit) {
270
+ if (shape.length === 0) {
271
+ visit([]);
272
+ return;
273
+ }
274
+ const idx = new Array(shape.length).fill(0);
275
+ const total = shape.reduce((a, b) => a * b, 1);
276
+ for (let n = 0; n < total; n++) {
277
+ visit([...idx]);
278
+ for (let k = shape.length - 1; k >= 0; k--) {
279
+ if (++idx[k] < shape[k])
280
+ break;
281
+ idx[k] = 0;
282
+ }
283
+ }
284
+ }
285
+ // ---------------------------------------------------------------------------
286
+ // Metric-partial-derivative lookup (for 'supplied' strategy)
287
+ // ---------------------------------------------------------------------------
288
+ /**
289
+ * Look up ∂_{mu} g from inputs.metricDerivatives.
290
+ * Key format: `${metricName}/μ_${mu}` (e.g. 'g/μ_0' for ∂_0 g).
291
+ * Returns a flat [N*N] array.
292
+ *
293
+ * Strategy 'zero': returns [N*N] zeros.
294
+ * Strategy 'supplied': looks up the key; throws if absent.
295
+ */
296
+ export function getMetricDerivFlat(metricName, coordLabel, mu, strategy, N, metricDerivatives) {
297
+ if (strategy === 'zero') {
298
+ return new Array(N * N).fill(0);
299
+ }
300
+ // strategy === 'supplied'
301
+ const key = `${metricName}/${coordLabel}_${mu}`;
302
+ const d = metricDerivatives?.get(key);
303
+ if (d === undefined) {
304
+ throw new NumericalBackendError(`connection-lowering: no metric derivative supplied for "${key}" — ` +
305
+ `a covariant-derivative with derivativeStrategy='supplied' requires ` +
306
+ `inputs.metricDerivatives to contain "${key}" (flat [N×N] of ∂_{${mu}} g)`);
307
+ }
308
+ const flat = flattenNA(d);
309
+ if (flat.length !== N * N) {
310
+ throw new NumericalBackendError(`connection-lowering: metricDerivatives["${key}"] has ${flat.length} elements, ` +
311
+ `expected ${N * N} (N=${N})`);
312
+ }
313
+ return flat;
314
+ }
315
+ //# sourceMappingURL=connection-lowering-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-lowering-helpers.js","sourceRoot":"","sources":["../../src/numerical/connection-lowering-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,IAAiB;IACzC,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,CAAC,CAAc,EAAQ,EAAE;QACpC,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;YAClC,KAAK,MAAM,CAAC,IAAI,CAAC;gBAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,CAAC;IACX,OAAO,GAAG,CAAC;AACb,CAAC;AAED,8E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