qpe_toolbox.estimation.lcu_walk_operator¶
Functions¶
|
Compute the LCU weights, normalization factor, and ancilla register size for a Hamiltonian. |
|
Construct the normalized MPS representing the L register state \(\ket{\mathcal{L}}\). |
|
Construct the PREPARE oracle MPO \(\ket{0}\bra{\mathcal{L}}\). |
|
Construct the full list of gate instructions for the SELECT oracle. |
|
Construct the MPO implementing the SELECT oracle. |
|
Construct the reflection operator \(\mathcal{R}_L\) for the L register. |
|
Perform LCU and quantum phase estimation (QPE) using the walk operator. |
|
LCU first stage of QPE: apply Hadamard wall and controlled-W sequence. |
|
Get the energy from the eigenphase of the LCU Walk operator. |
|
Estimate the error bound in energy in LCU QPE from finite number of phase qubits. |
Module Contents¶
- qpe_toolbox.estimation.lcu_walk_operator.get_lcu_weights(hamiltonian)[source]¶
Compute the LCU weights, normalization factor, and ancilla register size for a Hamiltonian.
- Parameters:
hamiltonian (Hamiltonian) – Hamiltonian from the QPE-Toolbox
Hamiltonianclass.- Returns:
weights (list of float) – Absolute values of the Hamiltonian coefficients, extended with zeros to match a power-of-two length.
lmb (float) – Sum of absolute values of Hamiltonian coefficients (normalization factor).
L (int) – Number of original Hamiltonian terms.
m_L (int) – Number of qubits required for the auxiliary L-register, i.e.,
ceil(log2(L)).
- qpe_toolbox.estimation.lcu_walk_operator.build_lcu_prepare_state_mps(hamiltonian, *, cutoff=1e-10)[source]¶
Construct the normalized MPS representing the L register state \(\ket{\mathcal{L}}\).
\[\ket{\mathcal{L}} = \sum_\ell \sqrt{\frac{w_\ell}{\lambda}} \ket{\ell}\]- Parameters:
hamiltonian (Hamiltonian) – Hamiltonian to encode with LCU.
cutoff (float, default
1e-10) – Singular value cutoff for MPS compression.
- Returns:
L_mps – MPS representing the state \(\ket{\mathcal{L}}\).
- Return type:
- qpe_toolbox.estimation.lcu_walk_operator.build_lcu_prepare_mpo(hamiltonian, *, cutoff=1e-10)[source]¶
Construct the PREPARE oracle MPO \(\ket{0}\bra{\mathcal{L}}\).
- Parameters:
hamiltonian (Hamiltonian) – Hamiltonian to encode with LCU.
cutoff (float, default
1e-10) – Cutoff for MPO compression.
- Returns:
prep_mpo – MPO implementing the PREPARE oracle.
- Return type:
- qpe_toolbox.estimation.lcu_walk_operator.lcu_select_gates(hamiltonian)[source]¶
Construct the full list of gate instructions for the SELECT oracle.
- Parameters:
hamiltonian (Hamiltonian) – Hamiltonian object from the QPE-Toolbox
Hamiltonianclass.- Returns:
gates – Gate sequence implementing the SELECT oracle.
- Return type:
list of Gate
- qpe_toolbox.estimation.lcu_walk_operator.build_lcu_select_mpo(hamiltonian, *, cutoff=1e-10)[source]¶
Construct the MPO implementing the SELECT oracle.
- Parameters:
hamiltonian (Hamiltonian) – Hamiltonian describing the system.
cutoff (float, default
1e-10) – MPO compression cutoff.
- Returns:
select_mpo – MPO implementing \(SELECT = \sum_\ell \ket{\ell}\bra{\ell} \otimes H_\ell\).
- Return type:
- qpe_toolbox.estimation.lcu_walk_operator.build_lcu_reflection_mpo(hamiltonian, *, cutoff=1e-10)[source]¶
Construct the reflection operator \(\mathcal{R}_L\) for the L register.
\[\mathcal{R}_L = 2 \ket{\mathcal{L}}\bra{\mathcal{L}}\otimes\mathbb{1} - \mathbb{1}\]- Parameters:
hamiltonian (Hamiltonian) – Hamiltonian object from the QPE-Toolbox
Hamiltonianclass.cutoff (float, default
1e-10) – MPO compression cutoff.
- Returns:
R_L – MPO representing the reflection.
- Return type:
- qpe_toolbox.estimation.lcu_walk_operator.run_qpe_lcu_walk_operator(H, psi0_mps, m_ph, *, max_bond=0, cutoff=1e-10, verbosity=0)[source]¶
Perform LCU and quantum phase estimation (QPE) using the walk operator.
- Parameters:
H (Hamiltonian) – Hamiltonian object from the QPE-Toolbox
Hamiltonianclass.psi0_mps (MatrixProductState) – Initial state of the physical register.
m_ph (int) – Number of phase estimation qubits.
max_bond (int, default
0) – Maximum MPS bond dimension.cutoff (float, default
1e-10) – Truncation cutoff for MPS compression.verbosity (int, default
0) – Verbosity level. If >= 1, print result summary. If >= 2, print detailed progress messages.
- Returns:
traces (dict) – Contains timing information: {‘ctimes’: […]}.
theta (float) – Estimated phase from the walk operator.
- qpe_toolbox.estimation.lcu_walk_operator.qpe_first_stage_walk(H, psi0_mps, m_ph, regs, *, max_bond=0, cutoff=1e-10, verbosity=0)[source]¶
LCU first stage of QPE: apply Hadamard wall and controlled-W sequence.
- Parameters:
H (Hamiltonian) – Hamiltonian from the QPE-Toolbox
Hamiltonianclass.psi0_mps (MatrixProductState) – Initial state of the physical register.
m_ph (int) – Number of phase qubits.
regs (dict) – Dictionary with registers: {‘phase’:…, ‘L’:…, ‘phys’:…}.
max_bond (int, default
0) – Maximum MPS bond dimension.cutoff (float, default
1e-10) – MPO/MPS compression cutoff.verbosity (int, default
0) – Verbosity level. If >= 2, print progress messages.
- Returns:
traces (dict) – Contains timing information: {‘ctimes’: […]}.
circ (CircuitMPS) – Circuit representing the applied QPE first stage.
- qpe_toolbox.estimation.lcu_walk_operator.get_energy_from_lcu_walk_phase(theta, lmb)[source]¶
Get the energy from the eigenphase of the LCU Walk operator.
\[E = \lambda \cos(2 \pi \theta)\]