mimiqcircuits.operations.operation

Base Operation class.

Classes

Operation()

Abstract base class for quantum operations.

class mimiqcircuits.operations.operation.Operation[source]

Bases: ABC

Abstract base class for quantum operations.

classmethod allow_bit_aliasing()[source]
classmethod allow_zvar_aliasing()[source]
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
getparams()[source]
is_symbolic()[source]
getparam(pn)[source]
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:

Operation

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:

Operation

abstract iswrapper()[source]
isopalias()[source]
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”.

numparams()[source]
decompose()[source]
evaluate(d)[source]
isidentity()[source]
classmethod isunitary()[source]

Check if the class represents a unitary operator.

By default, this method returns False unless explicitly overridden in a subclass.

asciiwidth(qubits, bits, zvars)[source]
get_operation()[source]
listvars()[source]

List the symbolic variables in the parameters of the operation.

Wrappers such as Control, Inverse, Power, Parallel, Repeat, IfStatement and WhileStatement give the variables of the operation they wrap, and a Block those of all its instructions.

Returns:

Each symengine.Symbol once, in no particular order. The list is empty when the operation has no symbolic parameters.

Return type:

list

Examples

>>> from mimiqcircuits import *
>>> from symengine import Symbol
>>> theta = Symbol("theta")
>>> GateRX(theta).listvars()
[theta]
>>> Control(2, GateRY(2 * theta)).listvars()
[theta]
>>> GateH().listvars()
[]