AddExtension Add Method A Sandcastle Documented Class Library
Overload List

  NameDescription
Public methodStatic memberAdd(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:

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

Public methodStatic memberAdd(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:

  • 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

Top
See Also