Skip to content

Commit

Permalink
add support for iswap gate (#229)
Browse files Browse the repository at this point in the history
* add support for iswap gate

* changelog entry
  • Loading branch information
timmysilv authored Sep 19, 2022
1 parent 46b8919 commit e2bf486
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### New features since last release

* Add support for the `ISWAP` operation.
[(#229)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/229)

### Breaking changes

### Improvements
Expand All @@ -14,6 +17,8 @@

This release contains contributions from (in alphabetical order):

Matthew Silverman

---
# Release 0.24.0

Expand Down
1 change: 1 addition & 0 deletions pennylane_qiskit/qiskit_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"CNOT": ex.CXGate,
"CZ": ex.CZGate,
"SWAP": ex.SwapGate,
"ISWAP": ex.iSwapGate,
"RX": ex.RXGate,
"RY": ex.RYGate,
"RZ": ex.RZGate,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
qml.adjoint(qml.T), qml.adjoint(qml.S), qml.adjoint(qml.SX)]

single_qubit_operations_param = [qml.PhaseShift, qml.RX, qml.RY, qml.RZ]
two_qubit = [qml.CNOT, qml.SWAP, qml.CZ]
two_qubit = [qml.CNOT, qml.SWAP, qml.CZ, qml.ISWAP]
two_qubit_param = [qml.CRZ, qml.IsingXX, qml.IsingYY, qml.IsingZZ]
three_qubit = [qml.Toffoli, qml.CSWAP]

Expand Down
10 changes: 3 additions & 7 deletions tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,13 +590,10 @@ def test_two_qubit_operations_supported_by_pennylane(self, recorder):

qc = QuantumCircuit(2, 1)

unitary_op = [[1, 0, 0, 0], [0, 0, 1j, 0], [0, 1j, 0, 0], [0, 0, 0, 1]]
iswap_op = Operator(unitary_op)

qc.cx(*two_wires)
qc.cz(*two_wires)
qc.swap(*two_wires)
qc.unitary(iswap_op, [0, 1], label="iswap")
qc.iswap(*two_wires)

quantum_circuit = load(qc)
with recorder:
Expand All @@ -616,9 +613,8 @@ def test_two_qubit_operations_supported_by_pennylane(self, recorder):
assert recorder.queue[2].parameters == []
assert recorder.queue[2].wires == Wires(two_wires)

assert recorder.queue[3].name == "QubitUnitary"
assert len(recorder.queue[3].parameters) == 1
assert np.array_equal(recorder.queue[3].parameters[0], np.array(unitary_op))
assert recorder.queue[3].name == "ISWAP"
assert recorder.queue[3].parameters == []
assert recorder.queue[3].wires == Wires(two_wires)

def test_two_qubit_parametrized_operations_supported_by_pennylane(self, recorder):
Expand Down

0 comments on commit e2bf486

Please sign in to comment.