qbm/gibbs_map.py refuses when ParamHamiltonian.offset is set:
raise NotImplementedError("ParamHamiltonian.offset is not supported by the Gibbs map")
The block structure G = (+)_v G_h(v) still holds whenever the offset is itself diagonal on the visible register, so the restriction is stronger than the mathematics requires. The fix is to accept an offset whose visible part is diagonal and fold its per-v block into G_h(v), and keep refusing otherwise.
Acceptance
- gradient still matches
MarginalNLL exactly (~1e-16) with an offset present
- a non-diagonal-visible offset still raises, with the reason stated
Getting oriented
Week 15 of the codebase tour. test_gibbs_map.py::test_offset_is_refused pins the current behaviour and would need updating.
qbm/gibbs_map.pyrefuses whenParamHamiltonian.offsetis set:The block structure
G = (+)_v G_h(v)still holds whenever the offset is itself diagonal on the visible register, so the restriction is stronger than the mathematics requires. The fix is to accept an offset whose visible part is diagonal and fold its per-vblock intoG_h(v), and keep refusing otherwise.Acceptance
MarginalNLLexactly (~1e-16) with an offset presentGetting oriented
Week 15 of the codebase tour.
test_gibbs_map.py::test_offset_is_refusedpins the current behaviour and would need updating.