# qml.ops.op_math.ctrl_decomp_bisect¶

ctrl_decomp_bisect(target_operation, control_wires)[source]

Decompose the controlled version of a target single-qubit operation

Not backpropagation compatible (as currently implemented). Use only with numpy.

Automatically selects the best algorithm based on the matrix (uses specialized more efficient algorithms if the matrix has a certain form, otherwise falls back to the general algorithm). These algorithms are defined in section 3.1 and 3.2 of Vale et al. (2023).

Warning

This method will add a global phase for target operations that do not belong to the SU(2) group.

Parameters
• target_operation (Operator) – the target operation to decompose

• control_wires (Wires) – the control wires of the operation

Returns

the decomposed operations

Return type

list[Operation]

Raises

ValueError – if target_operation is not a single-qubit operation

Example:

>>> op = qml.T(0) # uses OD algorithm
>>> print(qml.draw(ctrl_decomp_bisect, wire_order=(0,1,2,3,4,5), show_matrices=False)(op, (1,2,3,4,5)))
0: ─╭X──U(M0)─╭X──U(M0)†─╭X──U(M0)─╭X──U(M0)†─┤
1: ─├●────────│──────────├●────────│──────────┤
2: ─├●────────│──────────├●────────│──────────┤
3: ─╰●────────│──────────╰●────────│──────────┤
4: ───────────├●───────────────────├●─────────┤
5: ───────────╰●───────────────────╰●─────────┤
>>> op = qml.QubitUnitary([[0,1j],[1j,0]], 0) # uses MD algorithm
>>> print(qml.draw(ctrl_decomp_bisect, wire_order=(0,1,2,3,4,5), show_matrices=False)(op, (1,2,3,4,5)))
0: ──H─╭X──U(M0)─╭X──U(M0)†─╭X──U(M0)─╭X──U(M0)†──H─┤
1: ────├●────────│──────────├●────────│─────────────┤
2: ────├●────────│──────────├●────────│─────────────┤
3: ────╰●────────│──────────╰●────────│─────────────┤
4: ──────────────├●───────────────────├●────────────┤
5: ──────────────╰●───────────────────╰●────────────┤
>>> op = qml.Hadamard(0) # uses general algorithm
>>> print(qml.draw(ctrl_decomp_bisect, wire_order=(0,1,2,3,4,5), show_matrices=False)(op, (1,2,3,4,5)))
0: ──U(M0)─╭X──U(M1)†──U(M2)─╭X──U(M2)†─╭X──U(M2)─╭X──U(M2)†─╭X──U(M1)─╭X──U(M0)─┤
1: ────────│─────────────────│──────────├●────────│──────────├●────────│─────────┤
2: ────────│─────────────────│──────────├●────────│──────────├●────────│─────────┤
3: ────────│─────────────────│──────────╰●────────│──────────╰●────────│─────────┤
4: ────────├●────────────────├●───────────────────├●───────────────────├●────────┤
5: ────────╰●────────────────╰●───────────────────╰●───────────────────╰●────────┤