Microsoft.Quantum.Arithmetic namespace
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.
This namespace contains functions and operations used for coherently computing arithmetic.
Operations
Name | Summary |
---|---|
AddConstantFxP | Adds a classical constant to a quantum fixed-point number. |
AddFxP | Adds two fixed-point numbers stored in quantum registers. |
AddI | Automatically chooses between addition with carry and without, depending on the register size of ys . |
ApplyLEOperationOnPhaseLE | Applies an operation that takes a PhaseLittleEndian user defined type register as input on a target register of type LittleEndian user defined type. |
ApplyLEOperationOnPhaseLEA | Applies an operation that takes a PhaseLittleEndian user defined type register as input on a target register of type LittleEndian user defined type. |
ApplyLEOperationOnPhaseLEC | Applies an operation that takes a PhaseLittleEndian user defined type register as input on a target register of type LittleEndian user defined type. |
ApplyLEOperationOnPhaseLECA | Applies an operation that takes a PhaseLittleEndian user defined type register as input on a target register of type LittleEndian user defined type. |
ApplyMajorityInPlace | Applies the three-qubit majority operation in-place on a register of qubits. |
ApplyPhaseLEOperationOnLE | Applies an operation that takes a LittleEndian user defined type register as input on a target register of type PhaseLittleEndian user defined type. |
ApplyPhaseLEOperationOnLEA | Applies an operation that takes a LittleEndian user defined type register as input on a target register of type PhaseLittleEndian user defined type. |
ApplyPhaseLEOperationOnLEC | Applies an operation that takes a LittleEndian user defined type register as input on a target register of type PhaseLittleEndian user defined type. |
ApplyPhaseLEOperationOnLECA | Applies an operation that takes a LittleEndian user defined type register as input on a target register of type PhaseLittleEndian user defined type. |
ApplyReversedOpBE | Applies an operation that takes big-endian input to a register encoding an unsigned integer using little-endian format. |
ApplyReversedOpBEA | Applies an operation that takes big-endian input to a register encoding an unsigned integer using little-endian format. |
ApplyReversedOpBEC | Applies an operation that takes big-endian input to a register encoding an unsigned integer using little-endian format. |
ApplyReversedOpBECA | Applies an operation that takes big-endian input to a register encoding an unsigned integer using little-endian format. |
ApplyReversedOpLE | Applies an operation that takes little-endian input to a register encoding an unsigned integer using big-endian format. |
ApplyReversedOpLEA | Applies an operation that takes little-endian input to a register encoding an unsigned integer using big-endian format. |
ApplyReversedOpLEC | Applies an operation that takes little-endian input to a register encoding an unsigned integer using big-endian format. |
ApplyReversedOpLECA | Applies an operation that takes little-endian input to a register encoding an unsigned integer using big-endian format. |
ApplyXorInPlace | Applies a bitwise-XOR operation between a classical integer and an integer represented by a register of qubits. |
AssertAllZeroFxP | Asserts that a quantum fixed-point number is initialized to zero. |
AssertMostSignificantBit | Asserts that the most significant qubit of a qubit register representing an unsigned integer is in a particular state. |
AssertPhaseLessThan | Asserts that the number encoded in PhaseLittleEndian is less than value . |
AssertProbInt | Asserts that the probability of a specific state of a quantum register has the expected value. |
Carry | Implements a reversible carry 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 and the carry-out is xored to the qubit carryOut . |
CompareGTI | Wrapper for integer comparison: result = x > y . |
CompareGTSI | Wrapper for signed integer comparison: result = xs > ys . |
CompareGreaterThanFxP | Compares two fixed-point numbers stored in quantum registers, and controls a flip on the result. |
CompareUsingRippleCarry | This operation tests if an integer represented by a register of qubits is greater than another integer, applying an XOR of the result onto an output qubit. |
ComputeReciprocalFxP | Computes the reciprocal of a number stored in a quantum register with the fixed-point representation. |
ComputeReciprocalI | Computes the reciprocal 1/x for an unsigned integer x using integer division. The result, interpreted as an integer, will be floor(2^(2*n-1) / x) . |
CopyMostSignificantBit | Copies the most significant bit of a qubit register from representing an unsigned integer into the qubit target . |
DivideI | Divides two quantum integers. |
EvaluateEvenPolynomialFxP | Evaluates an even polynomial in a fixed-point representation. |
EvaluateOddPolynomialFxP | Evaluates an odd polynomial in a fixed-point representation. |
EvaluatePolynomialFxP | Evaluates a polynomial in a fixed-point representation. |
GreaterThan | Applies a greater-than comparison between two integers encoded into qubit registers, flipping a target qubit based on the result of the comparison. |
IncrementByInteger | Increments an unsigned quantum register by a classical integer, using phase rotations. |
IncrementByModularInteger | Performs a modular increment of a qubit register by an integer constant. |
IncrementPhaseByInteger | Increments an unsigned quantum register by a classical integer, using phase rotations. |
IncrementPhaseByModularInteger | Performs a modular increment of a qubit register by an integer constant. |
Invert2sSI | Inverts a given integer modulo 2's complement. |
InvertFxP | Computes the additive inverse of fp . |
MAJ | This applies the in-place majority operation to 3 qubits. |
MeasureFxP | Measure a fixed-point number, returns its value as Double, and resets all the register to zero. |
MeasureInteger | Measures the content of a quantum register and converts it to an integer. The measurement is performed with respect to the standard computational basis, i.e., the eigenbasis of PauliZ . |
MultiplyAndAddByModularInteger | Performs a modular multiply-and-add by integer constants on a qubit register. |
MultiplyAndAddPhaseByModularInteger | The same as MultiplyAndAddByModularInteger, but assumes that the summand encodes integers in QFT basis. |
MultiplyByModularInteger | Performs modular multiplication by an integer constant on a qubit register. |
MultiplyFxP | Multiplies two fixed-point numbers in quantum registers. |
MultiplyI | Multiply integer xs by integer ys and store the result in result , which must be zero initially. |
MultiplySI | Multiply signed integer xs by signed integer ys and store the result in result , which must be zero initially. |
PrepareFxP | Initialize a quantum fixed-point number to a classical constant. |
ReflectAboutInteger | Reflects a quantum register about a given classical integer. |
RippleCarryAdderCDKM | Reversible, in-place ripple-carry addition of two integers. |
RippleCarryAdderD | Reversible, in-place ripple-carry addition of two integers. |
RippleCarryAdderNoCarryTTK | Reversible, in-place ripple-carry addition of two integers without carry out. |
RippleCarryAdderTTK | Reversible, in-place ripple-carry addition of two integers. Given two $n$-bit integers encoded in LittleEndian registers xs and ys , and a qubit carry, the operation computes the sum of the two integers where the $n$ least significant bits of the result are held in ys and the carry out bit is xored to the qubit carry . |
SquareFxP | Squares a fixed-point number. |
SquareI | Computes the square of the integer xs into result , which must be zero initially. |
SquareSI | Square signed integer xs and store the result in result , which must be zero initially. |
SubtractFxP | Computes minuend - subtrahend and stores the difference in minuend . |
Sum | 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 . |
Functions
Name | Summary |
---|---|
ApplyFunctionWithLookupTable | This function creates a lookup table operator for the function that you want to approximate, as well as the parameters required to make the two FixedPoint registers that need to be used as inputs to the operator. |
BigEndianAsLittleEndian | Converts a BigEndian qubit register to a LittleEndian qubit register by reversing the qubit ordering. |
IdenticalFormatFactFxP | Assert that all fixed-point numbers in the provided array have identical point positions and qubit numbers. |
IdenticalPointPosFactFxP | Assert that all fixed-point numbers in the provided array have identical point positions when counting from the least- significant bit. I.e., number of bits minus point position must be constant for all fixed-point numbers in the array. |
LittleEndianAsBigEndian | Converts a LittleEndian qubit register to a BigEndian qubit register by reversing the qubit ordering. |
ReversedOpBE | Given an operation that takes a big-endian input, returns a new operation that takes a little-endian input. |
ReversedOpBEA | Given an operation that takes a big-endian input, returns a new operation that takes a little-endian input. |
ReversedOpBEC | Given an operation that takes a big-endian input, returns a new operation that takes a little-endian input. |
ReversedOpBECA | Given an operation that takes a big-endian input, returns a new operation that takes a little-endian input. |
ReversedOpLE | Given an operation that takes a little-endian input, returns a new operation that takes a big-endian input. |
ReversedOpLEA | Given an operation that takes a little-endian input, returns a new operation that takes a big-endian input. |
ReversedOpLEC | Given an operation that takes a little-endian input, returns a new operation that takes a big-endian input. |
ReversedOpLECA | Given an operation that takes a little-endian input, returns a new operation that takes a big-endian input. |
User-defined types
Name | Summary |
---|---|
BigEndian | Register that encodes an unsigned integer in big-endian order. The qubit with index 0 encodes the highest bit of an unsigned integer. |
FixedPoint | Represents a register of qubits encoding a fixed-point number. Consists of an integer that is equal to the number of qubits to the left of the binary point, i.e., qubits of weight greater than or equal to 1, and a quantum register. |
FunctionWithLookupTable | The return type when making a lookup table. This contains the operation that makes the lookup table circuit, as well as all the parameters required to make the two FixedPoint registers that need to be used as inputs and outputs to the operator. |
LittleEndian | Register that encodes an unsigned integer in little-endian order. The qubit with index 0 encodes the lowest bit of an unsigned integer. |
PhaseLittleEndian | Little-endian unsigned integers in QFT basis. |
SignedLittleEndian | Type of a signed integer stored in little endian (see LittleEndian). Negative numbers are stored using two's complement. |
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