oreilly-qc / oreilly-qc.github.io

Code samples for Programming Quantum Computers, from O'Reilly Media
130 stars 59 forks source link

Sample code 11-3 #24

Open tarabelo opened 4 years ago

tarabelo commented 4 years ago

The sample code 11-3 at page 222 doesn't work as expected.

machinelevel commented 4 years ago

Hi there! (just catching up on these...) Regarding sample 11-3, I've just tried it, and I want to make sure it's working for you.

When I run it as-is using the Exercise 11-3 link, it runs this circuit:

image

...and produces this state (looking just at the first 16 circles, all others are empty):

image

This matches the tile in row 3, column 2 in the sample output as shown in Figure 11-10:

image

By changing the tile position on lines 17 and 18 of the sample:

image

...you can get any other tile to render.

I do notice that in the book itself the specified tile is 2,1 instead of 2,3. Is this the problem you're pointing out?

In any case, if you can clarify the issue you're seeing I'll be happy to help fix it. Cheers, - ej

3625365git-tx commented 3 years ago

@machinelevel There's nothing wrong with this code, but one question remains: can it show the entire 16 by 16 image like the one in the book?