Classical and Quantum Circuit Synthesis - PowerPoint PPT Presentation

About This Presentation
Title:

Classical and Quantum Circuit Synthesis

Description:

Don't-cares. Suppose we are interested in only part of the output. ... Quantum circuits can also have don't-cares, but they are different than classical ones. ... – PowerPoint PPT presentation

Number of Views:83
Avg rating:3.0/5.0
Slides: 46
Provided by: aditya61
Category:

less

Transcript and Presenter's Notes

Title: Classical and Quantum Circuit Synthesis


1
Classical and Quantum Circuit Synthesis
  • An Algorithmic Approach

2
Problem
  • How do we synthesize efficient n-input quantum
    circuits using CNOT gates only ?
  • Of the n! possible n-qubit permutations, how many
    can be implemented in this way?
  • What is the longest such circuit?
  • How can long chains of CNOTs be systematically
    reduced?

3
Goals
  • Way to synthesize quantum circuits
  • Currently, reducing chains of C-Not gates is
    important
  • More complex circuits (with Toffoli gates,
    etc...)
  • Larger circuits (more qubits, more gates, etc...)

4
Reducing C-Nots
  • Want to minimize error
  • Need an algorithmic approach
  • Classical circuit approach ? discrete reversible
    case

5
Example
wire 0 -------X--O-----X--X--O- wire 1
-O--X-----X--O--O-----X- wire 2
-X--O--O-----X-----O---- Reduces to wire 0
-O- wire 1 --- wire 2 -X-
6
Classical program goals
  • Synthesize optimal classical circuits
  • Provides method for creating reduced chains of
    C-Not gates
  • Scalable
  • As many inputs/outputs as necessary
  • Versatile
  • Use various gate libraries (AND, OR, NOT, etc...)

7
Refresher Truth Tables
AND gate
These can be represented in row format as
well X 0011 -gt 3 Y 0101 -gt 5 -------- Z
0001 -gt 1 (35)1
(Columnar format)
8
How to Synthesize?
?
Inputs
Desired result
X 0011
Z 0110
Y 0101
9
How to Synthesize?
Inputs
Desired result
X 0011
Gate Library AND, OR, NAND
Z 0110
Y 0101
10
Tree Structure
  • Solution space representable as a tree
  • Inputs at head of tree
  • Each level down represents addition of new gate
  • Branch factor depends on number of current gates
    and allowable new gates

11
Inputs X, Y
AXY
AXY
Level 1
Level 2
(Same as left)
BXY
BXY
BXA
BXA
BYA
BYA
If we have N inputs (N2 here) G gate types
(G2, we have AND and OR) Then at level L we have
a branch factor of B G (NL-1, 2) / 2
12
Branch and Bound
  • Depth-first search
  • First do top?bottom, then left?right
  • Travel down to leaves before going to siblings
  • Can be implemented by a recursive function,
    passing L1 with each call

13
DFS Branch Bound
14
DFS Branch Bound
15
DFS Branch Bound
16
DFS Branch Bound
17
DFS Branch Bound
18
BB Synthesis
Inputs
Desired result
X 0011
AXX0011
Z 0110
Y 0101
19
BB Synthesis
Inputs
Desired result
X 0011
AXX0011
BXX0011
Z 0110
Y 0101
20
BB Synthesis
Inputs
Desired result
X 0011
CXX0011 CXX0011 C(XX)1100 CXY0001 ...

AXX0011
BXX0011
Z 0110
Y 0101
21
BB Synthesis
Inputs
Desired result
X 0011
CXX0011 CXX0011 C(XX)1100 CXY0001 ...

AXX0011
BXX0011
Z 0110
Y 0101
22
BB Synthesis
Inputs
Desired result
X 0011
CXX0011 CXX0011 C(XX)1100 CXY0001 ...

AXX0011
B(XX)0011
Z 0110
Y 0101
23
Solution Found!
Inputs
Desired result
X 0011
AXY0111
B(XY)1110
CAB0110
Z 0110
Y 0101
24
(No Transcript)
25
Bounding Conditions
  • Branch factor unnecessarily large
  • Need bounding conditions
  • Dont need duplicate gates (AXX,BXX)
  • Symmetrical gates done only once
  • Dont need XY, then YX
  • Symmetrical branches of solution space can be
    bounded away
  • Optimality requirement creates a bound

26
Optimality Bounding
  • Assume we are only allowed one more gate
  • This gate cannot use all three level-two gates as
    inputs
  • If added, two of the level-two gates would be
    used, one would be left dangling
  • No reason to add a gate, bound now

