qml.labs.resource_estimation.CompressedResourceOp¶
- class CompressedResourceOp(op_type, params=None, name=None)[source]¶
Bases:
object
Instantiate a light weight class corresponding to the operator type and parameters.
This class provides a minimal representation of an operation, containing only the operator type and the necessary parameters to estimate its resources. It’s designed for efficient hashing and comparison, allowing it to be used effectively in collections where uniqueness and quick lookups are important.
- Parameters:
op_type (Type) – the class object of an operation which inherits from :class:’~.pennylane.labs.resource_estimation.ResourceOperator’
params (dict) – a dictionary containing the minimal pairs of parameter names and values required to compute the resources for the given operator
name (str, optional) – A custom name for the compressed operator. If not provided, a name will be generated using op_type.tracking_name with the given parameters.
Usage Details
This representation is the minimal amount of information required to estimate resources for the operator.
Example
>>> op_tp = plre.CompressedResourceOp(plre.ResourceHadamard, {"num_wires":1}) >>> print(op_tp) CompressedResourceOp(ResourceHadamard, params={'num_wires':1})
Attributes