Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User overloadable unitary modifiers (dagger, control, power) #585

Open
ss2165 opened this issue Oct 22, 2024 · 3 comments
Open

User overloadable unitary modifiers (dagger, control, power) #585

ss2165 opened this issue Oct 22, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@ss2165
Copy link
Member

ss2165 commented Oct 22, 2024

It is assumed there is some mechanism for automatically daggering, quantum controlling or powering (repeating) unitary subroutines. This may be higher order, with blocks. See #158 #361 etc.

Users should also be able to specify specialist implementations of these.

I propose using dunder methods for this:

@guppy_unitary
class MyOracle[N: int]:
    param: int # can be parametric instances
    __impl__(self, q: array[qubit, N]):
        ...
    __control__(self. q: array[qubit, N], ctrl: qubit):
        ...
    # dagger and power are still default
@ss2165 ss2165 added the enhancement New feature or request label Oct 22, 2024
@NathanCQC
Copy link
Collaborator

For context, this was one of the features users really enjoyed in qlibs regarding the speed of algorithm development.

@NathanCQC
Copy link
Collaborator

I will happily review this PR.

@jake-arkinstall
Copy link
Contributor

Extension request: provide __control__sqrt__ and __control_sqrt_inv__ to enable an arbitrary number of control qubits via recursion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants