qdk_chemistry.algorithms.controlled_circuit_mapper.controlled_swap_pauli_sequence_mapper module
QDK/Chemistry CSWAP-sandwich controlled circuit mapper.
- class qdk_chemistry.algorithms.controlled_circuit_mapper.controlled_swap_pauli_sequence_mapper.ControlledSwapPauliSequenceMapper[source]
Bases:
ControlledCircuitMapperControlled evolution circuit mapper using a CSWAP-sandwich construction.
Given a time evolution as a Pauli product formula \(U(t) \approx \left[ U_{\mathrm{step}}(t / r) \right]^{r}\), this mapper builds a controlled \(U(t)\) without controlling every gate. An internally allocated
vacuumregister (\(|0\ldots0\rangle\)) is conditionally swapped with the system, the uncontrolled evolution runs on the vacuum (step_repstimes), and the swap is uncomputed. The eigenphase accumulates on the \(|1\rangle\) control branch, as with a directly controlled evolution, using an additional system-sized register and two layers of system-wide controlled-\(\mathrm{SWAP}\) gates.Vacuum phase. The \(|0\rangle\) branch acquires \(U|0\ldots0\rangle = e^{i\varphi_0}|0\ldots0\rangle\) with \(\varphi_0 = -E_0 t\) and \(E_0 = \langle 0\ldots0|H|0\ldots0\rangle\). Only the diagonal (\(I\)/\(Z\)) terms of the product formula contribute, so \(\varphi_0\) is known classically and is cancelled by an \(R_1(\varphi_0)\) on the control. The circuit is then a genuine \(C\text{-}U\) up to a global phase for any \(E_0\).
Grouping requirement. The vacuum must stay an eigenstate, which is what particle conservation buys: \(H\) cannot connect \(|0\ldots0\rangle\) to any other occupation number. Leaked amplitude entangles the vacuum register with the control and destroys the control coherence. A fermionic term annihilates the vacuum only through the weighted sum of its Pauli strings, so a Trotterised \(U\) preserves the vacuum only when those strings are exponentiated as one contiguous, mutually commuting block:
\[U|0\ldots0\rangle = e^{-it\sum_i P_i}|0\ldots0\rangle \approx \prod_i e^{-it P_i}|0\ldots0\rangle = |0\ldots0\rangle .\]Grouping the Hamiltonian with the
vacuum_annihilatingterm grouper (VacuumAnnihilatingTermGrouper) produces that ordering. The incoming formula is validated and rejected otherwise; interleaving cancellation partners, sayXX, Z0, YY, Ifor \(H = \tfrac12(XX + YY) + \tfrac12(I - Z_0)\), leaks half the vacuum amplitude.Notes
Applies to particle-conserving Hamiltonians.
The requirement is on the mapped operator, not the encoding: after qubit tapering the all-zero state belongs to the retained sector, which the Hamiltonian need not annihilate.
Currently supports only single-control-qubit scenarios.
Requires a
PauliProductFormulaContainerfor the time evolution unitary.The vacuum register is allocated internally by the Q# operation.
- class qdk_chemistry.algorithms.controlled_circuit_mapper.controlled_swap_pauli_sequence_mapper.ControlledSwapPauliSequenceMapperSettings[source]
Bases:
ControlledCircuitMapperSettingsSettings for the
ControlledSwapPauliSequenceMapper.- vacuum_preservation_tolerance
Absolute tolerance on the amplitude leaked out of the vacuum, aggregated over every flipped-qubit set and over all
step_repsrepetitions.