Skip to content

LogicGates

themaddoctor1 edited this page Nov 19, 2014 · 2 revisions

The LogicGates class is a class in the computer package holds several methods that are used to simulate various logic gates. This class is used mainly by the Interpreter class to execute code that is entered by the user in the user-created script. It is not used to create objects, as every method is static. See the list below for descriptions of each method.

#####public static void CCNOT_X(Qubit a, Qubit b, Qubit c)

This method is used to perform a CCNOT gate using Qubits a, b, and c on the x-axis. The code is written so that if the value of a is 1, it will perform a CNOT operation on b and c, which is essentially how a CCNOT gate works.

#####public static void CCNOT_Y(Qubit a, Qubit b, Qubit c)

This method is used to perform a CCNOT gate using Qubits a, b, and c on the y-axis. The code is written so that if the value of a is 1, it will perform a CNOT operation on b and c, which is essentially how a CCNOT gate works.

#####public static void CCNOT_Z(Qubit a, Qubit b, Qubit c)

This method is used to perform a CCNOT gate using Qubits a, b, and c on the z-axis. The code is written so that if the value of a is 1, it will perform a CNOT operation on b and c, which is essentially how a CCNOT gate works.

#####public static void CNOT_X(Qubit a, Qubit b)

This method is used to perform a CNOT gate using Qubits a and b on the x-axis. After performing the transformation, it accesses the QuantumComputer class's Register object and runs the performEntanglementChange() method using both a and b.

#####public static void CNOT_Y(Qubit a, Qubit b)

This method is used to perform a CNOT gate using Qubits a and b on the x-axis. After performing the transformation, it accesses the QuantumComputer class's Register object and runs the performEntanglementChange() method using both a and b.

#####public static void CNOT_Z(Qubit a, Qubit b)

This method is used to perform a CNOT gate using Qubits a and b on the x-axis. After performing the transformation, it accesses the QuantumComputer class's Register object and runs the performEntanglementChange() method using both a and b.

#####public static void CSWAP_X(Qubit a, Qubit b, Qubit c)

This method is used to perform a CSWAP gate using Qubits Qubits a, b, and c on the x-axis. The code is written so that if the value of a is 1, it will perform a SWAP operation on b and c, which is essentially how a CSWAP gate works.

#####public static void CSWAP_Y(Qubit a, Qubit b, Qubit c)

This method is used to perform a CSWAP gate using Qubits Qubits a, b, and c on the y-axis. The code is written so that if the value of a is 1, it will perform a SWAP operation on b and c, which is essentially how a CSWAP gate works.

#####public static void CSWAP_Z(Qubit a, Qubit b, Qubit c)

This method is used to perform a CSWAP gate using Qubits Qubits a, b, and c on the x-axis. The code is written so that if the value of a is 1, it will perform a SWAP operation on b and c, which is essentially how a CSWAP gate works.

#####public static void NOT(Qubit q)

This method will flip the value of a Qubit to the opposite state. To do this, it runs the PauliX(), PauliY(), and PauliZ() methods using q.

#####public static void PauliX(Qubit q)

This method is used to perform a Pauli-X gate on Qubit q given as input to the method. After performing the transformation, it accesses the QuantumComputer class's Register object and runs the performEntanglementChange() method using q as input.

#####public static void PauliY(Qubit q)

This method is used to perform a Pauli-Y gate on Qubit q given as input to the method. After performing the transformation, it accesses the QuantumComputer class's Register object and runs the performEntanglementChange() method using q as input.

#####public static void PauliZ(Qubit q)

This method is used to perform a Pauli-Z gate on Qubit q given as input to the method. After performing the transformation, it accesses the QuantumComputer class's Register object and runs the performEntanglementChange() method using q as input.

#####public static void Swap(Qubit a, Qubit b)

This method swaps two qubits, a and b between positions, and then makes the necessary changes to the list of entangled quibts. After performing the transformation, it accesses the QuantumComputer class's Register object and runs the performEntanglementChange() method using both a and b as input.

Clone this wiki locally