Skip to content

Menu

WorksPhysics and Astronomy

Quantum State Preparation for Complex-Valued Amplitudes

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_jvds3a47. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

We present a state preparation procedure that takes binary registers containing the real and imaginary parts of a complex number z=x+iyz=x+iy and prepares an amplitude approximating z/αz/α, where αα is a normalization constant. The magnitude and argument are computed using the Coordinate Rotation Digital Computer (CORDIC) algorithm. We then encode the magnitude into an amplitude, and apply phase gates to introduce the argument. A reversible in-place multiplier allows the coordinate updates to use fixed precision while clearing their temporary workspace. The procedure uses O(n2)O(n^2) TT gates and O(n)O(n) additional qubits. Compared with separately encoding the real and imaginary parts and combining them through LCU, the construction can allow a smaller normalization and reduce amplitude-amplification costs. The computed polar representation also remains available for further arithmetic before amplitude-encoding.

Introduction

Quantum computing has attracted significant interest as a framework for approaching problems in scientific computing that are computationally hard on classical computers, including Hamiltonian simulation, ground-state energy estimation, and many-body physics [1, 2, 3, 4, 5]. These algorithms often require numerical values to be encoded into the amplitudes of a quantum state. However, values computed using quantum arithmetic are stored as binary digits in registers. In this work, we describe a state preparation procedure that takes the real and imaginary parts of a complex number stored in this form and encodes the number into an amplitude.

A complex number, z=x+iyz = x + iy, can be stored in two quantum registers containing the binary digits of its real and imaginary parts. This representation allows us to perform arithmetic on the stored values, but does not directly represent zz as an amplitude. We therefore consider how to convert these stored values into an amplitude while preserving the original inputs. The procedure must also work coherently when the inputs are in superposition, so that each input component is assigned its corresponding complex amplitude.

Given two registers ∣x⟩|x\rangle and ∣y⟩|y\rangle representing z=x+iyz = x + iy, we would like to perform the transformation

∣x⟩∣y⟩∣0⟩∣0⟩a⟼∣x⟩∣y⟩(z′α∣0⟩+∣⊥⟩)∣0⟩a,(1)|x\rangle|y\rangle|0\rangle|0\rangle_a \longmapsto|x\rangle|y\rangle\left(\frac{z'}{\alpha}|0\rangle+ |\perp\rangle\right)|0\rangle_a, \tag*{(1)}

where z′z' approximates zz and α\alpha is a normalization constant. Here, the third register is the output register, and ∣0⟩|0\rangle denotes all working ancilla registers. The state ∣⊥⟩|\perp\rangle is the remaining component perpendicular to the zero output state. It may depend on the input and is not necessarily normalized.

Our approach proceeds as follows. Writing z=reiϕz = r e^{i\phi}, we first compute approximations r′≈rr' \approx r and ϕ′≈ϕ\phi' \approx\phi using the Coordinate Rotation Digital Computer (CORDIC) algorithm [6, 7]. CORDIC computes the magnitude and argument through a sequence of bit-shifts and additions. This avoids expensive square-root and arctan operations when converting the input coordinates into magnitude and argument.

We then use the binary-to-amplitude encoding procedure AMP to encode r′/αr'/\alpha [8], and phase gates to introduce eiϕ′e^{i\phi'}. Together, these steps give the amplitude z′/αz'/\alpha, where z′=r′eiϕ′z' = r'e^{i\phi'}. The stored magnitude and argument remain unchanged during encoding, allowing us to reverse the arithmetic and return all working ancillas to ∣0⟩|0\rangle.

Our procedure may be useful within a larger algorithm, such as Hamiltonian simulation, where computing the complex inputs is expensive. Directly encoding the real and imaginary parts using AMP and combining them through LCU uses asymptotically fewer Toffoli gates, but our construction can allow a smaller normalization than the LCU approach. This can reduce the number of amplitude-amplification steps and thus save resources when each step repeats expensive input computations. Furthermore, we explicitly compute the polar representation of zz, allowing further arithmetic before amplitude-encoding. For example, this representation can be used in the fast-inversion procedure of Tong et al. [9]: for nonzero z=reiϕz = r e^{i\phi}, its reciprocal is z−1=r−1e−iϕz^{-1} = r^{-1}e^{-i\phi}, requiring a real reciprocal and negating the argument.

