qp.decomposition.CompressedResourceOp¶
- class CompressedResourceOp(op_type, params=None)[source]¶
Bases:
objectA lightweight representation of an operator to be decomposed.
The
CompressedResourceOpis 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.,Rotcan be decomposed into twoRZgates and anRYregardless of the angles, then every occurrence of this operator in the circuit is represented by the sameCompressedResourceOpwhich only specifies the operator type, i.e.,Rot.On the other hand, for some operators such as
MultiRZ, for which the number ofCNOTgates in its decomposition depends on the number of wires, the resource representation of aMultiRZmust include this information. To create aCompressedResourceOpobject for an operator, use theresource_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
Attributes