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

2023-11-06

量子计算机编程

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)

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.

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

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.

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

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:
Canva). Canva制作 )。

2. Using libraries on classical programming languages:

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

Canva). Canva制作 )。

3. Using pure quantum programming languages:

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

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

量子计算机编程

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

量子计算机编程_对量子计算机进行编程 的相关文章

  • 如何使用 Python 3 检查目录是否包含文件

    我到处寻找这个答案但找不到 我正在尝试编写一个脚本来搜索特定的子文件夹 然后检查它是否包含任何文件 如果包含 则写出该文件夹的路径 我已经弄清楚了子文件夹搜索部分 但检查文件却难倒了我 我发现了有关如何检查文件夹是否为空的多个建议 并且我尝
  • 找到一个数字所属的一组范围

    我有一个 200k 行的数字范围列表 例如开始位置 停止位置 该列表包括除了非重叠的重叠之外的所有类型的重叠 列表看起来像这样 3 5 10 30 15 25 5 15 25 35 我需要找到给定数字所属的范围 并对 100k 个数字重复该
  • 我可以使用 moq Mock 来模拟类而不是接口吗?

    正在经历https github com Moq moq4 wiki Quickstart https github com Moq moq4 wiki Quickstart 我看到它 Mock 一个接口 我的遗留代码中有一个没有接口的类
  • Azure 辅助角色“请求输入之一超出范围”的内部异常。

    我在辅助角色中调用 CloudTableClient CreateTableIfNotExist 方法 但收到一个异常 其中包含 请求输入之一超出范围 的内部异常 我做了一些研究 发现这是由于将表命名为非法表名引起的 但是 我尝试为我的表命
  • CMake 无法确定目标的链接器语言

    首先 我查看了this https stackoverflow com questions 11801186 cmake unable to determine linker language with c发帖并找不到解决我的问题的方法 我
  • Python:Goslate 翻译请求返回“503:服务不可用”[关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我们不允许提出寻求书籍 工具 软件库等推荐的问题 您可以编辑问题 以便用事实和引文来回答 这个问题似乎不是关于主要由程序员使用的特定编程问
  • 动态添加 ASP.Net 控件

    我有一个存储过程 它根据数据库中存储的记录数返回多行 现在我想有一种方法来创建 div 带有包含该行值的控件的标记 如果从数据库返回 10 行 则 10 div 必须创建标签 我有下面的代码来从数据库中获取结果 但我不知道如何从这里继续 S
  • 将 MQTTNet 服务器与 MQTT.js 客户端结合使用

    我已经启动了一个 MQTT 服务器 就像this https github com chkr1011 MQTTnet tree master例子 该代码托管在 ASP Net Core 2 0 应用程序中 但我尝试过控制台应用程序 但没有成
  • 为什么 gcc 抱怨“错误:模板参数 '0' 的类型 'intT' 取决于模板参数”?

    我的编译器是gcc 4 9 0 以下代码无法编译 template
  • 长轮询会冻结浏览器并阻止其他 ajax 请求

    我正在尝试在我的中实现长轮询Spring MVC Web 应用程序 http static springsource org spring docs 2 0 x reference mvc html但在 4 5 个连续 AJAX 请求后它会
  • C++ 函数重载类似转换

    我收到一个错误 指出两个重载具有相似的转换 我尝试了太多的事情 但没有任何帮助 这是那段代码 CString GetInput int numberOfInput BOOL clearBuffer FALSE UINT timeout IN
  • 如何使用 PrimaryKeyRelatedField 更新多对多关系上的类别

    Django Rest 框架有一个主键相关字段 http www django rest framework org api guide relations primarykeyrelatedfield其中列出了我的 IDmany to m
  • 使用 svn 1.8.x、subclise 1.10 的 m2e-subclipse 连接器在哪里?

    我读到 m2e 的生产商已经停止生产 svn 1 7 以外的任何版本的 m2e 连接器 Tigris 显然已经填补了维护 m2e subclipse 连接器的空缺 Q1 我的问题是 使用 svn 1 8 x 的 eclipse 更新 url
  • 如果没有抽象成员,基类是否应该标记为抽象?

    如果一个类没有抽象成员 可以将其标记为抽象吗 即使没有实际理由直接实例化它 除了单元测试 是的 将不应该实例化的基类显式标记为抽象是合理且有益的 即使在没有抽象方法的情况下也是如此 它强制执行通用准则来使非叶类抽象 它阻止其他程序员创建该类
  • python 对浮点数进行不正确的舍入

    gt gt gt a 0 3135 gt gt gt print 3f a 0 314 gt gt gt a 0 3125 gt gt gt print 3f a 0 312 gt gt gt 我期待 0 313 而不是 0 312 有没有
  • 双枢轴快速排序和快速排序有什么区别?

    我以前从未见过双枢轴快速排序 是快速排序的升级版吗 双枢轴快速排序和快速排序有什么区别 我在 Java 文档中找到了这个 排序算法是双枢轴快速排序 作者 弗拉基米尔 雅罗斯拉夫斯基 乔恩 本特利和约书亚 布洛赫 这个算法 在许多数据集上提供
  • Oracle Data Provider for .NET 不支持 Oracle 19.0.48.0.0

    我们刚刚升级到 Oracle 19c 19 3 0 所有应用程序都停止工作并出现以下错误消息 Oracle Data Provider for NET 不支持 Oracle 19 0 48 0 0 我将 Oracle ManagedData
  • Spring Rest 和 Jsonp

    我正在尝试让我的 Spring Rest 控制器返回jsonp但我没有快乐 如果我想返回 json 但我有返回的要求 完全相同的代码可以正常工作jsonp我添加了一个转换器 我在网上找到了用于执行 jsonp 转换的源代码 我正在使用 Sp
  • 当从finally中抛出异常时,Catch块不会被评估

    出现这个问题的原因是之前在 NET 4 0 中运行的代码在 NET 4 5 中因未处理的异常而失败 部分原因是 try finallys 如果您想了解详细信息 请阅读更多内容微软连接 https connect microsoft com
  • 如何将 PostgreSql 与 EntityFramework 6.0.2 集成? [复制]

    这个问题在这里已经有答案了 我收到以下错误 实体框架提供程序类型的 实例 成员 Npgsql NpgsqlServices Npgsql 版本 2 0 14 2 文化 中性 PublicKeyToken 5d8b90d52f46fda7 没

随机推荐

  • e7用什么主板_【有趣】第3期:八路E7的结局如何?盘点历代至尊版处理器现价...

    0 前言 什么八路E7 四路泰坦 你想在显卡吧出人头地受人膜拜 进阶的门槛似乎有些高 不过不论是当年人们口中顶级的至强E7 8870 还是GTX Titan 都经受不住时间的考验 现在组8路E7要不是主板不好买 要不然 这8个CPU加起来
  • no model named “compat“ ,Tensorflow 版本问题

    查看我的版本 Module tf compat TensorFlow Core v2 6 0Compatibility functions https tensorflow google cn versions r2 6 api docs
  • ChatGPT写文章教程_如何使用ChatGPT写文章

    如何用ChatGPT写出高质量文章 ChatGPT是一种基于人工智能技术的自然语言处理工具 它可以生成高质量的文章 但是如何利用它来写出优秀的文章呢 本文将为你介绍如何使用ChatGPT来写出高质量的文章 一 什么是ChatGPT Chat
  • MySQL数据库——DML基本操作

    文章目录 前言 插入数据 全列插入 指定列插入 修改数据 删除数据 前言 前面我们学习了MySQL DDL操作 对数据库和表的结构的操作 那么今天我将为大家分享MySQL DML操作 对表数据的操作 MySQL DML操作有以下几种 插入操
  • linux下的定时任务

    linux环境下 我们有两种常用的方式实现定时的任务 等待一段时间后执行某任务 一次性 该类型的需求直接通过sleep方法即可完成 1小时候执行ls任务 并将输出重定向至ls log sleep 1h ls gt gt ls log 每日定
  • 对话Sam Altman与Greg Brockman:初心和过去,信念和现在,责任和未来

    导读 近日 硅谷著名投资人Reid Hoffman和Aria Finger联手对Sam Altman和Greg Brockman进行了一场访谈 访谈涉及到主题有 OpenAI的使命 人工智能对教育 医疗等行业的变革性影响 人工智能如何面对监
  • 涂鸦TuyaOS SDK 网关例程-wifi配网

    涂鸦TuyaOS SDK 网关例程 wifi配网 使能WIFI配网预编译宏定义 net tools相关文件路径 配网步骤 如果一直都没配网成功 看下面 总结 使能WIFI配网预编译宏定义 例程默认没开WiFi的demo使能 代码预编译开启使
  • 大学计算机python怎样一个星期速成?

    一 Python基础知识 黑马程序员Python入门教程 适合零基础自学的Python教程 1 学习内容 计算机组成原理 计算机组成部分 操作系统分类 B S和C S架构 理解什么是软件和硬件 Python编程规范 字符串 字典 列表 元组
  • linux网络配通

    Linux网络配置 vim etc sysconfig network scripts ifcfg ens33 ONBOOT yes DNS 8 8 8 8 IPADDR 192 168 118 90 NETMASK 255 255 255
  • 最新版本EMGU使用说明 V4.2

    最新版本EMGU使用说明 V4 2 项目打开nuget搜索 Emgu CV Emgu CV runtime windows 下载安装 说明 netstandard 2 0环境版本 Emgu CV runtime windows 为windo
  • layui的框架导入

    目录 1 导入步骤 2 框架包含的组件 1 导入步骤 1 1 下载框架包 http www layui com 1 2 将layui文件夹拷入项目位置 1 3 页面中导入 layui all js layui css 和 jquery 即可
  • docker启动Nacos docker run requires at least 1 argument.

    nacos启动命令 docker run d e PREFER HOST MODE ip e MODE standalone e SPRING DATASOURCE PLATFORM mysql e MYSQL SERVICE HOST 4
  • glide的基本使用及进阶使用

    glide生命周期管理 内存管理 缓存机制 加载器 观察者模式 前言 本系列博文主要通过借鉴其他优秀博文以及自己的实际开发经验综合得出 主要分析glide相关使用 机制以及设计模式等内容 相信这篇博文会让你对glide有更加深入的理解 本篇
  • 如何手动优化xp系统

    1 删除系统备份的文件 直接在 开始 菜单的 运行 对话框中 输入sfc exe purgecache就可以了 2 删除系统中的帮助文件 如果你没有看帮助的习惯 况且在有时候误操作的时候 常把帮助对话框调出来 就删除了吧 免得浪费空间 找到
  • python项目快速生产依赖库列表

    安装pipreqs库 pip install pipreqs 在项目工程根目标执行以下命令 生成requirements txt pipreqs encoding utf8
  • Debian 8.2 安装docker

    一 安装docker io包之前 需要先设置使用backports源 编辑 etc apt sources list文件 加入下面这一句 deb http http debian net debian jessie backports ma
  • Python进阶-函数、模块和包

    使用如下方法 可以使函数接受不定数目的参数 def add x args total x for arg in args total arg return total 这样定义的函数不能使用关键词传入参数 要使用关键词 可以这样 def a
  • 【Dongle】【数据结构】Linklist L、Linklist *L、Node *p 和Node p

    最近在做数据结构导论试题的时候无意中发现答案中有用到这些东西的Linklist L Linklist L Node p 和Node p 不过不清楚都具体指什么 故而从网上查找了一番 先定义一个单链表结构体 typedef struct no
  • 01-linux下Postgresql的安装

    1 看官网 https www postgresql org download 2 选择系统 这里选择Red Hat family Linux including CentOS Fedora Scientific Oracle varian
  • 量子计算机编程_对量子计算机进行编程

    量子计算机编程 Quantum computing is one of the most rapidly advancing technologies Many companies and research labs are racing