Functions:
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:
∑jαjUj
where Uj is a unitary operation applied to data.
Parameters:
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:
H=∑jαjPj
where Pj is a tensor product of Pauli operators.
The SELECT operator (_select_paulis) loads each data qubit’s Pauli column from the
block index using gray-code uniformly-controlled RZ/RY rotations; the resulting
per-term phases are folded into the coefficients so that the single phase table inside
prepare_select corrects them together with the coefficient signs/phases.
Parameters:
lcu_unary_pauli
lcu_unary_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:
H=∑jαjPj
where Pj is a tensor product of Pauli operators.
Unlike lcu_pauli, which loads each Pauli via gray-code uniformly-controlled
arbitrary-angle RZ/RY rotations, the SELECT operator here (_select_paulis_unary)
is implemented using unary iteration (unary_select): it applies each Pauli string
exactly, using only Clifford gates plus auxiliary qubits for the unary-iteration
AND-tree, at the cost of those auxiliary qubits. This makes it fault-tolerant (FT)
friendly, as it avoids the arbitrary-angle rotations lcu_pauli relies on.
The AND-tree uses block.size - 1 auxiliary qubits, one per tree level, reused
across branches so at most one is live at a time.
Parameters:
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: {SELECT}=∑{j=0}{m−1}∣j⟩⟨j∣{block}⊗Uj.
Parameters: