qml.estimator.templates.AQFT

class AQFT(order, num_wires=None, wires=None)[source]

Bases: ResourceOperator

Resource class for the Approximate QFT.

Note

This operation assumes an appropriately sized phase gradient state is available. Users should ensure the cost of constructing such a state has been accounted for. See also PhaseGradient.

Parameters:
  • order (int) – the maximum number of controlled phase shifts per qubit to which the operation is truncated

  • num_wires (int | None) – the number of qubits the operation acts upon

  • wires (Sequence[int], None) – the wires the operation acts on

Resources:

The resources are obtained from (Fig. 4) of arXiv:1803.04933, excluding the allocation and instantiation of the phase gradient state. The phased Toffoli gates and the classical measure-and-reset (Fig. 2) are accounted for as TemporaryAND operations.

See also

The corresponding PennyLane operation AQFT.

Example

The resources for this operation are computed using:

>>> import pennylane.estimator as qre
>>> aqft = qre.AQFT(order=2, num_wires=3)
>>> gate_set = {"SWAP", "Hadamard", "T", "CNOT"}
>>> print(qre.estimate(aqft, gate_set))
--- Resources: ---
Total wires: 4
    algorithmic wires: 3
    allocated wires: 1
    zero state: 1
    any state: 0
Total gates : 57
'SWAP': 1,
'T': 40,
'CNOT': 9,
'Hadamard': 7

resource_keys

resource_params

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

resource_keys = {'order, num_wires'}
resource_params

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

Returns:

A dictionary containing the resource parameters:
  • order (int): the maximum number of controlled phase shifts to which the operation is truncated

  • num_wires (int): the number of qubits the operation acts upon

Return type:

dict

resource_decomp(order, num_wires)

Returns a list representing the resources of the operator.

resource_rep(order, num_wires)

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

tracking_name(order, num_wires)

Returns the tracking name built with the operator's parameters.

classmethod resource_decomp(order, num_wires)[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:
  • order (int) – the maximum number of controlled phase shifts to which the operation is truncated

  • num_wires (int) – the number of qubits the operation acts upon

Resources:

The resources are obtained from (Fig. 4) arXiv:1803.04933 excluding the allocation and instantiation of the phase gradient state. The phased Toffoli gates and the classical measure-and-reset (Fig. 2) are accounted for as TemporaryAND operations.

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(order, num_wires)[source]

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

Parameters:
  • order (int) – the maximum number of controlled phase shifts to truncate

  • num_wires (int) – the number of qubits the operation acts upon

Returns:

the operator in a compressed representation

Return type:

CompressedResourceOp

static tracking_name(order, num_wires)[source]

Returns the tracking name built with the operator’s parameters.

Contents

Using PennyLane

Release news

Development

API

Internals