Skip to content

Gibbs map: support a ParamHamiltonian offset #8

Description

@Michele-Minervini

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or capability

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions