态制备组合¶
oracq.algorithms.common.state_preparation
Composition utilities for initial state extension, applying encodings and physical subspace selection.
- oracq.algorithms.common.state_preparation.extend_initial(prep, extra_width)[源代码]¶
Extend the target space of a state preparation
prepbyextra_widthhigh bits.The original preparation acts on the low bits of the extended target and the new high bits stay zero; the zero-input promise is preserved.
- 参数:
prep -- The original
StatePreparation.extra_width -- Number of high qubits to append.
- 返回:
Preparation whose target width is
prep.width + extra_width.- 返回类型:
- oracq.algorithms.common.state_preparation.select_subspace(state, output_width, high_value=0, *, label='selection')[源代码]¶
Select the physical subspace out of the target space of a state oracle.
The low
output_widthbits serve as the output, while the remaining high bits are folded into signal and required to equalhigh_value; the success condition is that the whole signal register returns to zero.- 参数:
state -- The input
StateOracle, with width not less thanoutput_width.output_width -- The selected physical output width.
high_value -- The value that the discarded high bits must equal, zero by default.
label -- Label used for the generated module name and algorithm attribute.
- 返回:
State oracle with output width
output_widthand a signal holding the original signal bits plus the appended high bits.- 返回类型:
- 抛出:
ValidationError --
output_widthexceedsstate.width, orhigh_valueis out of range.
- oracq.algorithms.common.state_preparation.apply_be_to_state(a, prep)[源代码]¶
Apply a block encoding
ato an already prepared initial state, yielding a state oracle.The signal bits of
aoccupy the low bits of signal and the workspace ofprepis folded into its high bits; the success condition is that the whole signal register returns to zero.- 参数:
a -- The
BlockEncodingof the operator to apply.prep -- A
StatePreparationwith the same target width asa.
- 返回:
State oracle with unchanged target width and an attached signal register.
- 返回类型:
- 抛出:
ValidationError -- The two target widths differ.