Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Quantum Computing with Silq Programming

You're reading from   Quantum Computing with Silq Programming Get up and running with quantum computing with the simplicity of this new high-level programming language

Arrow left icon
Product type Paperback
Published in Apr 2021
Publisher Packt
ISBN-13 9781800569669
Length 310 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Thomas Cambier Thomas Cambier
Author Profile Icon Thomas Cambier
Thomas Cambier
Srinjoy Ganguly Srinjoy Ganguly
Author Profile Icon Srinjoy Ganguly
Srinjoy Ganguly
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Section 1: Essential Background and Introduction to Quantum Computing
2. Chapter 1: Essential Mathematics and Algorithmic Thinking FREE CHAPTER 3. Chapter 2: Quantum Bits, Quantum Measurements, and Quantum Logic Gates 4. Chapter 3: Multiple Quantum Bits, Entanglement, and Quantum Circuits 5. Chapter 4: Physical Realization of a Quantum Computer 6. Section 2: Challenges in Quantum Programming and Silq Programming
7. Chapter 5: Challenges in Quantum Computer Programming 8. Chapter 6: Silq Programming Basics and Features 9. Chapter 7: Programming Multiple-Qubit Quantum Circuits with Silq 10. Section 3: Quantum Algorithms Using Silq Programming
11. Chapter 8: Quantum Algorithms I – Deutsch-Jozsa and Bernstein-Vazirani 12. Chapter 9: Quantum Algorithms II – Grover's Search Algorithm and Simon's Algorithm 13. Chapter 10: Quantum Algorithms III – Quantum Fourier Transform and Phase Estimation 14. Section 4: Applications of Quantum Computing
15. Chapter 11: Quantum Error Correction 16. Chapter 12: Quantum Cryptography – Quantum Key Distribution 17. Chapter 13: Quantum Machine Learning 18. Other Books You May Enjoy

Implementing the QFT using Silq

In this section, you are going to learn how to implement the QFT algorithm from the very beginning, considering all the mathematics that we have gone through in the Exploring the QFT section.

In Figure 10.2, you can see a diagram of the QFT. This diagram is a generalized version of the QFT circuit that you saw for the three-qubits case in Figure 10.1 in the preceding section:

Figure 10.2 – QFT circuit for n qubits

Our code for the QFT will be based on Figure 10.2. The Silq implementation of the QFT is fairly intuitive and is very concise in size. Using Hadamard and controlled phasing, we generate the state corresponding to the circuit with the qubits in reverse order. Thus, the reversing of the qubits is done in anticipation at the beginning of the function so that, after applying Hadamard and phasing them, the qubits are outputted in the correct order. The code is as follows:

def QFT[n:!](: int[n])mfree: int[n]...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime