Skip to main content
Functions:

unitary

unitary(
elements: CArray[CArray[CReal]],
target: QArray[QBit, Literal[‘log(elements[0].len, 2)’]]
) -> None
[Qmod core-library function] Applies a unitary matrix on a quantum state. Parameters:

multiply

multiply(
left: Const[QNum],
right: Const[QNum],
result: Output[QNum]
) -> None
[Qmod core-library function] Multiplies two quantum numeric variables: leftrightleftrightleftright \left|\text{left}\right\rangle \left|\text{right}\right\rangle \mapsto \left|\text{left}\right\rangle \left|\text{right}\right\rangle \left|\text{left} \cdot \text{right} \right\rangle Parameters:

multiply_constant

multiply_constant(
left: CReal,
right: Const[QNum],
result: Output[QNum]
) -> None
[Qmod core-library function] Multiplies a quantum numeric variable with a constant: rightrightleftright \left|\text{right}\right\rangle \mapsto \left|\text{right}\right\rangle \left|\text{left} \cdot \text{right} \right\rangle Parameters:

canonical_add

canonical_add(
left: Const[QArray],
extend_left: CBool,
right: QArray
) -> None
[Qmod core-library function] Adds two quantum variables representing integers (signed or unsigned), storing the result in the second variable (in-place): leftrightleft(right+left)mod2right.size \left|\text{left}\right\rangle \left|\text{right}\right\rangle \mapsto \left|\text{left}\right\rangle \left|\left(\text{right} + \text{left}\right) \bmod 2^{\text{right.size}} \right\rangle Parameters:

canonical_add_constant

canonical_add_constant(
left: CInt,
right: QArray
) -> None
[Qmod core-library function] Adds an integer constant to a quantum variable representing an integer (signed or unsigned): right(right+left)mod2right.size \left|\text{right}\right\rangle \mapsto \left|\left(\text{right} + \text{left}\right) \bmod 2^{\text{right.size}} \right\rangle Parameters:

canonical_multiply

canonical_multiply(
left: Const[QArray],
extend_left: CBool,
right: Const[QArray],
extend_right: CBool,
result: QArray,
trim_result_lsb: CBool
) -> None
[Qmod core-library function] Multiplies two quantum variables representing integers (signed or unsigned) into the result variable which is assumed to start in the 0|0\rangle state. If trim_result_lsb is False, applies the transformation: leftright0leftright(leftright)mod2result.size \left|\text{left}\right\rangle \left|\text{right}\right\rangle \left|0\right\rangle \mapsto \left|\text{left}\right\rangle \left|\text{right}\right\rangle \left|\left( \text{left} \cdot \text{right} \right) \bmod 2^{\text{result.size}} \right\rangle If trim_result_lsb is True, the function avoids computing the result’s LSB and applies the transformation: leftright0leftright(leftright)1mod2result.size \left|\text{left}\right\rangle \left|\text{right}\right\rangle \left|0\right\rangle \mapsto \left|\text{left}\right\rangle \left|\text{right}\right\rangle \left|\left( \text{left} \cdot \text{right} \right) \gg 1 \bmod 2^{\text{result.size}} \right\rangle Parameters:

canonical_multiply_constant

canonical_multiply_constant(
left: CInt,
right: Const[QArray],
extend_right: CBool,
result: QArray,
trim_result_lsb: CBool
) -> None
[Qmod core-library function] Multiplies a quantum variable representing an integer (signed or unsigned) with a constant, into the result variable which is assumed to start in the 0|0\rangle state. If trim_result_lsb is False, applies the transformation: right0right(leftright)mod2result.size \left|\text{right}\right\rangle \left|0\right\rangle \mapsto \left|\text{right}\right\rangle \left|\left( \text{left} \cdot \text{right} \right) \bmod 2^{\text{result.size}} \right\rangle If trim_result_lsb is True, the function avoids computing the result’s LSB and applies the transformation: right0right(leftright)1mod2result.size \left|\text{right}\right\rangle \left|0\right\rangle \mapsto \left|\text{right}\right\rangle \left|\left( \text{left} \cdot \text{right} \right) \gg 1 \bmod 2^{\text{result.size}} \right\rangle Parameters:

canonical_square

canonical_square(
arg: Const[QArray],
extend_arg: CBool,
result: QArray,
trim_result_lsb: CBool
) -> None
[Qmod core-library function] Squares a quantum variable representing an integer (signed or unsigned), into the result variable which is assumed to start in the 0|0\rangle state. If trim_result_lsb is False, applies the transformation: arg0arg(arg2)mod2result.size \left|\text{arg}\right\rangle \left|0\right\rangle \mapsto \left|\text{arg}\right\rangle \left|\left( \text{arg}^{2}\right) \bmod 2^{\text{result.size}} \right\rangle If trim_result_lsb is True, the function avoids computing the result’s LSB and applies the transformation: arg0arg(arg2)1mod2result.size \left|\text{arg}\right\rangle \left|0\right\rangle \mapsto \left|\text{arg}\right\rangle \left|\left( \text{arg}^{2} \right) \gg 1 \bmod 2^{\text{result.size}} \right\rangle Parameters: