Qiskit / documentation

The documentation content home for https://docs.quantum.ibm.com.
https://docs.quantum.ibm.com
Apache License 2.0
38 stars 79 forks source link

Better documentation on Registers and Qubits #1469

Open Eric-Arellano opened 5 months ago

Eric-Arellano commented 5 months ago

URL, if applicable

Probably https://docs.quantum.ibm.com/build/circuit-construction

Describe the new content you are requesting.

This is user feedback from Qiskit Slack. A user asked this SO question: https://quantumcomputing.stackexchange.com/questions/38565/unable-to-extract-the-quantum-registers-information-from-qiskit-quantum-circuit

slack user 2: Once you have your Qubit isolated you can retrieve the index by doing: qc.qubits.index(your_qubit) where qc is your QuantumCircuit object

slack user 1: Thank you very much! I have been searching all over the internet for the answer for the past 2 days

Yes I find the documentation to be not super clear on how Registers and Qubits are handled

If this new content request is accepted, do you want to write the content?

no

shraddha-aangiras commented 5 months ago

Hi! Could I contribute to this issue?

abbycross commented 5 months ago

Thanks @shraddha-aangiras for contributing! I've assigned you to this issue.

AbdullahKazi500 commented 4 months ago

Thanks @shraddha-aangiras for contributing! I've assigned you to this issue.

The provided documentation for constructing and manipulating quantum circuits in Qiskit is largely correct, but the issue arises in how to extract the index of a qubit from a Qubit object. The documentation doesn't clarify this part, which can cause confusion, as seen in the user's query. To improve clarity, it should explicitly mention methods for extracting qubit indices from the Qubit objects

I have modified the code base while running the code it gives the following results

Name of gate: Instruction(name='u', num_qubits=1, num_clbits=0, params=[0, 0, 3.141592653589793])
qargs indices (find_bit): [1]
qargs indices (index): [1]

Name of gate: Instruction(name='cx', num_qubits=2, num_clbits=0, params=[])
qargs indices (find_bit): [2, 0]
qargs indices (index): [2, 0]

Both methods effectively extract the indices of the quantum registers for each gate in the circuit. This resolves the original issue of extracting the register information from Qubit objects. You can use either method depending on your preference or specific requirements in your quantum circuit operations.

AbdullahKazi500 commented 4 months ago

Hi @abbycross I think I tried making changes to the original ipynb file but for some reason it was not rendering in preview so the best option would be to rewrite it again for now I have just added a PR linking my notebook implementation of the solution if approved I can rewrite the section again incorporating the changes let me know

shraddha-aangiras commented 4 months ago

Hi @abbycross I think I tried making changes to the original ipynb file but for some reason it was not rendering in preview so the best option would be to rewrite it again for now I have just added a PR linking my notebook implementation of the solution if approved I can rewrite the section again incorporating the changes let me know

Hi @AbdullahKazi500 I'm currently assigned to this issue and am currently writing a more comprehensive documentation regarding Registers and Circuits. A part of it addresses the issue described on Slack, while the rest focused on other aspects that aren't specified explicitly on the docs

frankharkins commented 4 months ago

@AbdullahKazi500: @shraddha-aangiras has been assigned to this issue. Generally, do not try to work on an issue that another user has been assigned to as it duplicates effort.

shraddha-aangiras commented 4 months ago

@frankharkins can I continue working on this issue? I will make a pull request later today that addresses not only the qubit indexing, but improves documentation on registers and qubits overall. Thanks!

frankharkins commented 4 months ago

@shraddha-aangiras yes please, thank you.

AbdullahKazi500 commented 4 months ago

@AbdullahKazi500: @shraddha-aangiras has been assigned to this issue. Generally, do not try to work on an issue that another user has been assigned to as it duplicates effort.

Hi Frank okay but I have not heard back on the blog I want to contribute to qiskit in some way can you please update me about it