qat.lang.AQASM.classarith.add

qat.lang.AQASM.classarith.add(reg_size: int, reg_size_2: int)

Implementation based on [CTTK09]. Builds a circuit performing an addition using two qbits registers. The addition is done ‘in place’. Only the content of the first register is changed:

\[|a\rangle|b\rangle \mapsto |a + b\rangle|b\rangle\]

All additions, unless specified, are modulo \(2^n\) where n is the size of the register holding the result.

The circuit has size \(7n\) (\(2n\) Toffoli and \(5n\) CNOT).

Parameters
  • reg_size (int) – the number of qbits on which to perform the addition

  • reg_size_2 (int) – the number of qbits holding the value of the number to add

Note

This adder is the default adder of the namespace qat.lang.AQASM.classarith. This means that linking the full package to the to_circ() method will link this particular adder. If you wish to specifically use another adder ( cuccaro_add() for instance), the adder should linked individually.