Skip to content

fix(rcwa): stabilize independent uniform materials, fields and derivatives - #98

Merged
yonghakim merged 6 commits into
mainfrom
codex/independent-material-interfaces
Oct 22, 2026
Merged

yonghakim merged 6 commits into
mainfrom
codex/independent-material-interfaces

Conversation

@yonghakim

@yonghakim yonghakim commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Independent layer permittivity inputs at the complex-angle knife edge in #21 can still give order-one errors after the shared-material fixes. For a homogeneous nonmagnetic region stack, this change keeps each independent material and uses rationalized Fresnel interfaces, a two-face recursion, and compensated normal-root residuals. Reflection, transmission, field reconstruction and both SMM ports come from the same calculation. ETM and SMM use this direct homogeneous path under material transformations; concrete eager solves retain their existing path.

The same work fixes a Torch material-response narrowing: a Python wavelength must not cast a float64 material through complex64 and overflow its otherwise finite cotangent.

Validation:

  • New 120-digit ordinary-Fresnel references cover equal and adjacent float64 permittivities, separated values, both polarizations/sides, R/T, pointwise fields and their independent material tangents. Reference generation imports no solver code; CI needs no mpmath dependency.
  • The unmodified base fails 11 of the 19 new stack tests; its eight ordinary multilayer controls pass.
  • Selected solver regressions: 324 passed and one existing xfail across the uniform-interface, half-space merge, evanescent incidence, compiled field and public lifecycle tests; two subsequently added answer-contract tests passed separately (326 passed total). All 21 new stack tests pass.
  • Material regressions: 97 passed, including three new precision tests. Docs: 165 passed and one existing skip; quick profile: 17 passed; Ruff and diff checks pass.
  • The numerical candidate 7fff018 preserves all 1,952 recorded eager entries byte-for-byte, with four existing refusals, against the previously recorded PR97 tree (identical to this PR's base). No claim to rerun that baseline corpus or the historical research-tier discrepancies.
  • Self-review complete; no outstanding review threads. No tolerances or reference values were changed to make failures pass. An exact layer-cutoff probe remains NaN on both candidate and unmodified base; this inherited limit is not claimed fixed.

Scope: second-order, single-plane-wave, scalar nonmagnetic region stacks with no shapes. Patterned/raster, magnetic/tensor, first-order and coherent-source cases retain their existing limits. Physical poles, cutoffs and values beyond floating-point range are not resolved generally. This partially addresses #21 and does not close it. No release changes.

CI follow-up: the first Ready run failed the license inventory step and installed-distribution checks. Failure annotations identified an unreviewed installed tzdata 2026.5 package, also confirmed in the macOS installed check. The base inventory reproduces the same missing-entry error. The official wheel METADATA and Apache-2.0 license files were reviewed and recorded with the wheel hash; no dependency requirement or license policy was weakened. License/doc tests: 194 passed, one existing skip. Replacement required CI passed.

Ports: 72c5266ff4f21a6104d413550593f230b6755328

Full CI then exposed a Torch wavelength-derivative regression in the new homogeneous path: constant Python-scalar exterior materials reached tensor-only real/imag operations. The existing test reproduces the failure on bd237a6 and passes on the unmodified base. Commit7fff0185 promotes those constants through the root array without detaching the graph; the unchanged existing test now passes. Related material/uniform tests passed76, including all21 uniform cases. The exact7fff0185 eager corpus remains byte-identical for all1,952 entries with four existing refusals. Replacement full CI39717299468 passed all eight required gates (52 successful jobs, one existing diagnostic-only skip).

Integrated by Rebase and merge as ca5d27750a88810efe9329aee62794795241ffb3, tree-identical to the reviewed candidate. Exact-main tests39718968235 and CodeQL39718967784 succeeded. No release was made.

yonghakim and others added 3 commits October 22, 2026 02:47
…h responses

Keep a double material and its cotangent out of a complex64 intermediate when a Python wavelength selects the Torch default precision.

Co-authored-by: Codex <noreply@openai.com>
… tangents

Use rationalized scalar interfaces and a two-face recursion for transformed homogeneous nonmagnetic region stacks. Preserve both scattering ports and fields without removing independent equal-valued inputs. Compensated root residuals limit accumulated phase error.

Ports: 72c5266ff4f21a6104d413550593f230b6755328

Co-authored-by: Codex <noreply@openai.com>
Leave an exactly zero normal root untouched by residual refinement, keep ETM scattering unavailable, and verify efficiency-only versus amplitude solves.

Co-authored-by: Codex <noreply@openai.com>
@yonghakim
yonghakim marked this pull request as ready for review October 22, 2026 03:01
yonghakim and others added 3 commits October 22, 2026 03:06
Keep existing failures and exit statuses while making the license detail and failed distribution command visible without downloading the job log archive.

Co-authored-by: Codex <noreply@openai.com>
The installed CI timezone database is absent from the base inventory. Review the official wheel metadata and Apache-2.0 license files, record its SHA256, and keep the existing strict checker and dependency requirements unchanged.

Co-authored-by: Codex <noreply@openai.com>
The existing Torch wavelength-derivative regression exposed Python scalar exterior permittivities reaching array-only real/imag operations. Promote them through the root array without detaching material or wavelength derivatives.

Co-authored-by: Codex <noreply@openai.com>
@yonghakim
yonghakim merged commit ca5d277 into main Oct 22, 2026
56 checks passed
@yonghakim
yonghakim deleted the codex/independent-material-interfaces branch October 22, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant