quantum computing on Strathweb. A free flowing tech monologue.
https://www.strathweb.com/categories/quantum-computing/
Recent content in quantum computing on Strathweb. A free flowing tech monologue.Hugo -- gohugo.ioen-usMon, 23 Jan 2023 15:06:14 +0000Simulating Q# programs with QIR runner
https://www.strathweb.com/2023/01/simulating-qsharp-programs-with-qir-runner/
Mon, 23 Jan 2023 15:06:14 +0000https://www.strathweb.com/2023/01/simulating-qsharp-programs-with-qir-runner/<p>I recently <a href="https://www.strathweb.com/2022/07/running-q-and-qdk-on-arm64-mac/">blogged</a> about the rather unfortunate series of steps that are needed to make the Q# simulator work on arm64 Mac computers, since that platform is sadly not supported out of the box.</p>
<p>In today’s post we are going to kill two birds with one stone - we will make local simulation of Q# programs on arm64 MacOS much easier and we will additionally see how we can simulate Q# programs that happen to be compiled to <a href="https://www.qir-alliance.org">QIR</a>.</p>Q# Holiday Calendar 2022 – Peeking into Santa’s gifts with Q#
https://www.strathweb.com/2022/12/q-holiday-calendar-2022-peeking-into-santas-gifts-with-q/
Thu, 08 Dec 2022 08:08:45 +0000https://www.strathweb.com/2022/12/q-holiday-calendar-2022-peeking-into-santas-gifts-with-q/<p>🎄 This post is part of the <a href="https://devblogs.microsoft.com/qsharp/q-holiday-calendar-2022/">Q# Holiday Calendar 2022</a>. 🎅🏻</p>
<p>In 1993, Avshalom Elitzur and Lev Vaidman from Tel-Aviv University wrote a <a href="https://arxiv.org/abs/hep-th/9305002">paper</a> in which they proposed a fascinating thought experiment. They described bombs equipped with a very sensitive triggering mechanism - through interaction with a single photon only - and then proceeded to show that using quantum effects, in a procedure they called “interaction-free measurement”, such bombs can be safely (without triggering the explosion) tested to determine whether a given bomb is armed or not.</p>
<p>We will explore this concept in this post using Q#, but since we do not want to have anything to do with the bombs, we will replace the original thought experiment with something much better - Santa’s gifts! 🎁</p>Running Q# and QDK on arm64 Mac
https://www.strathweb.com/2022/07/running-q-and-qdk-on-arm64-mac/
Fri, 29 Jul 2022 14:55:48 +0000https://www.strathweb.com/2022/07/running-q-and-qdk-on-arm64-mac/<p>Due to a combination of issues, the current Microsoft.Quantum.Sdk (at the time of writing, version <em>0.25.222597</em>) does not support arm64 Macs, which of course are the flagship Apple silicon processors from the M1 and M2 family.</p>
<p>Hopefully these issues get resolved soon, but until then, this post will chronicle the necessary workarounds to be able to write Q#/QDK code on arm64 Macs.</p>Announcing TextMate grammar community project for Q#
https://www.strathweb.com/2022/06/announcing-textmate-grammar-community-project-for-q/
Wed, 29 Jun 2022 14:33:56 +0000https://www.strathweb.com/2022/06/announcing-textmate-grammar-community-project-for-q/I have recently started a new Q# community repo, aimed at bringing a holistic and structured approach for building up Q# TextMate grammar.
TextMate grammars are based on regular expressions from the Oniguruma regex engine and are a de-facto standard for syntax highlighting and tokenization for programming languages. Popular editors such as Visual Studio Code or Sublime Text base their syntax highlighting on such grammars.
At the moment, the Q# LSP extension ships with a very basic TextMate grammar only, focused on a handful of keywords and specially designated symbol names only.Announcing my new Q# and quantum computing book
https://www.strathweb.com/2022/05/announcing-my-new-q-and-quantum-computing-book/
Mon, 09 May 2022 13:43:08 +0000https://www.strathweb.com/2022/05/announcing-my-new-q-and-quantum-computing-book/I am extremely happy to announce that on 7 May 2022, my new book, “Introduction to Quantum Computing with Q# and QDK” has been published by Springer, as part of the excellent Quantum Science and Technology series. From now on, you can also see the book in the sidebar of this website.
I am extremely proud of this moment - it is the result of almost 2 years of hard work and countless long nights.Q# Advent Calendar 2020 – Partial application in Q#
https://www.strathweb.com/2021/12/q-advent-calendar-2020-partial-application-in-q/
Tue, 28 Dec 2021 11:04:29 +0000https://www.strathweb.com/2021/12/q-advent-calendar-2020-partial-application-in-q/Recently, as part of Q# Advent Calendar 2021, I published a special quest post on Q# Community blog. You can find my post on “Partial callable application in Q#” on the here. Enjoy!Difference between R1 and Rz gate in quantum computing
https://www.strathweb.com/2021/12/difference-between-r1-and-rz-gate-in-quantum-computing/
Tue, 07 Dec 2021 17:12:01 +0000https://www.strathweb.com/2021/12/difference-between-r1-and-rz-gate-in-quantum-computing/<p>In this post we will have a look at the subtle difference between two single qubit rotation gates - <em>Rz</em> and <em>R1</em>. Q# distinguishes between them, and the are de facto the same, yet differ in a very subtle way.</p>Introduction to quantum computing with Q# – Part 19, Quantum Phase Estimation
https://www.strathweb.com/2021/04/introduction-to-quantum-computing-with-q-part-19-quantum-phase-estimation/
Wed, 28 Apr 2021 14:20:56 +0000https://www.strathweb.com/2021/04/introduction-to-quantum-computing-with-q-part-19-quantum-phase-estimation/<p><a href="https://www.strathweb.com/2021/04/introduction-to-quantum-computing-with-q-part-18-quantum-fourier-transform/">Last time</a> we discussed the Quantum Fourier Transform - one of the important building blocks for more complex quantum algorithms. In this post, we will build upon that knowledge and take advantage of the QFT functionality, to explore another important subroutine that is used in many quantum programs, namely quantum phase estimation.</p>Introduction to quantum computing with Q# – Part 18, Quantum Fourier Transform
https://www.strathweb.com/2021/04/introduction-to-quantum-computing-with-q-part-18-quantum-fourier-transform/
Thu, 01 Apr 2021 06:56:54 +0000https://www.strathweb.com/2021/04/introduction-to-quantum-computing-with-q-part-18-quantum-fourier-transform/<p>In today’s post we will explore one of the important algorithm building blocks in quantum computing theory, called the Quantum Fourier Transform. It is a quantum variant of the classical <a href="https://en.wikipedia.org/wiki/Discrete_Fourier_transform">Discrete Fourier Transform</a> and is used in a number of algorithms such as Shor’s factoring algorithm, quantum phase estimation or quantum algorithm for linear systems of equations.</p>Introduction to quantum computing with Q# – Part 17, Grover’s algorithm
https://www.strathweb.com/2021/03/introduction-to-quantum-computing-with-q-part-17-grovers-algorithm/
Fri, 19 Mar 2021 15:49:31 +0000https://www.strathweb.com/2021/03/introduction-to-quantum-computing-with-q-part-17-grovers-algorithm/<p><a href="https://www.strathweb.com/2021/03/introduction-to-quantum-computing-with-q-part-16-quantum-search/">Last time</a> we looked at the basic theory behind quantum search based on the Grover’s algorithm. We went through the most basic case, a data set consisting of four items, and applied the algorithm to that, learning in the process that it managed to find the relevant entry we were looking for in a single step - compared to an average expected 2.25 steps required by the classical computation theory.</p>
<p>In this part, we will look at the more general theory behind Grover’s algorithm, and implement the general Q# variant that can be used to find any number in an arbitrarily large data set.</p>Introduction to quantum computing with Q# – Part 16, Quantum search
https://www.strathweb.com/2021/03/introduction-to-quantum-computing-with-q-part-16-quantum-search/
Fri, 05 Mar 2021 21:08:31 +0000https://www.strathweb.com/2021/03/introduction-to-quantum-computing-with-q-part-16-quantum-search/<p>In this post we will start exploring the topic of quantum search - the ability to locate a specific qubit state in an unsorted data set represented in a qubit register. We will look at the mathematics behind this problem, at the Q# code illustrating some basic examples and explain how the different building blocks fit together. This will help us lay ground for a more comprehensive discussion of the so-called Grover’s algorithm next time.</p>Introduction to quantum computing with Q# – Part 15, Deutsch-Jozsa algorithm
https://www.strathweb.com/2021/02/introduction-to-quantum-computing-with-q-part-15-deutsch-jozsa-algorithm/
Thu, 25 Feb 2021 08:25:20 +0000https://www.strathweb.com/2021/02/introduction-to-quantum-computing-with-q-part-15-deutsch-jozsa-algorithm/<p><a href="https://www.strathweb.com/2021/01/introduction-to-quantum-computing-with-q-part-14-deutschs-problem/">Last time</a>, we discussed a problem originally stated by David Deutsch, focusing on determining whether a function is constant or balanced. We found out that for that specific problem, quantum computing provides a much better query complexity than classical computing - as it can solve the task in a single blackbox function evaluation, while classical computing requires two function evaluations to provide the same answer.</p>
<p>Today, we shall look at the generalization of that simple problem.</p>Introduction to quantum computing with Q# – Part 14, Deutsch’s problem
https://www.strathweb.com/2021/01/introduction-to-quantum-computing-with-q-part-14-deutschs-problem/
Mon, 18 Jan 2021 20:08:22 +0000https://www.strathweb.com/2021/01/introduction-to-quantum-computing-with-q-part-14-deutschs-problem/<p>Over the course of this series, we have developed a solid foundational understanding of quantum computing, as we learned about the basic paradigms, mathematics and various computational concepts that characterize this unique disciple. We are now well equipped to start exploring some of the most important quantum algorithms - starting with today’s part 14, which will be devoted to a simple oracle problem formulated by David Deutsch.</p>Introduction to quantum computing with Q# – Part 13, CHSH Game
https://www.strathweb.com/2021/01/introduction-to-quantum-computing-with-q-part-13-chsh-game/
Wed, 06 Jan 2021 21:43:21 +0000https://www.strathweb.com/2021/01/introduction-to-quantum-computing-with-q-part-13-chsh-game/<p><a href="https://www.strathweb.com/2020/12/introduction-to-quantum-computing-with-q-part-12-bells-inequality/">Last time</a> we had an in-depth look at the original Bell’s inequality, and we wrote some Q# code that allowed us to quickly empirically test the predictions of quantum mechanics in that area.</p>
<p>In today’s post, we will continue with a generalization of Bell’s inequalities, called Clauser-Horne-Shimony-Holt<br>
inequality (in short CHSH), and discuss a simple game based on that. In the process, we will arrive at a remarkable conclusions - we will learn that for a certain class of simple boolean logic problems, they can be solved more efficiently when adopting a quantum strategy compared to a classical “common sense” approach.</p>Introduction to quantum computing with Q# – Part 12, Bell’s inequality
https://www.strathweb.com/2020/12/introduction-to-quantum-computing-with-q-part-12-bells-inequality/
Tue, 22 Dec 2020 14:33:50 +0000https://www.strathweb.com/2020/12/introduction-to-quantum-computing-with-q-part-12-bells-inequality/<p>After a short multi-part detour into the world of quantum cryptography, in this part 12 of the series, we are going to return to some of the foundational concepts of quantum mechanics, and look at the programmatic verification of Bell’s inequality.</p>Q# Advent Calendar 2020 – Creating Q# Compiler Rewrite Steps
https://www.strathweb.com/2020/12/q-advent-calendar-2020-creating-q-compiler-rewrite-steps/
Mon, 14 Dec 2020 16:09:08 +0000https://www.strathweb.com/2020/12/q-advent-calendar-2020-creating-q-compiler-rewrite-steps/On this day 120 years ago, December 14 1900, Max Planck presented to the German Physical Society his work on spectral density of black body radiation, and postulated that electromagnetic energy could only be emitted in quantized packets. This date is now widely considered to be the the birth of quantum theory. The work of Planck sparked an explosion of theoretical and empirical work, which resulted in arguably the most intense and transformational periods in the history of science.Introduction to quantum computing with Q# – Part 11, EPR Quantum Key Distribution
https://www.strathweb.com/2020/12/introduction-to-quantum-computing-with-q-part-11-epr-quantum-key-distribution/
Wed, 02 Dec 2020 22:24:49 +0000https://www.strathweb.com/2020/12/introduction-to-quantum-computing-with-q-part-11-epr-quantum-key-distribution/<p>In the last two posts we covered quantum key exchange using the <a href="https://www.strathweb.com/2020/11/introduction-to-quantum-computing-with-q-part-10-b92-quantum-key-distribution/">B92</a> and <a href="https://www.strathweb.com/2020/10/introduction-to-quantum-computing-with-q-part-9-bb84-quantum-key-distribution/">BB84</a> protocols. Both of those depended with their security on the <a href="https://www.strathweb.com/2020/08/introduction-to-quantum-computing-with-q-part-6-no-cloning-theorem/">no-cloning theorem</a>. Today we are going to dedicate a third post to the topic of quantum key distribution, and this time around we will explore a variant of key distribution relying on the phenomenon of entanglement and quantum correlations.</p>Introduction to quantum computing with Q# – Part 10, B92 Quantum Key Distribution
https://www.strathweb.com/2020/11/introduction-to-quantum-computing-with-q-part-10-b92-quantum-key-distribution/
Tue, 17 Nov 2020 20:50:49 +0000https://www.strathweb.com/2020/11/introduction-to-quantum-computing-with-q-part-10-b92-quantum-key-distribution/<p>In the <a href="https://www.strathweb.com/2020/10/introduction-to-quantum-computing-with-q-part-9-bb84-quantum-key-distribution/">last part</a> of this series we started talking about the area of quantum cryptography, or more accurately, quantum key distribution. We dissected, in considerable amount of detail, the BB84 protocol, and discussed how it can lead to effectively unbreakable cryptography.</p>
<p>Today we shall continue with quantum key distribution by looking at a sibling to BB84, the B92 protocol.</p>Introduction to quantum computing with Q# – Part 9, BB84 Quantum Key Distribution
https://www.strathweb.com/2020/10/introduction-to-quantum-computing-with-q-part-9-bb84-quantum-key-distribution/
Fri, 16 Oct 2020 12:54:26 +0000https://www.strathweb.com/2020/10/introduction-to-quantum-computing-with-q-part-9-bb84-quantum-key-distribution/<p>This is already part 9 of the series (time flies!). So far we have covered a wide array of topic around the nature of quantum computational units called qubits, superposition, entanglement, single-qubit gates, multi-qubit gates and some interesting concepts from the area of quantum information theory. In this post we will shift our attention to another interesting field in the quantum landscape - quantum cryptography. More specifically, we will explore a reference protocol for quantum key distribution, called BB884, discuss why it’s secure even when using a public channel to exchange qubits and realize a simple demonstrative implementation using Q#.</p>Introduction to quantum computing with Q# – Part 8, Superdense coding
https://www.strathweb.com/2020/09/introduction-to-quantum-computing-with-q-part-8-superdense-coding/
Wed, 16 Sep 2020 18:25:15 +0000https://www.strathweb.com/2020/09/introduction-to-quantum-computing-with-q-part-8-superdense-coding/<p>Last time, we discussed the <a href="https://www.strathweb.com/2020/09/introduction-to-quantum-computing-with-q-part-7-quantum-state-teleportation/">quantum teleportation protocol</a>, which relies on the phenomenon of quantum entanglement to move an arbitrary quantum state from one qubit to another, even if they are spatially separated. Today, we shall continue exploring the scenarios enabled by entanglement, by looking at the concept called “superdense coding”. It allows communicating two classical bits of information between two parties, by moving only a single qubit between them.</p>Introduction to quantum computing with Q# – Part 7, Quantum state teleportation
https://www.strathweb.com/2020/09/introduction-to-quantum-computing-with-q-part-7-quantum-state-teleportation/
Fri, 04 Sep 2020 04:50:56 +0000https://www.strathweb.com/2020/09/introduction-to-quantum-computing-with-q-part-7-quantum-state-teleportation/<p>In the <a href="https://www.strathweb.com/2020/08/introduction-to-quantum-computing-with-q-part-6-no-cloning-theorem/">previous part</a> of the series we discussed how quantum theory prohibits copying of an arbitrary quantum state. In computing terms, this means that regardless of the richness of features provided by high-level quantum-specific languages such as Q#, we cannot implement a classical functionality of copy-and-paste on a quantum computer.</p>
<p>It turns out, however, that we can achieve a cut-and-paste type of effect, through a remarkable process of quantum teleportation.</p>Introduction to quantum computing with Q# – Part 6, No-cloning theorem
https://www.strathweb.com/2020/08/introduction-to-quantum-computing-with-q-part-6-no-cloning-theorem/
Mon, 17 Aug 2020 20:54:58 +0000https://www.strathweb.com/2020/08/introduction-to-quantum-computing-with-q-part-6-no-cloning-theorem/<p>In the <a href="https://www.strathweb.com/2020/07/introduction-to-quantum-computing-with-q-part-5-entanglement/">last part</a> of this series we looked at the phenomenon of entanglement - one of the core concepts of quantum theory, which has been fundamentally important in the development of quantum information theory. We grappled with its deeply mysterious behavior and tried to understand and project its consequences onto the Q# code.</p>
<p>In today’s part 6, we shall ask ourselves a seemingly innocent question - how to you clone a quantum state, or in other words, how do you copy a qubit?</p>Running Q# compiler and simulation programmatically from a C# application
https://www.strathweb.com/2020/08/running-q-compiler-and-simulation-programmatically-from-a-c-application/
Wed, 05 Aug 2020 09:56:55 +0000https://www.strathweb.com/2020/08/running-q-compiler-and-simulation-programmatically-from-a-c-application/<p>The QDK provides an excellent, low barrier way of getting started with Q# development - without having to deal with the compiler directly, or worrying about how to simulate the code you wrote on a classical device. Additionally, for more technically versed users, the Q# compiler is also available as a command line utility that can be used to fine tune the compilation experience and cater to complex scenarios. The QDK is <a href="https://docs.microsoft.com/en-us/quantum/?view=qsharp-preview">well documented</a>, and the command line compiler provides good documentation as part of the application itself, but one of the things that is not widely known is that the Q# compiler can also be easily used programmatically - via its Nuget package.</p>
<p>Let’s have a look.</p>Introduction to quantum computing with Q# – Part 5, Entanglement
https://www.strathweb.com/2020/07/introduction-to-quantum-computing-with-q-part-5-entanglement/
Mon, 06 Jul 2020 13:15:50 +0000https://www.strathweb.com/2020/07/introduction-to-quantum-computing-with-q-part-5-entanglement/<p>In the <a href="https://www.strathweb.com/2020/06/introduction-to-quantum-computing-with-q-part-4-multi-qubit-gates/">last post</a> in this series we dove deep into the mathematics and usage examples of multi-qubit gates, with special attention paid to one of the most critical gates in quantum computing, the CNOT gate.</p>
<p>In today’s post we are going to explore the wonders of entanglement - a core concept of quantum mechanics and a critical idea for quantum computing, where it is obtained via the application of the CNOT gate.</p>Introduction to quantum computing with Q# – Part 4, multi-qubit gates
https://www.strathweb.com/2020/06/introduction-to-quantum-computing-with-q-part-4-multi-qubit-gates/
Wed, 24 Jun 2020 18:07:08 +0000https://www.strathweb.com/2020/06/introduction-to-quantum-computing-with-q-part-4-multi-qubit-gates/<p>In the <a href="https://www.strathweb.com/2020/05/introduction-to-quantum-computing-with-q-part-3-single-qubit-gates/">previous post</a> of this series, we discussed single qubit gates. In this next instalment, we are going to explore gates that act on multiple qubits at once, thus completing the exploration of quantum circuit building. We are also going to slowly, but diligently uncover the underlying theoretical scheme towards one of the most bizarre concepts in quantum mechanics - entanglement, which is something that will be dedicating the next part to.</p>Standalone Q# console applications
https://www.strathweb.com/2020/06/standalone-q-console-applications/
Tue, 16 Jun 2020 16:39:19 +0000https://www.strathweb.com/2020/06/standalone-q-console-applications/Last week I wrote a guest post on the Q# community blog about the new standalone/self-contained Q# applications that were introduced in Microsoft Quantum Development Kit 0.11.2004.2825.
In the post I go over the various aspects of the feature, discuss the new @EntryPoint() attribute that was introduced into Q# and dive deeper into some implementation details. Enjoy the article!Introduction to quantum computing with Q# – Part 3, Single qubit gates
https://www.strathweb.com/2020/05/introduction-to-quantum-computing-with-q-part-3-single-qubit-gates/
Wed, 20 May 2020 05:50:20 +0000https://www.strathweb.com/2020/05/introduction-to-quantum-computing-with-q-part-3-single-qubit-gates/<p>We left off in the last post after having discussed the Hadamard gate - our first quantum gate - and how it can be used to crate a uniform superposiiton for a single qubit. We are going to continue today by exploring other single qubit gates, discussing the underlying mathematics and, of course, testing it all out with some Q# code.</p>Introduction to quantum computing with Q# – Part 2, Superposition
https://www.strathweb.com/2020/04/intro-to-quantum-computing-with-q-part-2-superposition/
Wed, 08 Apr 2020 19:52:34 +0000https://www.strathweb.com/2020/04/intro-to-quantum-computing-with-q-part-2-superposition/<p><a href="https://www.strathweb.com/2020/03/intro-to-quantum-computing-with-q-part-1-the-background-and-the-qubit/">In the previous post</a> in this series we mentioned the concept of superposition briefly. Let’s use this second part to dive deeper into the mathematics of it, meet the cat of Schrödinger and try to find some simple quantum computing use cases for it.</p>Introduction to quantum computing with Q# – Part 1, The background and the qubit
https://www.strathweb.com/2020/03/intro-to-quantum-computing-with-q-part-1-the-background-and-the-qubit/
Fri, 20 Mar 2020 15:12:40 +0000https://www.strathweb.com/2020/03/intro-to-quantum-computing-with-q-part-1-the-background-and-the-qubit/<p>Quantum mechanics is one of the fundamental theories of physics, and has been tremendously successful at describing the behavior of subatomic particles. However, its counter-intuitive probabilistic nature, bizarre rules and confusing epistemology have troubled some of the greatest physicists of the 20th century, even prompting Albert Einstein to remark “Old Man (often translated as ‘God’) doesn’t play dice”.</p>
<p>In this post I am starting a new series that will introduce the basics of quantum computing - using examples in Q#.</p>