Skip to content

Use MultiControlX for all controlled-x-like gates #1556

@mpharrigan

Description

@mpharrigan

I was thinking the natural thing to do here should be to return an instance of the MultiControlX gate if you do Toffoli().controlled(), but then I checked that we don't return MultiControX from XGate.controlled() or CNOT.controlled() either.

This works for now. Eventually, it'll be nice to have the same bloq constructed upon calling

>>> XGate().controlled(CtrlSpec(cvs=[1, 1, 1, 1, 1]))
>>> CNOT().controlled(CtrlSpec(cvs=[1, 1, 1, 1]))
>>> Toffoli().controlled(CtrlSpec(cvs=[1, 1, 1]))

and the natural bloq to return for all three would be MultiControlX(cvs=(1, 1, 1, 1, 1)).

Originally posted by @tanujkhattar in #1552 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions