Skip to content

Commit

Permalink
Bugfix: target order matters in QubitExcitation.
Browse files Browse the repository at this point in the history
  • Loading branch information
dariavh committed Sep 21, 2023
1 parent 2a2d11f commit 8a8399e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/tequila/circuit/_gates_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,10 @@ def extract_targets(generator):
targets += [k for k in ps.keys()]
return tuple(set(targets))

def __init__(self, angle, generator, p0=None, control=None, eigenvalues_magnitude=0.5, steps=1, name="GenRot", assume_real=False):
super().__init__(eigenvalues_magnitude=eigenvalues_magnitude, generator=generator, assume_real=assume_real, name=name, parameter=angle, target=self.extract_targets(generator), control=control)
def __init__(self, angle, generator, p0=None, control=None, target=None, eigenvalues_magnitude=0.5, steps=1, name="GenRot", assume_real=False):
if target == None:
target = self.extract_targets(generator)
super().__init__(eigenvalues_magnitude=eigenvalues_magnitude, generator=generator, assume_real=assume_real, name=name, parameter=angle, target=target, control=control)
self.steps = steps
if control is not None:
# augment p0 for control qubits
Expand Down
2 changes: 1 addition & 1 deletion src/tequila/circuit/gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ def __init__(self, angle, target, generator=None, p0=None, assume_real=True, con
assert generator is not None
assert p0 is not None

super().__init__(name="QubitExcitation", angle=angle, generator=generator, p0=p0, control=control, assume_real=assume_real, steps=1)
super().__init__(name="QubitExcitation", angle=angle, generator=generator, target=target, p0=p0, control=control, assume_real=assume_real, steps=1)

if compile_options is None:
self.compile_options = "optimize"
Expand Down

0 comments on commit 8a8399e

Please sign in to comment.