Scaling up and down of 3-D floating-point data in quantum computation

In the past few decades, quantum computation has become increasingly attractive due to its remarkable performance. Quantum image scaling is considered a common geometric transformation in quantum image processing, however, the quantum floating-point data version of which does not exist. Is there a corresponding scaling for 2-D and 3-D floating-point data? The answer is yes. In this paper, we present a quantum scaling up and down scheme for floating-point data by using trilinear interpolation method in 3-D space. This scheme offers better performance (in terms of the precision of floating-point numbers) for realizing the quantum floating-point algorithms than previously classical approaches. The Converter module we proposed can solve the conversion of fixed-point numbers to floating-point numbers of arbitrary size data with \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$p+q$$\end{document}p+q qubits based on IEEE-754 format, instead of 32-bit single-precision, 64-bit double-precision and 128-bit extended-precision. Usually, we use nearest-neighbor interpolation and bilinear interpolation to achieve quantum image scaling algorithms, which are not applicable in high-dimensional space. This paper proposes trilinear interpolation of floating-point data in 3-D space to achieve quantum algorithms of scaling up and down for 3-D floating-point data. Finally, the quantum scaling circuits of 3-D floating-point data are designed.

Quantum computation is a theoretical computation system that performs operations on data by using quantummechanical phenomena (such as superposition and entanglement). In 1982, Feynman 1 proposed the concept of quantum computer at first. After that, the integer factoring problem 2 and database search algorithm 3 were essential evidences supporting the power of quantum computers. Researches in quantum image processing field started with proposals on quantum image representations such as Qubit Lattice 4 , Real Ket 5 and Entangled Image 6 . After 2011, some more practical quantum image models using entangled states (FRQI 7 ) and superposition states (NEQR 8 , INEQR 9 , GQIR 10 , QRDS 11 , GFPRQS 12 , QR2-DD 13 , etc.) have been proposed. With the proposal of NEQR representation, Chetia et al. 14 introduced a quantum image edge detection algorithm based on NEQR. Chakraborty et al. 15 provided a brief survey of the current status of research in the quantum image processing paradigm in 2018. In addition, Chakraborty et al. 16 proposed a combination of three different approaches for representing color quantum images in ternary quantum system. In 2018, Chakraborty et al. 17 proposed and designed a circuit level implementation of the quantum multilevel threshold based color image segmentation technique.
At present, quantum image processing research has been paid more attention to the transform domain. Fijany and Williams 18 studied fast algorithms and complete circuits for quantum wavelet transforms (QWT). Caraiman and Manta 19 introduced quantum image filtering in the frequency domain. Quantum arithmetic operations were given by Ruiz-Perez and Garcia-Escartin 20 based on quantum Fourier transform (QFT). Li and Sun 21 presented quantum color image filtering in the frequency domain. There are many research results in the transform domain. Asaka et al. 22 discussed an implementation of the fast Fourier transform (FFT) as a quantum circuit. The quantum version of the FFT (QFFT) is defined as a transformation of a tensor product of quantum states. Chakraborty et al. 23,24 proposed the image denoising schemes based on QWT. Chang and Vasilakos 25 presented core concepts of QFT and inverse QFT and given the reason of why QFT and inverse QFT are able to give exponential speed-up for FFT. Grigoryan and Agaian 26 proposed a new quantum representation of images: Fourier transform representation. Indeed, the QFT is a key ingredient of many important quantum algorithms, including Shor's factoring algorithm and the quantum phase estimation algorithm to estimate the eigenvalues of a unitary operator. Therefore, we propose the design scheme of quantum algorithm for 3-D floating-point data based on QFT in this paper.
In recent years, quantum image scaling as a kind of image geometric transformation has been widely studied and applied in quantum image processing. Jiang and Wang 9 proposed quantum algorithms and circuits to realize the quantum image scaling based on the INEQR model for quantum images using the nearest neighbor interpolation. Jiang et al. 10 given an improved quantum image representation GQIR and proposed a quantum algorithm to scale up quantum images based on nearest-neighbor interpolation with integer scaling ratio. Sang et al. 27 constructed the quantum circuits of the nearest-neighbor interpolation method for FRQI and NEQR. Zhou et al. 28 proposed the bilinear interpolation method for NEQR and given the corresponding quantum realization circuits. Li and Liu 29 designed quantum image scaling using bilinear interpolation method based on QFT. Zhou et al. 30 given quantum image scaling based on bilinear interpolation with arbitrary scaling ratio. However, as far as we know, three-dimensional (3-D) quantum floating-point data versions of which do not exist.
The problem of classical 3-D image (or data) reconstruction is currently a hot topic, such as the reconstruction technology of 2-D to 3-D data. We given a method to convert a 3-D data into 2-D data based on QR2-DD 13 . The dimensionality reduction from 3-D to 2-D data can reduce the number of qubits, and consequently, resources are saved at location information. As far as we know, the inverse problem, that is, 2-D to 3-D reconstruction problem, such as computed tomography (CT) imaging, has important practical significance. However, the quantum floating point data are not discussed. Inspired by this, we conducted preliminary explorations on the reconstruction of 2-D to 3-D quantum floating-point data. Therefore, the further research of our work can provide research ideas for the reconstruction of 2-D to 3-D quantum data.
Floating-point arithmetic precision is limited in length, such as the IEEE single (double, extended) precision format is 32-bit (64-bit, 128-bit) long. However, some problems require a longer floating-point format because of round-off errors. Such problems are usually solved in arbitrary precision (p+q) 13 .
Compared with fixed-point numbers, floating-point numbers offer great savings in the number of qubits when the required range of values or relative precision is large. It is very meaningful to consider the quantum scaling of floating-point data in 3-D space. Li and Liu 29 designed quantum image scaling using bilinear interpolation method based on QFT, in which two core operations (i.e., addition and multiplication) are implemented using QFT. Therefore, we consider using trilinear interpolation method to study the quantum scaling of floating-point data in 3-D space. In this paper, we present a quantum scaling up and down scheme of floating-point data by using trilinear interpolation method based on QFT in 3-D space. It has three main contributions: • The trilinear interpolation method for quantum scaling up and down of 3-D floating-point data is proposed for the first time. • The generalized floating-point quantum representation of 3-D data in this paper can represent the arbitrary precision (p+q). • A Converter module for converting fixed-point numbers to floating-point numbers is proposed.
In addition, based on QFT, we design the addition and multiplication (Q-Adder and Q-Multiplier modules) of 3-D floating-point data. Combining some basic modules in this paper, we propose the design scheme of the quantum scaling up and down of 3-D floating-point data using trilinear interpolation method based on QFT. Finally, we give the quantum scaling circuits of 3-D floating-point data.
The remainder of this paper is organized as follows: "Preliminaries' 'section gives a brief introduction to quantum representation of 3-D floating-point numbers, classical interpolation methods and QFT. After the description of the basic modules in "Some modules" section, the addition and multiplication of the floating-point based on QFT (Q-Adder and Q-Multiplier) and Converter for converting fixed-point numbers to floating-point numbers are designed in "Floating-point addition and multiplication based on QFT" section. "Quantum scaling-up circuit for 3-D floating-point data" and "Quantum scaling-down circuit for 3-D floating-point data"sections introduce the design scheme of quantum scaling up and down for 3-D floating-point data using trilinear interpolation method. "Complexity analysis" section analyzes the computational complexity of the scaling circuits based on the elementary gates. Finally, conclusions and future research works are described in "Conclusions" section.

Preliminaries
In this section, we briefly explain an overview of the foundation of the proposed methodology, including quantum representation of 3-D floating-point numbers, classical interpolation methods and QFT.
A quantum gate is simply an operator that acts on qubits. Such operators can be represented by unitary matrices. Some of the basic gates and their corresponding matrices are shown in (1). The identity gate (I), Hadamard gate (H), NOT gate (X), controlled-NOT gate (CNOT) and controlled-phase gate ( CR k ) are well-known 31 Table 2, and each format's parameters are shown in Table 3.

Classical interpolation methods.
In image scaling, interpolation methods are necessary to produce new pixels (when scaling up) or delete redundant pixels (when scaling down). The commonly used interpolation methods include nearest neighbor, linear and cubic interpolation in Fig. 2: As shown in Fig. 2, the value of the destination pixel (x, c) can be estimated by linear interpolation method, i.e.,   www.nature.com/scientificreports/ The bilinear interpolation method plays an important role in classical image scaling. For a W × H (width and height) image, the size of the corresponding interpolated image is W ′ × H ′ , which can be described in two steps.
The corresponding relationship is shown in Fig. 3. Here, where ⌊·⌋ denotes rounding down.
The pixel value in position (Y ′ , X ′ ) of the interpolated image using bilinear interpolation method can be calculated as follows:   where i is an imaginary unit. The specific quantum circuits are shown in Fig. 4, where |x� = |x 0 x 1 . . . x n−1 � . For simplicity, in this figure we have omitted the sequence of SWAP gates needed to invert the order of the output qubits.
We can equally define an Inverse Quantum Fourier Transform operator IQFT so that With the direct and the inverse Fourier transforms, we can move back and forth between the computational basis and the phase representation. In our notation, this conversion from the phase encoding to the computational basis |x� = |x 0 x 1 . . . x n−1 � is written as By employing 1-qubit Hadamard gates H and 2-qubit controlled-phase gates CR k , the QFT and IQFT can be efficiently implemented.

Quantum scaling up and down
In the following subsections, we first introduced some basic modules: adding one, rotation, adder, multiplier, special subtractor and divided by 2 modules, and then we designed the addition and multiplication of the floatingpoint based on QFT (Q-Adder and Q-Multiplier) and Converter for converting fixed-point numbers to floatingpoint numbers. Finally, we proposed the design scheme of quantum scaling up and down for 3-D floating-point data.
Some modules. In the next subsection, a series of quantum modules are used. So we introduce their circuits in this subsection.

Adder and Multiplier modules
Li 29 proposed a new method for the design of two core modules (i.e., addition and multiplication) based on QFT. It is clear that the subtraction operation could be implemented by a bit of modification in CR k . If we replace the element e 2πi/2 k in CR k matrix with e −2πi/2 k , then the quantum adder circuit would act as a quantum subtractor whose output will become |x�|x − y� . We don't give the detail quantum circuit of the quantum subtractor module. The quantum circuits of quantum adder and subtractor and multiplier modules are shown in Figs 7, 8 and 9, respectively.

Special Subtractor module
The function of this module is to implement the subtraction of two m-qubit numbers, i.e. 2 m − x , 0 ≤ x ≤ 2 m − 1 , and the special subtractor quantum circuit is shown in Fig. 10        The comparator module based on integer (CMP) is used to compares two exponents information s e and t e of |s� F and |t� F . If s e < t e , swap the two floating-point numbers (comparison followed by controlled swaps). Align the two results according to the difference in exponents E = s e − t e . (only if E < q 2 − 1 , else the adder will have no effect, m = {1, 2, . . . , q 2 − 1} in ②).
Step ②. Add mantissas in two's complement.  www.nature.com/scientificreports/ Compute two's complement from sign bits and mantissas (including the implicit leading 1). The second mantissa |t f � is shifted by the difference of the exponents s e and t e . Add mantissas in two's complement.
The final RN gate renormalizes the intermediate result using the first-ones circuit followed by shifting the mantissa by the output of the first-ones circuit (i.e., if adding the two mantissas in ② caused an overflow, rightshift the result by 1 and increment the exponent) and copies out the resulting floating-point representation. Figure 13 shows the multiplication of two floating-point numbers |s� F and |t� F , where |s� F = |s s s e s f � F = |s s s 1 s 2 . . . s p 1 s p 1 +1 . . . s p 1 +q 1 −1 � F , |t� F = |t s t e t f � F = |t s t 1 t 2 . . . t p 2 t p 2 +1 . . . t p 2 +q 2 −1 � F . There is only one renormalization step involved. In summary, it requires the following steps:
(3). If there was an overflow, right-shift by one and increment the result exponent. (4). The final step denoted by c COPY consists of conditionally copying out of the resulting exponent, mantissa and sign bit.
Before explaining the circuit, we first need to normalize |x�.
Step ①. Calculate the bias value. That is, +2 Step ③. Calculate the value of the mantissa. If x 0 = 1, x 1 = 1 , the value of the mantissa can be realized using the Toffoli gate and zero padding at the end of |x 1 x 2 . . . x n−1 � . Therefore, the remaining cases (example x 0 = 0, x 1 = 1 and x 0 = 0, x 1 = 0, x 2 = 1 ) are carried out in this way in sequence. That is to say, determine the position of the first 1.

Quantum scaling-up circuit for 3-D floating-point data.
In this subsection, the quantum scaling-up circuit of 3-D floating-point data based on QFT using trilinear interpolation is designed. The key idea of the proposed circuit is mathematically explained in (13). Without loss of generality, the quantum representation for an array of 2 h × 2 w × 2 l 3-D floating-point data in (2) ( H = 2 h , W = 2 w , L = 2 l ) can be expressed as follows: where The quantum representation uses Y (h qubits), X (w qubits), Z (l qubits), |S YXZ � F (p + q qubits) , respectively, to denote the Y-coordinate, X-coordinate, Z-coordinate and a floating-point number of 3-D data.
Assume that there is an array of 2 h × 2 w × 2 l 3-D floating-point data and the size of the resulting data after being scaled is 2 h+h 1 × 2 w+w 1 × 2 l+l 1 , i.e., r y = 2 h 1 , r x = 2 w 1 and r z = 2 l 1 (where r y , r x and r z represent the scaling in y-coordinate, x-coordinate, z-coordinate axis directions, respectively). The trilinear interpolation method for 3-D floating-point data can be described within the following two steps in detail.
Step 1: Build coordinate map relationship.
The coordinate position (Y ′ , X, Z ′ ) of the interpolated data can build a map relationship with the four positions (Y + 1, X, Z + 1) , (Y + 1, X, Z) , (Y , X, Z + 1) and (Y, X, Z) of the original data when X is fixed. The coordinate position (Y ′ , X + 1, Z ′ ) of the interpolated data can build a map relationship with the four positions www.nature.com/scientificreports/ is fixed. The coordinate position (Y ′ , X ′ , Z ′ ) of the interpolated data can build a map relationship with the two positions (Y ′ , X, Z ′ ) , (Y ′ , X + 1, Z ′ ) of the original data when yoz plane is fixed. The corresponding relationship is shown in Fig. 15. Therein, where ⌊·⌋ represents the rounding down operation, To build the mapping relationship described in Fig. 15, the multiply Control-Not operations and adding one operation +1 are chosen as the unitary operators. The function of the multiply Control-Not operators is to utilize h Control-Not gates to copy the h qubits |Y h+h 1 −1 Y h+h 1 −2 . . . Y h 1 � into the h ancillary qubits |0� ⊗h . Through these two unitary operators, the interpolation mapping relationship between the position of original data and the interpolated data has been established. The details are described in Figs. 17 and 18.
Step 2: Calculating value for 3-D floating-point data.
Firstly, eight quantum oracle operators Y +1, ,Z+1 � and |S Y ,X+1,Z � , respectively. A quantum oracle operator Y ,X,Z can realize the aim of assigning floating-point data |S Y ,X,Z � to the ancillary qubits |0� ⊗(p+q) , which can be expressed by (14) the function of i Y ,X,Z is setting the value of the ith qubit of the data in (Y,X,Z): where is the XOR operation, s i Y ,X,Z ∈ {0, 1} . Y ,X,Z are used to perform ( p + q ) XOR gate on the ( p + q ) |0� to obtain the data, as shown in following equation: Here, we need to point out that the multiplication between the first three items in each group is the fixed-point multiplication based on QFT (Multiplier module, given by Fig. 9). Since the Multiplier module requires the qubits to be the same, we obtain the final number of qubits by seeking the maximum value. The number of qubits after multiplying the first three items in each group is n 1 = max{h 1 , w 1 + 1, l 1 } , n 2 = max{h 1 + 1, w 1 + 1, l 1 } , n 3 = max{h 1 , w 1 + 1, l 1 + 1} , n 4 = max{h 1 + 1, w 1 + 1, l 1 + 1} , n 5 = max{h 1 , w 1 , l 1 } , n 6 = max{h 1 + 1, w 1 , l 1 } , n 7 = max{h 1 , w 1 , l 1 + 1} , n 8 = max{h 1 + 1, w 1 , l 1 + 1} , respectively. Before multiplying with the fourth item floating-point data, the result of the previous fixed-point multiplication needs to be converted into the floating-point data of the same qubit through the Converter module, given by Fig. 14. Finally, the multiplication here uses the floating-point multiplier based on QFT (Q-Multiplier module, given by Fig. 13). For convenience, we omit the process of seeking the maximum value in the Multiplier module and the Converter module before the Q-Multiplier module, refer to Figs. 17 and 18.
Finally, 3-D floating-point data |S Y ′ ,X ′ ,Z ′ � of the scaled-up is obtained by using seven Q-Adder modules (given by Fig. 12) and h 1 + w 1 + l 1 Divided by 2 modules (given by Fig. 11 For convenience, we show the schematic representation of the scaling-up circuit as Fig. 16, where the small cube represents a voxel point of the 3-D floating-point data, the right side is the scaled-up data representation, r y = 4 , r x = 2 , r z = 2.

Conclusions
Quantum computation has become a novel and important tool in the field of image/data processing. In this paper, the trilinear interpolation method for quantum scaling up and down of 3-D floating-point data is proposed for the first time. 3-D data have a wide range of applications in many diverse fields such as artificial intelligence, aeronautics, architecture, biological science, medicine, etc. Floating-point numbers offer great savings in the number of qubits when the required range of values and/or relative precision is large. Therefore, based on QFT, we have designed the addition and multiplication (Q-Adder and Q-Multiplier modules) of 3-D floating-point data. And then, we have proposed a Converter module for converting fixed-point numbers to floating-point numbers. Combining some basic modules in this paper, we can achieve the quantum scaling up and down for 3-D floating-point data. Finally, we have proposed the design scheme of quantum scaling up and down for 3-D floating-point data using trilinear interpolation method based on QFT.