RGMultiplier
QuICT.algorithm.arithmetic.multiplier.RGMultiplier ¶
Bases: CompositeGate
A QFT based out-of-place quantum multiplier using schoolbook method. For qreg_size equals n,
this gate requires in total 4n qubits. For two binary encoded n-qubits integers a and b,
calculates their product and store the result on 2n clean qubits.
Applying this multiplier on two 2-qubit sized register, \(a:=\vert{q_0q_1}\rangle\) and \(b:=\vert{q_2q_3}\rangle\) with output register \(\vert{q_4...q_7}\rangle\) looks like:
┌──────────┐
q_0: |0>───────────────────────┤0 ├────────────
┌──────────┐│ │
q_1: |0>───────────┤0 ├┤ ├────────────
│ ││ │
q_2: |0>───────────┤1 ├┤1 ├────────────
│ ││ │
q_3: |0>───────────┤2 ├┤2 cg_dder ├────────────
┌─────────┐│ ││ │┌──────────┐
q_4: |0>┤0 ├┤3 cg_dder ├┤3 ├┤0 ├
│ ││ ││ ││ │
q_5: |0>┤1 ├┤4 ├┤4 ├┤1 ├
│ cg_QFT ││ ││ ││ cg_IQFT │
q_6: |0>┤2 ├┤5 ├┤5 ├┤2 ├
│ ││ │└──────────┘│ │
q_7: |0>┤3 ├┤6 ├────────────┤3 ├
└─────────┘└──────────┘ └──────────┘
Examples:
from QuICT.core import Circuit
from QuICT.algorithm.arithmetic import RGMultiplier
circuit = Circuit(8)
RGMultiplier(2) | circuit
Implementation Details(Asymptotic)
| Parameter | Info |
|---|---|
| Input Size | \(n\) |
| num. ancilla | \(0\) |
| Gate set | \(CCX, CU_1, H\) |
| Width | \(4n\) |
| Depth | \(5n^3+{5\over2}n^2+{1\over2}n+6\) |
| Size | \(5n^3+9n^2+2n\) |
| Two-qubit gate | \(3n^3+7n^2-2n\) |
| CCX count | \(2n^3+2n^2\) |
References
[1]: "Quantum arithmetic with the Quantum Fourier Transform" by Lidia Ruiz-Perez and Juan Carlos Garcia-Escartin https://arxiv.org/abs/1411.5949v2.
Parameters:
-
qreg_size(int) –Register size for the first input register
-
qreg_size_b(int | None, default:None) –Register size for the second input register, will be the same as the first input register if not given.
-
name(str, default:None) –Name of the gate.
Raises:
GateParametersAssignedError: If qreg_size or qreg_size_b is smaller than 2.