Open Neo-Cai opened 3 months ago
Hey! Will you please assign this challenge to me?
Hi! For unitary hack we will not assign issues until after the pull request has been made and we can confirm that the bounty has been completed. Once you have a pull request, link it to this issue and I will assign it! Thanks
@Neo-Cai Is this issue and #9 still open to work as a bounty issue? Due to time constraint, I couldn't create a working PR during UnitaryHack.
Overview
Challenge mode is meant to help the user build an intuition for gate operations on a single, two-level qubit by allowing them to use buttons to navigate along the Bloch Sphere, a core representational schema for Qubit States in quantum computing.
General Requirements
To collect the bounty, you must implement
Figma
The figma for all of the requirements can be found here
Requirement Specs
Bloch Sphere and Gate Buttons
The Bloch sphere is a representation of all of the possible states on a Qubit. Using X-Gates and Y-Gates, we can flip the Qubit State between two poles of the Bloch sphere, |0〉and |1〉. This is similar to how a transistor flips between 1 and 0 for computational purposes.![image 3](https://github.com/mvwf/qublitz/assets/108304075/d6053aa8-d148-45d9-858a-f2b73bcc7e47)
The Bloch Sphere is plotted using
plotly.graph_objects
and takes in x, y, and z values that are outputted from thequantum_simulator
package already installed in the Challenge Mode home page.The X-Gate and Y-Gate buttons are clickable interfaces pictured below:![Slice 3](https://github.com/mvwf/qublitz/assets/108304075/927c1bfa-e1df-4d0c-99ef-f2669fe81ddd)
When pressing the X-Gate or Y-Gate buttons provided, the quantum simulator is fed a specific square pulse using the
add_square
function that is tuned to the type of gate the user selects. The output of the quantum simulator is then used by the Bloch sphere to plot a path.For example, when pressing the X-Gate button we get a rotation path about the x-axis that goes from |0〉to |1〉:![x-gate](https://github.com/mvwf/qublitz/assets/108304075/89fa9898-6fc5-4004-9454-ccaf734e98f1)
When pressing the Y-Gate button we get a transition from |0〉to |1〉but about the y-axis:![y-gate](https://github.com/mvwf/qublitz/assets/108304075/4b8c2685-12ef-4dea-9e3f-5bed5443a168)
Required Change: currently, when the user presses either button, the paths are plotted on a completely new graph. You cannot show a sequence of gates where there is first an X-gate path and then a Y-Gate path. Modify the buttons and bloch sphere such that the plot remembers the previous paths taken and displays them. See this illustration in Figma.
First the user presses the X-Gate Button:
Then they press the Y-Gate Button:
Notice how the X-gate path remains but is faded.
Required Change: additionally, the simulation only displays where on the Bloch sphere the Qubit has rotated to, it does not store the state information anywhere. Eg. are we at |0〉or |1〉. It is useful to add a way to store the state of the qubit based on the gate applied. This can be done using some simple matrix multiplications: |0〉and |1〉can be represented as [0; 1] and [1; 0] vectors respectively. The X-Gate and Y-Gate can be represented as [0, 1; 1, 0] and [0, i; -i, 0] (2x2 matrices). Performing a gate is doing a matrix multiplication on the vectors. For example, a Y-Gate on |0〉is just [0, i; -i, 0] * [0; 1]. The output is [i; 0] which is just i|1〉.
Gate Operation Timeline
With each button press, the gate operation timeline will help the user keep track of what gates they have used and what state they are in. Every qubit will start in the |0〉state and then record the gate the user selects and the new state as a result of that operation. See the figma link for how these progress with each button press.![Slice 4](https://github.com/mvwf/qublitz/assets/108304075/cb2da29b-65a7-4575-bbce-308761567a42)
Menu
The menu allows the user to navigate between pages. For now, the levels and pulse challenge buttons can link to placeholder pages while the gate challenge and tutorial buttons should link to the pages created in this issue.
The page that you are on should be highlighted in a difference shade of blue as pictured above.
Tutorial Sequence
Ideally, this should be an independent page. The tutorial sequence takes the user through the buttons and the bloch sphere and show follow the dialogue in the Figmas. Where there are no "next" buttons, the user must complete the action prompted in the dialogue box. Once they do, the tutorial will automatically progress. Else, they press next to progress. When the user presses "Go to Challenge!" they will be taken to the Challenge page.
Challenge Sequence
Ideally, this also should be an additional independent page. The Challenge sequence takes the user through 5 challenges. They will be asked to:
Each dialogue box will display the navigation challenge. When the user reaches the navigation objective, they progress to the next challenge. After each challenge is completed, the Challenge ticker will update. Eg. this indicates you are on the 4th Challenge:![Slice 6](https://github.com/mvwf/qublitz/assets/108304075/0d56a0f1-eeae-440a-a2e7-3be131ec89eb)
Tip
To make a continuous sequence of gates that is "stored" on the plot, you may have to store the previous step pulses (Gates) and replot it with each new button push. You can manually do this in free play mode already by adding 20 ns Square Pulse in the X Channel and then a 20 ns Square Pulse in the Y Channel afterward. Like so:![image](https://github.com/mvwf/qublitz/assets/108304075/068f9d29-63c3-4464-911c-67b388091349)
The Bloch Sphere is then displayed like so:![image](https://github.com/mvwf/qublitz/assets/108304075/6f1b6dcf-f6bc-459c-839a-dca4c07934b4)