Skip to content

Commit

Permalink
qr_stabilized: fix rare bug for complex tensors
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmgray committed Jan 24, 2024
1 parent f4e0fc0 commit 9b11068
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

Release notes for `quimb`.

(whats-new-1-7-1)=
## v1.7.1 (unreleased)

**Bug fixes:**

- fix bug in [`kruas_op`](quimb.kraus_op) when operator spanned multiple
subsystems ({issue}`214`)
- fix bug in [`qr_stabilized`](quimb.decomp.qr_stabilized) when the diagonal of
`R` has significant imaginary parts.


(whats-new-1-7-0)=
## v1.7.0 (12-08-2023)

Expand Down
4 changes: 2 additions & 2 deletions quimb/tensor/decomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def qr_stabilized(x, backend=None):
# stabilize the diagonal of R
rd = do("diag", R)
s = sgn(rd)
Q = rdmul(Q, s)
Q = rdmul(Q, do("conj", s))
R = ldmul(s, R)
return Q, None, R

Expand All @@ -629,7 +629,7 @@ def qr_stabilized_numba(x):
rii = R[i, i]
si = sgn_numba(rii)
if si != 1.0:
Q[:, i] *= si
Q[:, i] *= np.conj(si)
R[i, i:] *= si
return Q, None, R

Expand Down

0 comments on commit 9b11068

Please sign in to comment.