Skip to content

Docs#4

Merged
beykyle merged 10 commits into
mainfrom
docs
Jun 11, 2026
Merged

Docs#4
beykyle merged 10 commits into
mainfrom
docs

Conversation

@beykyle

@beykyle beykyle commented Jun 10, 2026

Copy link
Copy Markdown
Owner

No description provided.

beykyle and others added 10 commits June 9, 2026 21:30
assemble_block_hamiltonian now builds H in MeV by scaling each channel's
kinetic block by m_c and leaving V untouched. mass_factor_override accepts
a scalar or (N_c,) array for per-channel overrides. _spectrum_eigh and
_spectrum_eig divide the assembled MeV block by m0 to recover fm⁻²
eigenvalues so all downstream observables are unchanged.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… tasks 2-3)

- Add `Interaction` pytree dataclass to `types.py` with static `energy_dependent` flag
- Add `operators/interaction.py`: pickle-safe `_InteractionFromBlock/Array/Funcs` callables
  with `make_interaction_from_{block,array,funcs}` factories exposed on `Solver`
- Rewrite `linear_solve.py` direct path: `C = H_MeV - E*I`, `Q' = sqrt(m_c)*Q`,
  `R = Q'^T C^{-1} Q' / a`; add `_SMatrixDirectObservable`, `_PhasesDirectObservable`,
  `_WavefunctionDirectKernel` with JIT-compiled entry points
- Extend `Solver` and `compile.py` to wire `smatrix_direct`, `phases_direct`,
  `wavefunction_direct`, and `interaction_from_*` fields
- Fix test manual formulas to use MeV assembler convention throughout

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…hase 10 task 4)

- `boundary/coulomb.py`: index as `mass_factor_grid[energy_index, channel_index]`
  so each channel can have its own energy-dependent mass factor at boundary values
- `compile.py`: add `_broadcast_mass_factor_grid` that normalizes scalar / (N_E,) /
  (N_E, N_c) inputs to the canonical (N_E, N_c) NumPy array; update `compile()`
  docstring and validation accordingly
- `linear_solve.py`: `one_energy_with_mu` now receives `mu_row: (N_c,)` per energy
  step; builds `Q' = diag(repeat(sqrt(mu_row), N)) @ Q` for per-channel scaling and
  passes the vector to `assemble_block_hamiltonian(mass_factor_override=mu_row)`
- Tests: scalar/2D broadcasts reproduce uniform baseline; wrong-length raises; decoupled
  two-channel solver with unequal μ reproduces single-channel diagonal elements

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ilder tests (Tasks 5-6)

- `assembly.py`: handle ndim=2 potential (pre-assembled (M,M) Interaction.block) by
  slicing sub-blocks instead of channel-index scalar access; fixes Interaction dispatch
  through assemble_block_hamiltonian
- `linear_solve.py`: remove ambiguous ndim-based energy indexing in wavefunction_direct
  for raw arrays (user must slice energy-dependent arrays before calling); scale result by
  m₀ so wavefunction_direct matches spectral Green's function convention
  G = (H_fm2 - E/m)^{-1} = m·(H_MeV - E·I)^{-1}
- `wavefunction.py`: add docstring note showing the direct-path wavefunction_direct API
- New `tests/unit/test_interaction_builders.py`: round-trips for from_block, from_array
  (local + nonlocal), from_funcs; symmetry-validation error; energy-dependent shape;
  end-to-end rmatrix_direct(Interaction) == rmatrix_direct(raw_V)
- `test_solver_direct.py`: wavefunction_direct(interaction, src, i) == wavefunction(spec, E, src)
  round-trip test at 1e-10 tolerance

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@beykyle beykyle merged commit 1cbcbde into main Jun 11, 2026
6 checks passed
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