Skip to content

Arithmetic

arithmetic

Functions:

Name Description
unitary

[Qmod core-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