qp.decomposition.CompressedResourceOp

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

Bases: object

A lightweight representation of an operator to be decomposed.

The CompressedResourceOp is a lightweight data structure that contains an operator type and a set of parameters that affects the resource requirement of this operator. If the decomposition of an operator is independent of its parameters, e.g., Rot can be decomposed into two RZ gates and an RY regardless of the angles, then every occurrence of this operator in the circuit is represented by the same CompressedResourceOp which only specifies the operator type, i.e., Rot.

On the other hand, for some operators such as MultiRZ, for which the number of CNOT gates in its decomposition depends on the number of wires, the resource representation of a MultiRZ must include this information. To create a CompressedResourceOp object for an operator, use the resource_rep() function.

Parameters:
  • op_type – the operator type

  • params (dict) – the parameters of the operator relevant to the resource estimation of its decompositions. This should only include parameters that affect the gate counts.

See also

resource_rep()

name

The name of the operator type.

name

The name of the operator type.