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

# DraperQFTAdder

*class* `qiskit.circuit.library.DraperQFTAdder(num_state_qubits, kind='fixed', name='DraperQFTAdder')`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.4/qiskit/circuit/library/arithmetic/adders/draper_qft_adder.py#L24-L137)

Bases: `Adder`

A circuit that uses QFT to perform in-place addition on two qubit registers.

For registers with $n$ qubits, the QFT adder can perform addition modulo $2^n$ (with `kind="fixed"`) or ordinary addition by adding a carry qubit (with `kind="half"`).

As an example, a QFT adder circuit that performs an ordinary addition on two 2-qubit sized registers is as follows:

```text
 a_0: ─────────■──────■────────────────────────■────────────────
               │      │                        │
 a_1: ─────────┼──────┼────────■──────■────────┼────────────────
      ┌──────┐ │P(π)  │        │      │        │       ┌───────┐
 b_0: ┤0     ├─■──────┼────────┼──────┼────────┼───────┤0      ├
      │      │        │P(π/2)  │P(π)  │        │       │       │
 b_1: ┤1 QFT ├────────■────────■──────┼────────┼───────┤1 IQFT ├
      │      │                        │P(π/2)  │P(π/4) │       │
cout: ┤2     ├────────────────────────■────────■───────┤2      ├
      └──────┘                                         └───────┘
```

> **Note**
>
> The QFT and inverse-QFT blocks in this implementation omit their swap networks, which reverses the qubit order for a more efficient implementation. This affects which qubits the controlled-phase gates act on. This drawing represents how the adder is implemented in Qiskit; it should not be used as instructions for building the circuit manually.

> **See also**
>
> The following generic gate objects perform additions, like this circuit class, but allow the compiler to select the optimal decomposition based on the context. Specific implementations can be set via the [`HLSConfig`](/docs/api/qiskit/2.4/qiskit.transpiler.passes.HLSConfig "qiskit.transpiler.passes.HLSConfig"), e.g. this circuit can be chosen via `Adder=["qft_d00"]`.
>
> **[`ModularAdderGate`](/docs/api/qiskit/2.4/qiskit.circuit.library.ModularAdderGate "qiskit.circuit.library.ModularAdderGate"): A generic inplace adder, modulo $2^n$. This**
>
> is functionally equivalent to `kind="fixed"`.
>
> **`AdderGate`: A generic inplace adder. This**
>
> is functionally equivalent to `kind="half"`.

References:

\[1] T. G. Draper, Addition on a Quantum Computer, 2000. [arXiv:quant-ph/0008033](https://arxiv.org/pdf/quant-ph/0008033.pdf)

\[2] Ruiz-Perez et al., Quantum arithmetic with the Quantum Fourier Transform, 2017. [arXiv:1411.5949](https://arxiv.org/pdf/1411.5949.pdf)

\[3] Vedral et al., Quantum Networks for Elementary Arithmetic Operations, 1995. [arXiv:quant-ph/9511018](https://arxiv.org/pdf/quant-ph/9511018.pdf)

**Parameters**

- **num\_state\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int)) – The number of qubits in either input register for state $|a\rangle$ or $|b\rangle$. The two input registers must have the same number of qubits.
- **kind** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The kind of adder, can be `'half'` for a half adder or `'fixed'` for a fixed-sized adder. A half adder contains a carry-out to represent the most-significant bit, but the fixed-sized adder doesn’t and hence performs addition modulo `2 ** num_state_qubits`.
- **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The name of the circuit object.

**Raises**

[**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError) – If `num_state_qubits` is lower than 1.

## Attributes

### name

Type: `str`

A human-readable name for the circuit.

**Example**

```python
from qiskit import QuantumCircuit

qc = QuantumCircuit(2, 2, name="my_circuit")
print(qc.name)
```

```text
my_circuit
```
