AddExtension ClassA Sandcastle Documented Class Library

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.

Inheritance Hierarchy

System Object
  Quantum.Operations AddExtension

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

public static class AddExtension

The AddExtension type exposes the following members.

Methods

  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

Public methodStatic memberCarry
Sets the carry bit (in point of fact, a carry qubit). Used with Sum(QuantumComputer, RegisterRef, RegisterRef, RegisterRef) to perform addition.
Public methodStatic memberInverseAdd(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:

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

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

  • 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

Public methodStatic memberInverseCarry
Public methodStatic memberSum
Computes the least significant bit of sum of two given bits. Used with Carry(QuantumComputer, RegisterRef, RegisterRef, RegisterRef, RegisterRef) to perform addition.
Top
See Also