RippleCarryAdderD operation

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Arithmetic

Package: Microsoft.Quantum.Standard

Reversible, in-place ripple-carry addition of two integers.

operation RippleCarryAdderD (xs : Microsoft.Quantum.Arithmetic.LittleEndian, ys : Microsoft.Quantum.Arithmetic.LittleEndian, carry : Qubit) : Unit is Adj + Ctl

Description

Given two $n$-bit integers encoded in LittleEndian registers xs and ys, and a qubit carry, the operation computes the sum of the two integers where the $n$ least significant bits of the result are held in ys and the carry out bit is xored to the qubit carry.

Input

xs : LittleEndian

LittleEndian qubit register encoding the first integer summand.

ys : LittleEndian

LittleEndian qubit register encoding the second integer summand, is modified to hold the $n$ least significant bits of the sum.

carry : Qubit

Carry qubit, is xored with the most significant bit of the sum.

Output : Unit

Remarks

The specified controlled operation makes use of symmetry and mutual cancellation of operations to improve on the default implementation that adds a control to every operation.

References