Quantum Algorithms for Matrix Products over Semirings

Similar documents
Variance and Covariance Processes

Extremal problems for t-partite and t-colorable hypergraphs

On Control Problem Described by Infinite System of First-Order Differential Equations

7 Wave Equation in Higher Dimensions

Combinatorial Approach to M/M/1 Queues. Using Hypergeometric Functions

MEEN 617 Handout #11 MODAL ANALYSIS OF MDOF Systems with VISCOUS DAMPING

Representing Knowledge. CS 188: Artificial Intelligence Fall Properties of BNs. Independence? Reachability (the Bayes Ball) Example

Computer Propagation Analysis Tools

Lecture-V Stochastic Processes and the Basic Term-Structure Equation 1 Stochastic Processes Any variable whose value changes over time in an uncertain

CS 188: Artificial Intelligence Fall Probabilistic Models

The sudden release of a large amount of energy E into a background fluid of density

arxiv: v1 [math.co] 4 Apr 2019

Low-complexity Algorithms for MIMO Multiplexing Systems

Sections 3.1 and 3.4 Exponential Functions (Growth and Decay)

Deviation probability bounds for fractional martingales and related remarks

STUDY OF THE STRESS-STRENGTH RELIABILITY AMONG THE PARAMETERS OF GENERALIZED INVERSE WEIBULL DISTRIBUTION

[ ] 0. = (2) = a q dimensional vector of observable instrumental variables that are in the information set m constituents of u

156 There are 9 books stacked on a shelf. The thickness of each book is either 1 inch or 2

General Non-Arbitrage Model. I. Partial Differential Equation for Pricing A. Traded Underlying Security

Notes for Lecture 17-18

The shortest path between two truths in the real domain passes through the complex domain. J. Hadamard

Secure Frameproof Codes Through Biclique Covers

Reinforcement learning

On The Estimation of Two Missing Values in Randomized Complete Block Designs

Reichenbach and f-generated implications in fuzzy database relations

Lecture 22 Electromagnetic Waves

Research Article A Note on Multiplication and Composition Operators in Lorentz Spaces

, on the power of the transmitter P t fed to it, and on the distance R between the antenna and the observation point as. r r t

Lecture 18: Kinetics of Phase Growth in a Two-component System: general kinetics analysis based on the dilute-solution approximation

Probabilistic Models. CS 188: Artificial Intelligence Fall Independence. Example: Independence. Example: Independence? Conditional Independence

336 ERIDANI kfk Lp = sup jf(y) ; f () jj j p p whee he supemum is aken ove all open balls = (a ) inr n, jj is he Lebesgue measue of in R n, () =(), f

Dual Hierarchies of a Multi-Component Camassa Holm System

On the local convexity of the implied volatility curve in uncorrelated stochastic volatility models

Online Ranking by Projecting

AN EVOLUTIONARY APPROACH FOR SOLVING DIFFERENTIAL EQUATIONS

ENGI 4430 Advanced Calculus for Engineering Faculty of Engineering and Applied Science Problem Set 9 Solutions [Theorems of Gauss and Stokes]

Monochromatic Wave over One and Two Bars

Lecture 17: Kinetics of Phase Growth in a Two-component System:

KINEMATICS OF RIGID BODIES

An Automatic Door Sensor Using Image Processing

Lecture 20: Riccati Equations and Least Squares Feedback Control

Orthotropic Materials

Distribution Free Evolvability of Polynomial Functions over all Convex Loss Functions

Fig. 1S. The antenna construction: (a) main geometrical parameters, (b) the wire support pillar and (c) the console link between wire and coaxial

Today - Lecture 13. Today s lecture continue with rotations, torque, Note that chapters 11, 12, 13 all involve rotations

An Open cycle and Closed cycle Gas Turbine Engines. Methods to improve the performance of simple gas turbine plants

Online Completion of Ill-conditioned Low-Rank Matrices


Vehicle Arrival Models : Headway

Chapter 2. First Order Scalar Equations

INTRODUCTION TO MACHINE LEARNING 3RD EDITION

Fuzzy Hv-submodules in Γ-Hv-modules Arvind Kumar Sinha 1, Manoj Kumar Dewangan 2 Department of Mathematics NIT Raipur, Chhattisgarh, India

Research on the Algorithm of Evaluating and Analyzing Stationary Operational Availability Based on Mission Requirement

GRADIENT ESTIMATES, POINCARÉ INEQUALITIES, DE GIORGI PROPERTY AND THEIR CONSEQUENCES

Chapter 7. Interference

On the Semi-Discrete Davey-Stewartson System with Self-Consistent Sources

Risk tolerance and optimal portfolio choice

Chapter 7: Solving Trig Equations

New and Faster Filters for. Multiple Approximate String Matching. University of Chile. Blanco Encalada Santiago - Chile

t is a basis for the solution space to this system, then the matrix having these solutions as columns, t x 1 t, x 2 t,... x n t x 2 t...

( ) exp i ω b ( ) [ III-1 ] exp( i ω ab. exp( i ω ba

@FMI c Kyung Moon Sa Co.

11!Hí MATHEMATICS : ERDŐS AND ULAM PROC. N. A. S. of decomposiion, properly speaking) conradics he possibiliy of defining a counably addiive real-valu

MATHEMATICAL FOUNDATIONS FOR APPROXIMATING PARTICLE BEHAVIOUR AT RADIUS OF THE PLANCK LENGTH

Linear Response Theory: The connection between QFT and experiments

The k-filtering Applied to Wave Electric and Magnetic Field Measurements from Cluster

Christos Papadimitriou & Luca Trevisan November 22, 2016

arxiv: v1 [math.ca] 25 Sep 2013

Physics 235 Chapter 2. Chapter 2 Newtonian Mechanics Single Particle

Instructor: Barry McQuarrie Page 1 of 5

Unsupervised Segmentation of Moving MPEG Blocks Based on Classification of Temporal Information

Exponential and Logarithmic Equations and Properties of Logarithms. Properties. Properties. log. Exponential. Logarithmic.

ON 3-DIMENSIONAL CONTACT METRIC MANIFOLDS

5.1 - Logarithms and Their Properties

arxiv: v1 [math.ca] 15 Jan 2019

envionmen ha implemens all of he common algoihmic deails of all nodal mehods u pemis he specic mehod o e used in any concee insance o e specied y he u

Probablistically Checkable Proofs

EN221 - Fall HW # 7 Solutions

Lecture 2-1 Kinematics in One Dimension Displacement, Velocity and Acceleration Everything in the world is moving. Nothing stays still.

Dynamic Estimation of OD Matrices for Freeways and Arterials

PHYS PRACTICE EXAM 2

EXERCISES FOR SECTION 1.5

Bernoulli numbers. Francesco Chiatti, Matteo Pintonello. December 5, 2016

ÖRNEK 1: THE LINEAR IMPULSE-MOMENTUM RELATION Calculate the linear momentum of a particle of mass m=10 kg which has a. kg m s

Approximation Algorithms for Unique Games via Orthogonal Separators

Learning a Class from Examples. Training set X. Class C 1. Class C of a family car. Output: Input representation: x 1 : price, x 2 : engine power

Order statistics and concentration of l r norms for log-concave vectors

Logic in computer science

IMPROVING ON MINIMUM RISK EQUIVARIANT AND LINEAR MINIMAX ESTIMATORS OF BOUNDED MULTIVARIATE LOCATION PARAMETERS

Longest Common Prefixes

New sufficient conditions of robust recovery for low-rank matrices

Unitary Matrices in Fiber Optical Communications: Applications

Learning a Class from Examples. Training set X. Class C 1. Class C of a family car. Output: Input representation: x 1 : price, x 2 : engine power

4.1 - Logarithms and Their Properties

Finish reading Chapter 2 of Spivak, rereading earlier sections as necessary. handout and fill in some missing details!

A Weighted Moving Average Process for Forecasting. Shou Hsing Shih Chris P. Tsokos

Lecture 23: I. Data Dependence II. Dependence Testing: Formulation III. Dependence Testers IV. Loop Parallelization V.

23.2. Representing Periodic Functions by Fourier Series. Introduction. Prerequisites. Learning Outcomes

The Arcsine Distribution

2.7. Some common engineering functions. Introduction. Prerequisites. Learning Outcomes

Transcription:

CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 hp://cjcscsuchicagoedu/ Quanum Algoihms fo Maix Poducs ove Semiings Fançois Le Gall Haumichi Nishimua Received July 24, 2015; Revised May 15, 2016; Published May 11, 2017 Absac: In his pape we consuc quanum algoihms fo maix poducs ove seveal algebaic sucues called semiings, including he max,min-maix poduc, he disance maix poduc and he Boolean maix poduc In paicula, we obain he following esuls We consuc a quanum algoihm compuing he poduc of wo n n maices ove he max,min semiing wih ime complexiy On 2473 In compaison, he bes known classical algoihm fo he same poblem, by Duan and Peie SODA 09, has complexiy On 2687 We consuc a quanum algoihm compuing he l mos significan bis of each eny of he disance poduc of wo n n maices in ime O2 064l n 246 In compaison, he bes known classical algoihm fo he same poblem, by Vassilevska and Williams STOC 06 and Yuse SODA 09, has complexiy O2 l n 269 The above wo algoihms ae he fis quanum algoihms ha pefom bee han he Õn 5/2 -ime saighfowad quanum algoihm based on quanum seach fo maix muliplicaion ove hese semiings We also conside he Boolean semiing, and consuc a quanum algoihm compuing he poduc of wo n n Boolean maices ha oupefoms he bes known classical algoihms fo spase maices Key wods and phases: quanum algoihms, maix muliplicaion, semiings 1 Inoducion Backgound Maix muliplicaion ove semiings has a muliude of applicaions in compue science, and in paicula in he aea of gaph algoihms eg, [6, 19, 21, 22, 23, 25] One example is Boolean 2017 Fançois Le Gall and Haumichi Nishimua cb Licensed unde a Ceaive Commons Aibuion License CC-BY DOI: 104086/cjcs2017001

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA maix muliplicaion, elaed fo insance o he compuaion of he ansiive closue of a gaph, whee he poduc of wo n n Boolean maices A and B is defined as he n n Boolean maix C = A B such ha C[i, j] = 1 if and only if hee exiss a k {1,,n} such ha A[i,k] = B[k, j] = 1 Moe geneally, given a se R Z {, } and wo binay opeaions : R R R and : R R R, he sucue R,, is a semiing if i behaves like a ing excep ha hee is no equiemen on he exisence of an invese wih espec o he opeaion Given wo n n maices A and B ove R, he maix poduc ove R,, is he n n maix C defined as C[i, j] = n k=1 A[i,k] B[k, j] fo any i, j {1,,n} {1,,n} The Boolean maix poduc is simply he maix poduc ove he semiing {0,1},, The max,min-poduc and he disance poduc, which boh have applicaions o a muliude of asks in gaph heoy such as consucing fas algoihms fo all-pais pahs poblems see, eg, [21], ae he maix poducs ove he semiing Z {, },max,min and he semiing Z { }, min, +, especively Wheneve he opeaion is such ha a em as n k=1 x k can be compued in Õ n ime using quanum echniques eg, fo = using Gove s algoihm [9] o fo = min and = max using quanum algoihms fo minimum finding [8] and each opeaion can be implemened in polylogn ime, he poduc of wo n n maices ove he semiing R,, can be compued in ime Õn 5/2 on a quanum compue 1 This is ue fo insance fo he Boolean maix poduc, and fo boh he max,min and disance maix poducs A fundamenal quesion is whehe we can do bee han hose Õn 5/2 -ime saighfowad quanum algoihms Fo he Boolean maix poduc, he answe is affimaive since i can be compued classically in ime Õn ω, whee ω < 2373 is he exponen of squae maix muliplicaion ove a field Howeve, Boolean maix poduc appeas o be an excepion, and fo mos semiings i is no known if maix muliplicaion can be done in Õn ω -ime Fo insance, he bes known classical algoihm fo he max,min-poduc, by Duan and Peie [6], has ime complexiy Õn 3+ω/2 = On 2687 while, fo he disance poduc, no uly subcubic classical algoihm is even known wihou inoducing assumpions on he maices Ou esuls We consuc in his pape he fis quanum algoihms wih exponen sicly smalle han 5/2 fo maix muliplicaion ove seveal semiings We fis obain he following esul fo maix muliplicaion ove he max,min semiing Theoem 11 Thee exiss a quanum algoihm ha compues, wih high pobabiliy, he max,min- poduc of wo n n maices in ime On 2473 In compaison, he bes known classical algoihm fo he max,min-poduc, by Duan and Peie [6], has ime complexiy Õn 3+ω/2 = On 2687, as menioned above The max,min-poduc has mainly been sudied in he field in fuzzy logic [7] unde he name composiion of elaions and in he conex of compuing he all-pais boleneck pahs of a gaph ie, compuing, fo all pais s, of veices in a gaph, he maximum flow ha can be oued beween s and Moe pecisely, i is well known see, eg, [6, 19, 23] ha if he max,min-poduc of wo n n maices can be compued in ime T n, hen he all-pais boleneck pahs of a gaph wih n veices can be compued in ime ÕT n As an applicaion of Theoem 11, we hus obain a On 2473 -ime quanum algoihm compuing he all-pais boleneck 1 In his pape he noaion Õ suppesses he n o1 facos CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 2

QUANTUM ALGORITHMS FOR MATRIX PRODUCTS OVER SEMIRINGS pahs of a gaph of n veices, while classically he bes uppe bound fo his ask is On 2687, again fom [6] In ode o pove Theoem 11, we consuc a quanum algoihm ha compues he poduc of wo n n maices ove he exisence dominance semiing defined in he nex secion in ime Õn 5+ω/3 On 2458 The dominance poduc has applicaions in compuaional geomey [18] and gaph algoihms [22] and, in compaison, he bes known classical algoihm fo his poduc [25] has complexiy On 2684 Compuing efficienly he exisence dominance poduc is, neveheless, no enough fo ou pupose We inoduce in Secion 3 a new genealizaion of i ha we call he genealized exisence dominance poduc, and develop boh quanum and classical algoihms ha compue efficienly his poduc This is he mos echnical pa of his pape We also show in Secion 42 how hese esuls fo he genealized exisence dominance poduc can be used o consuc classical and quanum algoihms compuing he l mos significan bis of each eny of he disance poduc of wo n n maices In he quanum seing, we obain ime complexiy Õ 2 0640l n 5+ω/3 O2 0640l n 2458 In compaison, pio o he pesen wok, he bes known classical algoihm fo he same poblem by Vassilevska and Williams [22] had complexiy Õ 2 l n 3+ω/2 O2 l n 2687, wih a sligh impovemen on he exponen of n obained lae by Yuse [25] We obain an impovemen fo his classical ime complexiy as well, educing i o Õ 2 0960l n 3+ω/2, which gives a sublinea dependency on 2 l These esuls ae, o he bes of ou knowledge, he fis quanum algoihms fo maix muliplicaion ove semiings ohe han he Boolean semiing impoving ove he saighfowad Õn 5/2 -ime quanum algoihm, and he fis nonivial quanum algoihms offeing a speedup wih espec o he bes classical algoihms fo maix muliplicaion when no assumpions ae made on he spasiy of he maices involved spase maix muliplicaion is discussed below This shows ha, while quanum algoihms may no be able o oupefom he classical Õn ω -ime algoihm fo maix muliplicaion of dense maices ove a ing, hey can offe a speedup fo maix muliplicaion ove ohe algebaic sucues We finally invesigae unde which condiions quanum algoihms fase han he bes known classical algoihms can be consuced fo Boolean maix muliplicaion This quesion has been ecenly sudied exensively in he oupu-sensiive scenaio [3, 11, 13, 14], fo which quanum algoihms muliplying wo n n Boolean maices wih quey complexiy Õn λ and ime complexiy Õn λ + λ n wee consuced, whee λ denoes he numbe of non-zeo enies in he oupu maix In his wok, we focus on he case whee he inpu maices ae spase bu no necessaily he oupu maix, and evaluae he pefomance of quanum algoihms in his scenaio Ou esul Theoem 51 shows how seveal sandad combinaoial ideas fo spase Boolean maix muliplicaion can be adaped in he quanum seing, and used o consuc quanum algoihms fase han he bes known classical algoihms In paicula, we obain he following esul Theoem 12 simplified vesion he complee vesion appeas as Theoem 52 in Secion 5 Le A and B be wo n n Boolean maices each conaining a mos m non-zeo enies Thee exiss a quanum algoihm ha compues, wih high pobabiliy, he Boolean maix poduc A B and has ime complexiy Õn 2 if m n 1151, Õ m 0517 n 1406 if n 1151 m n ω 1/2, Õn ω if n ω 1/2 m n 2 CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 3

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA 2373 Yuse-Zwick This pape 23 22 21 20 1 1151 1686 1873 2 Figue 1: The uppe bounds of Theoem 12 in solid lines The hoizonal axis epesens he logaihm of m wih espec o basis n ie, he value log n m The veical axis epesens he logaihm of he complexiy wih espec o basis n The dashed lines epesen he uppe bounds obained by [26] The complexiy of he algoihm of Theoem 12 is he piece-linea funcion of log n m epesened in Figue 1 In compaison, he bes known classical algoihm, by Yuse and Zwick [26], has complexiy Õn 2 if m n 1151, Õm 0697 n 1199 if n 1151 m n 1+ω/2, and Õn ω if n 1+ω/2 m n 2 Ou algoihm pefoms bee when n 1151 < m < n ω 1/2 Fo insance, if m = On 1+ω/2 = On 1686, hen ou algoihm has complexiy On 2277, while he algoihm by [26] has complexiy Õn ω Ou main quanum ool is ahe sandad: quanum enumeaion, a vaian of Gove s seach algoihm We use his echnique in vaious ways o impove he combinaoial seps in seveal classical appoaches [1, 6, 23, 26] ha ae based on a combinaion of algebaic seps compuing some maix poducs ove a field and combinaoial seps Moeove, he speedup obained by quanum enumeaion enables us o depa fom hese oiginal appoaches and opimize he combinaoial and algebaic seps in diffeen ways, fo insance elying on ecangula maix muliplicaion insead of squae maix muliplicaion On he ohe hand, seveal suble bu cucial issues appea when ying o apply quanum enumeaion, such as how o soe and access infomaion compued duing he pepocessing seps, which induces complicaions and equies he inoducion of new algoihmic ideas We end up wih algoihms faily emoe fom hese oiginal appoaches, whee mos seps ae ailoed fo he use of quanum enumeaion Moe deailed echnical oveviews ae given a he beginning of Secions 3, 4 and 5 CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 4

2 Peliminaies QUANTUM ALGORITHMS FOR MATRIX PRODUCTS OVER SEMIRINGS Recangula maix muliplicaion ove fields Fo any k 1,k 2,k 3 > 0, le ωk 1,k 2,k 3 epesen he minimal value τ such ha, ove a field, he poduc of an n k 1 n k 2 maix by an n k 2 n k 3 maix can be compued wih Õn τ aihmeic opeaions The value ω1,1,1 is denoed by ω, and he cuen bes uppe bound on ω is ω < 2373, see [5, 15, 20, 24] Ohe impoan quaniies ae he value α = sup{k ω1,k,1 = 2} and he value β = ω 2/1 α The cuen bes lowe bound on α is α > 0302, see [12] The following facs ae known, and will be used in his pape We efe o [4, 10] fo deails Fac 21 ω1,k,1 = 2 fo k α and ω1,k,1 2 + βk α fo α k 1 Fac 22 The following elaions hold fo any values k 1,k 2,k 3 > 0: i ωkk 1,kk 2,kk 3 = kωk 1,k 2,k 3 fo any k > 0; ii ωk π1,k π2,k π3 = ωk 1,k 2,k 3 fo any pemuaion π ove {1,2,3}; iii ωk 1,k 2,1 + k 3 ωk 1,k 2,1 + k 3 ; iv ωk 1,k 2,k 3 max{k 1 + k 2,k 1 + k 3,k 2 + k 3 } Maix poducs ove semiings We define below wo maix poducs ove semiings consideed in Secions 3 and 4, especively, addiionally o he Boolean poduc, he max,min-poduc and he disance poduc defined in he inoducion These poducs wee also used in [6, 22, 23] Definiion 23 Le A be an n n maix wih enies in Z { } and B be an n n maix wih enies in Z { } The exisence dominance poduc of A and B, denoed A B, is he n n Boolean maix C such ha C[i, j] = 1 if and only if hee exiss some k {1,,n} such ha A[i,k] B[k, j] The poduc A B is he n n maix C such ha C[i, j] = if A[i,k] > B[k, j] fo all k {1,,n}, and C[i, j] = max k {A[i,k] A[i,k] B[k, j]} ohewise As menioned fo insance in [6, 23], compuing he max, min-poduc educes o compuing he poduc Indeed, if C denoes he max,min-poduc of wo maices A and B, hen fo any i, j {1,,n} {1,,n} we can wie C[i, j] = max { A B[i, j],b T A T [ j,i] }, whee A T and B T denoe he ansposes of A and B, especively Maix poducs ove he semiings min,max, min, and max, sudied, fo insance, in [21], similaly educe o compuing he poduc Quanum algoihms fo maix muliplicaion We assume ha a quanum algoihm can access any eny of he inpu maix in a andom access way, similaly o he sandad model used in [3, 11, 13, 14] fo Boolean maix muliplicaion Moe pecisely, le A and B be wo n n maices, fo any posiive inege n he model pesened below can be genealized o deal wih ecangula maices in a saighfowad way We suppose ha hese maices can be accessed diecly by a quanum algoihm: We have an oacle O A ha, fo any i, j {1,,n}, and any z {0,1}, maps he sae i j 0 z o i j A[i, j] z We have a simila oacle O B fo B Since we ae ineesed in ime complexiy, we will coun all he compuaional seps of he algoihm and assign a cos of one fo each call o O A o O B, which coesponds o he cases whee quanum access o he inpus A and B can be done a uni cos, fo example in a CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 5

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA andom access model woking in quanum supeposiion We say ha a quanum algoihm fo maix muliplicaion compues he poduc of A and B wih high pobabiliy if, when given access o oacles O A and O B coesponding o A and B, he algoihm oupus wih pobabiliy a leas 2/3 all he enies of he poduc of A and B The complexiy of seveal algoihms in his pape will be saed using an uppe bound λ on he numbe of non-zeo o non-infinie enies in he poduc of A and B The same complexiy, up o a logaihmic faco, can acually be obained even if no nonivial uppe bound is known a pioi, see [13, 14] We will use vaians of Gove s seach algoihm, as descibed fo insance in [2], o find elemens saisfying some condiions inside a seach space of size N Conceely, suppose ha a Boolean funcion f : {1,,N} {0,1} is given and ha we wan o find a soluion, ie, an elemen x {1,,n} such ha f x = 1 Conside he quanum seach pocedue called safe Gove seach in [17] obained by epeaing Gove s sandad seach a logaihmic numbe of imes, and checking if a soluion has been found This quanum pocedue oupus one soluion wih pobabiliy a leas 1 1/polyN if a soluion exiss, and always ejecs if no soluion exiss Is ime complexiy is Õ N/max1,, whee denoes he numbe of soluions, if he funcion f can be evaluaed in Õ1 ime By epeaing his pocedue and siking ou soluions as soon as hey ae found, one can find all he soluions wih pobabiliy a leas 1 1/polyN using Õ N/ + N/ 1 + + N/1 = Õ N + 1 compuaional seps We call his pocedue quanum enumeaion 3 Exisence Dominance Maix Muliplicaion In his secion we pesen a quanum algoihm ha compues he exisence dominance poduc of wo maices A and B The undelying idea of ou algoihm is simila o he idea in he bes classical algoihm fo he same poblem by Duan and Peie [6]: use a seach sep o find some of he enies of A B, and ely on classical algebaic algoihms o find he ohe enies We naually use quanum seach o implemen he fis pa, and pefom caeful modificaions of hei appoach o impove he complexiy in he quanum seing, aking advanage of he feaues of quanum enumeaion Thee ae wo noable diffeences: The fis one is ha he algebaic pa of ou quanum algoihms uses ecangula maix muliplicaion, while [6] uses squae maix muliplicaion The second and cucial diffeence is ha, fo applicaions in lae secions, we give a quanum algoihm ha can handle a new and moe geneal vesion of he exisence dominance poduc, defined on se of maices, which we call he genealized exisence dominance poduc and define below Definiion 31 Le u,v be wo posiive ineges, and S be he se S = {1,,u} {1,,v} Le be he lexicogaphic ode ove S {0,0} ie, i, j i, j if and only if i < i o i = i and j < j Conside u maices A 1,,A u, each of size n n wih enies in Z { }, and v maices B 1,,B v, each of size n n wih enies in Z { } Fo each i, j {1,,n} {1,,n} define he se S i j S {0,0} as follows: S i j = {x,y S A x B y [i, j] = 1} {0,0} The genealized exisence dominance poduc of hese maices is he n n maix C wih enies in S {0,0} defined as follows: fo all i, j {1,,n} {1,,n} he eny C[i, j] is he maximum elemen in S i j, whee he maximum efes o he lexicogaphic ode CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 6

QUANTUM ALGORITHMS FOR MATRIX PRODUCTS OVER SEMIRINGS Noe ha he case u = v = 1 coesponds o he sandad exisence dominance poduc, since C[i, j] = 1,1 if A 1 B 1 [i, j] = 1 and C[i, j] = 0,0 if A 1 B 1 [i, j] = 0 Poposiion 32 Le A 1,,A u be u maices of size n n wih enies in Z { }, and B 1,,B v be v maices of size n n wih enies in Z { } Le m 1 {1,,n 2 u} denoe he oal numbe of finie enies in he maices A 1,,A u, and m 2 {1,,n 2 v} denoe he oal numbe of finie enies in he maices B 1,,B v Fo any paamee {1,,m 1 }, hee exiss a quanum algoihm ha compues, wih high pobabiliy, hei genealized exisence dominance poduc in ime m1 m 2 n m1 m 2 uv Õ + + n ω1+log n u,1+log n,1+log n v n Poof Le L be he lis of all finie enies in A 1,,A u soed in inceasing ode if he finie enies of hese maices ae no disinc hen some elemens will appea moe han once in he lis Decompose L ino successive pas L 1,,L, each conaining a mos m 1 / enies Fo each x {1,,u} and each {1,,} we consuc wo n n maices A x,ā x as follows: fo all i, j {1,,n} {1,,n}, A x [i, j] = Ā x [i, j] = { A x [i, j] if A x [i, j] L, { 1 ohewise, if A x [i, j] L, 0 ohewise Similaly, fo each y {1,,v} and each {1,,} we consuc wo n n maices B y, B y as follows: fo all i, j {1,,n} {1,,n}, { B y B [i, j] = y [i, j] if minl B y [i, j] < maxl, ohewise, { B y 1 if B [i, j] = y [i, j] maxl, 0 ohewise The cos of his classical pepocessing sep is On 2 u + v ime I is easy o see ha, fo each x {1,,u} and y {1,,v}, he following equaliy holds whee he opeaos + and efe o he eny-wise OR: A x B y = =1 Āx B y + =1 A x B y 31 Indeed, he second em compaes enies ha ae in a same pa L, while he fis em akes ino consideaion enies in disinc pas Define wo n n maices C 1 and C 2 wih enies in S {0,0} as follows: fo all i, j {1,,n} {1,,n}, { } C 1 [i, j] =max C 2 [i, j] =max { {0,0} {x,y S {0,0} {x,y S =1 =1 Ā x B y [i, j] = 1} A x B y [i, j] = 1} }, 32 33 CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 7

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA Fom Equaion 31, he genealized exisence dominance poduc C saisfies C[i, j] = max{c 1 [i, j],c 2 [i, j]} fo all i, j {1,,n} {1,,n} The maix C can hen be compued in ime On 2 fom C 1 and C 2 The maix C 1 can clealy be compued in ime On 2 uv if all he ems Ā x B y ae known We can obain all hese uv ems by compuing he following Boolean poduc of an nu n maix by an n nv maix boh maices can be consuced in ime Õn 2 u + v Ā 1 1 Ā 1 Ā u 1 Ā u B 1 1 B v 1 B 1 B v The cos of his maix muliplicaion is Õ n ω1+log n u,1+log n,1+log v n Fom iem iv of Fac 22, we conclude ha he maix C 1 can be compued in ime Õ n 2 uv + n 2 u + v + n ω1+log n u,1+log n,1+log v n = Õ n ω1+log n u,1+log n,1+log v n We now explain how o compue he maix C 2 Inuiively, he main difficuly is ha Equaion 33 canno be used diecly since we do no know how o compue he dominance poduc efficienly Lemma 33 below shows ha i is possible o eplace his dominance poduc by a Boolean poduc if we eplace he maices A x and B y by some Boolean maices  x and ˆB y compae Equaion 33 wih Equaion 34 below This lemma fuhe shows ha he lae maices can be compued efficienly by a quanum algoihm based on quanum seach Acually, fo echnical easons we addiionally need o eplace he em {0,0} in Equaion 33 by he em {D[i, j]} in Equaion 34, whee D is a maix ha can also be compued efficienly using a quanum algoihm While his lemma is he main echnical pa of he poof of his poposiion, fo eadabiliy is poof is posponed unil Secion 6 Lemma 33 Thee exiss a quanum algoihm ha, wih high pobabiliy, oupus u Boolean maices  x, each of size n 2n, fo all x {1,,u} and {1,,}, v Boolean maices ˆB y, each of size 2n n, fo all y {1,,v} and {1,,}, a maix D of size n n wih enies in S {0,0} = {1,,u} {1,,v} {0,0}, such ha C 2 [i, j] = max { {D[i, j]} {x,y S =1  x ˆB y [i, j] = 1} fo all i, j {1,,n} {1,,n} The ime complexiy of his quanum algoihm is Õ n 2 m1 m 2 n u + v + + m1 m 2 uv n } 34 CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 8

QUANTUM ALGORITHMS FOR MATRIX PRODUCTS OVER SEMIRINGS Afe applying he quanum algoihm of Lemma 33, we can obain he maix C 2, similaly o he compuaion of C 1, if we know all he ems  x ˆB y We obain all hese uv ems by compuing he following Boolean poduc of an nu n maix by an n nv maix  1 1  1  u 1  u ˆB 1 1 ˆB v 1 ˆB 1 ˆB v The cos of his maix muliplicaion is Õ n ω1+log n u,1+log n,1+log v n The oal cos of compuing he maix C 2 is hus Õ n 2 m1 m 2 n m1 m 2 uv u + v + + + n ω1+log n u,1+log n,1+log n, v n which is he desied bound since he em n 2 u + v is negligible hee by iem iv of Fac 22 We can give a classical vesion of his esul, whose poof can be found in Secion 6, ha will be used o pove Theoem 43 in Secion 42 Poposiion 34 Thee exiss a classical algoihm ha compues he genealized exisence dominance poduc in ime Õ m 1 m 2 n + n ω1+log n u,1+log n,1+log n v, fo any paamee {1,,m 1 } We now conside he case u = v = 1 coesponding o he sandad exisence dominance poduc By opimizing he choice of he paamee in Poposiion 32, we obain he following heoem Theoem 35 Le A be an n n maix wih enies in Z { } conaining a mos m 1 non- enies, and B be an n n maix wih enies in Z { } conaining a mos m 2 non- enies Thee exiss a quanum algoihm ha compues, wih high pobabiliy, he exisence dominance poduc of A and B in ime Õ m 1 m 2 n 1 µ, whee µ is he soluion of he equaion µ + 2ω1,1 + µ,1 = 1 + log n m 1 m 2 In paicula, his ime complexiy is uppe bounded by Õ m 1 m 2 1/3 n ω+1/3 Poof The complexiy of he algoihm of Poposiion 32 is minimized fo = n µ, whee µ is he soluion of he equaion µ + 2ω1,1 + µ,1 = 1 + log n m 1 m 2 We can use iems ii and iii of Fac 22 o obain he uppe bound ω1,1+ µ,1 ω + µ, and opimize he complexiy of he algoihm by aking = m 1 m 2 1/3 n 1 2ω/3, which gives he uppe bound claimed in he second pa of he heoem In he case of compleely dense inpu maices ie, m 1 n 2 and m 2 n 2, he second pa of Theoem 35 shows ha he complexiy of he algoihm is Õn 5+ω/3 On 2458 4 Applicaions: he max, min-poduc and he Disance Poduc In his secion we show how o apply he esuls of Secion 3 o consuc quanum algoihms fo he max,min-poduc and he disance poduc CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 9

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA 41 Quanum Algoihm fo he max, min-poduc In his subsecion we pesen a quanum algoihm fo he maix poduc, which immediaely gives a quanum algoihm wih he same complexiy fo he max,min-poduc as explained in Secion 2, and hen gives Theoem 11 Ou algoihm fis explois he mehodology by Vassilevska e al [23] o educe he compuaion of he poduc o he compuaion of seveal spase dominance poducs The main echnical difficuly o ovecome is ha, unlike in he classical case, compuing all he spase dominance poducs successively becomes oo cosly ie, he cos exceeds he complexiy of all he ohe pas of he quanum algoihm Insead, we show ha i is sufficien o obain a small facion of he enies in each dominance poduc and ha his ask educes o he compuaion of a genealized exisence dominance poduc, and hen use he quanum echniques of Poposiion 32 o obain pecisely only hose enies Theoem 41 Thee exiss a quanum algoihm ha compues, fo any wo n n maices A and B wih enies especively in Z { } and Z { }, he poduc A B wih high pobabiliy in ime Õn 5 γ/2, whee γ is he soluion of he equaion γ + 2ω1 + γ,1 + γ,1 = 5 In paicula, his complexiy is uppe bounded by On 2473 Poof Le g {1,,n} be a paamee o be chosen lae Fo each i {1,,n}, we so he enies in he i-h ow of A in inceasing ode and divide he lis ino s = n/g successive pas R i 1,,Ri s wih a mos g enies in each pa Fo each {1,,s}, define he n n maix A as follows: A [i, j] = A[i, j] if A[i, j] R i and A [i, j] = ohewise The cos of his classical pepocessing is On 2 s ime We descibe below he quanum algoihm ha compues C = A B Sep 1 Fo each i, j {1,,n} {1,,n}, we compue he lages {1,,s} such ha A B[i, j] = 1, if such an exiss This is done by using he quanum algoihm of Poposiion 32 wih u = s, v = 1, A = A fo each {1,,s} and B 1 = B Noe ha m 1 s ng = On 2 and m 2 n 2 The complexiy of his sep is hus n 5/2 Õ + n ω1+log n s,1+log n,1 fo any paamee {1,,n 2 } We wan o minimize his expession Le us wie = n γ and g = n δ Fo a fixed δ, he fis em is a deceasing funcion of γ, while he second em is an inceasing funcion of γ The expession is hus minimized fo he value of γ soluion of he equaion in which case he expession becomes Õn 5 γ/2 ω2 δ,1 + γ,1 = 5 γ/2, 41 Sep 2 Noe ha a Sep 1 we also obain all i, j {1,,n} {1,,n} such ha no saisfying A B[i, j] = 1 exiss Fo all hose i, j, we se C[i, j] = Fo all ohe i, j, we will denoe by i j he value found a Sep 1 We now know ha C[i, j] = max {A i j [i,k] A i j [i,k] B[k, j]}, k: A[i,k] R i i j and C[i, j] can be compued in ime Õ g using he quanum algoihm fo maximum finding [8], since R i i j g The complexiy of Sep 2 is hus Õn 2 g CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 10

QUANTUM ALGORITHMS FOR MATRIX PRODUCTS OVER SEMIRINGS This algoihm compues, wih high pobabiliy, all he enies of C = A B Is complexiy is Õ n 2 s + n 5 γ/2 + n 2 g = Õ n 5 γ/2 + n 2+δ/2, since he em n 2 s = n 3 δ is negligible wih espec o n 5 γ/2 = n ω2 δ,1+γ,1 by iem iv of Fac 22 This expession is minimized fo δ and γ saisfying δ + γ = 1 Injecing his consain ino Equaion 41, we find ha he opimal value of γ is he soluion of he equaion γ + 2ω1 + γ,1 + γ,1 = 5, as claimed Using Fac 21 and iems i and ii of Fac 22, we obain 1 5 = γ + 21 + γω 1,1, 1 + γ γ + 21 + γ 2 + β 1 1 + γ α = 4 + 2β 2αβ + 5 2αβγ and hen γ 1+2αβ 2β 5 2αβ The complexiy is hus Õ n 12 6αβ+β/5 2αβ On 2473, as claimed 42 Quanum Algoihm fo he Disance Poduc In his subsecion we pesen a quanum algoihm ha compues he mos significan bis of he disance poduc of wo maices, as defined below Le A and B be wo n n maices wih enies in Z { } Le W be a powe of wo such ha he value of each finie eny of hei disance poduc C is uppe bounded by W Fo insance, one can ake he smalles powe of wo lage han max i, j {A[i, j]} + max i, j {B[i, j]}, whee he maxima ae ove he finie enies of he maices Each non-negaive finie eny of C can hen be expessed using log 2 W bis: he eny C[i, j] can be expessed as C[i, j] = log 2 W W k=1 C[i, j] k fo bis C[i, j] 2 k 1,,C[i, j] log2 W Fo any l {1,,log 2 W}, we say ha an algoihm compues he l mos significan bis of each eny if, fo all i, j {1,,n} {1,,n} such ha C[i, j] is finie and non-negaive, he algoihm oupus all he bis C[i, j] 1,C[i, j] 2,,C[i, j] l Vassilevska and Williams [22] have sudied his poblem, and shown how o educe he compuaion of he l mos significan bis o he compuaion of O2 l exisence dominance maix poducs of n n maices By combining his wih he Õn 3+ω/2 -ime algoihm fo dominance poduc fom [18], hey obained a classical algoihm ha compues he l mos significan bis of each eny of he disance poduc of A and B in ime Õ 2 l n 3+ω/2 Õ 2 l n 2687 Hee is he main esul of his subsecion, obained by educing he compuaion of he l mos significan bis o compuing a genealized exisence dominance poduc Theoem 42 Thee exiss a quanum algoihm ha compues, fo any wo n n maices A and B wih enies in Z { }, he l mos significan bis of each eny of he disance poduc of A and B in ime Õ 2 0640l n 5+ω/3 O2 0640l n 2458 wih high pobabiliy Poof Noe ha he ivial Õn 5/2 -ime quanum algoihm can be used o compue all he bis of each eny of he disance poduc C of A and B Theefoe, we will assume, wihou loss of genealiy, ha l saisfies he inequaliy 2 0640l n 5+ω/3 n 5/2, which implies in paicula ha 2 l n 2 Assume fis ha all he enies of C ae finie and non-negaive Wha we wan o do is o compue, fo each i, j {1,,n} {1,,n}, he inege d {0,1,2 l 1} such ha C[i, j] is in he ineval [dw/2 l,d + 1W/2 l CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 11

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA Fo any inege x, define he maices A x and B x as follows: fo all i, j {1,,n} {1,,n}, A x[i, j] = A[i, j] xw 2 l/2, B x[i, j] = B[i, j] + xw 2 l Assume fo simpliciy ha l is even a simila agumen woks fo l odd Fo each d {0,1,2 l 1}, le d 1,d 2 {0,1,2 l/2 1} denoe he values such ha d = d 1 2 l/2 +d 2 Fo each d {0,1,2 l 1}, define he Boolean maix D d = A d 1 B d 2, whee means he sic 2 exisence dominance poduc Noe ha d 1W + d 2W = dw Obseve ha, fo each i, j {1,,n} {1,,n}, we have 2 l/2 2 l 2 l D d [i, j] = 0 min k A[i,k] + B[k, j] dw 2 l Fo each i, j {1,,n} {1,,n}, he inege d {1,,2 l } such ha C[i, j] is in he ineval [d 1W/2 l,dw/2 l can hus be found by compuing he smalles d {0,1,2 l 1} such ha D d [i, j] = 1 We can hus use 3 he quanum algoihm of Poposiion 32, wih u = v = 2 l/2, A x = A x 1 and B y = B y 1 fo each x,y {1,,2l/2 } Since m 1 2 l/2 n 2, m 2 2 l/2 n 2 and fom he inequaliy 2 l n 2 on l, he complexiy is n 5/2 2 l/2 Õ + n ω1+log n 2l/2,1+log n,1+log n 2 l/2 fo any paamee {1,,2 l/2 n 2 } Le us wie µ = log n 2 l and = n γ The complexiy is minimized fo he value γ such ha 5 + µ γ = 2ω1 + µ/2,1 + γ,1 + µ/2, fo which he complexiy is Õ n 5+µ γ/2 Using Fac 21 and iems i and iii of Fac 22, we obain 1 ω1 + µ/2,1 + γ,1 + µ/2 γ + 1 + µ/2ω 1, 1 + µ/2,1 2 γ + 1 + µ/2 2 + β 2 + µ α This gives 5 + µ γ 2γ + 2 αβµ + 4 + 2β 2αβ and hus γ αβ 1µ + 1 2β + 2αβ 3 The complexiy is hus Õ n 2 5 + 2β 2αβ 1 6 + 4 αβ 6 µ = Õ n 5+ω +0640µ 3 = O 2 0640l n 2458 2 The sic exisence dominance poduc is obained by eplacing by < in he definiion of he exisence dominance poduc Definiion 31 Noe ha all ou esuls on he exisence dominance poduc also hold fo he sic exisence dominance poduc and hei poofs ae essenially he same, jus eplacing inequaliies by sic inequaliies 3 Acually, we need o modify he ode in Definiion 31 so ha he algoihm of Poposiion 32 finds he smalles d such ha D d [i, j] = 1 insead of he lages d This is done simply by choosing as he deceasing lexicogaphic ode insead of he usual lexicogaphic ode Poposiion 32 and is poof ae unchanged, since he poof only uses he fac ha is a sic oal ode CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 12

QUANTUM ALGORITHMS FOR MATRIX PRODUCTS OVER SEMIRINGS Finally, we discuss he geneal case whee he enies of C can be negaive o infinie Obseve ha he above algoihm deecs which enies of C ae lage han 2 l 1W/2 l : hese ae he enies such ha he algoihm finds no d such ha D d [i, j] = 1 We can find which of hese enies ae lage han W and hus infinie by compuing he dominance poduc A 0 B 2 l Noe ha he algoihm also finds which enies of C ae negaive: hese ae he enies fo which he smalles d such ha D d [i, j] = 1 is d = 0 Similaly, we can obain a bee classical algoihm as shown in he following heoem Theoem 43 Thee exiss a classical algoihm ha compues, fo any wo n n maices A and B wih enies in Z { }, he l mos significan bis of each eny of he disance poduc of A and B in ime Õ 2 0960l n 3+ω/2 O2 0960l n 2687 Poof The poof is simila o he poof of Theoem 42, bu we use Poposiion 34 insead of Poposiion 32 The complexiy becomes 2 l n 3 Õ + n ω1+log n 2l/2,1+log n,1+log n 2 l/2 fo any paamee {1,,2 l/2 n 2 } Le us wie µ = log n 2 l and = n γ This expession is hen O n 3+µ γ + n ω1+µ/2,1+γ,1+µ/2 This expession is minimized fo he value γ such ha 3 + µ γ = ω1 + µ/2,1 + γ,1 + µ/2, fo which he complexiy is Õ n 3+µ γ Using Fac 21 and iems i and iii of Fac 22, we obain 1 ω1 + µ/2,1 + γ,1 + µ/2 γ + 1 + µ/2ω 1, 1 + µ/2,1 γ + 1 + µ/2 2 + β This gives he inequaliy 3 + µ γ γ + 1 αβ 2 µ + 2 + β αβ, 2 2 + µ α fom which we obain αβ µ/2 + 1 β + αβ γ 2 The complexiy is hus Õ n 5+β αβ 2 +1 αβ µ 4 = Õ n 3+ω +0960µ 2 = O 2 0960l n 2687, as claimed CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 13

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA Noe ha he dependency on n of he Õ 2 l n 2687 -ime algoihm by Vassilevska and Williams [22] can be slighly impoved using he ecen On 2684 -ime algoihm fo dominance poduc by Yuse [25] based on ecangula maix muliplicaion We can similaly obain an impoved bound O2 cl n 2684, fo some c < 1, wih he same appoach as in he poof of Theoem 43 Howeve, i is complicaed o expess he value of c in a closed fom, so we omi he saemen of his sligh impovemen 5 Spase Boolean Maix Muliplicaion In his secion we descibe quanum vesions of seveal known combinaoial echniques fo handling spase Boolean maix poducs The main esul is he following heoem, which shows how o compue he Boolean poduc of wo maices A and B by educing i o fou poducs, each easie o compue han he oiginal one when A and B ae spase enough Noe ha simila ideas have been used in [1, 26] o analyze applicaions of hose combinaoial echniques in he classical seing Hee we show how o implemen hese ideas using quanum enumeaion and analyze he complexiy of he esuling algoihm Theoem 51 Assume ha hee exiss an algoihm ha, in ime Mn 1,n 2,n 3,L, compues he poduc of any n 1 n 2 Boolean maix and any n 2 n 3 Boolean maix such ha hei poduc conains a mos L non-zeo enies Le A and B be wo n n Boolean maices wih a mos m 1 and m 2 non-zeo enies in A and B, especively Fo any values of he hee paamees l 1 {1,,m 1 } and l 2,l 3 {1,,m 2 }, hee exiss a quanum algoihm ha compues, wih high pobabiliy, he Boolean poduc A B and has ime complexiy Õ Ml 1,l 2,l m 1 m 2 minλ,m 1 m 2 /l 2 m1 m2 3,λ + + λ + λ + n 2, l 2 l 1 l 3 whee λ denoes he numbe of non-zeo enies in A B, and l i = minl i,n fo each i {1,2,3} Poof Fo any k {1,,n}, le a R k esp br k be he numbe of non-zeo enies in he k-h ow of A esp B and a C k esp bc k be he numbe of non-zeo enies in he k-h column of A esp B We define he following six ses of indexes, and compue hem classically in ime On 2 S = { k {1,,n} b R } k m 2 /l 2 S = { k {1,,n} b R } k < m 2 /l 2 T = { k {1,,n} a R } k m 1 /l 1 T = { k {1,,n} a R } k < m 1 /l 1 U = { k {1,,n} b C k m } 2/l 3 U = { k {1,,n} b C k < m } 2/l 3 Given wo ses R,C {1,,n} and an n n Boolean maix M, he noaion MR C will epesen he n n Boolean maix such ha MR C [i, j] = 1 if and only if M[i, j] = 1 and i, j R C Fo convenience, M R will epesen he maix MR C fo C = {1,,n}, and MC he maix MR C fo R = {1,,n} I is easy o check ha A B = A S T B U S + AS B S + A T B + A B U, whee + epesens he eny-wise OR opeaion We will individually compue he fou ems of his sum CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 14

QUANTUM ALGORITHMS FOR MATRIX PRODUCTS OVER SEMIRINGS The compuaion of A S T BU S consiss in he compuaion of a T S maix by a S U maix We implemen his pa using he algoihm whose exisence is assumed in he saemen of he heoem Noe ha, fom he spasiy of B, we have m 2 n k=1 br k k S b R k S m 2/l 2, and hus S l 2 Similaly we have T l 1 and U l 3 Addiionally, we know ha S, T and U have size a mos n Thus his pa can be implemened in Ml 1,l 2,l 3,λ ime In ode o compue A S B S we do he following Le m 1 denoe he numbe of non-zeo enies of A S Fis, we lis all hese non-zeo enies, classically in ime On 2, and ecod hem ino wo aays M 1 and M 2 of size m 1 : fo each p {1,,m 1 } he value M 1[p] ecods he ow index of he p-h elemen of he lis, while M 2 [p] ecods is column index Then, fo each k S, we compue he se of indexes j {1,,n} such ha B[k, j] = 1 and ecod hem ino an aay N k Noe ha N k has lengh b R k, and ha b R k < m 2/l 2 fom he definiion of S The compuaion of all he N k s can be done classically in On 2 ime Finally, ake N = m 1 c=1 br M 2 [c] and define he funcion g: {1,,N} {1,,n} {1,,n} as follows: fo any p {1,,m 1 } and any q {1,,bR M 2 [p] }, g q + p 1 b R M 2 [c] c=1 = M 1 [p],n M2 [p][q], whee N M2 [p][q] denoes he q-h elemen of he aay N M2 [p] I is easy o check ha { g{1,,n} = i, j {1,,n} {1,,n} hee exiss k S such ha } A[i,k] = B[k, j] = 1, ie, g{1,,n} is pecisely he se of non-zeo enies of A S B S ha we wan o find A cucial poin hee is ha he funcion g can be evaluaed in polylogn ime using he daa sucues M 1, M 2 and N k Fo any subse Σ of {1,,n} {1,,n}, le f Σ : {1,,N} {0,1} be he funcion such ha f Σ x = 1 if and only if gx / Σ The quanum pocedue sas wih Σ being empy, pefoms successive quanum seaches ove {1,,N}, each ime seaching fo an elemen x such ha f Σ x = 1 and adding gx o Σ as soon as such an x is found, and sops when no new elemen x is found Fom he discussion of Secion 2, wih high pobabiliy all seaches succeed, in which case a he end of he pocedue Σ = g{1,,n} Le λ denoe he numbe of non-zeo enies in A S B S and obseve ha λ minλ,m 1 m 2 /l 2, since N < m 1 m 2/l 2 m 1 m 2 /l 2 The oveall complexiy of his quanum pocedue is Õ n 2 + N λ + 1 = Õ n 2 m 1 m 2 minλ,m 1 m 2 /l 2 + l 2 The compuaion of A T B is done as follows Fo each k {1,,n}, le a k denoe he numbe of non-zeo enies in he k-h column of A T We fis pefom a On 2 -ime classical pepocessing sep: fo each k {1,,n}, we consuc he se E k of he ow indexes of all non-zeo enies in he k-h column of A T, and consuc he se F k of he column indexes of all non-zeo enies in he k-h ow of B Noe ha E k = a k and F k = b R k The quanum pocedue compuing A T B uses a se Σ {1,,n} {1,,n}, iniially empy Fo each k {1,,n}, all he i, j E k F k such ha CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 15

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA A T [i,k] = B[k, j] = 1 and i, j / Σ ae compued by pefoming a quanum enumeaion, as above, ove he se E k F k, adding i, j o Σ as soon as such a i, j is found, and sopping when no new elemen i, j is found The oveall ime complexiy is Õ n 2 + n k=1 a k br k λ k + 1, whee λ k is he numbe of elemens found when pocessing k Noe ha he inequaliy k a k br k < λ minm 1/l 1,n holds, since k a k br k also epesens he oal numbe of winesses of A T B, ie, he numbe of iples i, j,k such ha A T [i,k] = B[k, j] = 1 obseve ha hee ae a mos λ pais i, j saisfying his condiion, all such ha i T Since k λ k λ n 2, his complexiy is uppe bounded by Õ n 2 + λ + n n a k br k k=1 = Õ n 2 + λ + n = Õ n 2 + λ m1 l 1 λ min m1,n l 1 Compuing A B U Õ n 2 + λ m 2 /l 3 is done similaly o he compuaion of he poduc A T B wih complexiy We now compae he esuls of Theoem 51 o pevious woks Fo he case m 1 = m 2 n 2, he bounds obained in Theoem 51 ae no bee han he bes known oupu-sensiive algoihms fo Boolean maix muliplicaion [11, 14, 16] Ineesingly, we neveheless ecove he same complexiy Oλ n as in [14] fo he egion n 3/2 λ n 2, bu using diffeen mehods his is done by aking l 1 = m 1 /n + 1, which gives T = {1,,n} and educes he compuaion of A B o he compuaion of only A T B Conside now spase inpu maices and, fo conceeness, focus on he case m 1 = m 2 we denoe his value simply by m The complexiy of he algoihm by Amossen and Pagh [1], while no saed in his fom, can be wien as Õ Ml 1,l 2,l 1,λ + m 2 /l 2 + λm/l 1 + n 2 using he noaions of Theoem 51 In compaison, Theoem 51 gives by choosing l 1 = l 3 he uppe bound Õ Ml 1,l 2,l 1,λ + minm λ/l 2,m 2 /l 2 + λ m/l 1 + n 2 We see ha he second and hid ems in ou complexiy ae neve wose In ode o evaluae quaniaively he speedup obained in he quanum seing, le us conside he case when only he inpu maices ae spase ie, λ n 2 In his case, he algoihm by Amossen and Pagh has he same complexiy as he algoihm by Yuse and Zwick [26] descibed in he inoducion In compaison, Theoem 51 gives he following esul, which shows ha ou quanum algoihm is bee han hei classical algoihm, as discussed in he inoducion Theoem 52 complee vesion of Theoem 12 Le A and B be wo n n Boolean maices wih a mos m 1 and m 2 non-zeo enies in A and B, especively Thee exiss a quanum algoihm ha compues, CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 16

QUANTUM ALGORITHMS FOR MATRIX PRODUCTS OVER SEMIRINGS wih high pobabiliy, he Boolean maix poduc A B and has ime complexiy Õn minm 1,m 2 if 1 m 1 m 2 n, Õn 2 if n m 1 m 2 n 1+α/2, Õ m 1 m 2 β 1+2β n 2+2β αβ 1+2β if n 1+α/2 m 1 m 2 n ω 1/2, Õn ω if n ω 1/2 m 1 m 2 n 2 Poof Fis conside he case m 1 m 2 n Assume fo now ha m 1 m 2 We use he following saegy: we fis use quanum enumeaion o find all he non-zeo enies of A and, hen, fo each such eny A[i,k], we oupu all he j s such ha B[k, j] = 1 The complexiy of his saegy is Õ m 1 + 1n 2 + m 1 n = Õm 1 n The same agumen gives he uppe bound Õm 2 n when m 2 m 1 If n m 1 m 2 n 1+α/2, hen we use he quanum algoihm of Theoem 51 wih paamees l 1 = m 1, l 2 = m 1 m 2 /n 2, l 3 = m 2, and applying he algoihm fo ecangula maix muliplicaion ove a field descibed in Secion 2 fo he pa Ml 1,l 2,l 3,n2 This gives oveall complexiy Õn 2 ime If n 1+α/2 m 1 m 2 n ω 1/2, hen we use he quanum algoihm of Theoem 51 wih paamees l 1 = m 1, l 3 = m 2 and l 2 = m 1 m 2 1 1+2β n 2αβ 1 1+2β, giving oveall complexiy Õ m 1 m 2 β 1+2β n 2+2β αβ 1+2β Finally, if m 1 m 2 n ω 1/2, hen we simply use he bes exising classical algoihm fo dense maix muliplicaion 6 Poofs of Lemma 33 and Poposiion 34 In his secion we give he poofs of Lemma 33 and Poposiion 34 61 Poof of Lemma 33 We will use he noaion colm,k o denoe he numbe of finie enies in he k-h ow of M, fo any n 1 n 2 maix M wih enies in Z {± } and any k {1,,n 2 } Ou algoihm poceeds in seveal seps Pepocessing: column balancing Fo each {1,,}, we do he following Conside he u maices A 1,,A u Each maix has size n n and we know ha he oal numbe of finie enies in hese u maices is a mos m 1 / : u n x=1 k=1 cola x,k m 1 / 61 CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 17

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA We will consuc u maices à 1,,à u, each of size n 2n Each à x will conain all he finie enies in A x, bu hese u maices will saisfy he following spasiy condiion on each column: u x=1 colã x,k m 1 /n fo all k {1,,2n} 62 These maices ae elaed o he concep of column balancing developed in [6] Le us descibe how o consuc hese maices à 1,,à u Fo each index k {1,,n}, we fis collec ogehe all he finie enies in he k-h column of A 1,,A u and so hem in inceasing ode This gives, fo each k, a soed lis of a mos nu numbes, wih possible epeiions We hen divide his lis ino successive pas T,k 1,T,k 2,,T a,k,k, fo some a,k 1, such ha { T q,k = m 1/n fo q {1,,a,k 1}, T q,k m 1/n fo q = a,k Define p = n k=1 a,k and noice ha p 2n: hee ae a mos n pas of size exacly m 1 /n due o Equaion 61, and a mos n pas of size sicly less han m 1 /n hese pas ae among he n pas wih q = a,k To each pai k,q wih k {1,,n} and q {1,,a,k }, we assign an abiay index in {1,, p }, denoed ρ k,q, in a bijecive way Finally, fo each x {1,,u}, we consuc he n 2n maix à x as follows: fo all i {1,,n} and all k {1,,2n}, à x [i,k ] = { This means ha each finie eny of A x A x [i,k] if k {1,, p } and A x [i,k] T q,k, whee k,q = ρ 1 k, ohewise appeas in à x, in he same ow bu geneally in a diffeen column By consucion, Equaion 62 holds The oveall cos of his classical pepocessing sep is Õn 2 u ime Pepocessing: ecoding elevan infomaion abou he inpu maices Since he complexiy of he quanum pocedue descibed in he las pa of he poof will depend cucially on he way infomaion abou maices à x and B y is soed, we inoduce adequae daa sucues o ecod his infomaion Fo each x {1,,u}, we do he following Fo all {1,,} we lis he finie enies in each column of à x, classically in ime Õn 2, and ceae a 3-dimensional aay U x such ha U x [,k,b] ecods he index of he ow of he b-h finie eny in he k -h column of à x, fo each {1,,}, each k {1,,2n}, and each b {1,,colà x,k } Fo each y {1,,v}, we do he following We consuc, classically in ime On 2, a lis conaining all he finie enies of B y 1,,By Le us denoe he oal numbe of hese finie enies by m y, and emembe ha we have v y=1 my m 2 We hen ceae an aay V y of size m y : fo each a {1,,m y }, if he a-h elemen of he lis is B y [k, j], hen V y [a] is se o he 3-uple,k, j The oveall cos of his classical pepocessing sep is Õn 2 u + v ime Consucion of he maices  x and ˆB y CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 18

QUANTUM ALGORITHMS FOR MATRIX PRODUCTS OVER SEMIRINGS Fo each {1,,} and each x {1,,u}, we consuc an n 2n Boolean maix  x fo all i {1,,n} and all k {1,,2n},  x [i,k ] = 1 iff à x [i,k ] Fo each {1,,} and each y {1,,v}, we consuc a 2n n Boolean maix ˆB y all k {1,,2n} and all j {1,,n}, ˆB y [k, j] = 1 iff k {1,, p } and B y [k, j] maxt q,k, whee k,q = ρ 1 k as follows: as follows: fo These ae he maices menioned in he saemen of he lemma The oveall cos of his classical consucion sep is Õn 2 u + v ime Relaion wih he maix C 2 Fo each {1,,}, each x {1,,u} and each y {1,,v}, conside he Boolean poduc ˆB y This poduc gives us some of he non-zeo enies of A x B y, bu no all Indeed, by  x definiion,  x [i,k ] = 1 if and only if A x [i,k] T q,k, whee k,q = ρ 1 k The indexes of he non-zeo enies of  x ˆB y ae hus pecisely all he i, j {1,, n} {1,, n} fo which hee exiss some k {1,,n} saisfying A x [i,k] T q,k fo some q {1,,a,k} and B y [k, j] maxt q Le us now conside he emaining non-zeo enies of A x B y : he i, j {1,,n} {1,,n} fo which hee exiss some k {1,,n} saisfying A x [i,k] T q,k fo some q {1,,a,k} and A x [i,k] B y [k, j] < maxt q,k 63 Define he n n maix D wih enies in S {0,0} as follows Fo any i, j {1,,n} {1,,n}, he eny D[i, j] is he lages elemen x,y S such ha Equaion 63 holds fo some {1,,} and some k {1,,n}, if a leas one such x,y exiss, and D[i, j] = 0,0 ohewise We hen have { } C 2 [i, j] = max {D[i, j]} {x,y S =1  x ˆB y [i, j] = 1} fo all i, j {1,,n} {1,,n}, as claimed in he saemen of he lemma Consucion of he maix D We finally show how o compue he maix D The idea is o find, fo all x,y S in deceasing ode, all he pais of indexes i, j {1,,n} {1,,n} such ha Equaion 63 holds fo some {1,,} and some k {1,,n}, and sike ou hose pais as soon as hey ae found The pocedue fo compuing D is descibed in Figue 2 The se R, iniially empy, ecods all pais i, j fo which D[i, j] has aleady been compued Duing he loop of Seps 8-13 he pocedue enumeaes all he i, j {1,,n} {1,,n}\R such ha Equaion 63 holds fo some {1,,} and some,k, CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 19

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA 1 R /0; 2 fo all i, j {1,,n} {1,,n} do D[i, j] 0,0; enddo 3 fo all y {1,,v}, all {1,} and all j,k {1,,n} {1,,n} do [k, j] < maxt q 4 compue he smalles q {1,,a,k } saisfying B y 5 enddo 6 fo all x,y S in deceasing ode do 7 es-full false; 8 while es-full = false do,k and denoe i by qy k j ; 9 find,i, j,k {1,,} {1,,n} 3 such ha i, j R and à x [i,ρ k,q y k j ] By [k, j]; # commen: he seach of Sep 9 is acually done ove Γ x,y {1,,} {1,,n} 3 10 if a soluion,i, j,k is found 11 hen D[i, j] x,y; R R {i, j}; 12 else es-full ue; 13 enddo 14 enddo Figue 2: Pocedue compuing he maix D k {1,,n} Noe ha only he non- enies of B y need o be consideed and, fom Equaion 63, fo each such non- eny B y [k, j] only he non- enies A x [i,k] of A x such ha A x [i,k] T qy k j need o be consideed, whee q y k j is he smalles inege in {1,,a,k} such ha B y,k [k, j] < maxt qy k j By consucion, hese non- enies of A x ae in he ρ k,q y k j -h column of Ãx The loop of Seps 8-13 hus pefoms successive quanum seaches ove he se { Γ x,y =,k,i, j,k {1,,} {1,,n} 3 B y looking fo elemens,i, j,k Γ x,y such ha i, j / R and à x [i,ρ k,q y k j [k, j] and ] By [k, j] à x [i,ρ k,q y k j }, ] The pocedue of Figue 2 coecly compues he maix D wheneve he quanum enumeaion does no e, ha is, wih pobabiliy a leas 1 1/polyn if safe Gove seach is used, as discussed in CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 20

QUANTUM ALGORITHMS FOR MATRIX PRODUCTS OVER SEMIRINGS Secion 2 Le us conside is ime complexiy The cos of Sep 2 is Õn 2, and he cos of he loop of Seps 3-5 is Õn 2 v since each q y k j can be found in polylogn ime using binay seach In ode o evaluae he cos of he loop of Seps 8-13, we need o discuss in moe deails how o pefom he quanum seach ove he se Γ x,y since suble issues aise when consideing how o access ime-efficienly he elevan enies of he maices and how o check if an elemen is a soluion in polyn ime Noe ha a 1 c=1 Γ x,y = =1 j,k such ha B y [k, j] colã x,ρ k,q y k j We define a bijecion g fom he se {1,, Γ x,y } o he se Γ x,y as follows Remembe ha he daa sucues U x and V y ae available, ecoding infomaion abou he à x s and he B y s, especively Fo noaional convenience fo each a {1,,m y } wih coesponding value V y [a] =,k, j, we will wie V 1 [a] =, V 2 [a] = k, V 3 [a] = j and W[a] = ρ k,q y k j Noe ha hese fou values can be immediaely obained fom V y [a] We define he funcion g as follows: fo all a {1,,m y } and all b {1,,colà x V 1 [a],w[a]}, g b + colã x V 1 [c],w[c] = V 1 [a],u x[ ] V 1 [a],w[a],b,v 3 [a],v 2 [a] I is easy o check ha g is a bijecion fom {1,, Γ x,y } o Γ x,y The cucial poin hee is ha he funcion g can be evaluaed in polylogn ime since U x and V y ae available in paicula, given any z {1,, Γ x,y } one can find he values a and b such ha z = b + a 1 c=1 colãx V 1 [c],w[c] efficienly, using binay seach fo insance We can hen implemen Sep 9 by pefoming quanum seaches ove he se {1,, Γ x,y } Fom he discussion in Secion 2, he ime complexiy of he loop of Seps 8-13, fo fixed x,y, is hus Õ Γ x,y λ x,y + 1 = Õ =1 j,k such ha B y [k, j] colã x,ρ k,q y k j λ x,y + 1, whee λ x,y denoes he numbe of elemens found duing he execuion of he loop ie, he numbe of new enies of D compued The oal cos of he pocedue of Figue 2 is hen Õ n2 v + u v x=1 y=1 =1 j,k such ha B y [k, j] colã x,ρ k,q y k j λ x,y + 1 CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 21

FRANÇOIS LE GALL AND HARUMICHI NISHIMURA Using Equaion 62, he inequaliy u x=1 v y=1 λ x,y n 2, and he Cauchy-Schwaz inequaliy, we can ewie his expession as v Õ n2 v + m 1 u n u + x=1λ x,y y=1 =1 j,k such ha B y [k, j] = Õ n 2 u v m1 m 2 v + uv + n λ x,y x=1 y=1 = Õ n 2 m1 m 2 n m1 m 2 uv v + + n This concludes he descipion of how o consuc he maix D Since he pepocessing has cos Õn 2 u + v, he oveall complexiy of he algoihm is Õ n 2 m1 m 2 n m1 m 2 uv u + v + + n This concludes he poof of Lemma 33 62 Poof of Poposiion 34 The algoihm is essenially he same as in he poof of Poposiion 32 The only change is ha a classical algoihm, which we descibe below, is used insead of he quanum algoihm in Lemma 33 In he poof of Lemma 33 we use classical enumeaion ie, exhausive seach insead of quanum enumeaion in he pocedue of Figue 2 The complexiy of he loop of Seps 8-13 of he pocedue of Figue 2 is hus Γ x,y, and he oal complexiy of he pocedue becomes Õ n2 v + u v x=1 y=1 =1 j,k such ha B y [k, j] colã x,ρ k,q y k j The oveall complexiy of he classical vesion of Lemma 33 is hus Õ n 2 u + v + n 2 v + m 1m 2 = Õ n which gives he uppe bound claimed Acknowledgemens = Õ n 2 u + v + m 1m 2 n n 2 v + m 1m 2 n This wok is suppoed by he Gan-in-Aid fo Young Scieniss B No 24700005, he Gan-in-Aid fo Young Scieniss A No 16H05853 and he Gan-in-Aids fo Scienific Reseach A Nos 24240001 and 16H01705 of he Japan Sociey fo he Pomoion of Science, and he Gan-in-Aid fo Scienific Reseach on Innovaive Aeas No 24106009 of he Minisy of Educaion, Culue, Spos, Science and Technology in Japan, CHICAGO JOURNAL OF THEORETICAL COMPUTER SCIENCE 2017, Aicle 1, pages 1 25 22