mimiqcircuits.operations.operation¶
Base Operation class.
Classes
Abstract base class for quantum operations. |
- class mimiqcircuits.operations.operation.Operation[source]¶
Bases:
ABCAbstract base class for quantum operations.
- property num_qubits¶
- property num_qregs¶
- property num_bits¶
- property num_zvars¶
- property num_cregs¶
- property qregsizes¶
- property cregsizes¶
- property zregsizes¶
- property name¶
- property parnames¶
- copy()[source]¶
- Creates a shallow copy of the operation.
To create a full copy use deepcopy() instead.
- Returns:
A new Operation object containing references to the same attributes as the original circuit
- Return type:
- deepcopy()[source]¶
Creates a copy of the object and for all its attributes
- Returns:
A new Operation object fully identical the original circuit
- Return type:
- supports_canonical_rewrite()[source]¶
Whether CanonicalRewrite may decompose this operation.
Default is conservative: unsupported operations must opt in. This keeps “non-terminal” separate from “canonically rewriteable”.
- classmethod isunitary()[source]¶
Check if the class represents a unitary operator.
By default, this method returns False unless explicitly overridden in a subclass.
- listvars()[source]¶
List the symbolic variables in the parameters of the operation.
Wrappers such as
Control,Inverse,Power,Parallel,Repeat,IfStatementandWhileStatementgive the variables of the operation they wrap, and aBlockthose of all its instructions.- Returns:
Each
symengine.Symbolonce, in no particular order. The list is empty when the operation has no symbolic parameters.- Return type:
Examples
>>> from mimiqcircuits import * >>> from symengine import Symbol >>> theta = Symbol("theta") >>> GateRX(theta).listvars() [theta] >>> Control(2, GateRY(2 * theta)).listvars() [theta] >>> GateH().listvars() []