Arithmetic library for IBM Qiskit
This is our great, awesome, extremely impressive, daunting, inspiring arithmetic library.
List of operations implemented:
Controlled Toffoli gate (qc,ctrl,a,b,c)
qc->quantum circuit, ctrl->control bit, a->toffoli control input1, b->toffoli control input2, c->target qubit
Source: O. Scott, Nathan & Dueck, G.W.. (2008). Pairwise decomposition of toffoli gates in a quantum circuit. 231-236. 10.1145/1366110.1366168.
Multiple Controlled Not gate (qc,ctrl,a...n, z)
qc->quantum circuit, ctrl->control bit, a->toffoli control input ... n->toffoli control input, z->target qubit
Source: Barenco, Adriano and Bennett, Charles H. and Cleve, Richard and DiVincenzo, David P. and Margolus, Norman and Shor, Peter and Sleator, Tycho and Smolin, John A. and Weinfurter, Harald. (1995). Elementary gates for quantum computation. 3457–3467. 10.1103/physreva.52.3457.
Logical AND (qc, a, b, c, N)
qc->quantum circuit, a->input1, b->input2, c->output, N->bit-string length
Logical OR (qc, a, b, c, N)
qc->quantum circuit, a->input1, b->input2, c->output, N->bit-string length
Logical XOR (qc, a, b, c, N)
qc->quantum circuit, a->input1, b->input2, c->output, N->bit-string length
Logical NOT (qc, a, c, N)
qc->quantum circuit, a->input, c->output, N->bit-string length
Shift right (qc,reg,N,shift)
qc->quantum circuit, reg->shift register, N->shift register bit-length, shift->shift amount
Shift left (qc,reg,N,shift)
qc->quantum circuit, reg->shift register, N->shift register bit-length, shift->shift amount
QFT-based add (Draper adder)
Source: Khosropour, A., Aghababa, H., & Forouzandeh, B. (2011). Quantum Division Circuit Based on Restoring Division Algorithm. 2011 Eighth International Conference on Information Technology: New Generations. doi:10.1109/itng.2011.177
Source: Vedral, V., Barenco, A., & Ekert, A. (1996). Quantum networks for elementary arithmetic operations. Physical Review A, 54(1), 147.
Uses the QFT-based adder and the fact that
Uses the ripple-carry adder and the fact that
Multiply & Controlled Multiply
Source: Nguyen, A. Q. (2004). TR-2004010: Optimal Reversible Quantum Circuit for Multiplication.
Source: Khosropour, A., Aghababa, H., & Forouzandeh, B. (2011). Quantum Division Circuit Based on Restoring Division Algorithm. 2011 Eighth International Conference on Information Technology: New Generations. doi:10.1109/itng.2011.177
Uses the QFT-adder based cmult and the fact that
a ^ b = a0 * a1 * .... * ab-2 * ab-1