qgraphics: quantum searching for ray triangle...

22
QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTION Carolina Alves Integrated Master in Physics Engineering Q Days, April 2019 University of Minho, HASLab

Upload: others

Post on 15-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTION

Carolina AlvesIntegrated Master in Physics Engineering

Q Days, April 2019University of Minho, HASLab

Page 2: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Ray Tracing

■ Calculates the color of pixelsby tracing the path that light wouldtake through a virtual 3D scenewhich is described by a collection ofgeometric primitives (e.g.,triangles).

■ The algorithm returns, for a givenray, which triangle it intersectscloser to its origin.

2

Page 3: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

The problem

■ Determine which rays intersect ageometric primitive.

■ For simplification the primitives willbe 1D and perpendicular to therays.

■ A higher dimensional approachwould require a large number ofqubits/gates because of the greatamount of calculations needed.

primitives

rays

light source

3

Page 4: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Classical Algorithm

for each ray{

intersect with primitives{

if intersect continue to next ray;

}

}

■ Complexity: O(R*P)

■ Note: The primitives can be ordered,resulting in a O(R*log(P)) complexityalthough it requires a setup timeand more memory.

4

Page 5: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Can we gain in complexity with a quantum strategy?

■ Finding an intersection is asearch algorithm so we’ll useGrover’s Algorithm in ourproblem.

5

https://slideplayer.com/slide/5346108/

Page 6: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Two Approaches

– Superposition of the rays

– Superposition of the primitives

6

Page 7: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the rays

7

H

H

H

Page 8: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the rays

8

H

H

H

i from 0 to P-1

Page 9: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the rays

9

H

H

H

i from 0 to P-1

Page 10: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the rays

10

H

H

H

Repeat x times

i from 0 to P-1

Page 11: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the rays

■ If we measure the control bit as 1 it is necessary to repeat the circuit without thatray from the superposition so we don’t measure it again.

■ Complexity: O R ∗ ##%&'%

11

Page 12: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the primitives

12

H

H

Page 13: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the primitives

13

H

H

Page 14: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the primitives

14

H

H

Page 15: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the primitives

15

H

H

Page 16: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the primitives

16

H

H

Repeat y times

Page 17: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Superposition of the primitives

■ Number of solutions: 0 or 1

■ Complexity: O(R*√P)

■ Quadratic gain over the classical algorithm

17

Page 18: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

S. RAYS

■ Multiple solutions

■ O R ∗ ##%&'%

■ Only 1 solution (or 0)

■ O(R*√P)

S. PRIMITIVES

Comparison

18

Page 19: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Future Work

■ Expand the geometricconfiguration:

– Rays on a plane– More complex primitives (2Dprimitives, inclined orintersecting primitives)

19

Page 20: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Future Work

■ Expand the geometricconfiguration:

– Rays on a plane– More complex primitives (2Dprimitives, inclined orintersecting primitives)

– Non-parallel raysDepends on the capacity of thequantum machine to performcalculations.

20

Page 21: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

Future Work

■ Change the problem to:– For each ray, what is the

geometric primitive closest to the origin of the ray?

■ Error tolerance – real machine:– Quantum error correction

21

Page 22: QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTIONw3.math.uminho.pt/qdays2019/talks/carolina.pdf · quantum strategy? Findinganintersectionisa searchalgorithmsowe’lluse

QGRAPHICS: QUANTUM SEARCHING FOR RAY TRIANGLE INTERSECTION

Carolina AlvesIntegrated Master in Physics Engineering

Q Days, April 2019University of Minho, HASLab