microsoft / iqsharp

Microsoft's IQ# Server.
https://docs.microsoft.com/quantum
MIT License
127 stars 58 forks source link

Support cell magics %%simulate and %%trace #596

Open guenp opened 2 years ago

guenp commented 2 years ago

Is your feature request related to a problem? Please describe. Currently, running %simulate for diagnostics or %trace for visualization requires on an operation that acts on a qubit register creating a boilerplate operation that either runs DumpRegister or DumpOperation (for %simulate) or allocates qubits (for %trace).

Describe the solution you'd like It would be great if there were a way to pass Q# code to either of those magics directly. We could achieve that by supporting cell magics.

Describe alternatives you've considered

Additional context Screenshots:

Screen Shot 2022-02-22 at 9 56 24 AM Screen Shot 2022-02-22 at 9 56 06 AM
cgranade commented 2 years ago

Definitely and wholly agreed; this would be a significant investment, however, due to the fact that jupyter-core itself currently only supports line-magics, so that we don't have a good API to plug into yet. We should consider making that investment, since this would eliminate a bunch of stub operations that serve only as shims for calling %simulate immediately.