Introduction¶
The Classiq arithmetic package includes various classical functions for arithmetic operations. The functions are optimized for quantum computation, include multiple implementations, and support classical input (fixed-point or integer) and quantum input (qubits), signed or unsigned.
The calculation is done in binary with Little Endian ordering. In general, it uses the minimal number of qubits to represent the solution. Additional qubits are added to account for overflow and sign when needed and are not otherwise stated.
As a quick refresher, binary numbers are converted to integers by multiplying each bit by the relevant power of two. The binary number 101.11 has three bits left of the radix point so the MSB (most significant bit i.e., the leftmost bit) has a value of \(2^{3-1}=2^{2}=4\). This is the number represented in this case:
Signed representation uses the two-complement method, where the MSB is multiplied by -1.
This is the unsigned value:
A quantum register can contain a single number or superposition of numbers represented in binary form. Each quantum register has three properties:
size
- the total number of qubits used.fraction_places
- the number of qubits used for the fraction part.is_signed
- indicating whether the value stored is signed or unsigned.
{
"arg": {
"size": 3,
"fraction_places": 1,
"is_signed": true
}
}
Basic Functions¶
- Bitwise And
- Bitwise Or
- Bitwise Xor
- Equal
- Not Equal
- Greater Than
- Greater Or Equal
- Less Than
- Less Or Equal
- Addition
- Subtraction
- Multiplication
- Minimum
- Maximum
- Modulo