mimiqcircuits.operations.gates.generalized.rnz¶
RNZ (Multi-qubit Z-rotation) gate.
Classes
|
Multi-qubit parity-phase rotation gate along the Z-axis. |
- class mimiqcircuits.operations.gates.generalized.rnz.GateRNZ(*args)[source]¶
Bases:
GateMulti-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.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]
- 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]¶
Return the SymEngine matrix representation of the operator.
Constant (parameter-free) operators are cached at class level, so repeated calls on, say,
GateX()are O(1). Numeric parametric operators build a SymEngine matrix through_matrix()and then evaluate each non-zero entry to a floating-point scalar. Genuinely symbolic operators return the raw SymEngine expression untouched — the oldsympy.simplifystep is deliberately gone; it was the main hot spot and produced no information the caller couldn’t recover with their own simplification pass.- Returns:
The matrix representation.
- Return type:
symengine.Matrix