class EfficientSU2(num_qubits=None, su2_gates=None, entanglement='full', reps=3, skip_unentangled_qubits=False, skip_final_rotation_layer=False, parameter_prefix='θ', insert_barriers=False, initial_state=None)[source]

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

The EfficientSU2 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) stands for 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\) su2_gates as single qubit gates, the hardware efficient SU(2) circuit is represented by:

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

See RealAmplitudes for more detail on the possible arguments and options such as skipping unentanglement qubits, which apply here too.


>>> circuit = EfficientSU2(3, reps=1)
>>> print(circuit)
     ┌──────────┐┌──────────┐          ┌──────────┐┌──────────┐
q_0: ┤ RY(θ[0]) ├┤ RZ(θ[3]) ├──■────■──┤ RY(θ[6]) ├┤ RZ(θ[9]) ├─────────────
     ├──────────┤├──────────┤┌─┴─┐  │  └──────────┘├──────────┤┌───────────┐
q_1: ┤ RY(θ[1]) ├┤ RZ(θ[4]) ├┤ X ├──┼───────■──────┤ RY(θ[7]) ├┤ RZ(θ[10]) ├
     ├──────────┤├──────────┤└───┘┌─┴─┐   ┌─┴─┐    ├──────────┤├───────────┤
q_2: ┤ RY(θ[2]) ├┤ RZ(θ[5]) ├─────┤ X ├───┤ X ├────┤ RY(θ[8]) ├┤ RZ(θ[11]) ├
     └──────────┘└──────────┘     └───┘   └───┘    └──────────┘└───────────┘
>>> ansatz = EfficientSU2(4, su2_gates=['rx', 'y'], entanglement='circular', reps=1)
>>> qc = QuantumCircuit(4)  # create a circuit and append the RY variational form
>>> qc.compose(ansatz, inplace=True)
>>> qc.draw()
     ┌──────────┐┌───┐┌───┐     ┌──────────┐   ┌───┐
q_0: ┤ RX(θ[0]) ├┤ Y ├┤ X ├──■──┤ RX(θ[4]) ├───┤ Y ├─────────────────────
     ├──────────┤├───┤└─┬─┘┌─┴─┐└──────────┘┌──┴───┴───┐   ┌───┐
q_1: ┤ RX(θ[1]) ├┤ Y ├──┼──┤ X ├─────■──────┤ RX(θ[5]) ├───┤ Y ├─────────
     ├──────────┤├───┤  │  └───┘   ┌─┴─┐    └──────────┘┌──┴───┴───┐┌───┐
q_2: ┤ RX(θ[2]) ├┤ Y ├──┼──────────┤ X ├─────────■──────┤ RX(θ[6]) ├┤ Y ├
     ├──────────┤├───┤  │          └───┘       ┌─┴─┐    ├──────────┤├───┤
q_3: ┤ RX(θ[3]) ├┤ Y ├──■──────────────────────┤ X ├────┤ RX(θ[7]) ├┤ Y ├
     └──────────┘└───┘                         └───┘    └──────────┘└───┘

