MultiplyByModularInteger 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

Performs modular multiplication by an integer constant on a qubit register.

operation MultiplyByModularInteger (constMultiplier : Int, modulus : Int, multiplicand : Microsoft.Quantum.Arithmetic.LittleEndian) : Unit is Adj + Ctl

Description

Let us denote modulus by $N$ and constMultiplier by $a$. Then this operation implements a unitary operation defined by the following map on the computational basis: $$ \begin{align} \ket{y} \mapsto \ket{(a \cdot y) \operatorname{mod} N} \end{align} $$ for all $y$ between $0$ and $N - 1$.

Input

constMultiplier : Int

Constant by which multiplicand is being multiplied. Must be co-prime to modulus.

modulus : Int

The multiplication operation is performed modulo modulus.

multiplicand : LittleEndian

The number being multiplied by a constant. This is an array of qubits encoding an integer in little-endian format.

Output : Unit

Remarks