Extension methods for performing simple, classically-inspired addition.
To add two registers, call Add(QuantumComputer, Register, Register). To inverse the operation (perform a subtraction), call InverseAdd(QuantumComputer, Register, Register). The rest of methods here are helpers used for performing these two. Nevertheless, each can be called independently.
Quantum.Operations AddExtension
Namespace: Quantum.Operations
Assembly: Quantum (in Quantum.dll) Version: 1.0.0.0 (1.0.0.0)
The AddExtension type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | Add(QuantumComputer, Register, Register) | 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:
|
![]() ![]() | Add(QuantumComputer, Register, Register, Register) | 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:
|
![]() ![]() | Carry |
Sets the carry bit (in point of fact, a carry qubit).
Used with Sum(QuantumComputer, RegisterRef, RegisterRef, RegisterRef) to perform addition.
|
![]() ![]() | InverseAdd(QuantumComputer, Register, Register) | 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:
|
![]() ![]() | InverseAdd(QuantumComputer, Register, Register, Register) | 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:
|
![]() ![]() | InverseCarry |
Inversion of Carry(QuantumComputer, RegisterRef, RegisterRef, RegisterRef, RegisterRef) method.
|
![]() ![]() | Sum |
Computes the least significant bit of sum of two given bits.
Used with Carry(QuantumComputer, RegisterRef, RegisterRef, RegisterRef, RegisterRef) to perform addition.
|