Create a new EfficientSU2 2-local circuit.

  • num_qubits (Optional[int]) – The number of qubits of the EfficientSU2 circuit.

  • reps (int) – Specifies how often the structure of a rotation layer followed by an entanglement layer is repeated.

  • su2_gates (Union[str, type, Instruction, QuantumCircuit, List[Union[str, type, Instruction, QuantumCircuit]], 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.

  • entanglement (Union[str, List[List[int]], Callable[[int], List[int]]]) – Specifies the entanglement structure. Can be a string (‘full’, ‘linear’ , ‘circular’ or ‘sca’), a list of integer-pairs specifying the indices of qubits entangled with one another, or a callable returning such a list provided with the index of the entanglement layer. See the Examples section of TwoLocal for more detail.

  • initial_state (Optional[Any]) – An InitialState object to prepend to the circuit.

  • skip_unentangled_qubits (bool) – If True, the single qubit gates are only applied to qubits that are entangled with another qubit. If False, the single qubit gates are applied to each qubit in the Ansatz. Defaults to False.

  • skip_final_rotation_layer (bool) – If False, a rotation layer is added at the end of the ansatz. If True, no rotation layer is added.

  • parameter_prefix (str) – The parameterized gates require a parameter to be defined, for which we use ParameterVector.

  • insert_barriers (bool) – If True, barriers are inserted in between each layer. If False, no barriers are inserted.



Returns a list of classical bits in the order that the registers were added.


Return the circuit data (instructions and context).


Get the entanglement strategy.


The blocks in the entanglement layers.




Return the initial state that is added in front of the n-local circuit.


If barriers are inserted in between the layers or not.



Deprecated, use num_qubits instead.


Return number of classical bits.


Return the number of layers in the n-local circuit.


Convenience function to get the number of parameter objects in the circuit.


The number of total parameters that can be set to distinct values.


Returns the number of qubits in this circuit.


The parameters used in the underlying circuit.


Return the parameter bounds.


Get the Parameter objects in the circuit.


The initial points for the parameters.



A list of the quantum registers associated with the circuit.


Returns a list of quantum bits in the order that the registers were added.


The number of times rotation and entanglement block are repeated.


The blocks in the rotation layers.


EfficientSU2.AND(qr_variables, qb_target, …)

Build a collective conjunction (AND) circuit in place using mct.

EfficientSU2.OR(qr_variables, qb_target, …)

Build a collective disjunction (OR) circuit in place using mct.


Return indexed operation.


Return number of operations in circuit.

EfficientSU2.add_layer(other[, …])

Append another layer to the NLocal.


Add registers.

EfficientSU2.append(instruction[, qargs, cargs])

Append one or more instructions to the end of the circuit, modifying the circuit in place.

EfficientSU2.assign_parameters(param_dict[, …])

Assign parameters to the n-local circuit.


Apply Barrier.


Assign numeric parameters to values yielding a new circuit.

EfficientSU2.cast(value, _type)

Best effort to cast value to type.


Converts several classical bit representations (such as indexes, range, etc.) into a list of classical bits.

EfficientSU2.ccx(control_qubit1, …[, …])

Apply CCXGate.

EfficientSU2.ch(control_qubit, target_qubit, *)

Apply CHGate.


Return the current number of instances of this class, useful for auto naming.


Return the prefix to use for auto naming.

EfficientSU2.cnot(control_qubit, target_qubit, *)

Apply CXGate.


Append rhs to self if self contains compatible registers.

EfficientSU2.compose(other[, qubits, …])

Compose circuit with other circuit or instruction, optionally permuting wires.


Copy the circuit.


Count each operation kind in the circuit.

EfficientSU2.crx(theta, control_qubit, …)

Apply CRXGate.

EfficientSU2.cry(theta, control_qubit, …)

Apply CRYGate.

EfficientSU2.crz(theta, control_qubit, …)

Apply CRZGate.

EfficientSU2.cswap(control_qubit, …[, …])

Apply CSwapGate.

EfficientSU2.cu1(theta, control_qubit, …)

Apply CU1Gate.

EfficientSU2.cu3(theta, phi, lam, …[, …])

Apply CU3Gate.

EfficientSU2.cx(control_qubit, target_qubit, *)

Apply CXGate.

EfficientSU2.cy(control_qubit, target_qubit, *)

Apply CYGate.

EfficientSU2.cz(control_qubit, target_qubit, *)

Apply CZGate.

EfficientSU2.dcx(qubit1, qubit2)

Apply DCXGate.


Call a decomposition pass on this circuit, to decompose one level (shallow decompose).


Return circuit depth (i.e., length of critical path).

EfficientSU2.diag_gate(diag, qubit)

Deprecated version of QuantumCircuit.diagonal.

EfficientSU2.diagonal(diag, qubit)

Attach a diagonal gate to a circuit.

EfficientSU2.draw([output, scale, filename, …])

Draw the quantum circuit.


Append QuantumCircuit to the right hand side if it contains compatible registers.

EfficientSU2.fredkin(control_qubit, …[, …])

Apply CSwapGate.


Take in a QASM file and generate a QuantumCircuit object.


Take in a QASM string and generate a QuantumCircuit object.

EfficientSU2.get_entangler_map(rep_num, …)

Overloading to handle the special case of 1 qubit where the entanglement are ignored.


Get the indices of unentangled qubits in a set.

EfficientSU2.h(qubit, *[, q])

Apply HGate.

EfficientSU2.hamiltonian(operator, time, qubits)

Apply hamiltonian evolution to to qubits.


Test if this circuit has the register r.

EfficientSU2.i(qubit, *[, q])

Apply IGate.

EfficientSU2.id(qubit, *[, q])

Apply IGate.

EfficientSU2.iden(qubit, *[, q])

Deprecated identity gate.

EfficientSU2.initialize(params, qubits)

Apply initialize to circuit.


Invert this circuit.

EfficientSU2.iso(isometry, q_input, …[, …])

Attach an arbitrary isometry from m to n qubits to a circuit.

EfficientSU2.isometry(isometry, q_input, …)

Attach an arbitrary isometry from m to n qubits to a circuit.

EfficientSU2.iswap(qubit1, qubit2)

Apply iSwapGate.

EfficientSU2.mcmt(gate, control_qubits, …)

Apply a multi-control, multi-target using a generic gate.

EfficientSU2.mcrx(theta, q_controls, q_target)

Apply Multiple-Controlled X rotation gate

EfficientSU2.mcry(theta, q_controls, …[, …])

Apply Multiple-Controlled Y rotation gate

EfficientSU2.mcrz(lam, q_controls, q_target)

Apply Multiple-Controlled Z rotation gate

EfficientSU2.mct(control_qubits, target_qubit)

Apply MCXGate.

EfficientSU2.mcu1(lam, control_qubits, …)

Apply MCU1Gate.

EfficientSU2.mcx(control_qubits, target_qubit)

Apply MCXGate.

EfficientSU2.measure(qubit, cbit)

Measure quantum bit into classical bit (tuples).


Adds measurement to all non-idle qubits.


Adds measurement to all qubits.


Mirror the circuit by reversing the instructions.

EfficientSU2.ms(theta, qubits)

Apply MSGate.


How many non-entangled subcircuits can the circuit be factored to.


Return number of non-local gates (i.e.


Computes the number of tensor factors in the unitary (quantum) part of the circuit only.


Computes the number of tensor factors in the unitary (quantum) part of the circuit only.


Returns information about the setting.

EfficientSU2.qasm([formatted, filename])

Return OpenQASM string.


Converts several qubit representations (such as indexes, range, etc.) into a list of qubits.

EfficientSU2.r(theta, phi, qubit, *[, q])

Apply RGate.

EfficientSU2.rcccx(control_qubit1, …)

Apply RC3XGate.

EfficientSU2.rccx(control_qubit1, …)

Apply RCCXGate.


Removes final measurement on all qubits if they are present.


Reset q.

EfficientSU2.rx(theta, qubit, *[, label, q])

Apply RXGate.

EfficientSU2.rxx(theta, qubit1, qubit2)

Apply RXXGate.

EfficientSU2.ry(theta, qubit, *[, label, q])

Apply RYGate.

EfficientSU2.ryy(theta, qubit1, qubit2)

Apply RYYGate.

EfficientSU2.rz(phi, qubit, *[, q])

Apply RZGate.

EfficientSU2.rzx(theta, qubit1, qubit2)

Apply RZXGate.

EfficientSU2.rzz(theta, qubit1, qubit2)

Apply RZZGate.

EfficientSU2.s(qubit, *[, q])

Apply SGate.

EfficientSU2.sdg(qubit, *[, q])

Apply SdgGate.


Returns total number of gate operations in circuit.

EfficientSU2.snapshot(label[, …])

Take a statevector snapshot of the internal simulator representation.


Take a density matrix snapshot of simulator state.


Take a snapshot of expectation value <O> of an Operator.

EfficientSU2.snapshot_probabilities(label, …)

Take a probability snapshot of the simulator state.


Take a stabilizer snapshot of the simulator state.


Take a statevector snapshot of the simulator state.

EfficientSU2.squ(unitary_matrix, qubit[, …])

Decompose an arbitrary 2*2 unitary into three rotation gates.

EfficientSU2.swap(qubit1, qubit2)

Apply SwapGate.

EfficientSU2.t(qubit, *[, q])

Apply TGate.

EfficientSU2.tdg(qubit, *[, q])

Apply TdgGate.


Create a Gate out of this circuit.


Create an Instruction out of this circuit.

EfficientSU2.toffoli(control_qubit1, …[, …])

Apply CCXGate.

EfficientSU2.u1(theta, qubit, *[, q])

Apply U1Gate.

EfficientSU2.u2(phi, lam, qubit, *[, q])

Apply U2Gate.

EfficientSU2.u3(theta, phi, lam, qubit, *[, q])

Apply U3Gate.

EfficientSU2.uc(gate_list, q_controls, q_target)

Attach a uniformly controlled gates (also called multiplexed gates) to a circuit.

EfficientSU2.ucg(angle_list, q_controls, …)

Deprecated version of uc.

EfficientSU2.ucrx(angle_list, q_controls, …)

Attach a uniformly controlled (also called multiplexed) Rx rotation gate to a circuit.

EfficientSU2.ucry(angle_list, q_controls, …)

Attach a uniformly controlled (also called multiplexed) Ry rotation gate to a circuit.

EfficientSU2.ucrz(angle_list, q_controls, …)

Attach a uniformly controlled (also called multiplexed gates) Rz rotation gate to a circuit.

EfficientSU2.ucx(angle_list, q_controls, …)

Deprecated version of ucrx.

EfficientSU2.ucy(angle_list, q_controls, …)

Deprecated version of ucry.

EfficientSU2.ucz(angle_list, q_controls, …)

Deprecated version of ucrz.

EfficientSU2.unitary(obj, qubits[, label])

Apply unitary gate to q.


Return number of qubits plus clbits in circuit.

EfficientSU2.x(qubit, *[, label, ctrl_state, q])

Apply XGate.

EfficientSU2.y(qubit, *[, q])

Apply YGate.

EfficientSU2.z(qubit, *[, q])

Apply ZGate.


Return indexed operation.


Return number of operations in circuit.