---
title: efficient_su2 (v2.4)
description: API reference for qiskit.circuit.library.efficient_su2 in qiskit v2.4
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/2.4/qiskit.circuit.library.efficient_su2
---

# qiskit.circuit.library.efficient\_su2

`qiskit.circuit.library.efficient_su2(num_qubits, su2_gates=None, entanglement='reverse_linear', reps=3, skip_unentangled_qubits=False, skip_final_rotation_layer=False, parameter_prefix='θ', insert_barriers=False, name='EfficientSU2')`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.4/qiskit/circuit/library/n_local/efficient_su2.py#L31-L134)

The hardware-efficient $SU(2)$ 2-local circuit.

The `efficient_su2` circuit consists of layers of single qubit operations spanned by $SU(2)$ and CX entanglements. This is a heuristic pattern that can be used to prepare trial wave functions for variational quantum algorithms or classification circuit for machine learning.

$SU(2)$ is the special unitary group of degree 2, its elements are $2 \times 2$ unitary matrices with determinant 1, such as the Pauli rotation gates.

On 3 qubits and using the Pauli $Y$ and $Z$ rotations as single qubit gates, this circuit is represented by:

```python
┌──────────┐┌──────────┐ ░            ░       ░ ┌───────────┐┌───────────┐
┤ RY(θ[0]) ├┤ RZ(θ[3]) ├─░────────■───░─ ... ─░─┤ RY(θ[12]) ├┤ RZ(θ[15]) ├
├──────────┤├──────────┤ ░      ┌─┴─┐ ░       ░ ├───────────┤├───────────┤
┤ RY(θ[1]) ├┤ RZ(θ[4]) ├─░───■──┤ X ├─░─ ... ─░─┤ RY(θ[13]) ├┤ RZ(θ[16]) ├
├──────────┤├──────────┤ ░ ┌─┴─┐└───┘ ░       ░ ├───────────┤├───────────┤
┤ RY(θ[2]) ├┤ RZ(θ[5]) ├─░─┤ X ├──────░─ ... ─░─┤ RY(θ[14]) ├┤ RZ(θ[17]) ├
└──────────┘└──────────┘ ░ └───┘      ░       ░ └───────────┘└───────────┘
```

Examples:

Per default, the `"reverse_linear"` entanglement is used, which, in the case of CX gates, is equivalent to an all-to-all entanglement:

```python
from qiskit.circuit.library import efficient_su2

circuit = efficient_su2(3, reps=1)
circuit.draw("mpl")
```

![Circuit diagram output by the previous code.](https://eu-de.quantum.cloud.ibm.com/docs/images/api/qiskit/2.4/qiskit-circuit-library-efficient_su2-1.avif)

To specify which SU(2) gates should be used in the rotation layer, we can set the `su2_gates` argument. In addition, we can change the entanglement structure. For example:

```python
circuit = efficient_su2(4, su2_gates=["rx", "y"], entanglement="circular", reps=1)
circuit.draw("mpl")
```

![Circuit diagram output by the previous code.](https://eu-de.quantum.cloud.ibm.com/docs/images/api/qiskit/2.4/qiskit-circuit-library-efficient_su2-2.avif)

**Parameters**

- **num\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int)) – The number of qubits.
- **su2\_gates** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)  *|*[*Gate*](/docs/api/qiskit/2.4/qiskit.circuit.Gate "qiskit.circuit.gate.Gate")  *|*[*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str)  *|*[*Gate*](/docs/api/qiskit/2.4/qiskit.circuit.Gate "qiskit.circuit.gate.Gate")*] | None*) – The $SU(2)$ single qubit gates to apply in single qubit gate layers. If only one gate is provided, the same gate is applied to each qubit. If a list of gates is provided, all gates are applied to each qubit in the provided order.
- **reps** ([*int*](https://docs.python.org/3/library/functions.html#int)) – Specifies how often the structure of a rotation layer followed by an entanglement layer is repeated.
- **entanglement** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)  *|*[*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*int*](https://docs.python.org/3/library/functions.html#int)*]] |* [*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str)  *|*[*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*int*](https://docs.python.org/3/library/functions.html#int)*]]] |* [*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable)*\[\[*[*int*](https://docs.python.org/3/library/functions.html#int)*],* [*str*](https://docs.python.org/3/library/stdtypes.html#str)  *|*[*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*int*](https://docs.python.org/3/library/functions.html#int)*]] |* [*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str)  *|*[*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*Iterable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)*\[*[*int*](https://docs.python.org/3/library/functions.html#int)*]]]]*) – The indices specifying on which qubits the input blocks act. See [`n_local()`](/docs/api/qiskit/2.4/qiskit.circuit.library.n_local "qiskit.circuit.library.n_local") for detailed information.
- **skip\_final\_rotation\_layer** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) – Whether a final rotation layer is added to the circuit.
- **skip\_unentangled\_qubits** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) – If `True`, the rotation gates act only on qubits that are entangled. If `False`, the rotation gates act on all qubits.
- **parameter\_prefix** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The name of the free parameters.
- **insert\_barriers** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) – If True, barriers are inserted in between each layer. If False, no barriers are inserted.
- **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The name of the circuit.

**Returns**

An efficient-SU(2) circuit.

**Return type**

[*QuantumCircuit*](/docs/api/qiskit/2.4/qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit")
