Quantum computing is one of the most rapidly advancing technologies. Many companies and research labs are racing to deliver functional quantum hardware to the market as soon as they can. It is one of those fields where every little bit of progress is a significant advancement.
量子计算是最快速发展的技术之一。 许多公司和研究实验室都在竞相将功能量子硬件尽快推向市场。 这是每一个进步都是重大进步的领域之一。
At the moment, there’s no perfect quantum computer that is capable of running promising algorithms, such as Shor’s and Grover’s algorithms. However, current quantum machines are advancing rapidly. IBM speculates that during the next decade, quantum computers will offer an undeniable advantage by solving many problems that are unsolvable on a classical computer.
目前，还没有完美的量子计算机能够运行有前途的算法，例如Shor和Grover的算法。 但是，当前的量子机器正在Swift发展。 IBM推测，在未来十年中，量子计算机将通过解决传统计算机无法解决的许多问题而提供不可否认的优势。
In 2019, IBM proposed a metric to measure how capable and efficient a quantum computer is (on the hardware side), and they called it Quantum Volume (QV). QV is a number calculated based on different factors, such as the number of qubits in the computer, their connectivity, and the measurement error probability. For us to run real-life-sized algorithms on real hardware, we need a large QV. For reference, the highest QV device owned by IBM at the moment is 32.
在2019年，IBM提出了一种度量标准，以衡量量子计算机的功能和效率(在硬件方面)，他们称其为量子体积(QV)。 QV是根据不同因素(例如计算机中的qubit数量，它们的连接性和测量错误概率)计算得出的数字。 为了使我们能够在真实的硬件上运行真实大小的算法，我们需要一个大型QV。 作为参考，IBM目前拥有的最高QV设备为32。
On the software side, some researchers predict that the market need for quantum programmers will grow exponentially over the next decade. Companies such as Google, IBM, and Microsoft are putting in considerable effort and a massive amount of funds to train the next generation of quantum researchers/ programmers.
To program a quantum computer, you don’t need an advanced degree in physics or maths. In my opinion, you just need a good imagination.
经典与量子编程 (Classical vs. Quantum Programming)
Quantum computers operate based on a completely different paradigm than that of classical computers. Here’s a simple way to think about the difference: In classical computers, you have 0s and 1s. However, on a quantum computer, you have 0s, 1s, and “maybe 0 or 1,” which is also called superposition. All quantum algorithms take advantage of the “maybe” state to show the full power of quantum computers. Programming quantum computers today is somewhat like programming classical computers back in the 1950s — in a manner close to assembly language but with a better syntax.
量子计算机基于与经典计算机完全不同的范例进行操作。 这是一种思考差异的简单方法：在传统计算机中，您有0和1。 但是，在量子计算机上，您有0、1和“也许是0或1”，这也称为叠加。 所有量子算法都利用“也许”状态来显示量子计算机的全部功能。 今天的量子计算机编程有点像1950年代的经典计算机编程-以接近汇编语言的方式但具有更好的语法。
That might sound challenging because assembly language is not easy at all. The truth is you can start programming quantum computers if you know the basic gates and what qubits and superposition mean. You don’t need to get deep into the physics to start writing decent quantum code.
量子计算机编程的选项 (Options for Programming a Quantum Computer)
Both companies and research labs have been working really hard to develop a high-level quantum programming language that doesn’t require the programmer to be extremely familiar with quantum physics and quantum mechanics. Right now, there are more standalone quantum programming languages and quantum libraries for classical programming languages than you might think.
So, your options will be either to program on a quantum assembly level, use a library for quantum computing through a classical programming language, or use a pure quantum programming language. I will list the most known/active options for each of the categories.
汇编级量子编程 (Assembly-level quantum programming)
QX Simulator: This simulator is built to simulate the behavior of a universal quantum computer. It allows the programmer to design and simulate their quantum algorithms. To implement an algorithm using QX Simulator, the programmer needs to describe the flow of the algorithm in terms of quantum assembly language (QASM).
带有量子库的古典语言 (Classical language with quantum libraries)
There are many options to use a classical programming language to write quantum code. I will sort them from most to least popular.
Qiskit: Qiskit (Quantum Information Science Kit) is a Python library build developed and maintained by IBM Research in 2017. It is the most popular and widely used quantum programming library. One of the reasons Qiskit is popular its very active and thriving community. Also, you can run your codes written in Python on actual IBM quantum computers.
Qiskit： Qiskit(量子信息科学工具包)是由IBM Research在2017年开发和维护的Python库构建。它是最受欢迎和使用最广泛的量子编程库。 Qiskit之所以受欢迎是因为其活跃而繁荣的社区。 另外，您可以在实际的IBM Quantum计算机上运行用Python编写的代码。
Cirq: This is an unofficial Python library developed by Google developers to write and run tests on Google’s quantum computers. You can use Cirq to write and simulate quantum algorithms. However, Google doesn’t allow anyone to run code on their devices.
Cirq ：这是Google开发人员开发的非官方Python库，用于在Google的量子计算机上编写和运行测试。 您可以使用Cirq编写和模拟量子算法。 但是，Google不允许任何人在其设备上运行代码。
Pyquil: A Python library built by Rigetti to write and implement quantum algorithms on Rigetti machines using a quantum instruction language called Quil (also developed by Rigetti). Quil is similar in syntax to QASM.
Scaffold: Moving on from Python, Scaffold is a C++ library that can be used to write and run quantum algorithms on a classical machine.
脚手架 ： 从Python出发，Scaffold是一个C ++库，可用于在经典计算机上编写和运行量子算法。
Strange: This is a Java API used to write and run quantum algorithms. Strange is distributed through traditional Java distribution channels, which makes it easy to use by leveraging Maven or Gradle.
奇怪 ： 这是用于编写和运行量子算法的Java API。 Strange是通过传统的Java分发渠道分发的，因此可以利用Maven或Gradle轻松使用。
There are many more quantum libraries based on classical programming languages, but many of them are outdated or their development stopped at some point.
量子编程语言 (Quantum programming languages)
To move away from classical programming languages and build standalone quantum languages, researchers have worked and developed quantum programming languages that are close in syntax to famous classical languages. This eases the process of moving from classical to quantum programming. Among these languages are:
为了摆脱古典编程语言并构建独立的量子语言，研究人员已经研究和开发了与著名古典语言在语法上接近的量子编程语言。 这简化了从经典编程到量子编程的过程。 这些语言包括：
Q#: This is a quantum programming language developed by Microsoft to write and execute quantum code. It’s part of Microsoft’s Quantum Development Kit (QDK). The QDK includes a separate simulator and circuit optimizer.
Q＃ ：这是一种由Microsoft开发的用于编写和执行量子代码的量子编程语言。 它是Microsoft量子开发套件(QDK)的一部分。 QDK包括单独的模拟器和电路优化器。
Quipper: This is an embedded quantum programming language that supports functional quantum programming and allows the programmer to describe their algorithms on a higher level than assembly languages. Quipper also includes seven implemented quantum algorithms from current theoretical research.
拆箱机 ： 这是一种嵌入式量子编程语言，支持功能量子编程，并允许程序员在比汇编语言更高的层次上描述其算法。 Quipper还包括从当前理论研究中获得的七种已实现的量子算法。
Sliq: This is the newest quantum programming language, released earlier this year and developed by researchers at ETH Zürich. Sliq offers a high-level representation of quantum algorithms and has a syntax similar to Python and C++.
Sliq ：这是最新的量子编程语言，今年年初发布，由苏黎世联邦理工学院的研究人员开发。 Sliq提供了量子算法的高级表示，并且具有类似于Python和C ++的语法。
如何开始 (How to Start)
With so many options, you may get overwhelmed when trying to choose where to start your quantum journey. Here’s my advice: Start with a library built on a classical programming language you’re used to. Once you’re comfortable with the quantum logic and thinking approach, move to a pure quantum programming language.
有这么多的选择，当您尝试选择从哪里开始量子之旅时，您可能会不知所措。 这是我的建议：从建立在习惯于经典编程语言的库开始。 一旦您对量子逻辑和思维方法感到满意，请转向纯量子编程语言。
I would only consider using a low-level language (e.g. QX Simulator) if I want to dig deeper into how a quantum computer works and the dynamics between the gates.
I started with Qiskit and still use it extensively — not just because it’s written in Python but also because I can run my code on a real quantum computer. Yes, the results are bad now, but it is still an intriguing fact that you can actually run code on a quantum computer.
To make things a bit easier, let’s implement the same quantum code using all nine approaches mentioned above. You can inspect the different ways a circuit is implemented and decide which looks more interesting to start with.
In most quantum programming now, you build a circuit that applies your algorithm using quantum gates, which are equivalent to classical gates. Let’s try to implement a quantum circuit that creates a superposition between two qubits. To do that, you need to know the magic gate — the one that creates superposition. It’s called the Hadamard Gate. You give it 0 or 1, and it returns an equal superposition of 0 and 1.
现在，在大多数量子编程中，您将构建一个电路，该电路使用与经典门等效的量子门来应用算法。 让我们尝试实现一个在两个量子位之间创建叠加的量子电路。 为此，您需要了解魔术门-创造叠加的门。 这就是哈达玛门。 您给它0或1，它返回0和1相等的叠加。
- Using QX Simulator: 使用QX Simulator：
2. Using libraries on classical programming languages:
3. Using pure quantum programming languages:
I am a fan of learning and exploring new things, but I also know that we perform better when we focus our power in learning one thing at a time.
That’s why I suggest you start with a quantum library based on a classical programming language. By doing that, you’re only focusing on getting used to the quantum way of thinking and not learning how to use a specific programming language as well. Once you get comfortable with quantum logic, move on to a quantum programming language. Once you’re comfortable with that and want to expand your knowledge further, go lower and explore QASM.
因此，我建议您从基于经典编程语言的量子库开始。 这样，您只专注于习惯于量子思维方式，而不是学习如何使用特定的编程语言。 一旦您对量子逻辑感到满意，请继续使用量子编程语言。 一旦您对此感到满意，并想进一步扩大自己的知识，那就走低一些，探索QASM。