Sum 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

Implements a reversible sum gate. Given a carry-in bit encoded in qubit carryIn and two summand bits encoded in summand1 and summand2, computes the bitwise xor of carryIn, summand1 and summand2 in the qubit summand2.

operation Sum (carryIn : Qubit, summand1 : Qubit, summand2 : Qubit) : Unit is Adj + Ctl

Input

carryIn : Qubit

Carry-in qubit.

summand1 : Qubit

First summand qubit.

summand2 : Qubit

Second summand qubit, is replaced with the lower bit of the sum of summand1 and summand2.

Output : Unit

Remarks

In contrast to the Carry operation, this does not compute the carry-out bit.