Skip to content

Generators#1

Open
georgios-ts wants to merge 3 commits intodevelfrom
generators
Open

Generators#1
georgios-ts wants to merge 3 commits intodevelfrom
generators

Conversation

@georgios-ts
Copy link
Owner

Unify gates by adding generator, U = exp(- i a / 2 G).

TODO:

  • Replace parameter of PowerGate with power . pi and fix this in Compiler.

@georgios-ts
Copy link
Owner Author

@kottmanj



def PowerGate(name: str, target: typing.Union[list, int], power: bool = None, control: typing.Union[list, int] = None):
def PowerGate(name: str, target: typing.Union[list, int], power: bool = None, control: typing.Union[list, int] = None,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name can now be auto-assigned by the generator or vice versa

would allow that
give name a default: name=None and just incude some consistency checks below

if name is None and generator is None:
raise TequilaException("name or generator needs to be provided to initialize a power gate")

if name is not None and generator is not None:
#failsafe for standard gates
if name.lower()=="x":
assert generator == paulis.X(target)
etc (would do for X, Y, Z and H)
warnings.warn("name {} and generator {} provided to PowerGate".format(name, generator), TequilaWarning)

@kottmanj
Copy link

kottmanj commented Dec 8, 2020

Looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants