Four Arithmetic Operations on the Quantum Computer

Quantum computer has been proved to be superior to electronic computer in solving some NP problems. Based on the former quantum adder, this paper proposes a new quantum adder and quantum subtracter, and then designs a fixed-point quantum multiplier and a fixed-point quantum divider based on fixed-point number operations. Four arithmetic units are presented using quantum gate circuits. These researches lay a foundation for the quantum implementation of digital filters.


Introduction
Since Feynman, more and more scholars believe that the computing power of quantum computer is unmatched by electronic computer [1]. In 1992, Deutsch et al. proposed a quantum computer model, which confirmed that Deutsch problem can be solved faster in quantum computer than in electronic computer [2]. Both Shor quantum factorization algorithm and Grover search algorithm have shown that quantum computers have greater computational advantages than traditional electronic computers in some aspects [3].
Quantum computation and quantum computers have attracted wide attention of scholars [4,5]. Two important applications of quantum computing are quantum cryptography [6,7] and quantum image processing [8]. Since quantum information is non-clonable, quantum entanglement is an important physical guarantee of secure communications [9]. Some chaotic systems realized by quantum gate circuits can be used as pseudo-random sequence generators in image cryptosystems to realize the encryption and decryption of quantum images [10].
On the basis of the previous research on quantum computation and quantum gate circuits, this paper studies in detail the method of realizing basic arithmetic units by means of quantum gate circuits, especially the multiplier and divider of fixed-point number with the quantum gate circuits. The research work paves the way for the realization of fixed-point number operations by means of quantum computer.

Existing Quantum Adder
In 1996, Vedral et al. proposed a quantum adder [11]. They designed adders and carry circuits based on quantum circuits such as quantum NOT gate and quantum XOR gate, as shown in figure 1 and figure 2. Then, a quantum adder is implemented using the circuits shown in figure 1 and figure 2, as shown in figure 3.
In figure 1b, the inputs are the carry bit c from the previous stage and two addends a and b from top to bottom, and the outputs are c, a and a+b from top to bottom. In figure 2b, the inputs are successive carry c 0 from the previous stage, two addends a and b, and the carry signal from top to bottom, and the outputs are c 0 , a, b and c 1 from top to bottom and the carry signal is stored in c 1 .   In figure 3, c 0 , c 1 ,..., c n-1 are added to save the carry signals, and b n is added to save the whole carry signal after addition. Figure 3b is the symbol of quantum adder and figure 3c is the symbol of quantum subtracter. That is, figure 3c is the inverse unit of figure 3b.

Improved Quantum Adder
Based on Vedral's work, three Toffoli gates and two NOT-controlled gates are used to design a quantum full adder, as shown in figure 4. The logical truth table for figure 4a is shown in table 1. In table 1, a 0 +b 0 +c 0 are assigned to the new b 0 . Figure 4c is the reverse circuit of figure 4a to realize subtraction. The adder and subtracter, designed with the help of the quantum circuits shown in figure 4, are shown in figure 5 and figure 6, respectively.
In the electronic computer, there is no subtraction circuit. The electronic computer unifies addition and subtraction into addition operation by means of complement form. In the quantum computer, the addition and subtraction can also be unified into addition operation by means of complement form, just like in the electronic computer. The complement of a positive integer is the same as that of the original, and the complement of a negative integer is the inverse of every bit except the sign bit, followed by 1. The quantum circuit for converting a signed integer to its complement form is shown in figure 7.
In figure 7, if the input is original code of a, the output is complement of a; if the input is complement of a, the output is original code of a. In figure 8, the addition and subtraction operations are unified into addition operations with the complement processing unit.

Quantum Multiplier of Fixed-point Number
In quantum computer, the multiplication method of fixed-point decimals is to use the calibration method to process the decimals with fixed points. The calibration method is denoted by Qm.n, where m+n+1 is the word length of the computer. For example, -0.52 uses Q0.15 for calibration to get a fixed-point number 1.851E (in hexadecimal), and 0.68 uses Q0.15 for calibration to get a fixed-point number 0.AE14 (in hexadecimal).
For example, the product of two original-code decimals represented by Q0.4 is the decimals with Q0.9. The operation process is as follows: Let a and b be the decimals of original-code form represented by Q0.4, where, a=a 0 .a 1 a 2 a 3 a 4 , b=b 0 .b 1 b 2 b 3 b 4 . a 0 and b 0 are the sign bits of a and b, respectively. Let a * b=r and r=r 0 .r 1 r 2 ...r 9 . r 0 is the sign bit of r. And r 0 =a 0 b 0 , r 1 r 2 ...r 9 =(a 1 a 2 a 3 a 4 ) * (b 1 b 2 b 3 b 4 ) * 2. The corresponding quantum circuit is shown in figure 9. In figure 9, zero-controlled gate is used as shown in figure 10.  For multiplication of any two Q0.(n-1) decimals, the quantum multiplication circuit is similar to that shown in figure 9 with the expanded part having the property that a zero-controlled NOT gate unit is applied to the upper line every two exclusive-OR operations in the same line.

Quantum Divider of Fixed-point Number
The division (b/a) of two fixed-point numbers a and b is considered. Generally, a is formatted as the scaling form Q0.(n-1) or Qm.(n-m-1), and b is formatted as the scaling form Q0.(2n-1) or Qk.(2n-k-1). Thus, a=a 0 a 1 a 2 ...a n-1 (in binary), and a 0 is the sign bit. And b=b 0 b 1 b 2 ...b 2n-1 (in binary) and b 0 is the sign bit. In the quantum computer, the quantum circuit as shown in figure 11 is constructed to divide the fixed-point numbers. The quotient r=b/a and the remainder is saved in b.  Figure 11. Quantum divider (a) divider; (b) symbol. In the quantum division unit shown in figure 11, a controlled adder is used. When the i-th borrow signal is 0, the corresponding result r i is 1. When the i-th borrow symbol is 1, the corresponding output of subtracter needs to add a to restore to the original b i b i+1 ...b i+n-2 .

Conclusion
In this paper, four arithmetic operations implemented on quantum computer are studied. At first, the quantum adder and complement quantum adder are designed. Then, the representation and calculation methods of fixed-point numbers are discussed. After that, the general quantum multiplier and divider of fixed-point numbers are constructed. Based on the designed quantum arithmetic units, one can perform high-precision decimal multiplications and divisions. On the basis of this work, we plan to design the quantum versions of floating-point number operations in the future, and realize the quantum processing versions of number system operations used on conventional electronic computers.

Acknowledgments
We would like to thank the financial supports from the National Natural Science Foundation of China