Projects Gallery

Project Details:

Four Qubit Adder
Actions:



This is not the most efficient known algorithm for performing arithmetic on a quantum computer but it is a good and relevant example.

The 'Sum' circuit adds the input values from the first two qubits and places the result in the third qubit. The 'Carry' circuit adds the carry-in value from the first qubit with the input values from the second and third qubit and places the result and the carry-out value in the third and the fourth qubit respectively.

The Adder circuit is a 4-qubit adder. The input qubits can be identified in the circuit by the presence an X gate in the first layer of gates in the circuit such that the input value is 1 for each input qubit. The Id gates in the first layer of the circuit indicate the qubits neede to hold the carry-in qubit or the carry-out qubits or both carry-in and carry-out qubits. The qubits with measure gates are exactly those qubits which one needs to measure in order to extract de addition result.

As you would expect the result of adding 1111 with 1111 is 11110 which corresponds to number 30 in decimal base. In order to see that, DO NOT FORGET to un-check the Big Endian ordering checkbox because casting the measured state to numbers works when using Little Endian convention for qubit and bit ordering. You might also want to uncheck the base-2 checkbox in order to see decimal results.

You can play around and modify the input value by removing some the the Pauli-X gates in the first layer of gates.

Circuit Name Qubits Modified
 
Adder Circuit 13 22-07-13 14:50
Carry 4 22-07-13 14:42
Sum 3 22-07-13 14:42