Skip to content

Commit

Permalink
Merge a10dcaa into f282ca4
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Ristè committed Oct 8, 2019
2 parents f282ca4 + a10dcaa commit 077e9d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions QGL/ChannelLibraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,13 +542,13 @@ def set_control(self, qubit_or_edge, transmitter, generator=None):
qubit_or_edge.phys_chan.generator = generator
self.update_channelDict()

def new_edge(self, source, target):
def new_edge(self, source, target, cnot_impl=config.cnot_implementation):
label = f"{source.label}->{target.label}"
if label in self.channelDict:
edge = self.channelDict[f"{source.label}->{target.label}"]
logger.warning(f"The edge {source.label}->{target.label} already exists: using this edge.")
else:
edge = Channels.Edge(label=f"{source.label}->{target.label}", source=source, target=target, channel_db=self.channelDatabase)
edge = Channels.Edge(label=f"{source.label}->{target.label}", source=source, target=target, cnot_impl = cnot_impl, channel_db=self.channelDatabase)
self.add_and_update_dict(edge)
return edge

Expand Down
8 changes: 7 additions & 1 deletion QGL/PulsePrimitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,13 @@ def CNOT_simple(source, target, **kwargs):

@_memoize
def CNOT(source, target, **kwargs):
cnot_impl = globals()[config.cnot_implementation]
channel = ChannelLibraries.EdgeFactory(source, target)
if hasattr(channel, 'cnot_impl'):
cnot_impl_name = channel.cnot_impl
#print(f'Chosen CNOT implementation: {cnot_impl_name}')
else:
cnot_impl_name = config.cnot_implementation
cnot_impl = globals()[cnot_impl_name]
return cnot_impl(source, target, **kwargs)

# The worker method for MEAS and MEASA
Expand Down
2 changes: 1 addition & 1 deletion QGL/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

# select a CNOT implementation (a name of a Pulse function that implements
# CNOT in your gate set, e.g. CNOT_simple or CNOT_CR)
cnot_implementation = "CNOT_simple"
cnot_implementation = "CNOT_CR"

def load_config():
global config_file
Expand Down

0 comments on commit 077e9d2

Please sign in to comment.