qml.estimator.templates.IterativeQPE¶
- class IterativeQPE(base, num_iter)[source]
Bases:
ResourceOperator
Resource class for Iterative Quantum Phase Estimation (IQPE).
- Parameters:
base (
ResourceOperator
) – the phase estimation operatornum_iter (int) – the number of mid-circuit measurements performed to read out the phase
- Resources:
The resources are obtained following the construction from arXiv:0610214v3.
See also
Example
The resources for this operation are computed using:
>>> import pennylane.estimator as qre >>> gate_set = {"Hadamard", "CRX", "PhaseShift"} >>> iqpe = qre.IterativeQPE(qre.RX(), 5) >>> print(qre.estimate(iqpe, gate_set)) --- Resources: --- Total wires: 2 algorithmic wires: 1 allocated wires: 1 zero state: 1 any state: 0 Total gates : 25 'CRX': 5, 'PhaseShift': 10, 'Hadamard': 10
Attributes
Returns a dictionary containing the minimal information needed to compute the resources.
- resource_keys = {'base_cmpr_op', 'num_iter'}¶
- resource_params¶
Returns a dictionary containing the minimal information needed to compute the resources.
- Returns:
- A dictionary containing the resource parameters:
base_cmpr_op (
CompressedResourceOp
): A compressed resource operator, corresponding to the phase estimation operator.num_iter (int): the number of mid-circuit measurements made to read out the phase
- Return type:
dict
Methods
resource_decomp
(base_cmpr_op, num_iter)Returns a list representing the resources of the operator.
resource_rep
(base_cmpr_op, num_iter)Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
- classmethod resource_decomp(base_cmpr_op, num_iter)[source]¶
Returns a list representing the resources of the operator. Each object in the list represents a gate and the number of times it occurs in the circuit.
- Parameters:
base_cmpr_op (
CompressedResourceOp
) – A compressed resource operator, corresponding to the phase estimation operator.num_iter (int) – the number of mid-circuit measurements made to read out the phase
- Resources:
The resources are obtained following the construction from arXiv:0610214v3.
- Returns:
A list of GateCount objects, 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(base_cmpr_op, num_iter)[source]¶
Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
- Parameters:
base_cmpr_op (
CompressedResourceOp
) – A compressed resource operator, corresponding to the phase estimation operator.num_iter (int) – the number of mid-circuit measurements made to read out the phase
- Returns:
the operator in a compressed representation
- Return type: