qml.estimator.templates.GQSPTimeEvolution¶
- class GQSPTimeEvolution(walk_op, time, one_norm, poly_approx_precision=None, wires=None)[source]
Bases:
ResourceOperatorResource class for performing Hamiltonian simulation using GQSP.
- Parameters:
walk_op (
ResourceOperator) – the quantum walk operatortime (float) – the simulation time
one_norm (float) – one norm of the Hamiltonian
poly_approx_precision (float) – the tolerance for error in the polynomial approximation
wires (WiresLike | None) – The wires the operation acts on. This includes both the wires of the signal operator and the control wire required for block-encoding.
- Resources:
The resources are obtained as described in Theorem 7 and Corollary 8 of Generalized Quantum Signal Processing (2024).
- Raises:
ValueError – if the
wiresprovided don’t match the number of wires expected by the operatorValueError – if the
timeprovided is not a positive real number greater than zeroValueError – if the
one_normprovided is not a positive real number greater than zeroValueError – if the
poly_approx_precisionprovided is not a positive real number greater than zero
Example
The resources for this operation are computed using:
>>> import pennylane.estimator as qre >>> walk_op = qre.RX(0.1, wires=0) >>> time = 1.0 >>> one_norm = 1.0 >>> approx_error = 0.01 >>> hamsim = qre.GQSPTimeEvolution(walk_op, time, one_norm, approx_error) >>> print(qre.estimate(hamsim)) --- Resources: --- Total wires: 2 algorithmic wires: 2 allocated wires: 0 zero state: 0 any state: 0 Total gates : 1.110E+3 'T': 1.080E+3, 'CNOT': 12, 'X': 6, 'Hadamard': 12
Attributes
Returns a dictionary containing the minimal information needed to compute the resources.
- resource_keys = {'one_norm', 'poly_approx_precision', 'time', 'walk_op'}¶
- resource_params¶
Returns a dictionary containing the minimal information needed to compute the resources.
- Returns:
- A dictionary containing the resource parameters:
walk_op (
CompressedResourceOp): the quantum walk operatortime (float): the simulation time
one_norm (float): one norm of the Hamiltonian
poly_approx_precision (float): the tolerance for error in the polynomial approximation
- Return type:
dict
Methods
poly_approx(time, one_norm, epsilon)Obtain the maximum degree of the polynomial approximation required to approximate \(e^{(iHt \cos{\theta})}\) within some error epsilon.
resource_decomp(walk_op, time, one_norm[, ...])Returns a list representing the resources of the operator.
resource_rep(walk_op, time, one_norm[, ...])Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
- static poly_approx(time, one_norm, epsilon)[source]¶
Obtain the maximum degree of the polynomial approximation required to approximate \(e^{(iHt \cos{\theta})}\) within some error epsilon.
- Parameters:
time (float) – the simulation time
one_norm (float) – one norm of the Hamiltonian
epsilon (float) – the tolerance for error in the polynomial approximation
- Returns:
the minimum degree of the polynomial approximation
- Return type:
int
- classmethod resource_decomp(walk_op, time, one_norm, poly_approx_precision=None)[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:
walk_op (
CompressedResourceOp) – the quantum walk operatortime (float) – the simulation time
one_norm (float) – one norm of the Hamiltonian
poly_approx_precision (float | None) – the tolerance for error in the polynomial approximation
- Resources:
The resources are obtained as described in Theorem 7 and Corollary 8 of Generalized Quantum Signal Processing (2024).
- 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(walk_op, time, one_norm, poly_approx_precision=None)[source]¶
Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
- Parameters:
walk_op (
CompressedResourceOp) – the quantum walk operatortime (float) – the simulation time
one_norm (float) – one norm of the Hamiltonian
poly_approx_precision (float | None) – the tolerance for error in the polynomial approximation
- Returns:
the operator in a compressed representation
- Return type: