Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L....

37
Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced Computer Architecture Laboratory DARPA QuIST PI Meeting St. Augustine, April 2005 DARPA DARPA

Transcript of Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L....

Page 1: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Synthesis and Simulation of Quantum Circuits

Igor L. Markov and John P. HayesUniversity of Michigan

Advanced Computer Architecture Laboratory

DARPA QuIST PI MeetingSt. Augustine, April 2005

DARPADARPA

Page 2: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Quantum Circuit Design Automation at the University of Michigan

• Faculty: John Hayes and Igor Markov• Students: George Viamontes, Vivek Shende,

Smita Krishnaswamy and Gabe Black• Collaborations: S. Bullock (NIST),

G. Berman (LANL), Y. Shi (Michigan)• Our background: Computer Architecture and

algorithms for Electronic Design Automation (EDA)– We have contributed to commercial EDA tools

for classical circuit synthesis, layout and testing– Our students understand quantum circuits, algorithms,

and have software-develop software

Page 3: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Quantum Circuit Simulation & Synthesis

• Simulation: For a given quantum circuit and a given input, find the resulting output; e.g.,– Randomized simulation

– Estimating the probabilities of outcomes

• Synthesis: For a given 2nx2n matrix (explicit or not),find an n-qubit circuit that implements it– Up to phase or up to a given measurement

– With given precision

• More generic Q-M simulations possible• New links between simulation and synthesis

Page 4: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Recent Results in Synthesis

Generic synthesis of n-qubit circuits• New synthesis algorithm (starting from a unitary) –

current world record in terms of CNOT counts• Algorithm for n-qubit state synthesis

(economical and simple)• Circuits for spin-chain architecture

(nearest-neighbor CNOTs + one-qubit gates)• Far-reaching analogy with MUX gates

(quant-ph/0406176 joint w S. Bullock)

Page 5: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Flashback to July/August 2003

• Three CNOTs are necessary and sufficientto synthesize an arbitrary 2-qubit operator– Vidal & Dawson (Caltech)

– Vatan & Williams (JPL)

– Shende, Bullock & Markov (Michigan)• CNOT-optimal synthesis

• Lower bound for n qubits

– Zhang, Whaley et al (Berkeley)

• Similar question for 3 qubits– 14 CNOTs required by a generic lower bound (Michigan)

– 64 CNOTs achievable by existing generic algorithms

– 40 CNOTs by a handcrafted circuit (JPL, quant-ph/0401178)

