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

Update random_circuit fuction in qiskit.circuit.random.utils.py #13054

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

PhysicsQoo
Copy link

Summary

Adding random_clifford_T_circuit to support random circuits selects T and Tdg as elements.

Details and comments

part of #13053

Adding random_clifford_T_circuit to support random circuits selects T and Tdg as elements.
@PhysicsQoo PhysicsQoo requested a review from a team as a code owner August 29, 2024 02:34
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Aug 29, 2024
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@CLAassistant
Copy link

CLAassistant commented Aug 29, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Cryoris
Copy link
Contributor

Cryoris commented Aug 30, 2024

Thanks for opening a PR @PhysicsQoo! But I think we could tackle your issue in a bit a more general fashion, I just left a comment on your issue.

Description:

Added a gates: list[str] | None argument, replacing the hardcoded gate list with standard_gates.get_standard_gate_name_mapping().
Introduced a parameterized argument, allowing users to select whether they want parameterized rotation gates.
Known Issue:

The parameterized functionality currently encounters an AttributeError: 'Parameter' object has no attribute '_root_uuid'. This issue is yet to be resolved.
The feature works correctly when parameterized = False.
@PhysicsQoo
Copy link
Author

PhysicsQoo commented Aug 31, 2024

Description:

Added a gates: str | list[str] ='all' argument, replacing the hardcoded gate list with standard_gates.get_standard_gate_name_mapping().
Introduced a parameterized argument, allowing users to select whether they want parameterized rotation gates.

Known Issue:

The parameterized functionality currently encounters an AttributeError: 'Parameter' object has no attribute '_root_uuid'. This issue is yet to be resolved.
The feature works correctly when parameterized = False.

@PhysicsQoo PhysicsQoo changed the title Update utils.py to add random_clifford_T_circuit fuction Update random_circuit fuction in qiskit.circuit.random.utils.py Aug 31, 2024
@Cryoris
Copy link
Contributor

Cryoris commented Sep 3, 2024

Dear @PhysicsQoo, it's nice to see that you're motivated to implement the additions to the random circuit -- but we have to approach this a bit differently: for this PR, we cannot remove existing functionality.

We can do the following steps:

  • Start by only adding support for an additional gates argument in the random_circuit function. All other arguments remain in place, and we have to add the argument at the end (to not break user code that was using arguments positionally). So the new signature would be
        def random_circuit(
        num_qubits,
        depth,
        max_operands=4,
        measure=False,
        conditional=False,
        reset=False,
        seed=None,
        num_operand_distribution: dict = None,
        gates=None,
    ):
  • Then, instead of the hardcoded lists gates_(1,2,3,4)q we would like to use the get_standard_gate_name_mapping function.
  • If gates was given by the user, we can then filter to have only the supported gates.

Importantly, we don't change any of the existing functionality that creates the circuit with a certain depth or handles the operand distribution or parameterization. In a next step, we can have a look at supporting also num_gates as termination criterion or other features, but it would be good to start with a single feature and understand the process 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PR PRs from contributors that are not 'members' of the Qiskit repo
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants