6 Changing the odds: An introduction to Q#

 

This chapter covers:

  • Using the Quantum Development Kit to write quantum programs in Q#,
  • How to use Jupyter Notebook to work with Q#,
  • How to run Q# programs using a classical simulator.

Up to this point, we’ve used Python to implement our own software stack to simulate quantum programs. Moving forward, though, we’ll be writing more intricate quantum programs that will benefit from specialized language features that are hard to implement by embedding our software stack inside Python. Especially as we explore quantum algorithms, it’s helpful to have a language tailor-made for quantum programming at our disposal. In this chapter, we’ll get started with Q#, Microsoft’s domain-specific language for quantum programming, included with the Quantum Development Kit.

6.1  Introducing the Quantum Development Kit

The Quantum Development Kit provides a new language, Q#, for writing quantum programs and simulating them using classical resources. Quantum programs written in Q# are run by thinking of quantum devices as a kind of accelerator, similar to how you might run code on a graphics card.

Tip

If you’ve ever used a graphics card programming framework like CUDA or OpenCL, this is a very similar model.

Figure 6.1. Q# software stack on a classical computer.
CH06 qsharp software stack

Let’s take a look at this software stack for Q#.

6.2  Functions and Operations in Q#

6.3  Passing Operations as Arguments

6.4  Playing Morgana’s Game in Q#

6.5  Summary

sitemap