qdk_chemistry.algorithms.phase_estimation.circuit_builder.unary_phase_estimation_builder module

Unary-iteration phase estimation circuit builder.

class qdk_chemistry.algorithms.phase_estimation.circuit_builder.unary_phase_estimation_builder.QdkUnaryQpeCircuitBuilder(num_queries=-1, unitary_builder=None, circuit_mapper=None)[source]

Bases: QpeCircuitBuilder

Phase estimation circuit builder driven by unary iteration.

Standard QPE applies controlled \(U^{2^k}\) once per phase qubit and therefore consumes a power-of-two number of walk queries. This builder instead emits a single chain of num_queries self-inverse walk blocks and uses unary iteration over the phase register to select which interleaved reflection is omitted, so any positive query count is supported.

The phase register is prepared in a cosine window state to suppress the spectral leakage of the truncated schedule. The unitary builder must set quantum_walk=True for the post-processing formula.

References

  • [BGB+18] — cosine-window control state.

  • [LBG+21] — non-power-of-two query schedule.

Parameters:
__init__(num_queries=-1, unitary_builder=None, circuit_mapper=None)[source]

Initialize the unary-iteration QPE circuit builder.

Parameters:
  • num_queries (int) – Number of queries to the block encoding. Default to -1; user needs to set a valid value.

  • unitary_builder (AlgorithmRef | None) – Optional algorithm reference for the unitary builder.

  • circuit_mapper (AlgorithmRef | None) – Optional algorithm reference for the block-encoding circuit mapper.

Return type:

None

resolve_num_queries()[source]

Return the query count to apply and the phase-register size addressing it.

Return type:

tuple[int, int]

Returns:

The number of walk blocks the schedule applies, and the number of phase qubits needed to address its num_queries + 1 reflection slots.

Raises:

ValueError – If the configured num_queries is not a positive integer.

name()[source]

Return the name of the builder algorithm.

Return type:

str

class qdk_chemistry.algorithms.phase_estimation.circuit_builder.unary_phase_estimation_builder.QdkUnaryQpeCircuitBuilderSettings[source]

Bases: QpeCircuitBuilderSettings

Settings for the unary-iteration phase estimation circuit builder.

__init__()[source]

Initialize the unary-iteration QPE builder settings.

Return type:

None

qdk_chemistry.algorithms.phase_estimation.circuit_builder.unary_phase_estimation_builder.cosine_window_state(num_queries)[source]

Return the phase-register amplitudes, zero-padded to a whole number of qubits.

The cosine window is the Heisenberg-limited control state of [BGB+18] (Eq. 17), \(\psi_t \propto \sin(\pi (t + 1) / (p + 2))\) over the \(p + 1\) reflection slots.

Parameters:

num_queries (int) – Number of walk blocks; the window spans num_queries + 1 slots.

Return type:

list[float]

Returns:

Real amplitudes normalized to unit norm, zero-padded to a whole number of qubits.