---
title: SynthesizeRZRotations (latest version)
description: API reference for qiskit.transpiler.passes.SynthesizeRZRotations in the latest version of qiskit
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/qiskit.transpiler.passes.SynthesizeRZRotations
---

# SynthesizeRZRotations

*class* `qiskit.transpiler.passes.SynthesizeRZRotations(*args, **kwargs)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/passes/synthesis/synthesize_rz_rotations.py#L20-L95)

Bases: [`TransformationPass`](/docs/api/qiskit/qiskit.transpiler.TransformationPass "qiskit.transpiler.basepasses.TransformationPass")

Replace RZ gates with Clifford+T decompositions.

This pass replaces all single-qubit RZ rotation gates with floating-point angles by equivalent Clifford+T sequences.

Internally, the pass synthesizes RZ(theta) for a general theta by reducing the angle modulo pi/2: the circuit for RZ(theta) can be constructed from a circuit for RZ(theta mod pi/2) by appending appropriate Clifford gates. Importantly, the pass also caches synthesis results and reuses them for angles that are within a given tolerance of each other.

For example:

```python
from qiskit.circuit import QuantumCircuit
from qiskit.transpiler.passes import SynthesizeRZRotations
from qiskit.quantum_info import Operator
from numpy import pi

# The following quantum circuit consists of 5 Clifford gates
# and three single-qubit RZ rotations gates

qc = QuantumCircuit(4)
qc.cx(0, 1)
qc.rz(9*pi/4, 0)
qc.cz(0, 1)
qc.rz(3*pi/8, 1)
qc.h(1)
qc.s(2)
qc.rz(13*pi/2, 2)
qc.cz(2, 0)
qc.rz(5*pi/3, 3)

qct = SynthesizeRZRotations()(qc)

# The transformed circuit consists of Clifford, T and Tdg gates
clifford_t_names = get_clifford_gate_names() + ["t"] + ["tdg"]
assert(set(qct.count_ops().keys()).issubset(set(clifford_t_names)))

# The circuits before and after the transformation are equivalent
# (with the default value of approximation_degree used by SynthesizeRZRotations)
assert Operator(qc) == Operator(qct)
```

If both `synthesis_error` and `cache_error` are provided, they specify the error budget for approximate synthesis and for caching respectively. If either value is not specified, the total allowed error is derived from `approximation_degree`, and suitable values for `synthesis_error` and `cache_error` are computed automatically.

**Parameters**

- **approximation\_degree** – Controls the overall degree of approximation. Defaults to `1 - 1e-10`.
- **synthesis\_error** – Maximum allowed error for the approximate synthesis of $RZ(\theta)$. If specified, must be in the range `(0, 1]`.
- **cache\_error** – Maximum allowed error when reusing a cached synthesis result for angles close to $\theta$. If specified, must be in the range `[0, 1]`.

## Attributes

### is\_analysis\_pass

Check if the pass is an analysis pass.

If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.

### is\_transformation\_pass

Check if the pass is a transformation pass.

If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).

## Methods

### execute

`execute(passmanager_ir, state, callback=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/basepasses.py#L162-L181)

Execute optimization task for input Qiskit IR.

**Parameters**

- **passmanager\_ir** ([*DAGCircuit*](/docs/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit._accelerate.circuit.DAGCircuit")) – Qiskit IR to optimize.
- **state** ([*DAGCircuit*](/docs/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit._accelerate.circuit.DAGCircuit")) – State associated with workflow execution by the pass manager itself.
- **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable)*\[\[*[*Task*](/docs/api/qiskit/qiskit.passmanager.Task "qiskit.passmanager.base_tasks.Task")*,* [*DAGCircuit*](/docs/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit._accelerate.circuit.DAGCircuit")*,* [*PropertySet*](/docs/api/qiskit/qiskit.passmanager.PropertySet "qiskit.passmanager.compilation_status.PropertySet")*,* [*float*](https://docs.python.org/3/library/functions.html#float)*,* [*int*](https://docs.python.org/3/library/functions.html#int)*], None] | None*) – A callback function which is called per execution of optimization task.

**Returns**

Optimized Qiskit IR and state of the workflow.

**Return type**

[tuple](https://docs.python.org/3/library/stdtypes.html#tuple)\[[*DAGCircuit*](/docs/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit._accelerate.circuit.DAGCircuit"), [*PassManagerState*](/docs/api/qiskit/qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")]

### name

`name()`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/passmanager/base_tasks.py#L72-L74)

Name of the pass.

**Return type**

[str](https://docs.python.org/3/library/stdtypes.html#str)

### run

`run(dag)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/passes/synthesis/synthesize_rz_rotations.py#L90-L95)

Run the SynthesizeRZRotations pass on dag.

**Parameters**

**dag** ([*DAGCircuit*](/docs/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit._accelerate.circuit.DAGCircuit"))

**Return type**

[*DAGCircuit*](/docs/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit._accelerate.circuit.DAGCircuit")

### update\_status

`update_status(state, run_state)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/basepasses.py#L183-L191)

Update workflow status.

**Parameters**

- **state** ([*PassManagerState*](/docs/api/qiskit/qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – Pass manager state to update.
- **run\_state** (*RunState*) – Completion status of current task.

**Returns**

Updated pass manager state.

**Return type**

[*PassManagerState*](/docs/api/qiskit/qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")
