factoring using 2n 2 qubits with toffoli based modular
play

Factoring using 2n+2 qubits with Toffoli based modular - PowerPoint PPT Presentation

Factoring using 2n+2 qubits with Toffoli based modular multiplication aner 1 , 2 Martin Roetteler 2 Krysta M. Svore 2 Thomas H 1 Institute for Theoretical Physics ETH Z urich, Switzerland 2 Quantum Architectures and Computation Group


  1. Factoring using 2n+2 qubits with Toffoli based modular multiplication aner 1 , 2 Martin Roetteler 2 Krysta M. Svore 2 Thomas H¨ 1 Institute for Theoretical Physics ETH Z¨ urich, Switzerland 2 Quantum Architectures and Computation Group Microsoft Research, Redmond, U.S.A. arXiv:1611.07995 19th Annual SQuInT Workshop Baton Rouge, Louisiana February 24, 2017

  2. Outline Improved constant increment “ + 1” Toffoli networks for modular multiplication Testable circuit for Shor on 2 n + 2 qubits Simulations 2

  3. How to increment a quantum register? Realizing a cyclic shift How to realize x �→ x + 1 mod 2 n , which cyclically shifts the basis states of an n qubit register? Solution 1: Recursive Solution 2: Fourier-style ❢ · · · r ❢ 1 · · · n ω . . . r r ❢ . . . · · · . . . DFT − 1 DFT 2 n ... 2 n 1 ω 2 r r r ❢ · · · 1 ω r r r r ❢ · · · Good: needs only n qubits Good: needs only n + 1 qubits Bad: needs O ( n 2 ) gates Bad: needs O ( n 2 ) gates Ugly: needs rotations 3

  4. How to increment a quantum register? Realizing a cyclic shift How to realize x �→ x + 1 mod 2 n , which cyclically shifts the basis states of an n qubit register? Solution 1: Recursive Solution 2: Fourier-style ❢ · · · r ❢ 1 · · · n ω . . . r r ❢ . . . · · · . . . DFT − 1 DFT 2 n ... 2 n 1 ω 2 r r r ❢ · · · 1 ω r r r r ❢ · · · Good: needs only n qubits Good: needs only n + 1 qubits Bad: needs O ( n 2 ) gates Bad: needs O ( n 2 ) gates Ugly: needs rotations 3

  5. How to increment a quantum register? Realizing a cyclic shift How to realize x �→ x + 1 mod 2 n , which cyclically shifts the basis states of an n qubit register? Solution 1: Recursive Solution 2: Fourier-style ❢ · · · r ❢ 1 · · · n ω . . . r r ❢ . . . · · · . . . DFT − 1 DFT 2 n ... 2 n 1 ω 2 r r r ❢ · · · 1 ω r r r r ❢ · · · Good: needs only n qubits Good: needs only n + 1 qubits Bad: needs O ( n 2 ) gates Bad: needs O ( n 2 ) gates Ugly: needs rotations 3

  6. How to increment a quantum register? Realizing a cyclic shift How to realize x �→ x + 1 mod 2 n , which cyclically shifts the basis states of an n qubit register? Solution 1: Recursive Solution 2: Fourier-style ❢ · · · r ❢ 1 · · · n ω . . . r r ❢ . . . · · · . . . DFT − 1 DFT 2 n ... 2 n 1 ω 2 r r r ❢ · · · 1 ω r r r r ❢ · · · Good: needs only n qubits Good: needs only n + 1 qubits Bad: needs O ( n 2 ) gates Bad: needs O ( n 2 ) gates Ugly: needs rotations 3

  7. How to increment a quantum register? Realizing a cyclic shift How to realize x �→ x + 1 mod 2 n , which cyclically shifts the basis states of an n qubit register? Solution 1: Recursive Solution 2: Fourier-style ❢ · · · r ❢ 1 · · · n ω . . . r r ❢ . . . · · · . . . DFT − 1 DFT 2 n ... 2 n 1 ω 2 r r r ❢ · · · 1 ω r r r r ❢ · · · Good: needs only n qubits Good: needs only n + 1 qubits Bad: needs O ( n 2 ) gates Bad: needs O ( n 2 ) gates Ugly: needs rotations 3

  8. How to increment a quantum register? Solution 3: Constant folding const const const const const Good: needs O ( n ) gates. Bad: needs 2 n qubits Solution 4 ??? Is there a circuit with n qubits, that needs only O ( n ) gates? Or even just one with n + const qubits but O ( n ) gates? 4

  9. How to increment a quantum register? Solution 3: Constant folding const const const const const Good: needs O ( n ) gates. Bad: needs 2 n qubits Solution 4 ??? Is there a circuit with n qubits, that needs only O ( n ) gates? Or even just one with n + const qubits but O ( n ) gates? 4

  10. How to increment a quantum register? Solution 3: Constant folding const const const const const Good: needs O ( n ) gates. Bad: needs 2 n qubits Solution 4 ??? Is there a circuit with n qubits, that needs only O ( n ) gates? Or even just one with n + const qubits but O ( n ) gates? 4

  11. How to increment a quantum register? Solution 3: Constant folding const const const const const Good: needs O ( n ) gates. Bad: needs 2 n qubits Solution 4 ??? Is there a circuit with n qubits, that needs only O ( n ) gates? Or even just one with n + const qubits but O ( n ) gates? 4

  12. Trick from Barenco et al (PRA’95) Note: this uses n / 2 “dirty” ancillas qubits. 5

  13. Trick from Barenco et al (PRA’95) Note: this uses n / 2 “dirty” ancillas qubits. 5

  14. Incrementer “ + 1 ” by Craig Gidney Based on the following trick: | x � | g � �→ | x − g � | g � � � g ′ − 1 � �→ | x − g � � x − g − g ′ + 1 � � � � g ′ − 1 � �→ �→ | x + 1 � | g � (Note that g + 1 = g ′ , where g ′ denotes two’s complement and g denotes one’s complement, and that g + g ′ = 0). If n dirty ancillas are available, this allows to implement + 1 increment using only O ( n ) Toffoli gates. If only 1 dirty ancilla is available, precompute final carry, apply a split and recurse. Leads to O ( n log n ) Toffoli gates. 6

  15. Incrementer “ + 1 ” by Craig Gidney Based on the following trick: | x � | g � �→ | x − g � | g � � � g ′ − 1 � �→ | x − g � � x − g − g ′ + 1 � � � � g ′ − 1 � �→ �→ | x + 1 � | g � (Note that g + 1 = g ′ , where g ′ denotes two’s complement and g denotes one’s complement, and that g + g ′ = 0). If n dirty ancillas are available, this allows to implement + 1 increment using only O ( n ) Toffoli gates. If only 1 dirty ancilla is available, precompute final carry, apply a split and recurse. Leads to O ( n log n ) Toffoli gates. 6

  16. Incrementer “ + 1 ” by Craig Gidney Based on the following trick: | x � | g � �→ | x − g � | g � � � g ′ − 1 � �→ | x − g � � x − g − g ′ + 1 � � � � g ′ − 1 � �→ �→ | x + 1 � | g � (Note that g + 1 = g ′ , where g ′ denotes two’s complement and g denotes one’s complement, and that g + g ′ = 0). If n dirty ancillas are available, this allows to implement + 1 increment using only O ( n ) Toffoli gates. If only 1 dirty ancilla is available, precompute final carry, apply a split and recurse. Leads to O ( n log n ) Toffoli gates. 6

  17. Carry precomputation w/dirty qubits | a 0 � | a 0 � | g 0 � | ˜ g 0 � | a 1 � | ˜ a 1 � | g 1 � | ˜ g 1 � . . ... ... . . . . · · · | g n − 3 � | ˜ g n − 3 � | a n − 2 � · · · | ˜ a n − 2 � | g n − 2 � · · · | ˜ g n − 2 � | a n − 1 � · · · | r n − 1 � Works for any constant addition “ + c ” (not just “ + 1”). Bits are encoded in the presence/absence of orange gates. This needs 4 ( n − 2 ) Toffoli and 4 wt ( c ) Clifford gates. 7

  18. Carry precomputation w/dirty qubits | a 0 � | a 0 � | g 0 � | ˜ g 0 � | a 1 � | ˜ a 1 � | g 1 � | ˜ g 1 � . . ... ... . . . . · · · | g n − 3 � | ˜ g n − 3 � | a n − 2 � · · · | ˜ a n − 2 � | g n − 2 � · · · | ˜ g n − 2 � | a n − 1 � · · · | r n − 1 � Works for any constant addition “ + c ” (not just “ + 1”). Bits are encoded in the presence/absence of orange gates. This needs 4 ( n − 2 ) Toffoli and 4 wt ( c ) Clifford gates. 7

  19. Carry precomputation w/dirty qubits | a 0 � | a 0 � | g 0 � | ˜ g 0 � | a 1 � | ˜ a 1 � | g 1 � | ˜ g 1 � . . ... ... . . . . · · · | g n − 3 � | ˜ g n − 3 � | a n − 2 � · · · | ˜ a n − 2 � | g n − 2 � · · · | ˜ g n − 2 � | a n − 1 � · · · | r n − 1 � Works for any constant addition “ + c ” (not just “ + 1”). Bits are encoded in the presence/absence of orange gates. This needs 4 ( n − 2 ) Toffoli and 4 wt ( c ) Clifford gates. 7

  20. Carry precomputation w/dirty qubits | a 0 � | a 0 � | g 0 � | ˜ g 0 � | a 1 � | ˜ a 1 � | g 1 � | ˜ g 1 � . . ... ... . . . . · · · | g n − 3 � | ˜ g n − 3 � | a n − 2 � · · · | ˜ a n − 2 � | g n − 2 � · · · | ˜ g n − 2 � | a n − 1 � · · · | r n − 1 � Works for any constant addition “ + c ” (not just “ + 1”). Bits are encoded in the presence/absence of orange gates. This needs 4 ( n − 2 ) Toffoli and 4 wt ( c ) Clifford gates. 7

  21. Carry precomputation w/dirty qubits n | a � | a � | a 0 � | a 0 � | a 1 � | a 1 � C | g 0 � | g 1 � A c = 11 | a 2 � | a 2 � n − 1 ≡ R | g � | g � | g 1 � | g 2 � R Y | a 3 � | a 3 � | g 2 � | g 3 � | 0 � | ( a + c ) n � | 0 � | ( a + 11) 4 � 8

  22. Putting it all together: addition-by-constant ⌈ n 2 ⌉ | x L � + c L | r L � C C A A ⌊ n 2 ⌋ | x H � + c H | r H � +1 R R R R Y Y | 0 � | 0 � Note that this circuit uses a clean ancilla to detect if the final overflow happened. However, it is not necessary to use a clean qubit, a dirty qubit suffices as shown next. 9

  23. Carry computation using garbage only ⌈ n 2 ⌉ + c L | x L � | r L � C C A A ⌊ n 2 ⌋ | x H � +1 +1 + c H | r H � R R R R Y Y | g � | g � 10

  24. Carry computation using garbage only ⌈ n 2 ⌉ + c L | x L � | r L � C C A A ⌊ n 2 ⌋ | x H � +1 +1 + c H | r H � R R R R Y Y | g � | g � T A ( n ) = 2 T A ( n 2 ) + 2 ( 2 · 2 n + 4 n ) 2 2 � �� � ���� carry incr = 2 T A ( n 2 ) + 8 n . . . = 8 n log 2 n 10

Recommend


More recommend