Skip to content

Create explicit C3XGate/C4XGate in MCXGrayCode#5601

Merged
mergify[bot] merged 6 commits into
Qiskit:masterfrom
enavarro51:create_c3x_c4x_in_mcxgraycode_5447
Jan 21, 2021
Merged

Create explicit C3XGate/C4XGate in MCXGrayCode#5601
mergify[bot] merged 6 commits into
Qiskit:masterfrom
enavarro51:create_c3x_c4x_in_mcxgraycode_5447

Conversation

@enavarro51
Copy link
Copy Markdown
Contributor

Summary

Fixes #5447

Details and comments

In the current master, the MCXGate will explicitly create a CXGate or CCXGate if num_ctrl_qubits is 1 or 2, respectively, for all modes of the MCXGate. If there are no ancillas, then MCXGrayCode is used, and in this PR, a C3XGate or a C4XGate are explicitly created if num_ctrl_qubits is 3 or 4, respectively. For example, in this circuit, 2 C3XGates are created.

qc = QuantumCircuit(4)
qc.mcx([0, 1, 2], [3])
qc.append(MCXGrayCode(3), [0, 1, 2, 3])

@enavarro51 enavarro51 requested a review from a team as a code owner January 11, 2021 00:32
Copy link
Copy Markdown
Collaborator

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix!

@mergify mergify Bot merged commit 3b59319 into Qiskit:master Jan 21, 2021
@ajavadia ajavadia added the stable backport potential Make Mergify open a backport PR to the most recent stable branch on merge. label Jan 21, 2021
mergify Bot pushed a commit that referenced this pull request Jan 21, 2021
* Make MCX a C3X or C4X if MCXGrayCode and 3 or 4 controls

* Update test

* Place all explicit in MCXGrayCode

Co-authored-by: Julien Gacon <gaconju@gmail.com>
(cherry picked from commit 3b59319)
mergify Bot added a commit that referenced this pull request Jan 25, 2021
* Create explicit C3XGate/C4XGate in MCXGrayCode (#5601)

* Make MCX a C3X or C4X if MCXGrayCode and 3 or 4 controls

* Update test

* Place all explicit in MCXGrayCode

Co-authored-by: Julien Gacon <gaconju@gmail.com>
(cherry picked from commit 3b59319)

* Update releasenotes/notes/mcx_create_explicit_c3x_c4x-d4475c0bb70fae49.yaml

Co-authored-by: Edwin Navarro <enavarro@comcast.net>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
@kdk kdk added the Changelog: Changed Add a "Changed" entry in the GitHub Release changelog. label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: Changed Add a "Changed" entry in the GitHub Release changelog. stable backport potential Make Mergify open a backport PR to the most recent stable branch on merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explicitly construct C3X and C4X in MCXGrayCode

4 participants