The remainder of the paper proceeds as follows. In Subsec. I A, we introduce our notation and binary representation. In Sec. II, we describe how to compute the magnitude and argument reversibly. In Sec. III, we use these values to prepare the desired amplitude and then uncompute the arithmetic registers.

Notation

In this work, each input uses a fixed-point binary representation with nn total bits: one sign bit, ll integer bits, and n−l−1n-l-1 fractional bits. We write a number aa as

sa al−1…a0.a−1…a−(n−l−1).s_a\ a_{l-1}\ldots a_0.a_{-1}\ldots a_{-(n-l-1)}.

We use two’s complement, so its value is

a=−sa2l+∑k=−(n−l−1)l−1ak2k.a=-s_a2^l+\sum_{k=-(n-l-1)}^{l-1}a_k2^k.

The register ∣a⟩|a\rangle contains these binary digits. Arithmetic registers may include additional integer and fractional bits to hold intermediate values and provide the required precision.

We use r′r' and ϕ′\phi' to approximate the magnitude and argument of zz, respectively. We choose α\alpha to be a power of two large enough that r<αr<\alpha and 0≤r′<α0\le r'<\alpha for all allowed inputs, including the magnitude approximation error. We use the smallest such power of two. Angles are modulo 2π2\pi, and we set the magnitude and argument to zero for zero input.

Computing the Magnitude and Argument

We use the Coordinate Rotation Digital Computer (CORDIC) algorithm to compute the magnitude and argument of z=x+iyz=x+iy using shifts and additions [6]. The resulting registers are used by the state preparation procedure in Sec. III.

Our goal is to compute approximations to

r=x2+y2,ϕ=atan2⁡(y,x).r=\sqrt{x^2+y^2},\qquad\phi=\operatorname{atan2}(y,x).

CORDIC rotates the vector (x,y)(x,y) toward the positive xx-axis through a sequence of smaller rotations. The accumulated angle gives the argument, while the final horizontal coordinate gives the magnitude after a known scaling correction.

Preparing the Input

We treat the real and imaginary parts of zz as the coordinates of the vector (x,y)(x,y) and would like to compute its magnitude and argument.

To do so, we perform the CORDIC iterations on separate working registers, leaving the original inputs unchanged. We initialize the working registers by copying the binary digits of xx and yy using CNOT gates:

∣x⟩∣y⟩∣0⟩∣0⟩⟼∣x⟩∣y⟩∣x⟩∣y⟩.|x\rangle|y\rangle|0\rangle|0\rangle\longmapsto|x\rangle|y\rangle|x\rangle|y\rangle.

The new registers hold the working coordinates and include additional bits to accommodate intermediate values. We keep the original inputs in order to uncompute the workspace after the amplitude-encoding procedure.

As a pre-processing step, we place the working vector in the right half-plane. This allows the same CORDIC iteration rule to be used for inputs in every quadrant. If x<0x < 0, we negate both working coordinates:

(x0,y0)={(x,y),x≥0,(−x,−y),x<0.(x_0,y_0)= \begin{cases} (x,y), & x \ge0,\\ (-x,-y), & x < 0. \end{cases}

This preserves the magnitude but changes the argument by π\pi. We account for this change by initializing the angle register to

ϕ0={0,x≥0,π,x<0, y≥0,−π,x<0, y<0.\phi_0 = \begin{cases} 0, & x \ge0,\\ \pi, & x < 0,\ y \ge0,\\ -\pi, & x < 0,\ y < 0. \end{cases}

The CORDIC iterations then add the argument of the transformed vector to this initial correction, giving an approximation to the argument of the original input. Angle constants are stored to the chosen working precision. The original inputs are used to control the correction and to uncorrect it at the end of the procedure. For x=y=0x = y = 0, we set both outputs to zero.

Cartesian-to-Polar CORDIC

We perform nn iterations, indexed by j=0,…,n−1j = 0,\ldots,n-1. At iteration jj, we use the precomputed angle

αj=arctan⁡(2−j).\alpha_j = \arctan(2^{-j}).

The vector is rotated clockwise when yj≥0y_j \ge0 and counterclockwise when yj<0y_j < 0. Writing the direction as

dj={−1,yj≥0,+1,yj<0,d_j = \begin{cases} -1, & y_j \ge0,\\ +1, & y_j < 0, \end{cases}

the ideal updates, before rounding, are as follows.

xj+1=xj−dj2−jyj,yj+1=yj+dj2−jxj,ϕj+1=ϕj−djαj.(2)\begin{aligned} x_{j+1} &= x_j - d_j 2^{-j} y_j,\\ y_{j+1} &= y_j + d_j 2^{-j} x_j,\\ \phi_{j+1} &= \phi_j - d_j \alpha_j. \tag*{(2)} \end{aligned}

The angle update records the opposite of the rotation applied to the vector. Thus, it accumulates the original argument as the vector approaches the positive xx-axis.

These operations don’t include the normalization factor of a genuine rotation. Each iteration therefore increases the vector length by 1+2−2j\sqrt{1 + 2^{-2j}}. After nn iterations, the correction factor is

Kn=∏j=0n−111+2−2j.(3)K_n = \prod_{j=0}^{n-1} \frac{1}{\sqrt{1 + 2^{-2j}}}. \tag*{(3)}

Consequently,

yn≈0,Knxn≈r,ϕn≈ϕ.y_n \approx0,\qquad K_n x_n \approx r,\qquad\phi_n \approx\phi.

Quantum CORDIC Implementation

This procedure uses reversible ripple-carry adders [10]. We denote arithmetic two’s-complement conversion by S2C. Subtraction is implemented by performing an S2C, followed by an adder and an inverse of S2C.

In each iteration, before changing either coordinate, we copy the sign bit sjs_j of yjy_j into a fresh direction qubit. This qubit determines whether each update requires addition or subtraction, which can be done using an adder with one of the operands acted on by a controlled-S2C. For a right-shift x≫jx \gg j we approximate 2−jx2^{-j}x by rounding toward minus infinity. We shift before applying the direction-dependent sign. The coordinate updates proceed as follows.

  1. We update the xx register:

xj↦xj+1=xj−dj(yj≫j).x_j \mapsto x_{j+1}=x_j-d_j(y_j\gg j).

The shifted operand is prepared from the unchanged yy register and is uncomputed after the addition or subtraction.

  1. We multiply the yy register by 1+2−2j1+2^{-2j} using Appendix A:

yj↦yj+(yj≫2j).y_j \mapsto y_j+(y_j\gg2j).

This gives the rounded product without adding fractional bits. Its temporary workspace is uncomputed.

  1. We add dj(xj+1≫j)d_j(x_{j+1}\gg j) to the modified yy register. To see why this works, consider the same steps without rounding:

(1+2−2j)yj+dj2−jxj+1=(1+2−2j)yj+dj2−j(xj−dj2−jyj)(4)(1+2^{-2j})y_j+d_j2^{-j}x_{j+1}=(1+2^{-2j})y_j+d_j2^{-j}(x_j-d_j2^{-j}y_j) \tag*{(4)}
=yj+dj2−jxj.(5)=y_j+d_j2^{-j}x_j. \tag*{(5)}

This recovers the ideal yy update because dj2=1d_j^2=1. The shifted operand is prepared from xj+1x_{j+1} and uncomputed while that register is unchanged.

This approximates both coordinate updates without storing a separate copy of xjx_j. The rounding error is bounded in Subsec. II E.

We then update the angle register by adding −djαj-d_j\alpha_j, where αj=arctan⁡(2−j)\alpha_j=\arctan(2^{-j}). We load αj\alpha_j into a temporary register and conditionally negate it when sj=1s_j=1 using S2C. After adding the signed constant to the angle register, we reverse the conditional negation and unload the constant.

The temporary operand and carry registers are returned to ∣0⟩\lvert0\rangle after use. The direction qubit is retained until the iteration is reversed during uncomputation after the whole procedure. At that point, yjy_j has been restored, and its sign bit is used to return the direction qubit to ∣0⟩\lvert0\rangle. The sign bit is not uncomputed in each iteration and is left to uncompute the entire CORDIC procedure.

The circuit for one iteration is shown in Figure 1.

One CORDIC iteration circuit

Figure 1. One CORDIC iteration, with each slice marking the end of a stage. (1) Copy the sign of yjy_j into sjs_j, prepare 2−jyj2^{-j}y_j, and load αj\alpha_j. (2) Use controlled S2C and addition to update xj+1x_{j+1}. (3) Clear the shifted operand and multiply yy by 1+2−2j1+2^{-2j}. (4) Prepare 2−jxj+12^{-j}x_{j+1} and use controlled S2C and addition to update yj+1y_{j+1}. (5) Clear the shifted operand. (6) Add the signed angle −djαj-d_j\alpha_j to ϕ\phi. (7) Restore and unload the angle operand. The Copy & Shift gates copy the arithmetic right shift.

Recovering the Magnitude

After the iterations, we multiply xnx_n by the precomputed constant KnK_n and store the result in a separate register:

∣xn⟩∣0⟩⟼∣xn⟩∣r′⟩,r′≈Knxn.\lvert x_n\rangle\lvert0\rangle\longmapsto\lvert x_n\rangle\lvert r'\rangle,\qquad r' \approx K_n x_n.

We compute KnK_n classically to the required precision and load its binary approximation into an O(n)O(n)-qubit register. We then use a reversible multiplication circuit, chosen according to the available ancillas and desired circuit depth [11, 12]. For the resource bounds below, we use [11]. We compute the full product, copy the required output bits into the magnitude register, and reverse the multiplication. The unchanged xnx_n and gain constant allow all intermediate product bits to be cleared.

The registers ∣r′⟩\lvert r'\rangle and ∣ϕ′⟩\lvert\phi'\rangle, with ϕ′=ϕn\phi'=\phi_n, are then used for magnitude and phase encoding in Sec. III.

Precision and Resource Costs

We use fixed-point arithmetic throughout the iterations. Let δ\delta denote the weight of the least significant bit in the working registers. To account for accumulated rounding error, we use O(log⁡n)O(\log n) additional fractional bits, giving δ=O(2−(n−l)/n)\delta=O(2^{-(n-l)}/n).

Theorem II.1. If the input registers have least significant bit weight 2−(n−l−1)2^{-(n-l-1)} and the working registers use the additional precision described above, then following the construction in Subsec. II C gives a reconstructed complex value with error O(2−(n−l))O(2^{-(n-l)}).

Proof. For an arithmetic right shift by kk bits, we write

v≫k=2−kv+ϵk,∣ϵk∣<δ.v \gg k = 2^{-k}v+\epsilon_k,\qquad\lvert\epsilon_k\rvert<\delta.

The error is zero when k=0k=0.

First, consider the update to xx. Since djd_j opposes the sign of yjy_j, we have

xj+1=xj+2−j∣yj∣+ϵj,∣ϵj∣<δ.(6)x_{j+1}=x_j+2^{-j}\lvert y_j\rvert+\epsilon_j,\qquad\lvert\epsilon_j\rvert<\delta. \tag*{(6)}

Since the arithmetic right shift preserves the sign of the shifted operand, the implemented increment −dj(yj≫j)-d_j(y_j\gg j) is nonnegative, and so xj+1≥xjx_{j+1}\ge x_j.

For the update of yy, the implementation computes

yj+1=yj+(yj≫2j)+dj(xj+1≫j).y_{j+1}=y_j+(y_j\gg2j)+d_j(x_{j+1}\gg j).

The in-place multiplication and the right shift each introduce an error of less than δ\delta. Substituting the rounded xx update and cancelling the 2−2jyj2^{-2j}y_j terms gives

yj+1=yj+dj2−jxj+ηj,∣ηj∣<3δ,y_{j+1}=y_j+d_j2^{-j}x_j+\eta_j,\qquad\lvert\eta_j\rvert<3\delta,

where we account for the error coming from xj+1x_{j+1}. Since djd_j opposes the sign of yjy_j, it follows that

∣yj+1∣≤∣∣yj∣−2−jxj∣+3δ.(7)\lvert y_{j+1}\rvert\le\lvert\lvert y_j\rvert-2^{-j}x_j\rvert+3\delta. \tag*{(7)}

We now bound the final yy value by induction. At the first iteration, the shifts are exact, so

∣y1∣=∣∣y0∣−x0∣≤∣y0∣+x0=x1.\lvert y_1\rvert=\lvert\lvert y_0\rvert-x_0\rvert\le\lvert y_0\rvert+x_0=x_1.

Suppose that

∣yj∣≤2−(j−1)xj+3(j−1)δ.\lvert y_j\rvert\le2^{-(j-1)}x_j+3(j-1)\delta.

Then

∣∣yj∣−2−jxj∣≤2−jxj+3(j−1)δ.\lvert\lvert y_j\rvert-2^{-j}x_j\rvert\le2^{-j}x_j+3(j-1)\delta.

Using xj+1≥xjx_{j+1} \ge x_j, we obtain

∣yj+1∣≤2−jxj+1+3jδ.|y_{j+1}| \le2^{-j}x_{j+1} + 3j\delta.

So, by induction,

∣yn∣=O(2−nxn+nδ).|y_n| = O(2^{-n}x_n + n\delta).

Thus, we introduce rounding errors of O(δ)O(\delta) when updating both xx and yy per iteration. Subsequent iterations multiply each error by at most a constant factor, giving a total error of O(nδ)O(n\delta) [13].

We will now give an error bound on the approximate magnitude r′≈Knxnr' \approx K_n x_n compared to the true ∣z∣|z|. The scaled vector length, Knxn2+yn2K_n\sqrt{x_n^2+y_n^2}, differs from ∣z∣|z| by O(nδ)O(n\delta), and replacing it with KnxnK_nx_n adds at most Kn∣yn∣K_n|y_n| error. Both inputs have magnitude at most 2l2^l, and so the gain multiplication and the rounding error give xn=O(2l+nδ)x_n = O(2^l+n\delta). Our bound on yny_n therefore gives an error of O(2−n2l+nδ)=O(2−(n−l)+nδ)O(2^{-n}2^l+n\delta)=O(2^{-(n-l)}+n\delta) when using the horizontal coordinate to approximate the magnitude. With our chosen precision, the total magnitude error is O(2−(n−l))O(2^{-(n-l)}).

The remaining vertical component contributes at most Kn∣yn∣K_n|y_n| to the complex-value error, so the same bound applies. We store each angle constant to error O(2−n/n)O(2^{-n}/n) and the gain constant to error O(2−n)O(2^{-n}). These errors and final magnitude rounding don’t change the error bound, giving

∣r′eiϕ′−z∣=O(2−(n−l)),|r'e^{i\phi'}-z| = O(2^{-(n-l)}),

as claimed.

Each iteration uses O(n)O(n) Toffoli gates and O(n)O(n) temporary qubits, which are cleared and reused. We also retain one direction qubit per iteration. The nn iterations and final multiplication use O(n2)O(n^2) Toffoli gates and O(n)O(n) additional qubits. Reversing the arithmetic changes the gate count only by a constant factor.

State Preparation Procedure

We now use the computed registers ∣r′⟩|r'\rangle and ∣ϕ′⟩|\phi'\rangle to prepare the amplitude in Eq. (1). We encode the magnitude first and then introduce its phase.

Encoding the Magnitude

We encode the normalized magnitude r′/αr'/\alpha into an amplitude using the AMP procedure by Pocrnic et al. [8]. Since α\alpha is a power of two, normalization is only a bitwise shift. We retain all stored bits and write

r′α=∑j=1mbj2−j,bj∈{0,1},m=O(n).(8)\frac{r'}{\alpha} = \sum_{j=1}^{m} b_j2^{-j}, \qquad b_j \in\{0,1\}, \qquad m=O(n). \tag*{(8)}

AMP encodes this binary value while leaving the magnitude register unchanged:

∣r′⟩∣0⟩⟼∣r′⟩(r′α∣0⟩+∣⊥⟩),(9)|r'\rangle|0\rangle\longmapsto|r'\rangle\left(\frac{r'}{\alpha}|0\rangle+ |\perp\rangle\right), \tag*{(9)}

where ∣⊥⟩|\perp\rangle is the orthogonal component. The procedure exactly encodes the stored value, using O(n)O(n) Toffoli gates and O(n)O(n) additional qubits.

Encoding the Phase

We encode the argument by applying a phase gate to each qubit of ∣ϕ′⟩|\phi'\rangle. For a bit with binary weight 2j2^j, we apply

P(2j)=diag⁡(1,ei2j).P(2^j)=\operatorname{diag}(1,e^{i2^j}).

We use two integer bits in the argument register, so its sign bit has weight −22-2^2. We apply P(−22)P(-2^2) on the sign bit of ϕ\phi to account for its weight in the two’s-complement representation. Together, these gates give

∣ϕ′⟩⟼eiϕ′∣ϕ′⟩.(10)|\phi'\rangle\longmapsto e^{i\phi'}|\phi'\rangle. \tag*{(10)}

Thus, each input component acquires its corresponding phase, and the desired output amplitude becomes

r′αeiϕ′=z′α.(11)\frac{r'}{\alpha}e^{i\phi'}=\frac{z'}{\alpha}. \tag*{(11)}

The stored argument remains unchanged.

We synthesize each of the O(n)O(n) phase gates to error O(2−n/n)O(2^{-n}/n). This gives a total synthesis error of O(2−n)O(2^{-n}) using O(n2)O(n^2) TT gates [14]. Combining this with Theorem II.1, the total error in the desired amplitude is O(2−(n−ℓ)/α+2−n)O(2^{-(n-\ell)}/\alpha+2^{-n}).

Uncomputing the Arithmetic Registers

The stored arithmetic values are preserved during amplitude and phase encoding. We first reverse the gain correction, then the CORDIC iterations in reverse order. Each inverse iteration restores yjy_j, whose sign bit clears its direction qubit. Finally, we undo the quadrant correction and use the unchanged inputs to clear the initial coordinate copies.

With ideal phase gates, the final transformation is

∣x⟩∣y⟩∣0⟩∣0⟩a⟼∣x⟩∣y⟩(z′α∣0⟩+∣⊥⟩)∣0⟩a,(12)|x\rangle|y\rangle|0\rangle|0\rangle_a \longmapsto|x\rangle|y\rangle\left(\frac{z'}{\alpha}|0\rangle+|\perp\rangle\right)|0\rangle_a , \tag*{(12)}

where ∣⊥⟩|\perp\rangle is the component perpendicular to ∣0⟩|0\rangle in the output register.

Resource Costs

With the precision and implementation in Sec. II E, computing the magnitude and argument of zz requires O(n2)O(n^2) Toffoli gates and O(n)O(n) ancillary qubits. The AMP procedure adds O(n)O(n) Toffoli gates and output qubits. Uncomputing the arithmetic changes its cost only by a constant factor.

The arithmetic and magnitude encoding therefore require O(n2)O(n^2) Toffoli gates. Phase encoding requires an additional O(n2)O(n^2) TT gates, and so the total procedure uses O(n2)O(n^2) TT gates. The total number of additional qubits, including the output, is O(n)O(n).

Conclusion

We have presented a state preparation procedure that takes the real and imaginary parts of a complex number stored in binary registers and encodes an approximation of that number into an amplitude. We use CORDIC to compute the magnitude and argument together through shifts and additions, then encode the magnitude using AMP and introduce the argument using phase gates. The procedure acts coherently on superpositions of inputs. The original inputs are preserved, and the arithmetic is reversed after encoding to clear its temporary registers.

This state preparation procedure may be useful within a larger algorithm when a bound on the magnitude allows a smaller normalization than separately encoding and combining the real and imaginary parts. The resulting increase in success probability can reduce the number of calls needed during amplitude amplification. When these calls repeat expensive input computations, the savings can outweigh the additional CORDIC arithmetic. Comparing these costs in specific applications is a natural next step.

Acknowledgements

The author gives thanks to Anton Borissov and Vlad Gheorghiu for the many insightful discussions and feedback regarding this manuscript. This work was supported in part by the National Research Council of Canada (NRC).

AI Disclosure

This manuscript was initially drafted in March 2026 with limited assistance from OpenAI’s ChatGPT for text editing. ChatGPT was used more extensively during revisions in October 2026 to assist with redrafting and editing the text and checking and formalizing mathematical arguments. The author takes responsibility for the final content and correctness of the manuscript.

References

In-Place Multiplication by 1+2−2j1+2^{-2j}

We implement

∣x⟩∣0⟩⟼∣x′⟩∣0⟩,x′≈x(1+2−2j),\lvert x\rangle\lvert0\rangle\longmapsto\lvert x'\rangle\lvert0\rangle,\qquad x' \approx x(1+2^{-2j}),

where x′x' is the product rounded toward minus infinity at the chosen fixed-point precision. We keep the same number of fractional bits and allocate enough integer bits to avoid overflow. All temporary registers return to ∣0⟩\lvert0\rangle. We first consider j>0j>0.

Computing the Product

The multiplication is addition with a shifted operand:

x(1+2−2j)=x+2−2jx.x(1+2^{-2j})=x+2^{-2j}x.

We prepare a copy of xx and an arithmetic right-shifted copy using CNOT gates, then add the shifted copy into the first copy with a reversible ripple-carry adder [10] (we choose an input size such that there is no overflow). The shift rounds down at the chosen binary point. Since the original input is unchanged, we reverse the CNOT gates to clear the shifted copy. The adder clears its carries. We then swap the input and product registers, leaving

∣x′⟩∣x⟩.\lvert x'\rangle\lvert x\rangle.

It remains to clear the old input.

Recovering and Clearing the Input

After the swap, we have the rounded product and the old input. To clear the old input, we first reconstruct it from the product alone. We then XOR the reconstructed bits into the old input and reverse the reconstruction circuit to clear its workspace.

The key point is that this particular rounded multiplication still determines the input exactly. Let uu and vv be the signed integers represented by the input and product bits, with the same binary point, and write M=22jM = 2^{2j}. The shifted addition gives

v=u+⌊uM⌋v = u + \left\lfloor\frac{u}{M} \right\rfloor

To undo it, write u=Mq+ru = Mq + r, where 0≤r<M0 \le r < M. The forward operation adds qq, giving

v=(M+1)q+r.v = (M + 1)q + r.

Dividing vv by M+1M + 1 therefore recovers the same quotient qq. Subtracting it recovers the input:

u=v−⌊vM+1⌋.u = v - \left\lfloor\frac{v}{M + 1} \right\rfloor.

This identity also holds for negative inputs, using rounding toward minus infinity.

We proceed with the recovery of uu using long division with blocks of 2j2j bits at a time following the long division process from left to right. Each remainder uses 2j+12j + 1 bits, since division by M+1M + 1 can produce remainders in the range 0≤R≤M0 \le R \le M. For a nonnegative dividend, suppose the current remainder is RR and the next block has value aa. Bringing down that block gives MR+aMR + a since the remainder has weight MM relative to the immediately less significant block.

Since

MR+a=(M+1)R+(a−R),MR + a = (M + 1)R + (a - R),

we can take RR as the next quotient block and a−Ra - R as the new remainder. If a<Ra < R then the new remainder is negative. In this case, we take R−1R - 1 as the quotient block and add M+1M + 1 to the new remainder, giving

MR+a=(M+1)(R−1)+(a−R+M+1).MR + a = (M + 1)(R - 1) + (a - R + M + 1).

Since 0≤R≤M0 \le R \le M and 0≤a<M0 \le a < M, the quotient block always fits in 2j2j bits. If a≥Ra \ge R, the quotient block is R≤a<MR \le a < M. If a<Ra < R, it is R−1R - 1, which lies between 00 and M−1M - 1. Thus, successive quotient blocks do not overlap.

The construction starts with R=0R = 0. For each input block aa, we first compare aa with RR and store the result in bit bb, where b=1b = 1 if a<Ra < R and b=0b = 0 otherwise. We then compute the quotient block R−bR - b and the new remainder a−R+b(M+1)a - R + b(M + 1), which can be computed using a controlled-add, in fresh registers. Thus, bb controls whether we subtract one from the quotient block and add M+1M + 1 to the remainder.

We use the new remainder to process the next input block, while keeping the previous remainder, the comparison bit bb, and all working ancillas. This allows us to reverse the entire division after clearing the old input.

For v<0v < 0, we first use ∣v∣\lvert v\rvert as the dividend. If the remainder is zero, negating the quotient gives the required result. Otherwise, we also subtract one to round toward minus infinity.

We subtract the quotient from a copy of vv to obtain ∣u⟩\lvert u\rangle in the workspace. We then apply CNOT gates from the recovered bits to the old-input register, clearing it to ∣0⟩\lvert0\rangle. We reverse the subtraction, leaving the copy of vv in the workspace. We clear this copy using CNOT gates from the unchanged product, then reverse the division to clear the quotient and all intermediate workspace. This reversal works because recovery used only the product, which is unchanged; it never used the old-input register that we have just cleared.

Resource Costs

For 2j<n2j < n, our division procedure uses ⌈n2j⌉\lceil\frac{n}{2j}\rceil blocks, each requiring O(j)O(j) Toffoli gates and ancillas. For 2j≥n2j \ge n, the quotient is 00 for v≥0v \ge0 and −1-1 otherwise. Including the addition and uncomputation, we use O(n)O(n) Toffoli gates and O(n)O(n) clean ancillas for this procedure. All temporary registers return to ∣0⟩\lvert0\rangle.

For j=0j = 0, multiplication is exactly doubling. With one additional integer bit, we implement it using only CNOT and SWAP gates and clear the old input using the shifted output.

References

  1. [1]J. M. Martyn, Z. M. Rossi, A. K. Tan, and I. L. Chuang, Grand unification of quantum algorithms, PRX Quantum 2, 10.1103/prxquantum.2.040203 (2021).DOI
  2. [2]J. Lee, D. W. Berry, C. Gidney, W. H. Huggins, J. R. McClean, N. Wiebe, and R. Babbush, Even more efficient quantum computations of chemistry through tensor hypercontraction, PRX Quantum 2, 10.1103/prxquantum.2.030305 (2021).DOI
  3. [3]R. Babbush, C. Gidney, D. W. Berry, N. Wiebe, J. McClean, A. Paler, A. Fowler, and H. Neven, Encoding electronic spectra in quantum circuits with linear t complexity, Physical Review X 8, 10.1103/physrevx.8.081015 (2018).DOI
  4. [4]S. P. Jordan, K. S. M. Lee, and J. Preskill, Quantum algorithms for quantum field theories, Science 336, 1130–1133 (2012).DOI
  5. [5]Y. Cao, J. Romero, J. P. Olson, M. Degroote, P. D. Johnson, M. Kieferová, I. D. Kivlichan, T. Menke, B. Peropadre, N. P. D. Sawaya, S. Sim, L. Veis, and A. Aspuru-Guzik, Quantum chemistry in the age of quantum computing, Chemical Reviews 119, 10856–10915 (2019).DOI
  6. [6]J. E. Volder, The cordic trigonometric computing technique, IRE Transactions on Electronic Computers EC-8, 330 (1959).DOI
  7. [7]I. Burge, M. Barbeau, and J. Garcia-Alfaro, Quantum cordic – arcsine on a budget (2026), arXiv:2411.14434 [quant-ph].arxiv.org/abs/2411.14434
  8. [8]M. Pocrnic, I. Loaiza, J. M. Arrazola, N. Wiebe, and D. Motlagh, Efficient simulation of pre-born-oppenheimer dynamics on a quantum computer (2026), arXiv:2602.11272 [quant-ph].arxiv.org/abs/2602.11272
  9. [9]Y. Tong, D. An, N. Wiebe, and L. Lin, Fast inversion, preconditioned quantum linear system solvers, fast green’s-function computation, and fast evaluation of matrix functions, Physical Review A 104, 10.1103/physreva.104.032422 (2021).DOI
  10. [10]S. A. Cuccaro, T. G. Draper, S. A. Kutin, and D. P. Moulton, A new quantum ripple-carry addition circuit (2004), arXiv:quant-ph/0410184 [quant-ph].DOI
  11. [11]D. Lintsinki, Quantum schoolbook multiplication with fewer toffoli gates (2024), arXiv:2410.00899 [quant-ph].
  12. [12]F. Sun and A. Borissov, A polylogarithmic-depth quantum multiplier (2026), arXiv:2604.09847 [quant-ph].arxiv.org/abs/2604.09847
  13. [13]Y.-M. Kim, Error analysis of cordic processor with fpga implementation (2023), arXiv:2308.01025 [eess.SY].arxiv.org/abs/2308.01025
  14. [14]V. Kliuchnikov, D. Maslov, and M. Mosca, Asymptotically Optimal Approximation of Single Qubit Unitaries by Clifford and T Circuits Using a Constant Number of Ancillary Qubits, Phys. Rev. Lett. 110, 190502 (2013), arXiv:1212.0822 [quant-ph].DOI

AI tools statement

This work lists 1 AI tool.

  • ChatGPT · AI tool

    Roles
    Formal AnalysisWriting — original draftWriting — review & editing
    Verification
    self-declared at submission

Recorded on the work at submission, not per version. Names and roles are shown as submitted; roles use the CRediT taxonomy.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

No code, data or supplementary files were declared for this version.

Pick where to look, or just type