qml.estimator.templates.QSP

class QSP(block_encoding, poly_deg, convention='Z', rotation_precision=None, wires=None)[source]

Bases: ResourceOperator

Implements the Quantum Signal Processing (QSP) circuit.

This template estimates the resources for a QSP circuit of degree \(d\) (poly_deg). The circuit uses a single-qubit ResourceOperator \(W(a)\) that block encodes a scalar value \(a\) in its top-left entry.

The circuit is given as follows in the Z-convention (convention="Z"):

\[\hat{U}_{QSP} = e^{i\phi_{0}\hat{Z}}\prod^{d}_{k=1}\hat{W}(a)e^{i\phi_{k}\hat{Z}} .\]

The circuit can also be expressed in the X-convention (convention="X"):

\[\hat{U}_{QSP} = e^{i\phi_{0}\hat{X}}\prod^{d}_{k=1}\hat{W}(a)e^{i\phi_{k}\hat{X}} .\]

See also

qsvt() and QSVT.

Parameters:
  • block_encoding (ResourceOperator) – the block encoding operator

  • poly_deg (int) – the degree of the polynomial transformation being applied

  • convention (str) – the basis used for the rotation operators, valid conventions are "X" or "Z"

  • rotation_precision (float | None) – The error threshold for the approximate Clifford + T decomposition of the single qubit rotation gates used to implement this operation.

  • wires (WiresLike | None) – the wires the operation acts on

Raises:
  • ValueError – if the block encoding operator acts on more than one qubit

  • ValueError – if the convention is not "X" or "Z"

Resources:

The resources are obtained as described in Theorem 1 of A Grand Unification of Quantum Algorithms (2021).

Example

The resources for this operation are computed using:

>>> import pennylane.estimator as qre
>>> block_encoding = qre.RX(0.1, wires=0)
>>> poly_deg = 3
>>> qsp = qre.QSP(block_encoding, poly_deg, convention="Z", rotation_precision=1e-5)
>>> print(qre.estimate(qsp))
--- Resources: ---
 Total wires: 1
   algorithmic wires: 1
   allocated wires: 0
     zero state: 0
     any state: 0
 Total gates : 151
   'T': 151

resource_keys

resource_params

Returns a dictionary containing the minimal information needed to compute the resources.

resource_keys = {'block_encoding', 'convention', 'poly_deg', 'rotation_precision'}
resource_params

Returns a dictionary containing the minimal information needed to compute the resources.

Returns:

A dictionary containing the resource parameters:
  • block_encoding (CompressedResourceOp): the block encoding operator

  • poly_deg (int): the degree of the polynomial transformation being applied

  • convention (str): the basis used for the rotation operators, valid conventions are "X" or "Z"

  • rotation_precision (float | None): The error threshold for the approximate Clifford + T decomposition of the single qubit rotation gates used to implement this operation.

Return type:

dict

resource_decomp(block_encoding, poly_deg[, ...])

Returns a list representing the resources of the operator.

resource_rep(block_encoding, poly_deg[, ...])

Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.

classmethod resource_decomp(block_encoding, poly_deg, convention='Z', 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:
  • block_encoding (CompressedResourceOp) – the block encoding operator

  • poly_deg (int) – the degree of the polynomial transformation being applied

  • convention (str) – the basis used for the rotation operators, valid conventions are "X" or "Z"

  • rotation_precision (float) – The error threshold for the approximate Clifford + T decomposition of the single qubit rotation gates used to implement this operation.

Resources:

The resources are obtained as described in Theorem 1 of A Grand Unification of Quantum Algorithms (2021).

Raises:

ValueError – if the convention is not "X" or "Z"

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(block_encoding, poly_deg, convention='Z', rotation_precision=None)[source]

Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.

Parameters:
  • block_encoding (CompressedResourceOp) – the block encoding operator

  • poly_deg (int) – the degree of the polynomial transformation being applied

  • convention (str) – the basis used for the rotation operators, valid conventions are "X" or "Z"

  • rotation_precision (float | None) – The error threshold for the approximate Clifford + T decomposition of the single qubit rotation gates used to implement this operation.

Returns:

the operator in a compressed representation

Return type:

CompressedResourceOp

Contents

Using PennyLane

Release news

Development

API

Internals