Skip to content

Commit

Permalink
fix that argument compute_K(..., expect_mean_k) wasn't used
Browse files Browse the repository at this point in the history
  • Loading branch information
jhauschild committed May 8, 2024
1 parent 9739ac3 commit 09eee8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/changelog/latest/misc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- fix that :meth:`~tenpy.networks.mps.MPS.compute_K` didn't use the argument `expect_mean_k`.
4 changes: 2 additions & 2 deletions tenpy/networks/mps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4846,7 +4846,7 @@ def compute_K(self,
expected_mean_k : float
As explained in :cite:`cincio2013`, the returned `W` is extracted as eigenvector of a
mixed transfer matrix, and hence has an undefined phase. We fix the overall phase
such that ``sum(s[j]**2 exp(iK[j]) == np.sum(W) = np.exp(1.j*expected_mean_k)``.
such that ``sum(s[j]**2 exp(iK[j])) == np.sum(W) = np.exp(1.j*expected_mean_k)``.
Returns
-------
Expand Down Expand Up @@ -4912,7 +4912,7 @@ def compute_K(self,
W = W / np.sum(np.abs(W)) # fix overall scaling by normalization np.sum(S[i]**2) == 1.
mean_exp_ik = np.sum(W)
if np.abs(mean_exp_ik) > 1.e-5:
W *= np.conj(mean_exp_ik) / np.abs(mean_exp_ik)
W *= np.exp(1.j*expected_mean_k) * np.conj(mean_exp_ik) / np.abs(mean_exp_ik)
# Strip S's from U
inv_S = 1. / self.get_SL(0)
U = sUs.scale_axis(inv_S, 0).iscale_axis(inv_S, 1) # note: U should commute with s
Expand Down

0 comments on commit 09eee8d

Please sign in to comment.