qdk_chemistry.utils.phase module
Utility functions for manipulating phases produced by QPE.
- qdk_chemistry.utils.phase.accumulated_phase_from_bits(bits_msb_first)[source]
Compute
Φ(1)directly from a measured bit string (MSB to LSB).
- qdk_chemistry.utils.phase.energy_alias_candidates(raw_energy, *, evolution_time, shift_range=range(-2, 3))[source]
Enumerate alias energies compatible with
raw_energy.- Return type:
- Parameters:
raw_energy (float) – Energy derived from the measured phase.
evolution_time (float) – Evolution time
tused by the unitary.Integer shifts (in multiples of
2π / t) to explore.The default
range(-2, 3)checksk = -2, -1, 0, 1, 2—a pragmatic window that typically covers chemical-energy estimates because they rarely deviate by more than one or two2π / tperiods from the raw measurement.
- Returns:
Sorted list of alias energy values covering positive and negative branches.
- qdk_chemistry.utils.phase.energy_from_phase(phase_fraction, *, evolution_time)[source]
Convert a measured phase fraction to energy using
E = angle / t.
- qdk_chemistry.utils.phase.iterative_phase_feedback_update(current_phase, measured_bit)[source]
Update the feedback phase according to Kitaev’s recursion [Kit95].
- Return type:
- Parameters:
- Returns:
Updated feedback phase
Φ(k)for the next iteration.- Raises:
ValueError – If
measured_bitis not 0 or 1.
- qdk_chemistry.utils.phase.phase_fraction_from_feedback(phase_feedback)[source]
Convert the final feedback phase
Φ(1)into the phase fractionφ.
- qdk_chemistry.utils.phase.resolve_energy_aliases(raw_energy, *, evolution_time, reference_energy, shift_range=range(-2, 3))[source]
Select the alias energy closest to a known reference value.
- Return type:
- Parameters:
raw_energy (float) – Energy derived from the measured phase.
evolution_time (float) – Evolution time
tused by the unitary.reference_energy (float) – External reference guiding alias selection.
shift_range (Iterable[int]) –
Integer shifts (in multiples of
2π / t) to explore.Use a wider window when the true value may sit multiple periods away from the raw estimate.
- Returns:
Alias energy closest to
reference_energy.