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

V0.19.1 updates #86

Merged
merged 5 commits into from
May 4, 2020
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

### Breaking changes

* Now supports Qiskit version 0.18.3. As a result of breaking changes
within Qiskit, version 0.17 and below are no longer supported.
* Now supports Qiskit version 0.19.1. As a result of breaking changes
within Qiskit, version 0.18 and below are no longer supported.
[(#81)](https://github.com/XanaduAI/pennylane-qiskit/pull/81)
[(#85)](https://github.com/XanaduAI/pennylane-qiskit/pull/85)
[(#86)](https://github.com/XanaduAI/pennylane-qiskit/pull/86)

### Improvements

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
qiskit>=0.18.3
qiskit>=0.19.1
pennylane
numpy
networkx==2.3
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
long_description = fh.read()

requirements = [
"qiskit>=0.18.3",
"qiskit>=0.19.1",
"pennylane>=0.8.1",
"numpy"
]
Expand Down
39 changes: 3 additions & 36 deletions tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def test_extra_parameters_were_passed(self, recorder):
with recorder:
quantum_circuit(params={theta: 0.5, phi: 0.3})

@pytest.mark.parametrize("qiskit_operation, pennylane_name", [(QuantumCircuit.crx, "CRX"), (QuantumCircuit.crz, "CRZ")])
@pytest.mark.parametrize("qiskit_operation, pennylane_name", [(QuantumCircuit.crx, "CRX"), (QuantumCircuit.crz, "CRZ"), (QuantumCircuit.cry, "CRY")])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!!

def test_controlled_rotations(self, qiskit_operation, pennylane_name, recorder):
"""Tests loading a circuit with two qubit controlled rotations (except
for CRY)."""
Expand All @@ -275,39 +275,6 @@ def test_controlled_rotations(self, qiskit_operation, pennylane_name, recorder):
assert recorder.queue[0].params == [0.5]
assert recorder.queue[0].wires == [0, 1]

def test_cry(self, recorder):
"""Tests that the decomposition of the controlled-Y operation is being
loaded."""
# This test will be merged into the test_controlled_rotations test once
# the native CRY is used in Qiskit and not a set of instructions
# yielded from decomposition is being added

q2 = QuantumRegister(2)
qc = QuantumCircuit(q2)

qc.cry(0.5, q2[0], q2[1])

quantum_circuit = load(qc)

with recorder:
quantum_circuit()

assert len(recorder.queue) == 4
assert recorder.queue[0].name == "U3"
assert recorder.queue[0].params == [0.25, 0, 0]
assert recorder.queue[0].wires == [1]

assert recorder.queue[1].name == "CNOT"
assert recorder.queue[1].wires == [0, 1]

assert recorder.queue[2].name == "U3"
assert recorder.queue[2].params == [-0.25, 0, 0]
assert recorder.queue[2].wires == [1]

assert recorder.queue[3].name == "CNOT"
assert recorder.queue[3].wires == [0, 1]


def test_one_qubit_operations_supported_by_pennylane(self, recorder):
"""Tests loading a circuit with the one-qubit operations supported by PennyLane."""

Expand Down Expand Up @@ -1015,8 +982,8 @@ def test_gradient(self, theta, phi, varphi, analytic, tol):
qc.rx(qiskit_params[0], 0)
qc.rx(qiskit_params[1], 1)
qc.rx(qiskit_params[2], 2)
qc.cnot(0, 1)
qc.cnot(1, 2)
qc.cx(0, 1)
qc.cx(1, 2)

# convert to a PennyLane circuit
qc_pl = qml.from_qiskit(qc)
Expand Down