Skip to content

Arithmetic

arithmetic

Functions:

Name Description
unitary

[Qmod core-library function]

modular_increment

[Qmod Classiq-library function]

unitary

unitary(
    elements: CArray[CArray[CReal]],
    target: QArray[
        QBit,
        Literal["log(get_field(elements[0], 'len'), 2)"],
    ],
) -> None

[Qmod core-library function]

Applies a unitary matrix on a quantum state.

Parameters:

Name Type Description Default
elements CArray[CArray[CReal]]

A 2d array of complex numbers representing the unitary matrix. This matrix must be unitary.

required
target QArray[QBit, Literal["log(get_field(elements[0], 'len'), 2)"]]

The quantum state to apply the unitary on. Should be of corresponding size.

required

modular_increment

modular_increment(a: CInt, x: QNum) -> None

[Qmod Classiq-library function]

Adds \(a\) to \(x\) modulo the range of \(x\), assumed that \(x\) is a non-negative integer and \(a\) is an integer. Mathematically it is described as:

\[ x = (x+a)\ \mod \ 2^{x.size}-1 \]

Parameters:

Name Type Description Default
a CInt

A classical integer to be added to x.

required
x QNum

A quantum number that is assumed to be non-negative integer.

required