Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Make DumpMachine output configurable in the code #178

Open
tcNickolas opened this issue Apr 28, 2020 · 2 comments
Open

Make DumpMachine output configurable in the code #178

tcNickolas opened this issue Apr 28, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@tcNickolas
Copy link
Member

Please describe what you would like the feature to accomplish.
DumpMachine is one of the key features for a person who starts learning quantum computing using Q#. Unfortunately, the little-endian labels and ordering of the basis states gets new learners confused in most of cases. IQ# tries to solve this by introducing different formats of labeling (little endian vs big endian vs bit string), but I'd really like to see a similar feature in regular Q# projects, since I do most Q# coding and debugging in VS.

Describe the solution you'd like
Add a parameter to DumpMachine that would allow user to switch between little endian, big endian and bit string formats and orderings of the basis vectors in the output.

Describe alternatives you've considered
So far I have to stick to explaining the output of DumpMachine in great detail, but it still doesn't help the learners.

Side note
Adding an extra parameter to DumpMachine is going to be a fairly painful breaking change, but it would simplify microsoft/iqsharp#126 - it would allow the user to configure the output of DumpMachine directly rather than by configurations, so that running the same code in Notebooks and in VS Code produces the same results.

@tcNickolas tcNickolas added the enhancement New feature or request label Apr 28, 2020
@cgranade
Copy link
Contributor

As a matter of Q# APIs, I think we shouldn't add an extra parameter to DumpMachine. After all, only the quantum simulator even dumps a state in particular, such that a new parameter for formatted output would expose simulator internals at the level of Q#, when it's really a host program configuration option. That's a large part of why the current design in IQ# allows the use of the %config magic for configuring output, for example.

@tcNickolas
Copy link
Member Author

I've been just reminded of how valuable this capability would be: I had an 8-qubit quantum state that had only 2 non-zero basis states in a Q# unit test project, and the ability to use dump.truncateSmallAmplitudes there would've been priceless (it could've been a 16-qubit state!)

@cgranade, @bettinaheim, any thoughts on how to enable configuring DumpMachine output outside of IQ#, in Q# standalone mode?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants