Operations¶
MimiqCircuits provides a rich set of operations to build your quantum circuits. From standard unitary gates to advanced noise channels and classical control flow, explore the available tools below.
Standard single and multi-qubit gates (X, H, CX, etc.).
Manipulate classical bits logic (AND, XOR) and registers.
Measurements, resets, and conditional logic.
Define custom noise models and apply them to your circuits.
Work with parameterized circuits using symbolic variables.
Operations for extracting statistical properties.
Specialized operations and structures.
Operations on the Z-register.
Reference¶
- class mimiqcircuits.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
- 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:
- 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:
- abstract iswrapper()[source]
- isopalias()[source]
- 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]
- class mimiqcircuits.Gate[source]
Bases:
AbstractOperator- iswrapper()[source]
Check if the operator is a wrapper around another operator.
This method should be overridden in subclasses to return True if the operator is acting as a wrapper around another operation or object, and False otherwise.
- Returns:
Always returns False in the base class. Subclasses should override this method to provide the appropriate logic.
- Return type:
- inverse()[source]
Raise an error, as non-unitary operators cannot be inverted.
This method is not implemented for non-unitary operators and will raise a NotImplementedError if called.
- Raises:
NotImplementedError – If the method is called.
- power(*args)[source]
Raise an error, as powers of non-unitary operators are not supported.
This method is not implemented for non-unitary operators and will raise a NotImplementedError if called.
- Parameters:
n (int) – The exponent to which the operator would be raised.
- Raises:
NotImplementedError – If the method is called.
- control(*args)[source]
- parallel(*args)[source]
- repeat(*args)[source]
- evaluate(d)[source]
Substitute the symbolic parameters of the operator with numerical values.
This method evaluates the operator’s symbolic parameters using the values provided in the dictionary d. If the operator has no parameters, it returns the same instance. Otherwise, it creates a new instance of the operator with updated numerical parameters.
- Parameters:
d (dict) – A dictionary where keys are symbolic parameter names and values are values for substitution.
Example
>>> from symengine import * >>> from mimiqcircuits import * >>> theta = symbols('theta') >>> op = GateRX(theta) >>> evaluated_op = op.evaluate({'theta': 0.5}) >>> print(evaluated_op) RX(0.5)
- gettypekey()[source]
- static isunitary()[source]
Check if the object is unitary.
By default, this method returns False unless explicitly overridden in a subclass.