Docsity

Grovers Algorithm - Quantum Computing - Lecture Slides, Slides of Computer Science

Partial preview of the text

Download Grovers Algorithm - Quantum Computing - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Grover’s Algorithm in

Machine Learning and

Optimization

Applications

Grover Algorithm

Reminder in new light

Simpler Graph Coloring Problem

2

1 3

4

Two wires for color of node 1 Two wires for color of node 2 Two wires for color of node 3

Two wires for color of node 4

Gives “1” when nodes 1 and 2 have different colors

1 ≠ 2 1 ≠^3 2 ≠^3

2 ≠ 4

3 ≠ 4

Value 1 for good coloring

We need to give all possible colors here

F(x)

Simpler Graph Coloring Problem

1 ≠ 2 1 ≠^3 2 ≠^3

2 ≠ 4

3 ≠ 4

Value 1 for good coloring

We need to give all possible colors here H H H H

H

Give Hadamard for each wire to get superposition of all state, which means the set of all colorings

|0> |0> |0>

Discuss naïve non- quantum circuit with a full counter of minterms Now we will generate whole Kmap at once using quantum properties - Hadamard

f(x)

Motivating calculations for 3 variables

 As we remember, these are transformations of Hadamard gate:

|0> H |0> + |1> (^) |1> H |0> - |1>

|x> H |0> + (-1) x^ |1>

In general:

For 3 bits, vector of 3 Hadamards works as follows: (|0>+(-1)a^ |1>) (|0>+(-1)b^ |1>) (|0>+(-1)c^ |1>) =

From multiplication

|000> +(-1)c^ |001> +(-1)b^ |001>+(-1)b+c^ |001>000> +(-1) a^ |001> + (-1)a+c^ |001> + (-1)a+b^ |001> (-1)a+b+c^ |001>

|abc> 

This is like a Kmap with every true minterm (1) encoded by -

And every false minterm (0) encoded by 1

We can say that Hadamard gates before the oracle
create the Kmap of the function, setting the function in
each of its possible minterms (cells) in parallel

f(x)

oracle

What Grover algorithm does?

 Grover algorithm looks to a very big Kmap and tells where is the -1 in it.

1 1 -^1 1 1 1 1 1

Here is -

What “Grover for m ultiple solutions” algorithm does?

 Grover algorithm looks to a very big Kmap and tells where is the -1 in it.  “Grover for many solutions” will tell all solutions.

1 1 -^1 1 1 1 1 1
1 1 1 -1^ -1^ 1 1 1

Here is -1, and here is - 1, and here

1 in 4 search

A practical Example

 This presentation shows clearly how to perform
a so called 1 in 4 search
 We start out with the basics

Pick your needle and I will find you a haystack

The point of this slide is to show examples of 4 different oracles. Grovers search can tell between these oracles in a single iteration, classically we would need 3 iterations.

f

| x 1 〉
| x 2 〉
| y 〉
| x 2 〉
| x 1 〉
| y ⊕ f ( x 1 ,x 2 )〉

(( – 1 ) f (^00 )| 00 〉 + ( – 1 ) f (^01 )| 01 〉 + ( – 1 ) f (^10 )| 10 〉 + ( – 1 ) f (^11 )| 11 〉)(| 0 〉 – | 1 〉)

Output state:

Black box for 1-4 search:

Start by creating phases in superposition of all inputs to f :

Input state to query: (| 00 〉 + | 01 〉 + | 10 〉 + | 11 〉)(| 0 〉 – | 1 〉)

f

H

H

| 1 〉 H

| 0 〉 | 0 〉

A 1-4 search can chose between 4 oracles in one iteration

Here we clearly see the Kmap encoded in phase – the main property of many quantum algorithms Docsity.com

f

H

H

| 1 〉 H

| 0 〉 | 0 〉 H

H

H

H H

X X (^) H H

X X

M M M

Time

state = 0 (^10) (^00) (^00) 0

state =0. -0.3530. -0.3530. -0.3530. -0.

state =0. -0.3530. -0.3530. -0.353-0.

state =0. -0.3530. -0.3530. -0.353-0.

state =-0. 0.3530. -0.3530. -0.3530. -0.

state = 0 -0.5^0 0.50. -0.5 0 0

state = 0 -0.5^0 0.5 0 0.5^0 -0.

00 01 11 10

ab c 0 1 1 00 01 11 10

ab c 0 1 0.3 –0, 0.3 –0, 0.3 –0, 0.3 –0,

ab c 0 1 0.3 –0, 0.3 –0,

- 0.3 0, 0.3 –0,

00 01 11 10

ab c 0 1

0.3 –0,

- 0.3 0,

00 01 11 10

0.3 –0,

0.3 –0,

ab c 0 1

0.3 –0, 0.3 - 0,

00 01 11 10

- 0.3 0,

0.3 – 0,

ab c 0 1

- 0.5 0, 0 0

00 01 11 10

0 0

0.5 – 0,

ab c 0 1

- 0.5 0, 0.5 - 0.

00 01 11 10

0 0

0 0

This slide illustrates how the state of the system is changed as it propagatesthrough the quantum network implementation of Grovers Search algorithm.

|ψ 00 〉 = – | 00 〉 + | 01 〉 + | 10 〉 + | 11 〉 |ψ 01 〉 = + | 00 〉 – | 01 〉 + | 10 〉 + | 11 〉 |ψ 10 〉 = + | 00 〉 + | 01 〉 – | 10 〉 + | 11 〉 |ψ 11 〉 = + | 00 〉 + | 01 〉 + | 10 〉 – | 11 〉

f

H

H

| 1 〉 H

| 0 〉 | 0 〉 H

H

H

H H

X X (^) H H

X X

M M M

Time

The state corresponding to the input to the oracle that has a output result of 1 is ‘tagged’ with a negative 1.

After Hadamard the solution is “known” in Hilbert space by having value -1. But it is hidded from us

This was a special case where we could transform the state vector without repeating the oracle.

In general we have to repeat the oracle – general Grover Docsity.com

Reed-Muller Transform

Reminder

 Definition: for a function , the Reed-Muller
transform pair is given by :
 The R-M matrix for two variables is

f

s = R n ( ) × f and f = R −^1 ( ) n × s

1 1

where ( ) (1), 1, 2,..., ( ) (1), 1, 2,...,

i i

R n R i n R −^ n R − i n

= ⊗ = = ⊗ =

(1) 1 0 R (^) 1 1 = ^   

1 0 0 0 (2) (1)=^1 1 0 1 0 1 0 1 1 1 1

R (^) iR

    = ⊗ ^     