Skip to content

Commit

Permalink
Fix a bug in dense_to_mps (#1237)
Browse files Browse the repository at this point in the history
Bug reported by @hsim13372 , thanks a lot!

Quick fix. This was missed because the function is just used to show the
dimensionality.
  • Loading branch information
Qottmann authored Oct 11, 2024
1 parent acd1f70 commit 468266c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion demonstrations/tutorial_mps.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
],
"dateOfPublication": "2024-09-29T00:00:00+00:00",
"dateOfLastModification": "2024-10-07T00:00:00+00:00",
"dateOfLastModification": "2024-10-11T00:00:00+00:00",
"categories": [
"Quantum Computing",
"Algorithms",
Expand Down
2 changes: 1 addition & 1 deletion demonstrations/tutorial_mps.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def dense_to_mps(psi, bond_dim):
Ms.append(U)
Ss.append(Ss)
bondL = Vd.shape[0]
psi = Vd
psi = np.tensordot(np.diag(S), Vd, 1)

for _ in range(n-2):
psi = np.reshape(psi, (2*bondL, -1)) # reshape psi[2 * bondL, (2x2x2...)]
Expand Down

0 comments on commit 468266c

Please sign in to comment.