Page 6: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Today: n-qubit Synthesis (#CNOTs)

• A group from Finland (Vartiainen, Möttönen, Bergholm & Salomaa) came up with asymptotically-optimal n-qubit circuits– PRL 93:130502, PRL 92:177902– However for n=2,3, they have too many CNOTs

• Our algorithm achieves best known results ∀n – For n>2, 2x fewer CNOTs than best previous results

Page 7: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Generic n-qubit Circuit Synthesis

Given a 2nx2n unitary U, we find a circuit for it• Gates: CNOT, Ry and Rz

• Implement U up to phase• CNOTs typically determine circuit cost• (23/48)·4n-3·2n-1+4/3 CNOT gates

– Less than 2x from our lower bound– For n=2, get 3 (optimal)– For n=3, get 20 (best reported; lower bound 14)

• Our circuits have clear top-down structure– Are built from quantum multiplexors

Page 8: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Quantum Multiplexors

• Simple quantum multiplexors:2x2 block diagonal matrices– Analogy with classical MUX gates:

one select bit completely changesbehavior

– The “if then else” gate; true/false can be entangledif (A) then (B) else (C)

• More general quantum MUXes– K select (control) qubits: read-only– N data bits: read-write– Matrix form: 2K diagonal blocks, each 2N-by-2N

Page 9: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

New Circuits for Quantum MUXes

• CNOT and Toffoli gates are quantum qMUXes;so are controlled-U gates, diagonals, etc

• Special case I: only one select qubit

• Two gates of smaller dimension, and a diagonal

• Special case II: multiplexed Ry and Rz gates

Page 10: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Quantum Shannon Decomposition

• Quantum MUXesappear in the Cosine –Sine Decomposition

• Implementing themleads to the followingn-qubit decomposition

MUX-control

Page 11: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Recall Shannon Decomposition

• For one-bit Boolean function f(b1,b2,…,bn),consider cofactors fbk=0(b1,b2,…,bn) and fbk=1(b1,b2,…,bn)

• Then f=xfx=1+x’fx=0 (Shannon Decomposition)

=xyf11+x’yf01+xy’f10+y’x’f11

• A multi-bit Boolean function will have more cofactors

• Shannon decomposition → MUX-based circuits

Page 12: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Our Synthesis Algorithm

• Apply Quantum Shannon recursively– “Divide and conquer”

• 2-qubit end-case (optimal circuits known)

• Further improvement: peephole optimization– A number of 2-qubit diagonals throughout the

circuit can be “collected”, commuted through and merged

• Resulting CNOT count< 1/2 dimension of SU(2n)

Page 13: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Is Quantum Shannon DecompositionSame as Cosine-Sine Decomposition ?

Page 14: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Ongoing Work on MUXes

• New theory of quantum multiplexors– Simplifies many existing results in the literature:

simple, intuitive proofs with circuit diagrams

– Allows one to construct circuit decompositionsby adding wires and MUX-controls

• Is MEP really a quantum property?– Consider the statement

if (k==0) then A0==B0C0 else A1==B1C1

– Can rewrite it as Ak==BkCk

Page 15: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

State Synthesis: Formulation & Results

• Find a circuit to transform |0> into a given |Ψ>• Simple circuit-synthesis algo using 2n+1-2n-2 gates

– Only ~4x away from our lower bound (2n+1-3n-1)/4in QIC Jan 2005 (quant-ph/0401162)

– Can transform any |Ψ’> to any |Ψ> in two steps

• The Finns now have a 2x smaller circuit,but more complicated– It would be interesting to compare the two algorithms

on “useful” states (send us some!)

Page 16: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

State Synthesis: Recursive Algorithm

• Given a |Ψ>, strip away all phases– Synthesize the phase-change (a diagonal operator)

– Now need to solve real-valued state synthesis

– Shorten the vector (2x) by packing two realsinto a complex number; then recurse

Page 17: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Spin-chain Circuits• All CNOTs must operate on nearest-neighbor qubits

– Other spatial architectures seem more forgiving

• Universal circuit with the same asymptotics(~9x overhead; the Finns have a smaller circuit)– Idea 1: localize each CNOT as shown

– Idea 2: Observe that 50% of CNOTs act on bottom two qubits, 25% on bottom three, etc

Page 18: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Quantum Circuit Synthesis For Users

• Dramatic progress in the last 2 years– But little work done on implementations

– Published “algorithms” are not described for programming(running them on paper can be very challenging)

• Several competing algorithms for each problem– Not a single group “owns” best results all around

• Ongoing work: collaborative quantum synthesisover the Web– Users submit an H, U or |Ψ>, get circuits in return

– Researchers contribute implementations

Page 19: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Page 20: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Page 21: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Page 22: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Page 23: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Generic2-qubit op

Generic1-qubit op

Page 24: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Page 25: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Page 26: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Page 27: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

II. Recent Work on Simulation• QuIDDPro Simulator

– Front-end: Matlab-like input language– Back-end: C++ libraries implement the QuIDD data structure– High-performance simulation of state vectors,

density matrices, errors, communication, etc.

• New release: QuIDDPro v1.2 available– Up to 60 times faster than QuIDDPro v1.1

– Faster algorithms for simulating 1-qubit gatesand 1-controlled 1-qubit gates (e.g., CNOT)

– Better memory management (improves speed!)

– Most bugs reported by users fixed

Page 28: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Quantum Info. Decision Diagrams (QuIDDs)

• Data structure that can automatically compress matrices and vectors used in Q-M applications

• Algorithms for matrix & tensor products, measurement, manipulate compressed QuIDDs

i02/1

i02/1

2/12/12/12/1

2/12/12/12/1

2/12/12/12/1

2/12/12/12/100

01

10

11

1001 1100

1

0R

0C

1R

1C

1R

1C

0 1

0

Page 29: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Faster Simulation of 1-Qubit Gates

• Given a 2x2 matrix U, a QuIDD for state-vector,and a target qubit

• Traverse down the QuIDD until the nodes corresponding to the target qubits are reached

• Apply U via the following transformation:

iX

000 iXu 1

01 iXu010 iXu 1

11 iXu

Uu uu u

Page 30: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Faster Simulation of Controlled Gates

• Consider a two-qubit gatewith control bit i and target bit j

• It will be applied to a state-vector in QuIDD– First, assume that i<j in the QuIDD ordering– For a positive control qubit, traverse down

the “1” edge of QuIDD nodes at level i– For a negative control qubits traverse “0” edge

• Upon reaching any QuIDD nodes at level j,apply the special 1-qubit multiplication algorithm

• CNOTs with i>j: conjugate with 4 Hadamardsto reduce to the case i<j

Page 31: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Example: Simulating a CNOT Gate

f

0C

1C

1 0

1

0

0

0 00

01

10

11

CNOTApply CNOT with 1st qubit ascontrol and 2nd qubit as target

1.) Traverse 1 edge of control qubit node

