guppyalgos.algorithms.block_encoding.lcu¶
Perform sums / Linear Combinations of Unitaries.
Functions
Build an externally controlled two-term SELECT oracle from LCU data. |
|
|
Build an externally controlled unary-iteration SELECT from LCU data. |
Build a doubly-controlled SELECT oracle from LCU data. |
|
Build a single-control SELECT oracle from LCU data. |
|
|
Build a unary-iteration SELECT oracle from LCU data. |
Classes
|
Guppy struct representing an LCU block encoding. |
|
LCU block encoding with an externally controlled SELECT oracle. |
|
Classical Hamiltonian data used to build LCU oracles. |
- class guppyalgos.algorithms.block_encoding.lcu.LCU¶
Guppy struct representing an LCU block encoding.
Given PREPARE, SELECT, and UNPREPARE oracles,
composeapplies\[ L = \mathrm{UNPREPARE}\,\mathrm{SELECT}\,\mathrm{PREPARE}. \]PREPARE initializes
PrepRegswith the amplitudes used to select terms in the linear combination. SELECT applies the corresponding operation toTargetRegs, controlled by the state ofPrepRegs. UNPREPARE then restores the initialPrepRegsbasis state; it is typically the inverse of PREPARE, giving \(L = \mathrm{PREPARE}^{\dagger}\,\mathrm{SELECT}\,\mathrm{PREPARE}\).When these oracles encode an operator \(A\) with normalization \(\lambda\), projecting
PrepRegsonto its all-zero state extracts the block \(A / \lambda\).PrepRegsandTargetRegsare generic register types. They may be individual qubit arrays or Guppy structs containing multiple registers, as long as the three oracle signatures agree with the types used byLCU.- Type Parameters:
PrepRegs: PREPARE register type shared by all three oracles. TargetRegs: Type of the target registers acted on by SELECT.
- Variables:
prepare – PREPARE oracle acting on
PrepRegs.select – SELECT oracle acting on
PrepRegsandTargetRegs.unprepare – UNPREPARE oracle restoring the initial
PrepRegsstate.
- compose(prep_register, state_register)¶
Apply the LCU block encoding \(L\).
- Parameters:
prep_register – The PREPARE register.
state_register – The SELECT register.
- prepare¶
- select¶
- unprepare¶
- class guppyalgos.algorithms.block_encoding.lcu.LCUCntrl¶
LCU block encoding with an externally controlled SELECT oracle.
ControlRegsis forwarded unchanged tocntrl_selectand may be a qubit, qubit array, or structured register type. The supplied SELECT oracle defines the condition under which its target operation is applied.- cntrl_select¶
- compose(controls, prep_register, target_registers)¶
Apply PREPARE, controlled SELECT, and UNPREPARE.
- prepare¶
- unprepare¶
- class guppyalgos.algorithms.block_encoding.lcu.LCUData(n_state_qubits, n_terms, n_prep_qubits, pauli_strings, coeffs, coefficient_phases, l1_norm)¶
Classical Hamiltonian data used to build LCU oracles.
- property amplitudes: NDArray[float64]¶
Return normalized PREPARE amplitudes for the Hamiltonian terms.
- guppyalgos.algorithms.block_encoding.lcu.build_cntrl_single_cntrl_select(data)¶
Build an externally controlled two-term SELECT oracle from LCU data.
- guppyalgos.algorithms.block_encoding.lcu.build_cntrl_unary_iteration_select(data, comp_and_op=<function toffoli>, uncomp_and_op=<function toffoli>)¶
Build an externally controlled unary-iteration SELECT from LCU data.
- guppyalgos.algorithms.block_encoding.lcu.build_double_cntrl_select(data)¶
Build a doubly-controlled SELECT oracle from LCU data.
- guppyalgos.algorithms.block_encoding.lcu.build_single_cntrl_select(data)¶
Build a single-control SELECT oracle from LCU data.
- guppyalgos.algorithms.block_encoding.lcu.build_unary_iteration_select(data, comp_and_op=<function toffoli>, uncomp_and_op=<function toffoli>)¶
Build a unary-iteration SELECT oracle from LCU data.