Linear Combination of Unitaries
lcu
Functions:
| Name | Description |
|---|---|
lcu |
[Qmod Classiq-library function] |
lcu_pauli |
[Qmod Classiq-library function] |
prepare_select |
[Qmod Classiq-library function] |
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 the given coefficients, and then conditionally applies each unitary controlled by the block.
The operation is of the form:
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 |
lcu_pauli
lcu_pauli(
operator: SparsePauliOp,
data: QArray[QBit, Literal["operator.num_qubits"]],
block: QNum[
Literal[
"max(ceiling(log(operator.terms.len, 2)), 1)"
]
],
) -> None
[Qmod Classiq-library function]
Applies a linear combination of unitaries (LCU) where each unitary is a Pauli term, represented as a tensor product of Pauli operators. The function prepares a superposition over the unitaries according to the given magnitudes and phases, and applies the corresponding Pauli operators conditionally.
This is useful for implementing Hamiltonian terms of the form:
where \(P_j\) is a tensor product of Pauli operators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operator
|
SparsePauliOp
|
Operator consists of pauli strings with their coefficients, represented in a sparse format. |
required |
data
|
QArray[QBit, Literal['operator.num_qubits']]
|
Quantum Variable on which the Pauli operators act. Its size must match the number of qubits required by the Pauli operator. |
required |
block
|
QNum[Literal['max(ceiling(log(operator.terms.len, 2)), 1)']]
|
Quantum variable that holds the superposition index used for conditional application of each term. |
required |
prepare_select
prepare_select(
coefficients: list[float],
select: QCallable[QNum],
block: QNum[
Literal["max(ceiling(log(coefficients.len, 2)), 1)"]
],
) -> None
[Qmod Classiq-library function]
Applies the 'Prepare-Select' scheme used for Linear Combination of Unitaries (LCU).
Compared to the lcu function, here the Select operator should be provided directly, allowing to take advantage of some structure for
the unitaries of the LCU.
The select operator is defined by: \(\mathrm{SELECT} = \sum_{j=0}^{m-1} |j
angle\!\langle j|_{block} \otimes U_j\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coefficients
|
list[float]
|
L1-normalized array of \(\{ \alpha_j \}\) of the LCU coefficients. |
required |
select
|
QCallable[QNum]
|
A quantum callable to be applied between the state preparation and its inverse. Its input is the |
required |
block
|
QNum[Literal['max(ceiling(log(coefficients.len, 2)), 1)']]
|
A Quantum variable that holds the index used as input for the 'select' operator. |
required |