AddExtension Methods A Sandcastle Documented Class Library

The AddExtension type exposes the following members.

Methods

NameDescription

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

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

Carry
Sets the carry bit (in point of fact, a carry qubit). Used with Sum(QuantumComputer, RegisterRef, RegisterRef, RegisterRef) to perform addition.

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

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

InverseCarry
Sum
Computes the least significant bit of sum of two given bits. Used with Carry(QuantumComputer, RegisterRef, RegisterRef, RegisterRef, RegisterRef) to perform addition.
Top