qml.estimator.templates.QSVT

class QSVT(block_encoding, encoding_dims, poly_deg, wires=None)[source]

Bases: ResourceOperator

Resource class for Quantum Singular Value Transformation (QSVT).

This operation uses a ResourceOperator \(U\) that block encodes a matrix \(A\) in its top-left block. This circuit applies a polynomial transformation (\(Poly^{SV}\)) of degree \(d\) to the singular values of the block encoded matrix:

\[\begin{split}\begin{align} U_{QSVT}(A, \vec{\phi}) &= \begin{bmatrix} Poly^{SV}(A) & \cdot \\ \cdot & \cdot \end{bmatrix}. \end{align}\end{split}\]

When the degree of the polynomial is odd, the QSVT circuit is defined as:

\[U_{QSVT} = \tilde{\Pi}_{\phi_1}U\left[\prod^{(d-1)/2}_{k=1}\Pi_{\phi_{2k}}U^\dagger \tilde{\Pi}_{\phi_{2k+1}}U\right],\]

and when the degree is even,

\[U_{QSVT} = \left[\prod^{d/2}_{k=1}\Pi_{\phi_{2k-1}}U^\dagger\tilde{\Pi}_{\phi_{2k}}U\right],\]

where \(\Pi_{\phi}\) and \(\tilde{\Pi}_{\phi}\) are projector-controlled phase shifts (PCPhase).

See also

qsvt() and QSVT.

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

  • encoding_dims (int | tuple(int)) – The dimensions of the encoded matrix. If an integer is provided, a square matrix is assumed.

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

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

Raises:
  • ValueError – if encoding_dims is not a positive integer or a tuple of two positive integers

  • ValueError – if poly_deg is not a positive integer greater than zero

  • ValueError – if the wires provided don’t match the number of wires expected by the operator

Resources:

The resources are obtained as described in Theorem 4 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)
>>> encoding_dims = (2, 2)
>>> poly_deg = 3
>>> qsvt = qre.QSVT(block_encoding, encoding_dims, poly_deg)
>>> print(qre.estimate(qsvt))
--- Resources: ---
 Total wires: 1
   algorithmic wires: 1
   allocated wires: 0
     zero state: 0
     any state: 0
 Total gates : 39
   'T': 39

resource_keys

resource_params

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

resource_keys = {'block_encoding', 'encoding_dims', 'poly_deg'}
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

  • encoding_dims (int | tuple(int)): The dimensions of the encoded matrix. If an integer is provided, a square matrix is assumed.

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

Return type:

dict

resource_decomp(block_encoding, ...)

Returns a list representing the resources of the operator.

resource_rep(block_encoding, encoding_dims, ...)

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

classmethod resource_decomp(block_encoding, encoding_dims, poly_deg)[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

  • encoding_dims (int | tuple(int)) – The dimensions of the encoded matrix. If an integer is provided, a square matrix is assumed.

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

Resources:

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

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, encoding_dims, poly_deg)[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

  • encoding_dims (int | tuple(int)) – The dimensions of the encoded matrix. If an integer is provided, a square matrix is assumed.

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

Returns:

the operator in a compressed representation

Return type:

CompressedResourceOp

Contents

Using PennyLane

Release news

Development

API

Internals