qml.estimator.templates.GQSP¶
- class GQSP(signal_operator, d_plus, d_minus=0, rotation_precision=None, wires=None)[source]
Bases:
ResourceOperatorResource class for the Generalized Quantum Signal Processing (GQSP) algorithm.
The
GQSPoperator is defined based on Theorem 6 of Generalized Quantum Signal Processing (2024):\[GQSP = \left( \prod_{j=1}^{d^{-}} R(\theta_{j}, \phi_{j}, 0) \hat{A}^{\prime} \right) \left( \prod_{j=1}^{d^{+}} R(\theta_{j + d^{-}}, \phi_{j + d^{-}}, 0) \hat{A} \right) R(\theta_0, \phi_0, \lambda),\]where \(R\) is the single-qubit rotation operator and \(\vec{\phi}\), \(\vec{\theta}\) and \(\lambda\) are the rotation angles that generate the polynomial transformation. The maximum positive and negative polynomial degrees are denoted by \(d^{+}\) and \(d^{-}\), respectively. Additionally, \(\hat{A}\) and \(\hat{A}^{\prime}\) are given by:
\[\begin{split}\begin{align} \hat{A} &= \ket{0}\bra{0}\otimes\hat{U} + \ket{1}\bra{1}\otimes\mathbf{I}, \\ \hat{A}^{\prime} &= \ket{0}\bra{0}\otimes\mathbf{I} + \ket{1}\bra{1}\otimes\hat{U}^{\dagger}, \\ \\ \end{align}\end{split}\]where \(U\) is a signal operator which encodes a target Hamiltonian.
- Parameters:
signal_operator (
ResourceOperator) – the signal operator which encodes a target Hamiltoniand_plus (int) – The largest positive degree \(d^{+}\) of the polynomial transformation.
d_minus (int) – The largest (in absolute value) negative degree \(d^{-}\) of the polynomial transformation, representing powers of the adjoint of the signal operator.
rotation_precision (float | None) – The precision with which the general rotation gates are applied.
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 6 of Generalized Quantum Signal Processing (2024).
- Raises:
ValueError – if
d_plusis not a positive integer greater than zeroValueError – if
d_minusis not an integer greater than or equal to zeroValueError – if
rotation_precisionis not a positive real number greater than zeroValueError – if the wires provided don’t match the number of wires expected by the operator
Example
The resources for this operation are computed using:
>>> import pennylane.estimator as qre >>> signal_op = qre.RX(0.1, wires=0) >>> d_plus = 5 >>> d_minus = 3 >>> gqsp = qre.GQSP(signal_op, d_plus, d_minus) >>> print(qre.estimate(gqsp)) --- Resources: --- Total wires: 2 algorithmic wires: 2 allocated wires: 0 zero state: 0 any state: 0 Total gates : 1.438E+3 'T': 1.396E+3, 'CNOT': 16, 'X': 10, 'Hadamard': 16
Attributes
Returns a dictionary containing the minimal information needed to compute the resources.
- resource_keys = {'cmpr_signal_op', 'd_minus', 'd_plus', 'rotation_precision'}¶
- resource_params¶
Returns a dictionary containing the minimal information needed to compute the resources.
- Returns:
- A dictionary containing the resource parameters:
cmpr_signal_op (
CompressedResourceOp): the compressed representation of the signal operator which encodes the target Hamiltoniand_plus (int): The largest positive degree \(d^{+}\) of the polynomial transformation.
d_minus (int): The largest (in absolute value) negative degree \(d^{-}\) of the polynomial transformation, representing powers of the adjoint of the signal operator.
rotation_precision (float | None): The precision with which the general rotation gates are applied.
- Return type:
dict
Methods
resource_decomp(cmpr_signal_op, d_plus[, ...])Returns a list representing the resources of the operator.
resource_rep(cmpr_signal_op, d_plus[, ...])Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
- classmethod resource_decomp(cmpr_signal_op, d_plus, d_minus=0, rotation_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:
cmpr_signal_op (
CompressedResourceOp) – the compressed representation of the signal operator which encodes the target Hamiltoniand_plus (int) – The largest positive degree \(d^{+}\) of the polynomial transformation.
d_minus (int) – The largest (in absolute value) negative degree \(d^{-}\) of the polynomial transformation, representing powers of the adjoint of the signal operator.
rotation_precision (float | None) – The precision with which the general rotation gates are applied.
- Resources:
The resources are obtained as described in Theorem 6 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(cmpr_signal_op, d_plus, d_minus=0, rotation_precision=None)[source]¶
Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
- Parameters:
cmpr_signal_op (
CompressedResourceOp) – the compressed representation of the signal operator which encodes the target Hamiltoniand_plus (int) – The largest positive degree \(d^{+}\) of the polynomial transformation.
d_minus (int) – The largest (in absolute value) negative degree \(d^{-}\) of the polynomial transformation, representing powers of the adjoint of the signal operator.
rotation_precision (float | None) – The precision with which the general rotation gates are applied.
- Returns:
the operator in a compressed representation
- Return type: