Open tcNickolas opened 4 years ago
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.
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?
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 https://github.com/microsoft/iqsharp/issues/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.