Skip to content

Commit

Permalink
Tighten power-trace bound of odd loop Hafnian (#362)
Browse files Browse the repository at this point in the history
* Tighten power-trace bound of odd loop Hafnian

In the inner-loop, `powtrace[i // 2]` reaches a maximum at `n == i` according to the loop range, hence the power-trace need not compute any additional power traces.

* Update CHANGELOG.md

---------

Co-authored-by: Nicolas Quesada <[email protected]>
  • Loading branch information
GregoryMorse and nquesada authored Jul 18, 2023
1 parent 01fb78c commit 8e43ac1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

### Improvements


* Tighten power-trace bound of odd loop Hafnian. [(#362)](https://github.com/XanaduAI/thewalrus/pull/362)

* Simplifies the internal working of Bloch-Messiah decomposition [(#363)](https://github.com/XanaduAI/thewalrus/pull/338).

* Simplifies the internal working of Williamson decomposition [(#366)](https://github.com/XanaduAI/thewalrus/pull/338).
Expand All @@ -20,7 +23,7 @@

This release contains contributions from (in alphabetical order):

Nicolas Quesada
Gregory Morse, Nicolas Quesada

---

Expand Down
2 changes: 1 addition & 1 deletion thewalrus/_hafnian.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def f_loop_odd(AX, AX_S, XD_S, D_S, n, oddloop, oddVX_S): # pragma: no cover
count = 0
comb = np.zeros((2, n + 1), dtype=np.complex128)
comb[0, 0] = 1
powtrace = charpoly.powertrace(AX, n + 1)
powtrace = charpoly.powertrace(AX, n // 2 + 1)
for i in range(1, n + 1):
if i == 1:
factor = oddloop
Expand Down

0 comments on commit 8e43ac1

Please sign in to comment.