AddExtension Add Method (QuantumComputer, Register, Register, Register)A Sandcastle Documented Class Library

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

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

public static void Add(
	this QuantumComputer comp,
	Register a,
	Register b,
	Register c
)

Parameters

comp
Type: Quantum QuantumComputer
The QuantumComputer instance.
a
Type: Quantum Register
The first register to sum. Its value remains unchanged.
b
Type: Quantum Register
The second register to sum. After performing this operation, it contains the sum result.
c
Type: Quantum Register
The extra register for storing carry bits.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type QuantumComputer. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also