2.) Apply X operator via 1-qubit algorithm

f

0C

1C

0 1

Page 32: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Extensions to Other Gates• Arbitrary two-qubit C-U gates

– Conjugate by wire swaps if control follows target

– Each swap = three CNOTs

– Another approach: decompose C-U into one-qubit gates and up to two CNOTs

• Multiply-controlled gates can be handledthe same way– However, more cases to consider wrt controls & target

– This makes Toffoli much faster

• Observation: simulation speed depends on ordering

Page 33: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Empirical Results• Speed tests on randomly generated circuits

– This limits the amount of special-case structure that a clever simulator can handle

• CHP circuits: CNOT, Hadamard, phase and1-qubit measurement (stabilizer gates)

• TCHP: stabilizer gates plus Toffoli (a universal gate library)

• Separate speed tests for CNOT and Toffoli gates

Page 34: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

III. Critical Assessment of Q. Algorithms

• Theoretical speed-ups do not necessarily translateinto practical benefits– Analysis may ignore important details (e.g., reading the input)

– Implementation constants may be huge

– Hidden communication costs, energy, etc

• Must compare q. algorithms to best classical techniques(in hardware and/or software)– Classical algorithms are still improving!

– Classical algorithms often finish earlier than in the worst case(but quantum algorithms do not)

– If a quantum algorithm can be simulated efficiently in many practical cases, it may not be a good candidate for implementation

quant-ph/0405001

Page 35: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

quant-ph/0405001

Page 36: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Ongoing Work on Verification & Test• Formal verification

– Quantum circuit equivalence checking(to verify correctness of circuit optimizations)

• Circuit testing– Circuit/gate/qubit-based fault models,

e.g., the “missing gate” fault model

– Identifying test vectors that detect and/or locatevarious possible faults

– Explore trade-offs between testing and error correction

Page 37: Advanced Computer Architecture Laboratory Synthesis and Simulation of Quantum Circuits Igor L. Markov and John P. Hayes University of Michigan Advanced.

Advanced Computer Architecture Laboratory

Summary• Breakthrough in generic circuit synthesis• Strong results in state synthesis

and circuits with nearest-neighbor CNOTs– The latter can be viewed as technology mapping

• Ongoing work on quantum multiplexors– Joint with Stephen Bullock at NIST

• Dramatic speed-up of QuIDDPro in new release• Ongoing work on simulating errors in teleportation

– Joint with Gennady Berman at LANL

• Critical assessment of q. algorithms by comparingwith classical computing & through simulation