mimiqcircuits.operations.gates.generalized.rnz

RNZ (Multi-qubit Z-rotation) gate.

Classes

GateRNZ(*args)

Multi-qubit parity-phase rotation gate along the Z-axis.

class mimiqcircuits.operations.gates.generalized.rnz.GateRNZ(*args)[source]

Bases: Gate

Multi-qubit parity-phase rotation gate along the Z-axis.

Applies a phase of e^{±i θ/2} depending on the parity (number of 1s) in the computational basis state.

Parameters:
  • n (int) – Number of qubits

  • theta (float or symbolic) – Rotation angle

Examples:

>>> from mimiqcircuits import *
>>> from symengine import pi
>>> GateRNZ(2, pi/2)
RNZ((1/2)*pi)
>>> GateRNZ()
lazy GateRNZ(?, ?)
>>> GateRNZ(2)
lazy GateRNZ(2, ?)
>>> GateRNZ(2, pi/2).decompose()
2-qubit circuit with 3 instructions:
├── CX @ q[0], q[1]
├── RZ((1/2)*pi) @ q[1]
└── CX @ q[0], q[1]
>>> c = Circuit()
>>> c.push(GateRNZ(3, pi/2), 1, 2, 3)
4-qubit circuit with 1 instruction:
└── RNZ((1/2)*pi) @ q[1:3]
__init__(n=None, theta=None)[source]
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(pwr)[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.

matrix()[source]

Compute the matrix representation of the operator.

This method returns a symengine Matrix object representing the operator. It simplifies the matrix expression and evaluates it to a floating-point precision.

Returns:

The matrix representation of the operator.

Return type:

symengine.Matrix

evaluate(d)[source]

Evaluate symbolic parameters with substitution dictionary d.

Parameters:

d (dict) – Mapping of symbolic variables to values.

Returns:

A new evaluated GateRNZ instance.

Return type:

GateRNZ