Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mmvandieren authored Jan 6, 2025
1 parent 0e0d043 commit c7dcad2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions quick-start-to-quantum/02_quick_start_to_quantum.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1182,8 +1182,9 @@
"## 2.4 Application: modular arithmetic\n",
"\n",
"\n",
"Shor's algorithm is a well-known example that has the potential to break RSA encryption, assuming it could be executed on a fault-tolerant quantum computer at a sufficiently large scale. While we won’t be implementing the full algorithm here (you can explore more details [here starting on page 341](https://www.thomaswong.net/introduction-to-classical-and-quantum-computing-1e4p.pdf), [Chapter 4 of these lecture notes](https://arxiv.org/pdf/2311.08445) or [chapter 3 of Mermin's book here](http://mermin.lassp.cornell.edu/qcomp/CS483.html)), we will focus on one step of the algorithm: performing modular arithmetic. This will serve as a demonstration of the concepts we've covered so far and offer an opportunity to encode classical information (in this case, an integer) onto qubits.\n",
"The circuit shown below, inspired by this article, performs the operation of multiplying $5y$ modulo $21$, with the initial state representing various values of $y = 1, 4, 5, 16, 17, 20$.\n",
"Shor's algorithm is a well-known example that has the potential to break RSA encryption, assuming it could be executed on a fault-tolerant quantum computer at a sufficiently large scale. While we won’t be implementing the full algorithm here (you can explore more details [here starting on page 341](https://www.thomaswong.net/introduction-to-classical-and-quantum-computing-1e4p.pdf), [Chapter 4 of these lecture notes](https://arxiv.org/pdf/2311.08445) or [chapter 3 of Mermin's book here](http://mermin.lassp.cornell.edu/qcomp/CS483.html) and you can view the code for Shor's algorithm [here](https://nvidia.github.io/cuda-quantum/latest/applications/python/shors.html)), we will focus on one step of the algorithm: performing modular arithmetic. This will serve as a demonstration of the concepts we've covered so far and offer an opportunity to encode classical information (in this case, an integer) onto qubits.\n",
"The circuit shown below, inspired by [this article](https://physlab.org/wp-content/uploads/2023/05/Shor_s_Algorithm_23100113_Fin.pdf), performs the operation of multiplying $5y$ modulo $21$, with the initial state representing various values of $y = 1, 4, 5, 16, 17, 20$.\n",
"\n",
"<img src=\"https://raw.githubusercontent.com/NVIDIA/cuda-q-academic/main/images/modular_circuit.png\" alt=\"circuit for computing 5y mod 21 for certain values of y\" width=\"200\"/>\n",
"\n",
" For instance, if we want to calculate $5 \\times 1 \\mod 21$, we would encode $y = 1$ by preparing the quantum state $\\ket{10000}$ through the application of an $X$ gate to qubit $q_0$:\n",
Expand All @@ -1199,7 +1200,7 @@
"id": "0476beda"
},
"source": [
"**EXERCISE 6:** Edit the code below to carry out the instructions of the circuit diagram above to verify that the outcome of the circuit is as expected. For example, when the circuit is initialized as $y = 20$, we should expect to sample the binary representation of 16 (which is `00001`) since $5*20 = 100 \\equiv 16\\mod{21}$."
"**EXERCISE 6:** Edit the code below to carry out the instructions of the circuit diagrams above to compute $5*y\\mod{21}$ and verify that the outcome of the circuit is as expected. For example, when the circuit is initialized as $y = 20$, we should expect to sample the binary representation of 16 (which is `00001`) since $5*20 = 100 \\equiv 16\\mod{21}$."
]
},
{
Expand Down

0 comments on commit c7dcad2

Please sign in to comment.