Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ryanhill1/qbraid-qiskit-challenge


https://github.com/ryanhill1/qbraid-qiskit-challenge

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

# qBraid-qiskit-challenge

In this coding challenge, your task is to write a program that generates the qiskit source code for a given `qiskit.QuantumCircuit` object.

For example, let's say I create a random qiskit circuit:

```python
>>> from qiskit.circuit.random import random_circuit
>>> qc = random_circuit(num_qubits=2, depth=3)
>>> qc.draw()
┌────────────┐┌───┐
q_0: ──■──┤ Rz(4.6866) ├┤ H ├
┌─┴─┐└──┬─────┬───┘└─┬─┘
q_1: ┤ H ├───┤ Sdg ├──────■──
└───┘ └─────┘
```

When this or any other circuit object is passed to your program, it should output a `.py` file containing qiskit code that could accuractely recreate the circuit. For the above example, the output file could look as follows:

```python
# program_output.py

from qiskit import QuantumRegister, QuantumCircuit

qreg_q = QuantumRegister(2, 'q')

circuit = QuantumCircuit(qreg_q)

circuit.ch(qreg_q[0], qreg_q[1])
circuit.rz(4.6865553, qreg_q[0])
circuit.sdg(qreg_q[1])
circuit.ch(qreg_q[1], qreg_q[0])
```

If someone copy and pasted the output code back into the same notebook, they should find that the two circuit objects are equivalent. For this task, you can restrict yourself to processing only gates and operations that are able to be generated by the `qiskit.circuit.random.random_circuit` function.

The way you architect and/or deliver your solution (i.e. as a script, package, single function, or other) is up to you, and you can use any external packages you wish.