qml.estimator.templates.BasisRotation

class BasisRotation(dim=None, wires=None)[source]

Bases: ResourceOperator

Resource class for the BasisRotation gate.

Parameters:
  • dim (int | None) – The dimensions of the input matrix specifying the basis transformation. This is equivalent to the number of rows or columns of the matrix.

  • wires (Sequence[int], None) – the wires the operation acts on, should be equal to the dimension

Resources:

The resources are obtained from the construction scheme given in Optica, 3, 1460 (2016). Specifically, the resources are given as \(N \times (N - 1) / 2\) instances of the SingleExcitation gate, and \(N \times (1 + (N - 1) / 2)\) instances of the PhaseShift gate, where \(N\) is the dimensions of the input matrix.

See also

The corresponding PennyLane operation BasisRotation.

Example

The resources for this operation are computed using:

>>> import pennylane.estimator as qre
>>> basis_rot = qre.BasisRotation(dim = 5)
>>> print(qre.estimate(basis_rot))
--- Resources: ---
Total wires: 5
    algorithmic wires: 5
    allocated wires: 0
    zero state: 0
    any state: 0
Total gates : 1.740E+3
'T': 1.580E+3,
'CNOT': 20,
'Z': 40,
'S': 60,
'Hadamard': 40

resource_keys

resource_params

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

resource_keys = {'dim'}
resource_params

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

Returns:

A dictionary containing the resource parameters:
  • dim (int): The dimensions of the input unitary_matrix. This is computed as the number of columns of the matrix.

Return type:

dict

resource_decomp(dim)

Returns a list representing the resources of the operator.

resource_rep(dim)

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

tracking_name(dim)

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

classmethod resource_decomp(dim)[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:

dim (int) – The dimensions of the input unitary_matrix. This is computed as the number of columns of the matrix.

Resources:

The resources are obtained from the construction scheme given in Optica, 3, 1460 (2016). Specifically, the resources are given as \(N * (N - 1) / 2\) instances of the SingleExcitation gate, and \(N * (1 + (N - 1) / 2)\) instances of the PhaseShift gate, where \(N\) is the dimensions of the input matrix.

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(dim)[source]

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

Parameters:

dim (int) – The dimensions of the input unitary_matrix. This is computed as the number of columns of the matrix.

Returns:

the operator in a compressed representation

Return type:

CompressedResourceOp

static tracking_name(dim)[source]

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

Contents

Using PennyLane

Release news

Development

API

Internals