旧版兼容入口¶
oracq.applications.legacy
Open, bindable assembly examples for QFVM and QHAM.
- class oracq.applications.legacy.QfvmInputs(position, reverse_slot, column_position, column_reverse_slot, flow, boundary, physical_entry, amplitude, residual, cell_width, slot_width, field_width, value_width)[源代码]¶
基类:
objectAll open input declarations and layout constants of the QFVM assembly example.
- 变量:
position (oracq.algorithms.input_model.oracles.XorDatabase) -- Open XOR-database declaration for row-coordinate queries.
reverse_slot (oracq.algorithms.input_model.oracles.XorDatabase) -- Open XOR-database declaration for reverse column-slot queries within a row.
column_position (oracq.algorithms.input_model.oracles.XorDatabase) -- Open XOR-database declaration for column-coordinate queries.
column_reverse_slot (oracq.algorithms.input_model.oracles.XorDatabase) -- Open XOR-database declaration for reverse slot queries within a column.
flow (oracq.algorithms.input_model.oracles.XorDatabase) -- Open XOR-database declaration for flux-word queries.
boundary (oracq.algorithms.input_model.oracles.XorDatabase) -- Open XOR-database declaration for boundary-word queries.
physical_entry (oracq.infrastructure.builder.Operation) -- Open declaration of the reversible physical-entry function.
amplitude (oracq.infrastructure.builder.Operation) -- Open declaration of the amplitude transduction.
residual (oracq.algorithms.input_model.oracles.StatePreparation) -- Residual state preparation declaration.
cell_width (int) -- Bit width of spatial cell coordinates.
slot_width (int) -- Bit width of column slots.
field_width (int) -- Width of flux and boundary words.
value_width (int) -- Width of physical entry values.
- position¶
- reverse_slot¶
- column_position¶
- column_reverse_slot¶
- flow¶
- boundary¶
- physical_entry¶
- amplitude¶
- residual¶
- cell_width¶
- slot_width¶
- field_width¶
- value_width¶
- oracq.applications.legacy.qfvm_inputs(name='Qfvm', *, cell_width=1, slot_width=1, field_width=1, value_width=2)[源代码]¶
Build all open input declarations of the QFVM assembly example.
- 参数:
name -- Declaration name prefix, prepended to each slot module name.
cell_width -- Bit width of spatial cell coordinates.
slot_width -- Bit width of column slots.
field_width -- Width of flux and boundary words.
value_width -- Width of physical entry values.
- 返回:
Input bundle with the six XOR databases, the physical-entry and amplitude open declarations, and the residual preparation.
- 返回类型:
- oracq.applications.legacy.qfvm_block_encoding(inputs, *, alpha=2.0)[源代码]¶
Compose the QFVM access isometries into a block encoding with the
T_L†SWAP T_Rstructure.- 参数:
inputs -- Open input bundle built by
qfvm_inputs.alpha -- Normalization constant written into the
be_alphaattribute.
- 返回:
Block encoding view with spatial cells as the target and the access-graph workspace as the signal.
- 返回类型:
- oracq.applications.legacy.qfvm_step(inputs, qlss, *, alpha=2.0)[源代码]¶
Hand the QFVM block encoding and residual preparation to the linear-system solver protocol.
- 参数:
inputs -- Open input bundle built by
qfvm_inputs.qlss -- Solver protocol accepting a block encoding and a state preparation and returning a
StateOracle.alpha -- Normalization constant passed to the block encoding.
- 返回:
QFVM stepping solution-state oracle produced by the solver protocol.
- 返回类型:
- oracq.applications.legacy.embed_block(a, global_width, row_offset, column_offset)[源代码]¶
Embed a block encoding at a diagonal-block position of a larger global matrix.
The target is first wrapped by subtracting the column offset and the padding region flagged on the high bits, then
ais invoked and the row offset added to the whole register.- 参数:
a -- The embedded block encoding.
global_width -- Bit width of the global target register.
row_offset -- Row offset of the target block in the global matrix.
column_offset -- Column offset of the target block in the global matrix.
- 返回:
Block encoding with target width
global_widthand the same alpha asa.- 返回类型:
- 抛出:
ValidationError -- The embedded block crosses the global matrix boundary.
- oracq.applications.legacy.qham_lift_m1(linear, fold, *, h=-0.25, hfun=1.0)[源代码]¶
Lift the linear and folding terms into block encodings of the QHAM m=1 closed system.
The linear terms sit on diagonal blocks along the three coordinate blocks and two two-coordinate tensor-product terms, the folding terms appear on two coupling blocks with weight
-h*hfun, and the whole is combined by LCU.- 参数:
linear -- Block encoding of the single-coordinate linear operator.
fold -- Block encoding of the two-coordinate folding operator; its width must be twice that of
linear.h -- Folding coupling constant.
hfun -- Scaling factor of the folding coefficient; the product
h*hfunserves as the coupling weight.
- 返回:
LCU-combined block encoding of the lifted system.
- 返回类型:
- 抛出:
ValidationError -- The folding matrix is not padded to the two-coordinate space.
- oracq.applications.legacy.qham_initial_vector(values)[源代码]¶
Build the initial-state amplitude tuple of the QHAM m=1 lifted system.
Arranged as
[v, v, 0, v⊗v]and zero-padded to a power-of-two length for state preparation binding.- 参数:
values -- Sequence of physical-channel initial-state amplitudes.
- 返回:
Complex amplitude tuple zero-padded to a power-of-two length.
- 返回类型:
tuple[complex, ...]
- oracq.applications.legacy.qham_m1(linear, fold, initial, solver, *, final_time=0.1, h=-0.25, hfun=1.0, via_pde=False)[源代码]¶
Assemble and solve the QHAM m=1 lifted system, selecting the physical-channel subspace.
- 参数:
linear -- Block encoding of the single-coordinate linear operator.
fold -- Block encoding of the two-coordinate folding operator.
initial -- Physical-channel initial-state preparation.
solver -- Solver protocol for the lifted system; when
via_pdeis true it is called as(DiscretePDE, final time), otherwise as(block encoding, preparation, final time).final_time -- Final evolution time.
h -- Folding coupling constant.
hfun -- Scaling factor of the folding coefficient.
via_pde -- Whether to wrap in
DiscretePDEbefore handing over to the solver protocol.
- 返回:
Solution-state oracle after selecting the physical subspace.
- 返回类型: