Introducing Microsoft Quantum Computing for Developers: Using the Quantum Development Kit and Q#

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Dive in with this hands-on introduction to quantum computing with the Microsoft Quantum Development Kit and Q# for software developers. You may have heard about quantum computing, but what does it mean to you as a software developer? With many new developments, a resurgence in interest, and investment by some of the largest tech companies in the world to be the first to market with quantum programming (QP) hardware and platforms, it is no longer a tool in the distant future. Developers are at the forefront, now able to create applications that take advantage of QP through simulations. While the skill is of interest, for many developers, quantum computing and its implications still remains a mystery. In this book, you will get up to speed exploring important quantum concepts and apply them in practice through writing actual quantum algorithms, using the Microsoft Quantum Development Kit. Theoretical knowledge about quantum physics, such as superposition and entanglement, will be used to explain quantum computing topics, including quantum gates, quantum circuits, and quantum algorithms. Finally, take a tour of the new Azure Quantum. Use Q#, Microsoft's new programming language, to target quantum hardware. You will select your supporting language of choice, either C# or Python, to begin writing your quantum applications. Combined with just enough theoretical preparation, you will learn how to get your computer ready to simulate basic quantum programs using Microsoft Visual Studio or Visual Studio Code and Q#. What You Will Learn • Get up to speed on the platform-independent quantum tool set using the Microsoft Quantum Development Kit simulator and Visual Studio Code or Microsoft Visual Studio • Know the basics of quantum mechanics required to start working on quantum computing • Understand mathematical concepts such as complex numbers, trigonometry, and linear algebra • Install the Microsoft Quantum Development Kit on a Windows or Linux PC with Visual Studio Code or Microsoft Visual Studio • Write quantum algorithms with the Microsoft Quantum Development Kit and Q#, supported by C# or Python • Discover insights on important existing quantum algorithms such as Deutch, Deutch-Jozsa, and the fun CHSH-game • Get introduced to quantum as a service using the Microsoft Azure Quantum preview cloud offering Who This Book Is For Developers who are interested in quantum computing, specifically those software developers who are planning on using quantum computers in the future. Basic imperative programming knowledge is useful to understand the syntax and structure found in the Q# programming language. Knowledge of Microsoft C# or Python is not required since these languages are only used to support the simulation of Q# on a classical computer.

Author(s): Johnny Hooyberghs
Edition: 1
Publisher: Apress
Year: 2021

Language: English
Commentary: Vector PDF
Pages: 402
City: New York, NY
Tags: Random Number Generation; Quantum Computing; Q#; Quantum Algorithms; Visual Studio Code; Microsoft Quantum Development Kit; Deutsch-Jozsa Algorithm; Deutsch’s Algorithm

