qml.labs.resource_estimation.resource_rep

resource_rep(resource_op, resource_params=None)[source]

Produce a compressed representation of the resource operator to be used when tracking resources.

Note, the resource_params dictionary should specify the required resource parameters of the operator. The required resource parameters are listed in the resource_keys class property of every ResourceOperator.

Parameters:
  • resource_op (Type[ResourceOperator]]) – The type of operator we wish to compactify

  • resource_params (Dict) – The required set of parameters to specify the operator

Returns:

A compressed representation of a resource operator

Return type:

CompressedResourceOp

Example

In this example we obtain the compressed resource representation for ResourceQFT. We begin by checking what parameters are required for resource estimation, and then providing them accordingly:

>>> plre.ResourceQFT.resource_keys
{'num_wires'}
>>> cmpr_qft = plre.resource_rep(
...     plre.ResourceQFT,
...     {"num_wires": 3},
... )
>>> cmpr_qft
QFT(3)