Skip to content

Commit

Permalink
Upgrade to cirq 0.12 (quantumlib#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanujkhattar authored and ncrubin committed Jul 25, 2022
1 parent 44b1e45 commit 5360bc9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cirq~=0.11.0
cirq-core~=0.12.0
cirq-google~=0.12.0
deprecation
h5py>=2.8
networkx
Expand All @@ -7,4 +8,4 @@ pubchempy
requests~=2.18
scipy>=1.1.0
sympy
nbformat
nbformat
2 changes: 1 addition & 1 deletion src/openfermion/_compat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ def test_cirq_deprecations():
def old_func():
pass

with pytest.raises(ValueError, match="should not use deprecated"):
with pytest.raises(ValueError, match="deprecated .* not allowed"):
old_func()
3 changes: 1 addition & 2 deletions src/openfermion/circuits/gates/common_gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
import cirq


class FSwapPowGate(cirq.EigenGate, cirq.InterchangeableQubitsGate,
cirq.TwoQubitGate):
class FSwapPowGate(cirq.EigenGate, cirq.InterchangeableQubitsGate):
"""The FSWAP gate, possibly raised to a power.
FSwapPowGate()**t = FSwapPowGate(exponent=t) and acts on two qubits in the
Expand Down
10 changes: 8 additions & 2 deletions src/openfermion/circuits/gates/fermionic_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def interaction_operator_generator(

class QuadraticFermionicSimulationGate(InteractionOperatorFermionicGate,
cirq.InterchangeableQubitsGate,
cirq.TwoQubitGate, cirq.EigenGate):
cirq.EigenGate):
r"""``(w0 |10⟩⟨01| + h.c.) + w1 |11⟩⟨11|`` interaction.
With weights $(w_0, w_1)$ and exponent $t$, this gate's matrix
Expand Down Expand Up @@ -435,6 +435,9 @@ class QuadraticFermionicSimulationGate(InteractionOperatorFermionicGate,
def num_weights(cls):
return 2

def _num_qubits_(self) -> int:
return 2

def _decompose_(self, qubits):
r = 2 * abs(self.weights[0]) / np.pi
theta = _arg(self.weights[0]) / np.pi
Expand Down Expand Up @@ -532,7 +535,7 @@ def fswap(self, i: int = 0):


class CubicFermionicSimulationGate(InteractionOperatorFermionicGate,
cirq.ThreeQubitGate, cirq.EigenGate):
cirq.EigenGate):
r"""``w0|110⟩⟨101| + w1|110⟩⟨011| + w2|101⟩⟨011|`` + h.c. interaction.
With weights $(w_0, w_1, w_2)$ and exponent $t$, this gate's
Expand Down Expand Up @@ -576,6 +579,9 @@ class CubicFermionicSimulationGate(InteractionOperatorFermionicGate,
def num_weights(cls):
return 3

def _num_qubits_(self) -> int:
return 3

@classmethod
def wire_symbol(cls, use_unicode: bool):
return '↕↓↑' if use_unicode else 'na*a'
Expand Down

0 comments on commit 5360bc9

Please sign in to comment.