Skip to content

Commit 5d56e3f

Browse files
authored
Fix minor NumPy compatibility warnings (#434)
1 parent 7ec89f4 commit 5d56e3f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

recirq/hfvqe/objective_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def get_opdm(wf, num_orbitals, transform=of.jordan_wigner):
4848
# not using display style objects
4949
for p, q in product(range(num_orbitals), repeat=2):
5050
operator = creation_ops[p] @ creation_ops[q].conj().transpose()
51-
opdm_hw[p, q] = wf.conj().T @ operator @ wf
51+
opdm_hw[p, q] = (wf.conj().T @ operator @ wf)[0, 0]
5252

5353
return opdm_hw
5454

recirq/toric_code/toric_code_plaquettes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ def expectation_value(
109109
qubit_idxs = code.z_plaquette_to_qubit_idxs(row, col)
110110

111111
total_qubits = len(code.qubits)
112-
parities = data.applymap(
112+
parities = data.map(
113113
lambda value: cls.compute_parity(value, qubit_idxs, total_qubits)
114114
)
115-
return float(parities.mean())
115+
return float(parities.mean().iloc[0])
116116

117117
@staticmethod
118118
def compute_parity(value: int, qubit_idxs: Iterable[int], total_qubits: int) -> int:

0 commit comments

Comments
 (0)