Skip to content

About

Implements a quantum computer emulator as well as a complex matrix math library built from scratch.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quantum Computer Emulator

This project runs a quantum computing emulator that allows you to visualize and create quantum circuits. Along with this, there are a few other projects I made along the way in here, such as a double slit experiment and a matrix calculator. This project is programmed in Java and uses the JavaFX library, which requires some special setup. Some directions on setting it up with Visual Studio Code are provided at the end of this README.

GUI Overview

Before getting into how to set up a quantum circuit, I'd like to first explain the visuals of this program. This program allows to create basic quantum logic circuits, however these look quite different than traditional logic circuits. In quantum computing, all actions must be reversible, (excluding measurement) so we depict each qubit, the fundamental unit of quantum data as a wire. Throughout the circuit, operations are performed on wires and between wires. On default settings, the emulator boots with five wires and five time steps. Each possible operation is preloaded as an identity operation, denoted by the diamond with an I in the center. This is a "do nothing" operation and serves to show where gates can be placed.

QubitExplanation

The initial state of the qubit can be configured to either 0 or 1 via clicking the button at the far left of the wire. If you want to start a qubit in a more exotic state, a custom gate can be used (more on that later). To clear a column of gates, use the "Clear" button at the top of the column. Finally, the measurement button, which is the half-circle with a line through it, will measure the quantum circuit and display the output.

Creating a Quantum Circuit

In order to create a proper quantum circuit, quantum gates must be placed on wires to perform that operation. To do this, simply drag a gate from the bottom hotbar onto a gate node (wherever an identity gate is placed).

singlequbitgatetutorial

There are three different types of quantum gates that this program supports: single qubit gates, multi qubit gates on adjacent wires, and controlled gates in the forms of the CNOT and CCNOT gates. In the example above, the Hadamard Gate is an example of a single qubit state, which can be used to prepare a qubit into an equal superposition of the 0 and 1 states.

To place a multi qubit gate (only on adjacent wires), drag and drop to a point where there are at least (N-1) wires above that gate node, so that the dropped location becomes the bottom of the gate. The below example shows the placement of one of these gates.

multiqubitgatetutorial

Finally, to make a controlled-NOT or doubly controlled-NOT gate, the "Control Point" and "Reference Point" gates must be used. This language is a bit paradoxical for those already familiar with quantum computing. The "Reference Point(s)" are the controls of the gate, and the control point is the target. When all "Reference Points" are in the 1 state, an X gate is applied to the target. To create one of these, first place a control point and then references can be added to that respective column. NOTE: Any other gates in the column beside these two types of points will be ignored when the controlled operation is present!

controlledgatetutorial

Finally, when hitting one of the measurement symbols, the circuit will be ran and the output displayed. This notice first shows what was observed in a random measurement, and secondly it shows the population breakdown of the resulting quantum state - showing how likely each possible result was. Below is an example readout of a Grover's Search circuit.

exampleresult

Notes on Setting up JavaFX (If running the program)

First, you'll need a javafx sdk downloaded on your device. If you don't have this, download the sdk here: https://gluonhq.com/products/javafx/. Once downloaded, unzip the file and keep track of where it is on your computer, as we'll need to reference it a few times.

Next, clone this repository and open it in your IDE. I used VS Code to develop this, so all of the instructions will be in that IDE. In vscode, do ctrl+shift+P and look for the command labelled Java:Configure Classpath. Finally, click on the tab labelled library. Your result should look similar to this:

tutorial1

To get JavaFX working, we need to add its code to the library. Click on the add library button and enter the lib folder in the sdk downloaded in the first step. Select all of the jar files in the folder and confirm selection.

tutorial2

Your library tab should look like below:

tutorial3

There is one final step: telling the Java runtime where the sdk is located. Open the launch.json file. Edit the two "vmArgs" so that the file path routes to your sdk's lib folder.

tutorial4

That's it! Try running the App.java file - an application should open after a moment.

About

Implements a quantum computer emulator as well as a complex matrix math library built from scratch.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages