量子计算机编程_对量子计算机进行编程

量子计算机编程

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.

在软件方面,一些研究人员预测,在未来十年中,对量子程序员的市场需求将成倍增长。 Google,IBM和Microsoft等公司正投入大量精力和大量资金来培训下一代量子研究人员/程序员。

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)

Image for post
Canva). Canva制作 )。

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.

这听起来可能很有挑战性,因为汇编语言一点都不容易。 事实是,如果您知道基本的门以及量子位和叠加的含义,就可以开始对量子计算机进行编程。 您无需深入物理学即可开始编写体面的量子代码。

Image for post
Canva). Canva制作 )。

量子计算机编程的选项 (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.

因此,您的选择将是在量子汇编级别上进行编程,使用通过经典编程语言进行量子计算的库或使用纯量子编程语言。 我将列出每个类别中最知名/最活跃的选项。

Image for post
Canva). Canva制作 )。

汇编级量子编程 (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).

    QX模拟器 :此模拟器旨在模拟通用量子计算机的行为。 它允许程序员设计和模拟他们的量子算法。 为了使用QX Simulator实现算法,程序员需要用量子汇编语言 (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.

    Pyquil 由Rigetti构建的Python库,用于使用称为Quil的量子指令语言(也由Rigetti开发)在Rigetti机器上编写和实现量子算法。 Quil的语法与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.

如果我想更深入地研究量子计算机的工作原理以及各门之间的动态关系,我只会考虑使用低级语言(例如QX Simulator)。

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.

我从Qiskit开始,至今仍然广泛使用它-不仅因为它是用Python编写的,而且因为我可以在真正的量子计算机上运行代码。 是的,现在的结果很糟糕,但是实际上可以在量子计算机上运行代码仍然是一个有趣的事实。

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相等的叠加。

  1. Using QX Simulator:

    使用QX Simulator:
Image for post
Canva). Canva制作 )。

2. Using libraries on classical programming languages:

2.使用经典编程语言上的库:

Image for post
Canva). Canva制作 )。

3. Using pure quantum programming languages:

3.使用纯量子编程语言:

Image for post
Canva). Canva制作 )。

结论 (Conclusion)

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。

翻译自: https://medium.com/better-programming/program-a-quantum-computer-today-a62de23268f0

量子计算机编程

很抱歉,根据提供的引用内容,我无法直接回答您关于量子计算编程的PDF的问题。引用提到了量子编程语言,但并没有提及PDF文件。另外,引用和提到了量子计算的关键词和体系结构,但同样没有提及PDF文件。 然而,我可以为您提供一些关于量子计算编程的一般信息,希望对您有所帮助。 量子计算编程是指使用特定的编程语言算法来设计和实现在量子计算上运行的程序。与传统的计算编程不同,量子计算编程涉及到利用量子比特(qubit)的特性进行计算。 目前,已经存在一些量子编程语言,例如Qiskit、Q#和Cirq等。这些语言提供了一系列的量子算法和工具,使得开发人员能够利用量子计算的优势来解决特定的问题。 此外,了解量子计算的物理实现也是量子计算编程的重要一步。引用和提到了物理实现的内容,这包括使用不同的技术来构建量子比特,例如超导电路、离子阱和拓扑量子计算等。 对于进一步学习量子计算编程的资料,您可以参考各种在线教程、学术论文和专业书籍。一些量子计算的研究构和公司也提供了相关的教育资源和文档。 总结起来,量子计算编程是利用特定的编程语言算法来设计和实现在量子计算上运行的程序。虽然我无法提供具体的量子计算编程的PDF文件,但您可以通过学习量子编程语言和了解量子计算的物理实现来深入了解这个领域。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值