qml.estimator.templates.UnaryIterationQPE¶
- class UnaryIterationQPE(walk_op, num_iterations, adj_qft_op=None, wires=None)[source]
Bases:
ResourceOperatorResource class for Quantum Phase Estimation (QPE) using the unary iteration technique.
This form of QPE, as described in arXiv.2011.03494, requires the unitary operator to be a quantum walk operator constructed from
SelectandPreparesubroutines. In this approach, unary iteration is used to construct successive powers of the walk operator, which reducesTandToffoligate counts in their decomposition at the cost of increasing the number of auxiliary qubits required.For a detailed explanation of unary iteration, see here. Note that users can also provide a custom adjoint Quantum Fourier Transform (QFT) implementation, which can be used to further optimize the resource requirements.
- Parameters:
walk_op (
ResourceOperator) – the quantum walk operator to apply the phase estimation protocol onnum_iterations (int) – The total number of times the quantum walk operator is applied in order to reach a target precision in the eigenvalue estimate.
adj_qft_op (
ResourceOperator| None) – An optional argument to set the subroutine used to perform the adjoint QFT operation.wires (WiresLike | None) – the wires the operation acts on
- Resources:
The resources are obtained from Figure 2. in Section III of arXiv.2011.03494.
- Raises:
ValueError –
num_iterationsmust be an integer greater than zeroTypeError –
walk_opmust be an instance ofQubitizationorQubitizeTHC
See also
Related PennyLane operation
QuantumPhaseEstimationand explanation of Unary Iteration.Example
The resources for this operation are computed as follows:
>>> import pennylane.estimator as qre >>> thc_ham = qre.THCHamiltonian(num_orbitals=20, tensor_rank=40) >>> num_iter, walk_op = (11, qre.QubitizeTHC(thc_ham)) >>> res = qre.estimate(qre.UnaryIterationQPE(walk_op, num_iter)) >>> print(res) --- Resources: --- Total wires: 402 algorithmic wires: 101 allocated wires: 301 zero state: 301 any state: 0 Total gates : 5.821E+5 'Toffoli': 3.546E+4, 'T': 792, 'CNOT': 4.262E+5, 'X': 1.833E+4, 'Z': 475, 'S': 880, 'Hadamard': 9.995E+4
Attributes
Returns a dictionary containing the minimal information needed to compute the resources.
- resource_keys = {'adj_qft_cmpr_op', 'cmpr_walk_op', 'num_iterations'}¶
- resource_params¶
Returns a dictionary containing the minimal information needed to compute the resources.
- Returns:
- A dictionary containing the resource parameters:
cmpr_walk_op (
CompressedResourceOp): A compressed resource operator corresponding to the quantum walk operator to apply the phase estimation protocol on.num_iterations (int): The total number of times the quantum walk operator is applied in order to reach a target precision in the eigenvalue estimate.
adj_qft_cmpr_op (
CompressedResourceOp| None): An optional compressed resource operator corresponding to the adjoint QFT routine. IfNone, the defaultQFTwill be used.
- Return type:
dict
Methods
resource_decomp(cmpr_walk_op, num_iterations)Returns the resources for Quantum Phase Estimation implemented using unary iteration.
resource_rep(cmpr_walk_op, num_iterations[, ...])Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
tracking_name(cmpr_walk_op, num_iterations)Returns the tracking name built with the operator's parameters.
- classmethod resource_decomp(cmpr_walk_op, num_iterations, adj_qft_cmpr_op=None)[source]¶
Returns the resources for Quantum Phase Estimation implemented using unary iteration.
- Parameters:
cmpr_walk_op (
CompressedResourceOp) – A compressed resource operator corresponding to the quantum walk operator to apply the phase estimation protocol on.num_iterations (int) – The total number of times the quantum walk operator is applied in order to reach a target precision in the eigenvalue estimate.
adj_qft_cmpr_op (
CompressedResourceOp| None) – An optional compressed resource operator corresponding to the adjoint QFT routine. IfNone, the defaultQFTwill be used.
- Resources:
The resources are obtained from Figure 2. in Section III of arXiv.2011.03494.
- Returns:
A list of
GateCountobjects, where each object represents a specific quantum gate and the number of times it appears in the decomposition.- Return type:
list[
GateCount]
- classmethod resource_rep(cmpr_walk_op, num_iterations, adj_qft_cmpr_op=None)[source]¶
Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
- Parameters:
cmpr_walk_op (
CompressedResourceOp) – A compressed resource operator corresponding to the quantum walk operator to apply the phase estimation protocol on.num_iterations (int) – The total number of times the quantum walk operator is applied in order to reach a target precision in the eigenvalue estimate.
adj_qft_cmpr_op (
CompressedResourceOp| None) – An optional compressed resource operator corresponding to the adjoint QFT routine. IfNone, the defaultQFTwill be used.
- Returns:
the operator in a compressed representation
- Return type: