Skip to content

Commit

Permalink
fix bug (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariaschuld committed Aug 6, 2020
1 parent 77c7c95 commit c1efdad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pennylane_forest/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from pyquil.api._config import PyquilConfig

from pyquil.quil import DefGate
from pyquil.gates import X, Y, Z, H, PHASE, RX, RY, RZ, CZ, SWAP, CNOT, S, T, CSWAP
from pyquil.gates import X, Y, Z, H, PHASE, RX, RY, RZ, CZ, SWAP, CNOT, S, T, CSWAP, I

# following gates are not supported by PennyLane
from pyquil.gates import CPHASE00, CPHASE01, CPHASE10, CPHASE, CCNOT, ISWAP, PSWAP
Expand All @@ -66,7 +66,8 @@ def basis_state(par, *wires):
list: list of PauliX matrix operators acting on each wire
"""
# pylint: disable=unused-argument
return [X(w) for w, p in zip(wires, par) if p == 1]
# need the identity here because otherwise only the "p=1" wires register in the circuit
return [X(w) if p == 1 else I(w) for w, p in zip(wires, par)]


def qubit_unitary(par, *wires):
Expand Down

0 comments on commit c1efdad

Please sign in to comment.