IncrementByModularInteger 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 a modular increment of a qubit register by an integer constant.
operation IncrementByModularInteger (increment : Int, modulus : Int, target : Microsoft.Quantum.Arithmetic.LittleEndian) : Unit is Adj + Ctl
Description
Let us denote increment
by $a$, modulus
by $N$ and integer encoded in target
by $y$.
Then the operation performs the following transformation:
\begin{align}
\ket{y} \mapsto \ket{(y + a) \operatorname{mod} N}
\end{align}
Integers are encoded in little-endian format.
Input
increment : Int
Integer increment $a$ to be added to $y$.
modulus : Int
Integer $N$ that mods $y + a$.
target : LittleEndian
Integer $y$ in LittleEndian
format that increment
$a$ is added to.
Output : Unit
Remarks
Assumes that the initial value of target is less than $N$
and that the increment $a$ is less than $N$.
Note that
IncrementPhaseByModularInteger operation implements
the same operation in the PhaseLittleEndian
basis.
See Also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for