QuantumComputer ClassA Sandcastle Documented Class Library
The main class for quantum computation.
Remarks

QuantumComputer is a singleton, which instance can be obtained by calling GetInstance  method. QuantumComputer can create and delete the Register class (Registers cannot be created independently by new operator). Quantum computations can be performed by Register class, but also by QuantumComputer class, by using its extension methods located in namespace Quantum.Operations.

Inheritance Hierarchy

System Object
  Quantum QuantumComputer

Namespace: Quantum
Assembly: Quantum (in Quantum.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax

public class QuantumComputer : IQuantumComputer

The QuantumComputer type exposes the following members.

Methods

  NameDescription
Public methodDeleteRegister
Deletes register, given in argument, with its references, which enables freeing the memory by garbage collector. Registers consume large amount of memory, so this method is very useful when computations are complex and requires many registers.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodStatic memberGetInstance
Method for obtaining QuantumComputer's singleton instance.
Public methodGetRootRegister
Connects given registers into one root register and returns that root. If registers was already connected, returns simply their root register. It is strongly required before doing any operation on qubits in different registers. This method is used at the begin of every operation from namespace Quantum.Operations, as these methods usually operate on more than one register.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodNewRegister(IDictionary UInt64, Complex , Int32)
Creates new Register, with given width and initial states with their amplitudes. Very useful, when there is a need for creating register in nontrivial state, with some possible values.
Public methodNewRegister(UInt64, Int32, Nullable Int32 )
Creates new Register, with given width and initial state.
Public methodTensorProduct
Returns the tensor product of given registers. It has the same result as connecting registers into one in the method GetRootRegister( RegisterRef ). However, tensor product could be obtained only when given arguments are independent registers (neither connected with nor being a part of any other register).
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods

  NameDescription
Public Extension MethodAdd(Register, Register)Overloaded.

Adds two registers. The result is stored in the second. No extra registers are required.

Add(a, b, 0) -> (a, a+b, 0)

This method checks if arguments are valid. If not, an exception is thrown. The following conditions must be satisfied:

  • Registers a and b must not overlap
  • Register b must be exactly one bit wider than register a

(Defined by AddExtension.)
Public Extension MethodAdd(Register, Register, Register)Overloaded.

Adds two registers. The result is stored in the second. An extra register is needed for storing carry bits.

Add(a, b, 0) -> (a, a+b, 0)

In order to improve performance, this method do not check if arguments are valid. They must satisfy following conditions:

  • Registers a, b and c must not overlap
  • Registers a and c must have the same width
  • Register b must be exactly one bit wider than register a (or c)
  • Initial value of c must be 0

(Defined by AddExtension.)
Public Extension MethodAddModulo(Register, Register, UInt64)Overloaded. (Defined by AddModuloExtension.)
Public Extension MethodAddModulo(Register, Register, Register, Register, UInt64)Overloaded. (Defined by AddModuloExtension.)
Public Extension MethodCarry
Sets the carry bit (in point of fact, a carry qubit). Used with Sum(QuantumComputer, RegisterRef, RegisterRef, RegisterRef) to perform addition.
(Defined by AddExtension.)
Public Extension MethodCMultModulo(Register, Register, RegisterRef, UInt64, UInt64)Overloaded. (Defined by MultModuloExtension.)
Public Extension MethodCMultModulo(Register, Register, Register, Register, Register, RegisterRef, UInt64, UInt64)Overloaded. (Defined by MultModuloExtension.)
Public Extension MethodCNot

Performs a controlled not operation (C-NOT Gate). The target bit gets inverted if the control bit is enabled. The operation can be written as the unitary operation matrix:

(Defined by GatesExtension.)
Public Extension MethodCPhaseShift

Performs a conditional phase kick (or phase shift) on the registers' state by the angle PI / 2 ^ dist. The operation is represented by the unitary matrix:

(Defined by GatesExtension.)
Public Extension MethodExpModulo(Register, Register, Int32, Int32)Overloaded.

Performs (a^x) modulo N, for given integers a and N. The x (one value or a superposition) is given in the input register x.

After computation, the result (or results, when x stores superposition of multiple integers) is stored in register x1.

This method is a simple variant of ExpModulo(QuantumComputer, Register, Register, Register, Register, Register, Register, Int32, Int32). It allocates additional registers and frees them at the end. This variant has also requirements for the width of each given register but if they are not fullfilled, the exception is thrown.

(Defined by ExpModuloExtension.)
Public Extension MethodExpModulo(Register, Register, Register, Register, Register, Register, Int32, Int32)Overloaded.

Performs (a^x) modulo N, for given integers a and N. The x (one value or a superposition) is given in the input register x.

After computation, the result (or results, when x stores superposition of multiple integers) is stored in register x1.

This method is a variant of ExpModulo function, which operates directly on quantum registers given as arguments. It neither allocates nor frees any additional registers. It is thus recommended, when there is a need for performing modular exponentiation repeatedly. However, this variant has strict requirements for the width of each given register and if they are not fullfilled, the method gives unexpected results.

(Defined by ExpModuloExtension.)
Public Extension MethodGate1

Performs any arbitrary unitary operation on target qubit. The operation is described by unitary matrix of complex numbers, as follows:

(Defined by GatesExtension.)
Public Extension MethodHadamard

Applies the Hadamard gate to the target qubit. The unitary matrix for this operation is:

(Defined by GatesExtension.)
Public Extension MethodInverseAdd(Register, Register)Overloaded.

Performs an exact inversion of Add(QuantumComputer, Register, Register) method.

InverseAdd(a, a+b, 0) -> (a, b, 0)

This method checks if arguments are valid. If not, an exception is thrown. The following conditions must be satisfied:

  • Registers a and b must not overlap
  • Register b must be exactly one bit wider than register a

(Defined by AddExtension.)
Public Extension MethodInverseAdd(Register, Register, Register)Overloaded.

Performs an exact inversion of Add(QuantumComputer, Register, Register, Register) method.

InverseAdd(a, a+b, 0) -> (a, b, 0)

In order to improve performance, this method do not check if arguments are valid. They must satisfy following conditions:

  • Registers a, b and c must not overlap
  • Registers a and c must have the same width
  • Register b must be exactly one bit wider than register a (or c)
  • Initial value of c must be 0

(Defined by AddExtension.)
Public Extension MethodInverseAddModulo(Register, Register, UInt64)Overloaded. (Defined by AddModuloExtension.)
Public Extension MethodInverseAddModulo(Register, Register, Register, Register, UInt64)Overloaded. (Defined by AddModuloExtension.)
Public Extension MethodInverseCarry (Defined by AddExtension.)
Public Extension MethodInverseCMultModulo(Register, Register, RegisterRef, UInt64, UInt64)Overloaded. (Defined by MultModuloExtension.)
Public Extension MethodInverseCMultModulo(Register, Register, Register, Register, Register, RegisterRef, UInt64, UInt64)Overloaded. (Defined by MultModuloExtension.)
Public Extension MethodInverseCPhaseShift

Performs a inversed conditional phase kick (or phase shift) on the registers' state by the angle PI / 2 ^ dist. The operation is represented by the unitary matrix:

(Defined by GatesExtension.)
Public Extension MethodInverseLoadNumber (Defined by TrivialInverseExtension.)
Public Extension MethodInverseQFT

Performs an exact inversion of Quantum Fourier Transform (see QFT(QuantumComputer, Register)).

(Defined by QFTExtension.)
Public Extension MethodInverseReverse (Defined by TrivialInverseExtension.)
Public Extension MethodInverseSum (Defined by TrivialInverseExtension.)
Public Extension MethodInverseSwap(RegisterRef, RegisterRef)Overloaded. (Defined by TrivialInverseExtension.)
Public Extension MethodInverseSwap(Register, Register, RegisterRef)Overloaded. (Defined by TrivialInverseExtension.)
Public Extension MethodInverseWalsh (Defined by TrivialInverseExtension.)
Public Extension MethodLoadNumber (Defined by LoadNumberExtension.)
Public Extension MethodPhaseKick

Performs a phase kick (or phase shift) on the the registers' state. The operation is represented by the unitary matrix:

The controlled version of this operation can be written as an other unitary matrix:

(Defined by GatesExtension.)
Public Extension MethodPhaseScale

Adds a global phase on the registers' state. The operation is represented by the unitary matrix:

(Defined by GatesExtension.)
Public Extension MethodQFT

Performs the Quantum Fourier Transform on given Register.

(Defined by QFTExtension.)
Public Extension MethodReset (Defined by GatesExtension.)
Public Extension MethodReverse (Defined by SwapExtension.)
Public Extension MethodRotateX

Performs a rotation of the target qubit about the x-axis of the Bloch sphere. The angle of rotation is given in first argument (double gamma). The unitary matrix of this operation is:

(Defined by GatesExtension.)
Public Extension MethodRotateY

Performs a rotation of the target qubit about the y-axis of the Bloch sphere. The angle of rotation is given in first argument (double gamma). The operation is represented by the unitary matrix:

(Defined by GatesExtension.)
Public Extension MethodRotateZ

Performs a rotation of the target qubit about the z-axis of the Bloch sphere. The angle of rotation is given in first argument (double gamma). The operation is represented by the unitary matrix:

(Defined by GatesExtension.)
Public Extension MethodSigmaX

Performs a Sigma X Pauli's Gate on target qubit. Actually, it is a simple Not. The unitary operation matrix is:

(Defined by GatesExtension.)
Public Extension MethodSigmaY

Performs a Sigma Y Pauli's Gate on target qubit. The operation is represented by unitary matrix:

(Defined by GatesExtension.)
Public Extension MethodSigmaZ

Performs a Sigma Z Pauli's Gate on target qubit. The operation is represented by unitary matrix:

(Defined by GatesExtension.)
Public Extension MethodSqrtX

Performs the Square Root of Not on the target qubit. The Square Root of Not Gate is such a gate, that applied twice, performs Not operation. The operation can be represented as the unitary matrix:

(Defined by GatesExtension.)
Public Extension MethodSum
Computes the least significant bit of sum of two given bits. Used with Carry(QuantumComputer, RegisterRef, RegisterRef, RegisterRef, RegisterRef) to perform addition.
(Defined by AddExtension.)
Public Extension MethodSwap(RegisterRef, RegisterRef)Overloaded.
Swaps the values of two given qubits.
(Defined by SwapExtension.)
Public Extension MethodSwap(Register, Register, RegisterRef)Overloaded.
The controlled Swap. Swaps the values of two given qubits, if the control qubit is set.
(Defined by SwapExtension.)
Public Extension MethodToffoli

Applies Toffoli gate. If all of the control bits are enabled, the target bit gets inverted. This gate with more than two control bits is not considered elementary and is not available on all physical realizations of a quantum computer. Toffoli gate with two control bits can be represented by unitary matrix:

(Defined by GatesExtension.)
Public Extension MethodWalsh
Applies the Walsh-Hadamard transform on given register. In other words, applies Hadamard gate on every qubit in the register.
(Defined by WalshExtension.)
Top
Fields

  NameDescription
Public fieldStatic memberEpsilon
Constant value of Epsilon. This is a threshold for double values. It is used mainly in performing quantum gates operation. When the absolute amplitude value (real or imaginary) during computations reach the value smaller than Epsilon, it is rounded to 0.
Top
See Also