Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.