microsoft / qsharp

Azure Quantum Development Kit, including the Q# programming language, resource estimator, and Quantum Katas
https://microsoft.github.io/qsharp/
MIT License
406 stars 81 forks source link

[QOSF Question] Transition guide from Qiskit/Cirq to Q# #1746

Open Manvi-Agrawal opened 1 month ago

Manvi-Agrawal commented 1 month ago

Today, in QOSF presentation meeting, there was interest in resources for learning Q#. In general, documentation, samples and katas help. I also pointed them to "Q# pocket guide" and upcoming "Quantum Programming in Depth : Solving problems with Q# and Qiskit" book by Mariia.

Someone asked if there is a transition guide from Qiskit/Cirq to Q#, since these are primarily taught in universities. I tried searching the documentation but couldnt find it. Does anyone know about it?

tcNickolas commented 1 month ago

I don't recall ever seeing a guide like that, but that's an interesting idea!

There was an automatic OpenQASM to Q# converter at https://github.com/qsharp-community/qsharp-integrations, but it is so old, it probably doesn't work.

When I need code in multiple languages, I tend to write it in Q# first and then translate to other languages (well, to Qiskit). In this case, the main issues are:

  1. Local qubit allocation - Qiskit circuits need to have all qubits declared upfront, so counting auxiliary qubits is tricky.
  2. Endianness differences
  3. Mid-circuit measurements (and generally processing of measurement results, those look very different)

In the other direction, if Qiskit code uses libraries that are not available in Q# - either quantum or classical Python - that will be a massive problem for migration.

Manvi-Agrawal commented 1 month ago

Thanks @tcNickolas for providing more insights into Q# and Qiskit. I think the spirit of the question was that since Qiskit is widely used, people were asking if there is a cheatsheet/documentation to get started with Q# quickly if someone is familiar with Qiskit.

This is because Q# differs widely from Qiskit, Cirq and others, so people find it hard to try Q# because of learning curve. Personally speaking, I think Q# is good to learn afresh for someone familiar with programming. I found it more intuitive than Qiskit, some aspects being dynamic auxillary qubits handling, no need to have classical register for measurements, etc. But once I got used to Qiskit in university, there was a mental roadblock to adopt Q# again, had to dive in document and samples a bit :-)

sezna commented 3 weeks ago

We may consider this for learn.microsoft.com.