Skip to content

Commit

Permalink
Simplify search for predecessors in graph
Browse files Browse the repository at this point in the history
  • Loading branch information
dieris committed Feb 29, 2016
1 parent 9e7ee60 commit 024efcd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions QGL/PulsePrimitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,10 @@ def Ztheta(qubit, angle=0, label='Ztheta', **kwargs):
# special cased because it can be done with a frame update
Zprod = TAPulse(label, qubit, length=0, amp=0, phase=0, frameChange=-angle)
if hasattr(ChannelLibrary.channelLib,"connectivityG"):
for node in ChannelLibrary.channelLib.connectivityG.nodes():
#shift the reference for all CR gates with qubit as the target
if ChannelLibrary.channelLib.connectivityG.has_predecessor(qubit,node):
CRchan = ChannelLibrary.channelLib.connectivityG.edge[node][qubit]['channel']
Zprod = Zprod*TAPulse(label, CRchan, length=0, amp=0, phase=0, frameChange=-angle)
#shift the reference for all CR gates with qubit as the target
for predecessor in ChannelLibrary.channelLib.connectivityG.predecessors(qubit):
CRchan = ChannelLibrary.channelLib.connectivityG.edge[predecessor][qubit]['channel']
Zprod = Zprod*TAPulse(label, CRchan, length=0, amp=0, phase=0, frameChange=-angle)
return Zprod

#Setup the default 90/180 rotations
Expand Down

0 comments on commit 024efcd

Please sign in to comment.