31,19 €
Quantum computing is a growing field, with many research projects focusing on programming quantum computers in the most efficient way possible. One of the biggest challenges faced with existing languages is that they work on low-level circuit model details and are not able to represent quantum programs accurately. Developed by researchers at ETH Zurich after analyzing languages including Q# and Qiskit, Silq is a high-level programming language that can be viewed as the C++ of quantum computers! Quantum Computing with Silq Programming helps you explore Silq and its intuitive and simple syntax to enable you to describe complex tasks with less code.
This book will help you get to grips with the constructs of the Silq and show you how to write quantum programs with it. You’ll learn how to use Silq to program quantum algorithms to solve existing and complex tasks. Using quantum algorithms, you’ll also gain practical experience in useful applications such as quantum error correction, cryptography, and quantum machine learning. Finally, you’ll discover how to optimize the programming of quantum computers with the simple Silq.
By the end of this Silq book, you’ll have mastered the features of Silq and be able to build efficient quantum applications independently.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 371
Veröffentlichungsjahr: 2021
Get up and running with quantum computing with the simplicity of this new high-level programming language
Srinjoy Ganguly
Thomas Cambier
BIRMINGHAM—MUMBAI
Copyright © 2021 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Group Product Manager: Aaron Lazar
Publishing Product Manager: Shweta Bairoliya
Senior Editor: Storm Mann
Content Development Editor: Nithya Sadanandan
Technical Editor: Gaurav Gala
Copy Editor: Safis Editing
Project Coordinator: Deeksha Thakkar
Proofreader: Safis Editing
Indexer: Rekha Nair
Production Designer: Vijay Kamble
First published: April 2021
Production reference: 3090921
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
978-1-80056-966-9
www.packt.com
I dedicate this book to God, my Guru, to my family, my teachers and tutors, and to my amazing friends for their consistent support and encouragement throughout the writing process.
– Srinjoy Ganguly
I would like to thank Prof. Dr. Martin Vechev for giving me the opportunity to write my Master's thesis at the SRI lab at ETH Zurich, and Benjamin Bichsel for his help on implementing quantum algorithms with Silq.
– Thomas Cambier
Srinjoy Ganguly is the founder and CEO of AdroitERA, an EdTech firm, and possesses a Master's in quantum computing technology from the Technical University of Madrid, and a Master's in artificial intelligence from the University of Southampton. He has over 4 years' experience in quantum computing and 5 years' experience in machine learning and deep learning. He currently leads the Quantum Machine Learning (QML) study space at QWorld. He has given an expert talk on QML at IEEE SPS. His research interests include QML, Quantum Image Processing, Quantum Natural Language Processing (QNLP), machine learning, and deep learning.
Thomas Cambier is a French programmer and software developer. After studying top-level mathematics, physics, and computer science at Ecole Polytechnique, France's leading engineering school, he obtained a Master's degree in computer science at ETH Zürich on a broad range of subjects going from algorithmics and cryptography to object-oriented programming. Deeply interested in the promising possibilities resulting from quantum computing, he wrote his Master's thesis on the design of quantum algorithms with Silq, a brand-new high-level quantum language created by a research group at ETH Zürich.
Alberto Maldonado is doing his Ph.D. on QML in computer science at the Center for Computing Research, IPN, Mexico. At his institute, he has collaborated with the Fermilab and CERN research centers for the GeantV project. Alberto has participated in different events, such as Xanadu's Qhack, and was a mentee of QOSF's mentor program. He is passionate about using new technologies and paradigms, such as quantum computing, and is self-taught and diligent.
Quantum computing is an emerging cutting-edge technology that has already started having an impact on various industries, along with academia. Quantum computers have proved that significant speed-ups are possible in different kinds of algorithms over the present classical algorithms. As Moore's law comes to an end, the importance of quantum computers is increasing for various applications, including finance, chemistry, optimization, and many more. One of the major challenges that people in the quantum computing space face is related to low-level circuit programming, which restricts industry and academia from developing quantum applications for deployment.
This book will introduce you to a high-level quantum programming language – Silq. We will utilize Silq to construct quantum circuits on our own, understand and develop important quantum algorithms, and learn about some significant applications of quantum computing, such as quantum error correction, quantum cryptography, and quantum machine learning. You will be learning hands-on Silq programming to understand its unique features, such as more intuitive syntax and automatic uncomputation compared to other quantum programming languages, such as Microsoft Q#.
This Silq quantum computing book is for students, researchers, and scientists looking to learn quantum computing techniques and high-level quantum programming development. Quantum computing enthusiasts who want to explore this futuristic technology will also find this book useful. Beginner-level knowledge of any programming language, as well as mathematical topics such as linear algebra, probability, complex numbers, and statistics, is required.
Chapter 1, Essential Mathematics and Algorithmic Thinking, provides you with a basic foundational knowledge of mathematics and algorithms.
Chapter 2, Quantum Bits, Quantum Measurements, and Quantum Logic Gates, introduces the basics of quantum bits, measurements, and single-qubit quantum logic gates.
In Chapter 3, Multiple Quantum Bits, Entanglement, and Quantum Circuits, you will explore multiple qubits and their various quantum circuits using single- and multi-qubit quantum gates.
Chapter 4, Physical Realization of a Quantum Computer, takes you through various technologies that will enable you to build a real physical quantum computer.
Chapter 5, Challenges in Quantum Computer Programming, will introduce you to the various challenges faced in quantum programming.
In Chapter 6, Silq Programming Basics and Features, we will introduce Silq and help you to start programming with this high-level quantum programming language.
In Chapter 7, Programming Multiple Qubit Quantum Circuits with Silq, you will learn to tackle multiple qubits in Silq and construct various interesting quantum circuits using Silq.
In Chapter 8, Quantum Algorithms I – Deutsch-Jozsa and Bernstein-Vazirani, you will start coding your very first quantum algorithms using Silq – Deutsch-Jozsa, which identifies whether a function is constant or balanced, and Bernstein-Vazirani, which finds a secret string encoded in a function.
In Chapter 9, Quantum Algorithms II – Grover's Search Algorithm and Simon's Algorithm, you will see how to use Grover's search algorithm for unstructured database search, and Simon's algorithm for finding a hidden string.
In Chapter 10, Quantum Algorithms III – Quantum Fourier Transform and Phase Estimation, you will learn two of the most important algorithms – first, the Quantum Fourier Transform (QFT), which is a technique for linear transformations on qubits. Then you will use the QFT to learn about the quantum phase estimation algorithm.
Chapter 11, Quantum Error Correction, offers an introduction to classical error-correction techniques, and you will learn to implement different quantum error-correcting codes to prevent a potential bit-flip or phase-flip from occurring on a qubit.
In Chapter 12, Quantum Cryptography – Quantum Key Distribution, you will see an overview of classical cryptographical methods and learn to implement in Silq a quantum protocol useful to safely exchange keys: quantum key distribution.
In Chapter 13, Quantum Machine Learning, you will explore some important concepts regarding quantum machine learning and recent developments happening in the field of quantum computing.
You will need the latest version of Microsoft Visual Studio Code installed on your Windows computer.
If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.
After you finish with the book, we recommend you try to solve the challenges hosted by Microsoft Q# using Silq language for more programming practice!
You can find those challenges in the following links:
Microsoft coding contest 2018: https://codeforces.com/contest/1002/Microsoft coding contest 2019: https://codeforces.com/contest/1116/Some of the challenges, solved using Silq, have been given in the Silq documentation: https://silq.ethz.ch/examplesYou can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Quantum-Computing-with-Silq-Programming. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781800569669_ColorImages.pdf.
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "In the second line, the coerce keyword forces the secret string to be a classical unsigned integer on four qubits."
A block of code is set as follows:
def scal[n:!ℕ](const x:uint[n], const y:uint[n])qfree:uint[n] {
count := 0:uint[n];
for k in [0..n) {
count += x[k] && y[k];
}
return count;
}
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
def scal[n:!ℕ](const x:uint[n], const y:uint[n])qfree:uint[n] {
count := 0:uint[n];
for k in [0..n) {
count += x[k] && y[k];
}
return count;
}
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "In the world of quantum computing we use the term qubit or quantum bit to represent the bits."
Tips or important notes
Appear like this.
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packt.com.
This part deals with the mathematical prerequisites that are essential for understanding quantum computing and the challenges faced by users who perform quantum programming in their daily lives. The construction of a real quantum computer will also be touched upon briefly. After completing this part, you will feel confident in your mathematical abilities and understand the challenges faced by the quantum computing community.
This section comprises the following chapters:
Chapter 1, Essential Mathematics and Algorithmic ThinkingChapter 2, Quantum Bits, Quantum Measurements, and Quantum Logic GatesChapter 3, Multiple Quantum Bits, Entanglement, and Quantum CircuitsChapter 4, Physical Realization of a Quantum Computer