qml.estimator.resource_operator.CompressedResourceOp

class CompressedResourceOp(op_type, num_wires, params=None, name=None)[source]

Bases: object

This class is a minimal representation of a ResourceOperator, containing only the operator type and the necessary parameters to estimate its resources.

The CompressedResourceOp object is returned by the .resource_rep() method of resource operators. The object is used by resource operators to efficiently compute the resource counts.

>>> import pennylane.estimator as qre
>>> cmpr_op = qre.PauliRot.resource_rep(pauli_string="XYZ")
>>> print(cmpr_op)
CompressedResourceOp(PauliRot, num_wires=3, params={'pauli_string':'XYZ', 'precision':None})
Parameters:
  • op_type (type[ResourceOperator]) – the class object of an operation which inherits from ResourceOperator

  • num_wires (int) – The number of wires that the operation acts upon, excluding any auxiliary wires that are allocated on decomposition.

  • params (dict) – A dictionary containing the minimal pairs of parameter names and values required to compute the resources for the given operator.

  • name (str | None) – A custom name for the compressed operator. If not provided, a name will be generated using op_type.make_tracking_name with the given parameters.

name

Returns the name of operator.

name

Returns the name of operator.