Slide 1

Slide 1 text

Introduction to Q# Hiroshi Kurokawa, Dev Group, Mitene 2018-08-27 Vantage LT meetup

Slide 2

Slide 2 text

What’s Q#? Programming Language
 for Quantum Computing

Slide 3

Slide 3 text

What’s Quantum Computing? Computing using quantum- mechanical phenomena

Slide 4

Slide 4 text

What’s Quantum Computing? Probabilistic vector and matrix with complex numbers Computing using quantum- mechanical phenomena

Slide 5

Slide 5 text

Qubit Bit: 0 or 1 Qubit: superposition of and |0> |1> A quibit can be represented as
 
 α|0> + β |1>
 
 where the prob. of |0> and |1>
 is |α|2 and |β|2 respectively

Slide 6

Slide 6 text

Machine state Classic computerɿ 0110 Quantum computerɿ superposition of |0> |0> |0> |0> |0> |0> |0> |1> |0> |0> |1> |0> and and … |0> |0> |1> |1> and

Slide 7

Slide 7 text

|0> |0> |0‌> |0͏> Machine state Classic computerɿ 0110 Quantum computerɿ superposition of |0> |0> |0> |1͏> |0> |0> |1> |0͏> and and … |0> |0> |1> |1͏> and

Slide 8

Slide 8 text

|000‌0͏> Machine state Classic computerɿ 0110 Quantum computerɿ superposition of |0001͏> |0010͏> and and … |0011͏> and

Slide 9

Slide 9 text

Matrix operations Hadamard operator: H
 H |0> = 1/√2 ( |0> + |1> ) = |+>
 H |1> = 1/√2 ( |0> - |1> ) = |-> NOT operator: X
 X |0> = |1>
 X |1> = |0>

Slide 10

Slide 10 text

Problem https:/ /codeforces.com/contest/1001/ problem/A You are given |0> and an integer Convert the qubit to |+> if the integer is 1 |-> if the integer is -1

Slide 11

Slide 11 text

Solution Remember this:
 H |0> = |+>
 H |1> = |->
 X |0> = |1>

Slide 12

Slide 12 text

Solution namespace Solution { open Microsoft.Quantum.Primitive; open Microsoft.Quantum.Canon; operation Solve (q : Qubit, sign : Int) : () { body { // q is set as |0> if (sign == 1) { H(q); } else { X(q); // flip q to make it |1> H(q); } } } }

Slide 13

Slide 13 text

Matrix operations CNOT operator
 CNOT( |0> |0> ) = |0> |0>
 CNOT( |0> |1> ) = |0> |1>
 CNOT( |1> |0> ) = |1> |1>
 CNOT( |1> |1> ) = |1> |0>

Slide 14

Slide 14 text

Problem https:/ /codeforces.com/contest/1001/ problem/B You are given |00> Convert |00> → 1/√2( |00> + |11>)

Slide 15

Slide 15 text

Solution Hint:
 |+> |0> = 1/√2 (|0> + |1>) |0>
 = 1/√2 (|00> + |10> Remember CNOT:
 CNOT( |0> |0> ) = |0> |0>
 CNOT( |0> |1> ) = |0> |1>
 CNOT( |1> |0> ) = |1> |1>
 CNOT( |1> |1> ) = |1> |0> |11>

Slide 16

Slide 16 text

Solution namespace Solution { open Microsoft.Quantum.Primitive; open Microsoft.Quantum.Canon; operation Solve (qs : Qubit[], index : Int) : () { body { let x = qs[0]; let y = qs[1]; H(x); CNOT(x, y); } } }

Slide 17

Slide 17 text

Reference Quantum Computing Concepts
 https:/ /docs.microsoft.com/en-us/quantum/quantum- concepts-1-intro Microsoft Q# Coding Contest - Summer 2018 - Warmup
 https:/ /codeforces.com/contest/1001 Microsoft Q# Coding Contest - Summer 2018 - Warmupͷ໰୊Λղ͍ͯΈͨ
 https:/ /qiita.com/hatoo@github/items/ 49b8542029a2100efabf