Skip to content

Fix normalization handling in MPS/MPO expectations - #1

Merged
rezaquant merged 18 commits into
mainfrom
normalisation_bugfix
Jun 29, 2026
Merged

rezaquant merged 18 commits into
mainfrom
normalisation_bugfix

Conversation

@gamatos

@gamatos gamatos commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes normalization issues in tensor network expectation and sweep tracking paths, including avoiding double division for already-normalized MPS inputs and making sweep best-state tracking robust when state is unavailable.

  • Fixes expec_mpo so MPS expectation values remain scale-invariant.
  • Measures MPS working-data norms via tn_norm while preserving stored exponent state.
  • Guards sweep best-state snapshots against missing optimizer state.
  • Adds regression coverage for normalized expectations, raw norm measurement, and non-unitary norm-infidelity diagnostics.

@gamatos
gamatos requested a review from rezaquant June 24, 2026 12:53
@rezaquant
rezaquant merged commit c092863 into main Jun 29, 2026
1 of 2 checks passed
rezaquant added a commit that referenced this pull request Jul 8, 2026
…leau

- #1 pauli_combo_mpo windows to the operator support span (bond-1 identity outside
  [lo,hi]; operator factors I_outside (x) window-op). Callers unchanged; verified
  exact via to_dense. NB windowed gate_with_submpo_ is wrong here (fid 0.939) so we
  keep mpo.apply.
- #2 _evolve_nu fuses apply+compress via mpo.apply(compress=True) (one sweep;
  max_bond=None exact stays lossless).
- #3 STNState caches current_inverse_tableau, invalidated on apply_clifford/
  do_tableau; tableau updates routed through STNState.do_tableau.
Stress suite 17.4s -> 10.3s; 63 STN + 480 API/layout tests pass; n=10 depth-150
exact ~295ms, fidelity vs quimb = 1.0.
@rezaquant
rezaquant deleted the normalisation_bugfix branch August 1, 2026 14:58
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.

2 participants