Skip to content

Commit

Permalink
Remove numpy<1.24 restriction from requirements.txt (#6149)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanujkhattar authored Jun 22, 2023
1 parent f3965e8 commit 6c251a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cirq-core/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ backports.cached_property~=1.0.1; python_version < '3.8'
duet~=0.2.8
matplotlib~=3.0
networkx>=2.4
numpy>=1.16,<1.24
numpy>=1.16
pandas
sortedcontainers~=2.0
scipy
Expand Down
5 changes: 3 additions & 2 deletions cirq-ft/cirq_ft/algos/and_gate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"input_states = [(a, b, 0) for a, b in itertools.product([0, 1], repeat=2)]\n",
"output_states = [(a, b, a & b) for a, b, _ in input_states]\n",
"\n",
"\n",
"for inp, out in zip(input_states, output_states):\n",
" result = cirq.Simulator().simulate(c2, initial_state=inp)\n",
" result = cirq.Simulator(dtype=np.complex128).simulate(c2, initial_state=inp)\n",
" print(inp, '->', result.dirac_notation())\n",
" assert result.dirac_notation()[1:-1] == \"\".join(str(x) for x in out)"
]
Expand All @@ -128,7 +130,6 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"inds, = np.where(abs(result.final_state_vector) > 1e-8)\n",
"assert len(inds) == 1\n",
"ind, = inds\n",
Expand Down
2 changes: 1 addition & 1 deletion cirq-ft/cirq_ft/algos/and_gate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_multi_controlled_and_gate(cv: List[int]):

for input_control in input_controls:
initial_state = input_control + [0] * (r['ancilla'].bitsize + 1)
result = cirq.Simulator().simulate(
result = cirq.Simulator(dtype=np.complex128).simulate(
circuit, initial_state=initial_state, qubit_order=qubit_order
)
expected_output = np.asarray([0, 1] if input_control == cv else [1, 0])
Expand Down

0 comments on commit 6c251a3

Please sign in to comment.