City University of New York (CUNY) CUNY Acdemic Works Comuter Science Technicl Reorts Grdute Center 24 TR-24: Otiml Reversile Quntum Circuit for Multiliction Anh Quoc Nguyen Follow this nd dditionl works t: htt://cdemicworks.cuny.edu/gc_cs_tr Prt of the Comuter Sciences Commons Recommended Cittion Nguyen, Anh Quoc, "TR-24: Otiml Reversile Quntum Circuit for Multiliction" (24). CUNY Acdemic Works. htt://cdemicworks.cuny.edu/gc_cs_tr/246 This Technicl Reort is rought to you y CUNY Acdemic Works. It hs een cceted for inclusion in Comuter Science Technicl Reorts y n uthorized dministrtor of CUNY Acdemic Works. For more informtion, lese contct AcdemicWorks@gc.cuny.edu.
Otiml Reversile Quntum Circuit for Multiliction Anh Quoc Nguyen (communicted y Michel Anshel) Quntum Comuttion cn solve mny rolems tht re intrctle with clssicl comuters. Develoment of quntum lgorithms requires quntum circuits for elementry rithmetic. Reversile requirement mkes quntum circuit design more difficult thn clssicl circuit design. The numer of quits must e ket miniml. In this er we resent n otiml, in term of quit usge, reversile quntum circuit for multiliction. Since Shor develoed n lgorithm for fctoring tht runs in olynomil time using quntum comuter [9] nd Grover develoed lgorithm for serching unsorted dtse tht hs qudrtic imrovement over otiml clssicl lgorithm [] scientists hve egun intensive develoment of quntum circuits (.k.. quntum networks) for elementry rithmetic oertions. V. Vedrl, A. Brenco, nd A. Ekert develoed quntum circuits for ddition, modulr ddition, controlled modulr multiliction nd modulr exonentition tht re sufficient to imlement Shor s lgorithm, [2]. Mny other uthors tried to imrove those circuits, either y reducing execution time or the numer of required quits. The Shor s fctoring lgorithm ws exerimentlly relized y L.Vndersyen, M. Steffen, G. Breyt, C. Ynnoni, M. Sherwood, I.L. Chung,[7] nd [8]. In [8] uthors exressed the imortnce of effective quntum circuits with miniml numer of ctul gtes nd quits. With current exerimentl fcility the numer of quits re more crucil. In this er we re roosing universl quntum circuit for multiliction tht is otiml in term of quit usge.
. A Multiliction Circuit The circuit for multiliction of two n-its numers, nd, cn e constructed from controlled ddition circuits. We use the sic ddition circuit, or lin dder, from the rticle [2]. Figure descries the circuit. SUM SUM SUM SUM SUM SUM c= c= c= c= c2= c3= cn-= cn= c2= 2 2 c3= cn-= + ) c) + n- n- cn= n n n+= ADDER n n n ) n d) Figure. Plin dder s descried in rticle [2] 2
The registers for vlues nd cn e clled source nd result registers, resectively. Note tht the crry from ddition is treted s highest it of result register. The it must e zero efore the ddition. Figure d is the lock reresenttion of figure for using in more comlicted circuits. By dding control quit to every CNOT or TOFFOLI gte we hve controlled ddition circuit. If we denote the inry form of c s c c c n- then the roduct c*d cn e reresented s: c*d = c (2 *d) + c *(2 *d) + + c n- *(2 n- *d) In clssicl circuit design ech term c j *(2 j *d) is clled rtil roduct, nd the roduct is set to t eginning. At j th ste rtil roduct c j *(2 j *d) is dded to the roduct. Figure 2 descries quntum reliztion of the clssicl design. This circuit uses 4n quits to store imortnt informtion nd they re ssigned s the following: quits q to q n- re used for the multilicnd c, quits q n to q 2n- re used for the multilier d, quits q 2n to q 4n- re used for the roduct. Inside the circuit quits q to q n- re used s control its for ll dders nd quits q n to q 2n- re connected to their source register. Result registers from those dders re connected to different ortions of the roduct register. All dders shre n- working quits for temorry crries, which re not shown in figure 2, ecuse they don t ly imortnt role. Th e use c j it of t j th stge ensures tht rtil roduct is dded to the roduct only if c j is. Only connection scheme will e used for our finl design. As we mentioned erlier the crry for every dder is treted s highest it of the result register, therefore in figure 2 we suly n+ quits to result register. In this design we use no extr quits in the multilying rt to comute the roduct. All n- working quits come form lin dders, or ddition rt. 3
q c q - + d - CTRL_ADDER CTRL_ADDER CTRL_ADDER c d q q - + - + +2 q4n-3 q4n- + - + q3n-2 q3n- + - + +2 q3n- q3n + - q3n- q3n-2 q4n-3 + +2 c*d q4n-3 q4n- Figure 2. Quntum circuit for multiliction using controlled lin dders. Quits q n to q 2n- ly role of rtil roduct in every stge. 4
2. Addition circuit using Quntum Fourier Trnsform For reference urose we descrie Quntum Fourier Trnsform (QFT) circuit in figure 3, which relizes the design y Coersmith []. The sw circuit, figure 3, which cn e imlemented with three CNOT gtes, sws sttes of two quits. The controlled rotte gte, figure 3c, is controlled version of one of the sic quntum gte. 2 n- n ϕ H H n-2 ϕ n- H 2 ϕ n n ) H ϕ sw ) c) k e 2π k i / 2 Figure 3. Circuit for Quntum Fourier Trnsform. It s esy to see tht the lin dder circuit tht is descried in figure is not otiml in term of quit usge, ecuse it uses n- extr quits for temorry crries. In rticle [] T. Drer develoed circuit for ddition tht utilizes roerty of Quntum Fourier Trnsform (QFT) to void using extr quits for temorry crries. The originl design is reresented in figure 4. 5
n n ϕ ( ) n n + ϕ ( ) 2 n- n n-2 n- n 2 + ϕ ( + ) ϕ ( + ) 2 Figure 4. Originl Drer circuit for ddition in QFT stte. In this design the uthor uses nottion s stte of n th quit fter QFT It is interesting to notice tht in this design uthor denotes the stte of first quit in n-quit register fter QFT y n, nd the stte of n th quit in n-quit register fter QFT y ; this cretes some confusion in lying the circuit in rticulr design. We reorgnize gtes so tht we cn use the nottion s stte for first quit fter QFT. Figure 5 reresents modified version. We cll this circuit Fourier Addition (FA). As in the cse of lin dder we cll two registers in FA circuit y source nd result. 6
n n n n 2 n-2 n- 2 n- n ϕ ( + ) Figure 5. Modified circuit for ddition in QFT stte, or Fourier Addition (FA) The FA circuit hs two n-quit registers, first register contins vlue, second register contins QFT of vlue, nd tht register contins QFT of the vlue + fter clcultion. To mke the rel use of FA circuit we need QFT circuit to rovide inut to second register, nd n inverse QFT circuit, or QFT -, to trnsform the content of second register ck to sis stte for mesuring. The FA circuit hs very interesting feture: its gtes re comletely indeendent, nd they cn er in ny order. The FA circuit is reversile, we cn un-comute the result register to get ck vlue. The inverse circuit, or sutrction, is not reversing gtes order in ddition circuit, since it will roduce sme result, i.e. ddition. Rther, the inverse circuit uses controlled rottion gtes with oosite, or negtive, hse. 7
3. Quntum circuit for multiliction using ddition in QFT stte Since FA circuit requires exctly 2n quits for ddition of two n-quit numers, we cn use those dders to uilt quntum circuit for multiliction to void using extr quits. The originl FA circuit cn e modified to ecome controlled FA, y dding control it to every controlled rottion gte. But such controlled FA circuits re not redy to sustitute controlled lin dders in the multiliction circuit descried ove. The reson lies in the QFT rocess. The originl FA circuit for ddition of two n-quit numers uses QFT for n quits, QFT n, while the result from multiliction of two n-quit numers hs 2n quits. If we wnt to use the FA circuits for dding rtil roducts to the totl roduct in multiliction circuit we should rovide QFT 2n of to roduct register nd we exect its finl stte to e QFT 2n of the vlue c*d. Regulr controlled FA circuit tht oertes with QFT 2n sttes would require control quit long with two registers of size 2n quits nd it dds two 2n-quit numers. In multiliction circuit we just wnt to dd n-quit rtil roduct to rorite ortion of 2n-quits register; therefore we hve to uild such circuit sed uon FA logic. Recll tht in multiliction circuit descried in figure 2 the rtil roduct in ech stge is the multilicnd tht is shifted to rorite ortion of totl roduct register. Using tht logic we uild FA circuits for using in multiliction from regulr controlled FA circuits for 2n-quit oernds y removing ll gtes tht connect to zero quits outside the multilicnd for ech stge. For exmle in first stge, stge th, rtil roduct corresonds to quits q to q n- of roduct register therefore we remove ll gtes tht connect to quit q n, q n+,.., q 2n- in source register for regulr controlled FA to get ddition rt for tht stge. We reet this rocess for every stge. One of such circuit, circuit for dding rtil roduct to the roduct t second stge, FOURIER_ADDER_, is descried in figure 6. The numer of ctul quits in the roduct register tht re used vries t ech stge. 8
ctrl ctrl n n ϕ ( ) 2 2n 2 + n- 2n-3 2n-2 ϕ ( + ) ϕ ( + ) n 2n-2 2n- Figure 6. FA circuit for second stge in multiliction circuit. Vlue is current content of roduct register, is rtil roduct t this stge The comlete circuit for multiliction is resented in figure 7. In the figure FOURIER_ADDER_j is the rtil roduct ddition circuit for j th stge. Quits q n to q 2n- ly role of rtil roduct in every stge s in the multiliction circuit with lin dders. The outut of the circuit is QFT 2n of the roduct cd. It is imortnt to notice tht lthough the circuit in figure 5 for ddition in QFT stte doesn t hve storge for crry, i.e. its result register fter inverse QFT my contin vlue tht is smller thn one of the inut numers, tht doesn t ffect our design, ecuse in the multiliction circuit dditions of rtil roducts to the roduct register never roduce crry from the highest it. It s esy to see tht the circuit is universl, with the mening tht it cn comute roduct of ny two n-it numers. The circuit is reversile nd we cn uncomute the result to get ck zero its in roduct register. Like FA circuit, the inverse circuit for multiliction is not simle reversing of gtes in forwrd circuit. The inverse circuit for multiliction uses inverse FA circuits to rchive the result. 9
FOURIER_ADDER_n- FOURIER_ADDER_ FOURIER_ADDER_ c d q q - + - + +2 q4n-3 q4n- + - + q4n- + - + q4n-3 + - + q3n- q3n q q - + - + +2 q4n-3 q4n- c d c*d Figure 7. Quntum circuit for multiliction using controlled Fourier Adders.
4. Anlysis According to rules for quntum circuit design tht re descried in [3] nd other rticles the circuits must e reversile nd hve no loo. From tht oint of view the multiliction circuit for comuting the roduct of two numers, ech of them hs n-quit register, requires t lest 4n quits, ecuse we hve to reserve oth inut vlues nd store the roduct in serte register. In generl roduct of two n-it numers will occuy 2n its, therefore ny reversile circuit for multiliction requires 4n quits. Our circuit uses exctly tht mount of quits nd therefore is otiml in term of quit usge. It is worth to notice tht FA circuit requires high oertionl ccurcy, ecuse it uses rottions with smll hses; therefore it is more error rone. All circuits with regulr dders hve higher oertionl ccurcy, since regulr dder uses only CNOT nd TOFFOLI gtes, which hve much smller error rte. The most comlex gtes in our design re 3-quit controlled-controlled rottion gtes s shown in figure 6. As [6] nd other rticles rove tht two-quit gtes re universl, the gte cn e relized s comintion of two-quits gtes. The use of 3-quit gtes in this er llows us to focus on the design of the circuit nd mkes digrms esier to understnd. As we mentioned erlier ll gtes in FA circuit re indeendent, they cn e regroued to llow rllel execution, s the uthor of [] oints out. Our design reserves this feture. We hoe this design will encourge scientist to use multiliction in their design. Acknowledgement Author deely recites the guidnce nd the suort from rofessor Michel Anshel.
Literture:. T.G. Drer. Addition on Quntum Comuter. Online Archive qunth/8333. 2. V. Vedrl, A. Brenco, A. Ekert. Quntum Networks for Elementry Arithmetic Oertions. Phys Rev A, 995 3. M.A. Nielson nd I.L. Chung. Quntum Comuttion nd Quntum Informtion, Cmridge Univ. Press, 2. 4. Dvid P. DiVincenzo. The Physicl Imlementtion of Quntum Comuttion. Fortschritte der Physik, 48(9-), 2,.77-783 5. Adrino Brenco, Chrles H. Bennett, Richrd Cleve, Dvid P. DiVincenzo, Normn Mrgolus, Peter Shor, Tycho Sletor, John Smolin, Hrld Weinfurter. Elementry gtes for quntum comuttion. Phys. Review A, Mrch 995 6. Dvid P. DiVincenzo. Two-it gtes re universl for quntum comuttion. Phys. Rev. A, 994 7. Lieven M.K. Vndersyen, Mithis Steffen, Gregory Breyt, Costntino S. Ynnoni, Mrk H. Sherwood, Isc L. Chung. Exerimentl reliztion of Shor s quntum fctoring lgorithm using nucler mgnetic resonnce. Nture, Vol. 44, Dec. 2,. 883-887 8. Lieven M.K. Vndersyen. Exerimentl Quntum Comuttion with Nucler Sins in liquid solution. Ph.D disserttion, Det. of Elec. Eng., Stnford University, Stnford, Cliforni, USA, July 2 9. Peter Shor. Algorithm for Quntum Comuttion: Discrete Logrithm nd Fctoring. Proceedings, 35 th Annul Symosium on Foundtion of Comuter Science,. 24-34.. L. K. Grover, in Proceedings of the 28th Annul Symosium on the Theory of Comuting (ACM Press, New York, 996),. 22 29.. D. Coersmith. An roximte Fourier trnsform useful in quntum fctoring", IBM Reserch Reort No. RC9642, 994. 2