Table of Contents
About the Author
About the Technical Reviewer
Acknowledgments
Introduction
Part I: Introduction to Quantum Computing
Chapter 1: What, Why, and How?
Why?
Why Do We Need Quantum Computers?
What?
What Is Quantum Mechanics?
The Double Slit Experiment
The Double Slit Experiment, More Than a Century Later
Superposition
Entanglement
What Is Quantum Computing?
How?
The Last Word
Chapter 2: The Qubit and Quantum State
Storing Data
What Is the Quantum State of a Qubit?
The State of a Single Qubit
The Mathematical Representation
The Bloch Sphere
The State of Multiple Qubits
The Mathematical Representation
Physical Implementation
The Last Word
Solutions to Exercises
Chapter 3: Quantum Gates and Circuits
Quantum Gates
Reversible Gates
Single-Qubit Gates
H-Gate or Hadamard Gate
X-Gate or Pauli X
Y-Gate or Pauli Y
Z-Gate or Pauli Z
M-Gate or Measurement
Multiple Qubit Gates
CNOT-Gate or Controlled X
Quantum Circuits
Entanglement
Teleportation
Exercises
The Last Word
Solutions to Exercises
Part II: The Microsoft Quantum Development Kit and Q#
Chapter 4: Develop with the Microsoft Quantum Development Kit
Quantum Development Kit
Installing the Quantum Development Kit
Prepare Your .NET Environment
Prepare for Command-Line Development
Prepare for Visual Studio Code Development
Install Visual Studio Code
Install the Microsoft Quantum Development Kit for Visual Studio Code
Prepare for Microsoft Visual Studio Development
Install Visual Studio
Install the Microsoft Quantum Development Kit for Visual Studio
Prepare for Python Development
Install Python
Install the Microsoft Quantum Development Kit for Python
The Last Word
Chapter 5: Your First Quantum Program
A True Random Number Generator
Generating a Random Bit
Only Q#
Q# with a C# Host
Q# with a Python Host
Generating a Random Number
Only Q#
Q# with a C# Host
Q# with a Python host
The Last Word
Chapter 6: Q# Language Overview and the Quantum Simulator
Q# Project Structure
Q# Application Structure
Comments
Namespaces
Variable Declarations and Assignments
Scopes
Quantum Data Types
Qubit
Quantum Memory Management
Result Literals
Pauli Literals
Types
Arrays
Ranges
User-Defined Types
Operators
Copy-and-Update Expressions
Comparative Expressions
Logical Expressions
Conditional Expressions
Arithmetic Expressions
Concatenations
Statements
Conditional Branching
Iterations
Conditional Loops
While Loops
Repeat Loops
Conjugations
Callables
Functions
Operations
Functors
The Adjoint Specialization
The Controlled Specialization
Combining Specializations
Returns and Termination
Operations and Functions As First-Class Objects
Partial Application
Type Parameterizations
The Last Word
Chapter 7: Testing and Debugging Your Quantum Programs
Simulators
The Full-State Simulator
The Resources Estimator
The Toffoli Simulator
Testing Your Quantum Programs
Testing Qubit in the | 0⟩ State
Testing Qubit in the |1⟩ State
Testing Qubit in the Superposition State
Debugging Your Quantum Programs
DumpMachine
DumpRegister
The Last Word
Part III: Quantum Algorithms
Chapter 8: Deutsch’s Algorithm
The Deutsch Oracle
A Quantum Oracle
Back to the Deutsch Oracle
Constant-0
Constant-1
Identity
Negation
Deutsch’s Algorithm in Q#
A Classical Version
The Quantum Version
The Last Word
Chapter 9: Deutsch-Jozsa Algorithm
The Deutsch-Jozsa Oracle
The Classical Deutsch-Jozsa Algorithm in Q#
Constant-0
Constant-1
Modulo 2
Odd Number of Ones
The Full Implementation in Q#
Back to the Quantum World
Constant-0
Constant-1
Modulo 2
Odd Number of Ones
The Full Quantum Implementation in Q#
The Last Word
Chapter 10: The CHSH Game
Measuring Qubits
Computational Basis
Sign Basis
Measuring in Any Basis
The CHSH Game
Playing the Classic CHSH Game
Implementing the Classic CHSH Game
Playing the quantum CHSH game
Implementing the Quantum CHSH Game
The Last Word
Part IV: What to Do Next?
Chapter 11: Azure Quantum
Quantum Computing
Azure Quantum
Quantum Workspace
Providers and Targets
Jobs
Quantum Computing Jobs
Optimization
Quantum Inspired Optimization
Optimization Jobs
The Last Word
Chapter 12: What’s Next?
Quantum Supremacy
Quantum Error Correction
Quantum Intermediate Representation
Additional Resources
Part V: Appendixes
Appendix I: Trigonometry
Right-Angled Triangle
Degrees and Radians
Trigonometric Ratios
The Unit Circle
Common Trigonometric Values
The Last Word
Solutions to Exercises
Appendix II: Complex Numbers
Complex Numbers
Visualizing a Complex Number
Calculating with Complex Numbers
Adding Complex Numbers
Subtracting Complex Numbers
Multiplying Complex Numbers
Complex Conjugates
Dividing Complex Numbers
Absolute Value or Modulus for Complex Numbers
The Last Word
Solutions to Exercises
Appendix III: Linear Algebra
Vectors and Vector Spaces
Matrices
Matrix Operations
Matrix Multiplication
Tensor Products
Transformation Matrix
The Last Word
Solutions to Exercises
Index