Current circuit
27
Dont-cares
  • Suppose we are interested in only part of the
    output.
  • Say Z0110 and Z0111 are both desirable outputs.
    We dont care about the last bit.
  • Can represent output as Z 011X
  • This relaxed restriction allows us to find a
    suitable match more quickly
  • Quantum circuits can also have dont-cares, but
    they are different than classical ones.

28
Multiple Outputs
  • We may desire more than one output
  • Ex Half adder. Has two bits as input, two bits
    as output (sum, carry)
  • Optimal multi-output circuit may be different
    than circuit created by merging the individual
    optimal ones.
  • Causes an approximately linear increase in
    synthesis time.

29
Reversible Synthesis
  • To maintain reversibility, must have same number
    of qubits at every stage
  • Fan out must be 1, so there is no expansion in
    the number of gates at any stage
  • Both the input/output functions and all the gates
    must be reversible

30
Compact Representation (Revisited)
  • For a three qubit function, our inputs (A, B, C)
    will have these values

A 00001111 15 B 00110011 51 C 01010101
85
31
Permutation Representation
  • We want to synthesize the outputs A, B, and C
    from the inputs A, B, and C

To be reversible, all of the values of V must be
distinct. This allows us to treat the outputs as
permutations of the inputs.
32
Permutation Representation
So the problem (15,51,85)-gt(178,120,27) Can be
expressed as 01234567 -gt 42673051
33
Simplified Circuit Representation
A
A
B
B
C
C
(A, B)
(B, C)
34
Simplified Circuit Representation
A
A
A1
A2
B
B
B1
B2
C
C
C1
C2
(A, B)
(B, C)
35
(A, B)
(B, C)
36
Results
  • Question given a 3-Qubit system, what is the
    longest possible irreducible chain of C-Nots?
  • Note that some longest chain must exist because
    there are finitely many (8!) permutations.

37
Bounding
  • At each stage, we store the value on each wire.
  • If all wire values are the same, bound
  • If two gates can be permuted w/o affecting the
    circuit, only try one of them
  • -O-O- -O-O-
  • -X--- ---X-
  • ---X- -X---

38
Answer
  • Longest chains
  • wire 0 --O--X--O-----------
  • wire 1 -----------X--O--X--
  • wire 2 --X--O--X--O--X--O--
  • AND
  • wire 0 -----------X--O--X--
  • wire 1 --O--X--O-----------
  • wire 2 --X--O--X--O--X--O--

39
Why?
  • Recall that C-Nots act like XOR gates. That is,
    xgtygt ? xgtx XOR ygt
  • What does this code do?
  • A A xor B
  • B A xor B
  • A A xor B
  • This is a variable swap. The chains on the
    previous page represent wire swaps.

40
How many C-Nots?
  • Experimental results
  • Of the 40320 (8!) permutations, exactly 168 are
    achievable.
  • 2 of them require 6 C-Not gates
  • 24 require 5
  • 60 require 4
  • 51 require 3
  • 24 require 2 (6 6 - duplicates)
  • 6 require 1 (3 control choices 2 targets)
  • 1 requires 0

41
Why only 168?
  • Not all of the 8! permutations are achievable
  • The permutation must be even. Recall every C-Not
    caused two pairs of values to be swapped
  • Exactly half of the 8! permutations are even
  • Various other factors reduce this more

42
Parity of a Permutation
The number of line crossings determines the
parity of a permutation. There are four in this
case, and so the permutation is even.
43
Future Plans... Make Program
  • More scalable
  • Currently using 32-bit integers to store wire
    values. 25 32 only 5 wires at a time now.
  • More versatile
  • Currently only using C-Not gates. Allow n-input
    Toffoli gates, other gates
  • Quicker
  • Determine methods for bounding better, exploit
    characteristics of quantum circuits.

44
Potential improvements
  • Scalability
  • Use STL bit_vector, or bit_set... fully
    expandable
  • Speed
  • Since all the gates and the functions are
    reversible, the whole circuit is too.
  • Functions can be synthesized in reverse

45
Reversible Synthesis
  • Recall that C-Not acts like XOR
  • C-Not is its own inverse (going left to right is
    same as right to left)
  • Synthesis can be done right?left
  • We already know how to achieve the input values
    with several gates, because weve done this
    left?right before
  • This allows us to have a LUT when we get near
    enough to the inputs
Write a Comment
User Comments (0)
About PowerShow.com