SquareI 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.Numerics
Computes the square of the integer xs
into result
,
which must be zero initially.
operation SquareI (xs : Microsoft.Quantum.Arithmetic.LittleEndian, result : Microsoft.Quantum.Arithmetic.LittleEndian) : Unit is Adj + Ctl
Input
xs : LittleEndian
𝑛-bit number to square
result : LittleEndian
2𝑛-bit result, must be in state |0⟩ initially.
Output : Unit
Remarks
Uses a standard shift-and-add approach to compute the square. Saves
𝑛-1 qubits compared to the straight-forward solution which first
copies out xs
before applying a regular multiplier and then undoing
the copy operation.
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