qdk_chemistry.algorithms.amplitude_amplification module
QDK/Chemistry amplitude amplification.
- class qdk_chemistry.algorithms.amplitude_amplification.AmplitudeAmplification[source]
Bases:
AlgorithmBuild an amplitude-amplified circuit.
Amplitude amplification raises the probability of measuring a state in a chosen “good” subspace. Given a state preparation \(U\) with \(|\psi\rangle = U|0\rangle\) and an oracle that flips a flag qubit on the good subspace, one round applies the Grover iterate \(Q = -(2|\psi\rangle\langle\psi| - I)(I - 2\Pi_G)\), a rotation by \(2\vartheta\) in the plane spanned by the good and bad components. If the good subspace initially carries probability \(a = \sin^2\vartheta\), then after \(k\) rounds it carries
\[p_k = \sin^2\!\big((2k+1)\arcsin\sqrt{a}\big),\]so \(O(1/\sqrt{a})\) rounds suffice where direct sampling would need \(O(1/a)\) shots. More rounds are not always better: past the first maximum near \(k \approx \pi/(4\arcsin\sqrt{a})\) the success probability falls again, so pick
roundsfrom an estimate of \(a\).Reference: L. Lin, Lecture Notes on Quantum Algorithms for Scientific Computation, arXiv:2201.08309, Chapter 2.
- class qdk_chemistry.algorithms.amplitude_amplification.AmplitudeAmplificationFactory[source]
Bases:
AlgorithmFactoryFactory class for creating AmplitudeAmplification instances.
- class qdk_chemistry.algorithms.amplitude_amplification.AmplitudeAmplificationSettings[source]
Bases:
SettingsSettings for amplitude amplification.
- qdk_chemistry.algorithms.amplitude_amplification.phase_marking_oracle(qpe_circuit, target_phase_bins=None, *, target_energy_range=None, qubit_hamiltonian=None)[source]
Build a good state oracle marking a range of phase bins of a QPE circuit.
A QPE circuit with \(n\) phase qubits writes the phase \(\varphi\) of the eigenvalue \(e^{2\pi i\varphi}\) into the bin \(\lfloor 2^n\varphi\rceil\), so a target eigenvalue is selected by the bin its phase falls in. Bins are marked over the half-open interval
(start, stop).The target can be given as an energy window instead, which only makes sense for a QPE circuit built on a qubitization walk: its eigenvalues are \(e^{\pm i\arccos(E/\lambda)}\), where \(\lambda\) is the L1 norm of the Hamiltonian, so the window is converted with \(\varphi = \arccos(E/\lambda)/2\pi\). Both signs occur, so an energy is marked in two mirrored bins. Any other encoding, a Trotter step for instance, follows a different law and has to use
target_phase_bins. Energy bounds are clipped to the representable range \([-\lambda, \lambda]\), so passing an infinite bound gives a one-sided threshold.- Return type:
- Parameters:
qpe_circuit (Circuit) – The measurement-free QPE circuit whose phase register is marked.
target_phase_bins (tuple[int, int] | None) – Half-open phase-bin interval
(start, stop)to mark.target_energy_range (tuple[float, float] | None) – Half-open energy window
(low, high), an alternative totarget_phase_bins.qubit_hamiltonian (QubitOperator | None) – The Hamiltonian the QPE circuit estimates, supplying \(\lambda\).
- Returns:
A circuit for use as the
good_state_oracleofAmplitudeAmplification.- Raises:
ValueError – If the target range is invalid or the circuit is not a standard QPE circuit.
TypeError – If the range endpoints are not the expected type.