diff --git a/src/tequila/circuit/_gates_impl.py b/src/tequila/circuit/_gates_impl.py index 25e40cfa..926a7718 100644 --- a/src/tequila/circuit/_gates_impl.py +++ b/src/tequila/circuit/_gates_impl.py @@ -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 diff --git a/src/tequila/circuit/gates.py b/src/tequila/circuit/gates.py index a754c3ad..312a1811 100644 --- a/src/tequila/circuit/gates.py +++ b/src/tequila/circuit/gates.py @@ -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"