MultiplyI operation


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

Please see for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Arithmetic

Package: Microsoft.Quantum.Numerics

Multiply integer xs by integer ys and store the result in result, which must be zero initially.

operation MultiplyI (xs : Microsoft.Quantum.Arithmetic.LittleEndian, ys : Microsoft.Quantum.Arithmetic.LittleEndian, result : Microsoft.Quantum.Arithmetic.LittleEndian) : Unit is Adj + Ctl


xs : LittleEndian

๐‘›โ‚-bit multiplicand

ys : LittleEndian

๐‘›โ‚‚-bit multiplier

result : LittleEndian

(๐‘›โ‚+๐‘›โ‚‚)-bit result, must be in state |0โŸฉ initially.

Output : Unit


Uses a standard shift-and-add approach to implement the multiplication. The controlled version was improved by copying out ๐‘ฅแตข to an ancilla qubit conditioned on the control qubits, and then controlling the addition on the ancilla qubit.