Skip to content

Linear Combination of Unitaries

lcu

lcu(
    coefficients: list[float],
    unitaries: QCallableList,
    block: QNum[
        Literal["max(ceiling(log(coefficients.len, 2)), 1)"]
    ],
) -> None

[Qmod Classiq-library function]

Implements a general linear combination of unitaries (LCU) procedure. The algorithm prepares a superposition over the unitaries according to magnitudes, and then conditionally applies each unitary controlled by the block.

The operation is of the form:

\[\sum_j \alpha_j U_j\]

where \(U_j\) is a unitary operation applied to data.

Parameters:

Name Type Description Default
coefficients list[float]

L1-normalized array of \(\{ \alpha_j \}\) of the LCU coefficients.

required
unitaries QCallableList

A list of quantum callable functions to be applied conditionally.

required
block QNum[Literal['max(ceiling(log(coefficients.len, 2)), 1)']]

Quantum variable that holds the superposition index used for conditional application of each unitary.

required