Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in MultiQubitDumpMachineDemo Code #763

Closed
bdg221 opened this issue Sep 28, 2023 · 5 comments
Closed

Error in MultiQubitDumpMachineDemo Code #763

bdg221 opened this issue Sep 28, 2023 · 5 comments
Assignees
Labels
bug Something isn't working katas

Comments

@bdg221
Copy link

bdg221 commented Sep 28, 2023

Describe the bug

In the tutorials, The Qubit > Display the Quantum State of a Multi-Qubit Program includes the demo code DumpMachine for Multi-Qubit Systems. The comments about performing the X gate on the second qubit are incorrect:
image

First of all, the entire system is now in state |10> and also it is decimal notation that represents |2>. Finally, the Message() should also be changed to |10>.

This would be extremely confusing to someone who is new to quantum computing, especially if they run the code and see:
image

To Reproduce

Steps to reproduce the behavior:

  1. Go to the Learn with Azure Quantum katas and navigate to The Qubit then Display the Quantum State of a Multi-Qubit Program.
  2. Copy the demo code and run it.
  3. See confusing/conflicting results.

Expected behavior

I would expect the comment in the code to read:
The entire system is now in state |10>, or, in decimal notation, |2>.

Then the Message("State |01>:"); would be changed to Message(State |10>:");

Screenshots
Current implementation:
image

Results from running the demo:
image

System information

N/A

Additional context

I would be happy to correct this issue if you would like to assign it to me.

@bdg221 bdg221 added bug Something isn't working needs triage labels Sep 28, 2023
@tcNickolas
Copy link
Member

This is an artifact of migration from the "old" QDK used in https://github.com/microsoft/QuantumKatas/ to the new QDK we're using on the website (see https://devblogs.microsoft.com/qsharp/introducing-the-azure-quantum-development-kit-preview/ for the announcement). Old QDK had a different output format for DumpMachine, so the same code would output
image
(You can see that basis states are by default collapsed into integers, using little-endian notation, so the state 2 corresponded to a 01 bit string indeed - that's why the comment mentioned little endian. The new DumpMachine also uses a different order of bits, qubit 0 is printed last, so the bit string for this state would be indeed 10, but still 2 in big-endian.)

More broadly, the tutorials migrated to the website need to be double-checked for the discrepancies between the descriptions and the code output that arise from endianness - for example, the same issue is likely to show up in the MultiQubitSystems tutorial.

Thank you for reporting this!

@bdg221
Copy link
Author

bdg221 commented Oct 6, 2023

This same behavior can be seen in the MultiQubitSystemsDemo code from Multi-Qubit Systems > Multi-Qubit Systems in Q#.

image

image

image

@DmitryVasilevsky
Copy link
Contributor

DmitryVasilevsky commented Mar 6, 2024

With changes #1079 (most important!), and #1162, #1169 this issue should be fixed in the repository. This bug should be fixed once these changes propagate to QCOM web site.

@minestarks
Copy link
Member

@DmitryVasilevsky can this be closed now? I wasn't sure where to check on QCOM

@tcNickolas
Copy link
Member

This shows up in Multi-Qubit Systems kata, MultiQubitSystemsDemo demo. I've checked that the output matches the statements in the message on QCOM, so we can close this.

(And thank you @bdg221 for the original report!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working katas
Projects
None yet
Development

No branches or pull requests

4 participants