Skip to content

Commit

Permalink
Update deprecated function names from TW (#472)
Browse files Browse the repository at this point in the history
* Update deprecated name from TW

* update changelog

Co-authored-by: Josh Izaac <josh146@gmail.com>
  • Loading branch information
thisac and josh146 authored Oct 21, 2020
1 parent 96fca95 commit 414f035
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@
`cancel_pending` JobStatus until the cancellation is confirmed.
[(#456)](https://github.com/XanaduAI/strawberryfields/pull/456)

<h3>Breaking Changes</h3>

<h3>Bug fixes</h3>

* Fixed a bug where the function `reduced_dm` in `backends/tfbackend/states.py` gives the
Expand All @@ -111,6 +109,10 @@
incorrect results on NumPy 1.19.
[(#473)](https://github.com/XanaduAI/strawberryfields/pull/473)

* The Walrus version 0.14 introduced modified function names. Affected functions have been updated
in Strawberry Fields to avoid deprecation warnings.
[(#472)](https://github.com/XanaduAI/strawberryfields/pull/472)

<h3>Documentation</h3>

* Adds further testing and coverage descriptions to the developer documentation.
Expand Down
2 changes: 1 addition & 1 deletion doc/code/sf_decompositions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ sf.decompositions
.. automodapi:: strawberryfields.decompositions
:no-heading:
:include-all-objects:
:skip: block_diag, sqrtm, polar, schur, sympmat, changebasis, find_scaling_adjacency_matrix
:skip: block_diag, sqrtm, polar, schur, sympmat, changebasis, adj_scaling
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tensorboard>=2.0
networkx>=2.0
quantum-blackbird==0.2.3
python-dateutil==2.8.0
thewalrus>=0.13.0
thewalrus>=0.14.0
toml
appdirs
numba>=0.48.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"networkx>=2.0",
"quantum-blackbird>=0.2.3",
"python-dateutil>=2.8.0",
"thewalrus>=0.13.0",
"thewalrus>=0.14.0",
"numba",
"toml",
"appdirs",
Expand Down
4 changes: 2 additions & 2 deletions strawberryfields/apps/train/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from thewalrus._hafnian import reduction
from thewalrus._torontonian import tor
from thewalrus.quantum import Qmat
from thewalrus.quantum import find_scaling_adjacency_matrix as rescale
from thewalrus.quantum import find_scaling_adjacency_matrix_torontonian as rescale_tor
from thewalrus.quantum import adj_scaling as rescale
from thewalrus.quantum import adj_scaling_torontonian as rescale_tor
from thewalrus.quantum import photon_number_mean_vector, pure_state_amplitude

import strawberryfields as sf
Expand Down
6 changes: 3 additions & 3 deletions strawberryfields/decompositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import numpy as np
from scipy.linalg import block_diag, sqrtm, polar, schur
from thewalrus.quantum import find_scaling_adjacency_matrix
from thewalrus.quantum import adj_scaling

from .backends.shared_ops import sympmat, changebasis

Expand Down Expand Up @@ -182,7 +182,7 @@ def graph_embed(A, mean_photon_per_mode=1.0, make_traceless=False, rtol=1e-05, a
if make_traceless:
A = A - np.trace(A) * np.identity(n) / n

scale = find_scaling_adjacency_matrix(A, n * mean_photon_per_mode)
scale = adj_scaling(A, n * mean_photon_per_mode)
A = scale * A
s, U = takagi(A, tol=atol)
vals = -np.arctanh(s)
Expand Down Expand Up @@ -216,7 +216,7 @@ def bipartite_graph_embed(A, mean_photon_per_mode=1.0, rtol=1e-05, atol=1e-08):
raise ValueError("The matrix is not square.")

B = np.block([[0 * A, A], [A.T, 0 * A]])
scale = find_scaling_adjacency_matrix(B, 2 * n * mean_photon_per_mode)
scale = adj_scaling(B, 2 * n * mean_photon_per_mode)
A = scale * A

if np.allclose(A, A.T, rtol=rtol, atol=atol):
Expand Down
4 changes: 2 additions & 2 deletions tests/apps/train/test_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import numpy as np
import pytest
import thewalrus
from thewalrus.quantum import find_scaling_adjacency_matrix as rescale
from thewalrus.quantum import find_scaling_adjacency_matrix_torontonian as rescale_tor
from thewalrus.quantum import adj_scaling as rescale
from thewalrus.quantum import adj_scaling_torontonian as rescale_tor

from strawberryfields.apps import train
from strawberryfields.apps.train.embed import Exp
Expand Down

0 comments on commit 414f035

Please sign in to comment.