Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to cirq 0.12 #748

Merged
merged 1 commit into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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