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

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

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
)

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.

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