Diving into Quantum Computing: WWCode Days of Code Day 3

Diving into Quantum Computing: WWCode Days of Code Day 3

Context: Starting Jan 8th, I'm challenging myself to dig deeper into a trending technology domain, summarize, and create a short code snippet on it every day, for 7 days, for the Days of Code challenge from Women Who Code!

What is quantum computing?

What: Quantum computing leverages quantum physics (specifically quantum bits or qubits) for complex problem-solving in domains, such as quantum chemistry (more below). In classical computing, bits are represented by either 0 or 1. With quantum computing, instead, qubits can represent both 0 and 1 states through superposition; once measured, the qubits will collapse to the state of 0 or 1.

Why: The benefit and enthusiasm (and hype) around quantum computing are centered around its solution space, which is much larger than what we can achieve with classical computing. To increase the power of our computer, rather than having to double the number of transistors as we currently do with classical computing, with quantum computing we can add qubits.

Quantum computing can therefore have significant implications for many domains, including:

  • Quantum chemistry, where we apply quantum mechanics to chemistry problems. In this space, computing methods can make it more efficient to discover and create new chemical materials. I was interested to find and learn more about some of the NIST projects evaluating and leveraging quantum chemistry computations for different projects! One of these projects is around how quantum chemistry computations are used for a condensed version of the Fukui function, which describes electron density.
  • Financial services, where quantum computing can enable large-scale simulations given various financial market parameters for risk management.
  • Security, where quantum algorithms could be used to create new encryption schemes. Quantum algorithms can also break that are encryption schemes used for secure connections across the Internet, requiring post-quantum cryptography to ramp up the security.

How:

The fundamentals of quantum computing start with quantum circuits. It’s then possible to expound upon basic circuits to build more complex algorithms, like machine learning algorithms, or other components used for applications like quantum chemistry!

How do you implement them?

Step 1: Pick your qubits

This step involves picking the qubits depending on the lattice you would like to use (e.g., 1d lattice, 2d square lattice).

Step 2: Construct your circuit

In this step, you choose the quantum (logic) gates you want to add to your circuit to achieve a specific computation. Simpler gates that we’re familiar with via classical computing are AND and NOT gates (CE for babies has a great explanation on this ??).

There are gates specific to quantum computing including:

  • Hadamard gates: Single qubit-gates that turn a state of |0? or |1? into a superposition of |0? and |1?.
  • Pauli gates: A series of gates (X gate, Y gate, and Z gate). The X-Gate is the easiest to grasp – it’s the quantum version of a NOT gate.
  • CNOT gates: These gates use a target qubit and a control qubit. If the control qubit is in state 0, the gate uses a Pauli-X gate to flip the target qubit; if the control qubit is 1, it doesn’t change the target qubit.
  • and more.

By adding gates to our circuit, we can create a specific quantum state, like a Bell state (more below).

Step 3: Simulate the circuit

In this step, we simulate a quantum computer using a classical computer, to get the results of the circuit we created.

Step 4: Measure the results

Finally, we measure the qubits, which means the qubits that are superimposed will collapse to the 0 or 1 states!

A short implementation

Having previously dabbled in IBM’s qiskit library to create quantum circuits, I decided to implement a small quantum circuit using Google Quantum AI’s open-source Cirq to get familiar with a new library!

Here, I used a small Python snippet from the Cirq docs on how to create a Bell state, an entangled quantum state of two qubits, and added additional documentation to my code snippet. Quantum entanglement is an interesting concept; with the Bell state, the qubits are:

-??????? In a superposition of the 0 and 1 states.

-??????? Simply put, correlated with each other.

To create a Bell state, the circuit needs to contain a Hadamard gate and a CNOT gate, as illustrated below!

Illustration of a Bell state from qiskit.

Short snipet of code: wwcode-challenge-2024/Day3_Quantum_Circuits.ipynb at main · riacheruvu/wwcode-challenge-2024 (github.com)

Resources

Reading resources on #quantumcomputing that I found interesting and helpful as a starting point!

Next topics


要查看或添加评论,请登录

Ria Cheruvu的更多文章

社区洞察

其他会员也浏览了