---
title: XXDecomposer (v0.46)
description: API reference for qiskit.synthesis.XXDecomposer in qiskit v0.46
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/0.46/qiskit.synthesis.XXDecomposer
---

# XXDecomposer

*class* `qiskit.synthesis.XXDecomposer(basis_fidelity=1.0, euler_basis='U', embodiments=None, backup_optimizer=None)`

[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.46/qiskit/synthesis/two_qubit/xx_decompose/decomposer.py)

Bases: [`object`](https://docs.python.org/3/library/functions.html#object)

A class for optimal decomposition of 2-qubit unitaries into 2-qubit basis gates of XX type (i.e., each locally equivalent to CAN(alpha, 0, 0) for a possibly varying alpha).

**Parameters**

- **basis\_fidelity** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict)  *|*[*float*](https://docs.python.org/3/library/functions.html#float)) – available strengths and fidelity of each. Can be either (1) a dictionary mapping XX angle values to fidelity at that angle; or (2) a single float f, interpreted as \{pi: f, pi/2: f/2, pi/3: f/3}.
- **euler\_basis** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – Basis string provided to OneQubitEulerDecomposer for 1Q synthesis. Defaults to “U”.
- **embodiments** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict)*\[*[*float*](https://docs.python.org/3/library/functions.html#float)*,* [*QuantumCircuit*](/docs/api/qiskit/0.46/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")*] | None*) – A dictionary mapping interaction strengths alpha to native circuits which embody the gate CAN(alpha, 0, 0). Strengths are taken so that pi/2 represents the class of a full CX.
- **backup\_optimizer** (*Callable\[...,* [*QuantumCircuit*](/docs/api/qiskit/0.46/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")*] | None*) – If supplied, defers synthesis to this callable when XXDecomposer has no efficient decomposition of its own. Useful for special cases involving 2 or 3 applications of XX(pi/2), in which case standard synthesis methods provide lower 1Q gate count.

> **Note**
>
> If `embodiments` is not passed, or if an entry is missing, it will be populated as needed using the method `_default_embodiment`.

## Methods

### num\_basis\_gates

`num_basis_gates(unitary)`

Counts the number of gates that would be emitted during re-synthesis.

NOTE: Used by ConsolidateBlocks.
