Skip to content

hkhetawat/QArithmetic

Repository files navigation

QArithmetic

Arithmetic library for IBM Qiskit

This is our great, awesome, extremely impressive, daunting, inspiring arithmetic library.

List of operations implemented:

Bit-wise operations

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

Arithmetic operations

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

Ripple carry add

Source: Vedral, V., Barenco, A., & Ekert, A. (1996). Quantum networks for elementary arithmetic operations. Physical Review A, 54(1), 147.

QFT-based sub

Uses the QFT-based adder and the fact that

a - b = ~(~a + b)

Ripple carry sub

Uses the ripple-carry adder and the fact that

a - b = ~(~a + b)

Multiply & Controlled Multiply

Source: Nguyen, A. Q. (2004). TR-2004010: Optimal Reversible Quantum Circuit for Multiplication.

Divide

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

Square (qc, a, b)

Uses a custom implementation of QFT-based controlled adder

a ^ 2 = a*20 + a*21 + .... + a*2n-2 + a*2n-1

Power (qc, a, b, c)

Uses the QFT-adder based cmult and the fact that

a ^ b = a0 * a1 * .... * ab-2 * ab-1

About

Arithmetic library for IBM Qiskit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published