本代码实现了一个通用量子计算机的模拟器。模拟器允许用户在量子计算机实际部署之前模拟和调试量子算法。

The introduced code implements a simulator of a universal quantum computer. The simulator allows user to simulate and debug quantum algorithms before actual deployment on a quantum computer.

该模拟器基于通用量子计算机的David Deutsch数学模型,因此矩阵乘法和张量积(Kronecker)只是用于模拟的高级数学运算。模拟的结果是量子计算机状态的概率分布。

The simulator is based on David Deutsch mathematical model of a universal quantum computer, so matrix multiplication and tensor (Kronecker) products are only advanced mathematical operations used in simulation. The result of simulation is a probability distribution of a quantum computer states.

量子计算机中的量子算法实际上是一个字符串矩阵。矩阵的行表示算法的q位和列步进。矩阵的每个单元都包含一个量子门。

A quantum algorithm fed into the quantum computer is actually a string matrix. Rows of the matrix represents q-bits and columns steps of the algorithm. Each cell of the matrix contains a quantum gate.

模拟器实现了这些标准的单q位量子门:I, X, Y, Z, H, S, T, RX, RY, RZ, U1, U2, U3。S和T的逆,表示为DS和DT,也可用。门RX、RY、RZ、U1、U2和U3需要输入参数(请参阅函数getOperator以掌握门的实现)。模拟器允许使用上述任何门的一个q位控制版本。例如,控制X,实际上是CNOT门。Toffoli门(或CCNOT)也得到了实现(表示为TF)。

The simulator implements these standard single q-bit quantum gates: I, X, Y, Z, H, S, T, RX, RY, RZ, U1, U2, U3. Inverse of S and T, denoted DS and DT, are available too. Gates RX, RY, RZ, U1, U2 and U3 need parameters (see function getOperator to grasp implementation of the gates). The simulator allows to use one q-bit controlled version of any above discussed gate. For example, controlled X, which is actually CNOT gate. Toffoli gate (or CCNOT) is implemented as well (denoted TF).

模拟器的主要功能是量子计算机。这个函数有三个参数:量子算法、被测q位列表和初始状态。第一个参数包含量子算法本身的矩阵,第二个参数是包含测量的q位索引的行向量(索引从1开始),初始状态包含在算法运行开始时量子计算机状态的列向量。

A main function of the simulator is quantumComputer. This function has three parameters: a quantum algorithm, a list of measured q-bits and initial state. The first parameter contains matrix with quantum algorithm itself, second parameter is a row vector containing indexes of measured q-bits (index start with 1) and initial state contains column vector with the quantum computer state at the beginning of the algorithm run.

函数initializeRegisters和initializeRegistersInt用作初始状态的生成器。第一个函数将单个q位的列表(每个q位的状态q = a|0> + b|1>)转换为它们的张量积,从而准备量子计算机的初始状态。第二个函数将整数转换为量子计算机的初始状态。

Functions initializeRegisters and initializeRegistersInt serve as generator of an initial state. The first function transforms list of single q-bits, each in state q = a|0> + b|1>, to their tensor product and as a result prepares initial state of the quantum computer. Second function transforms integer to the quantum computer initial state.

函数getOperator实现上述所有的单q位门。用户可以在这个函数中添加自己的单q位量子门。

Function getOperator implements all above described single q-bit gates. User can add its own single q-bit quantum gate to this function.

函数getControlledOperator和toffoliAlgorithmPreprocess是辅助函数,用户可以忽略它们,因为它们只在函数quantumComputer内部调用。以上讨论的函数有助于理解如何使用它们。键入命令例如“help quantumComputer”获取帮助信息。

Functions getControlledOperator and toffoliAlgorithmPreprocess are auxiliary functions and user can ignore them as they are called only inside the function quantumComputer.

All above discussed function have help to understand how to use them. Type for example “help quantumComputer”.

To better understand how to write quantum algorithm for the simulator, files with extension *.mat contain these algorithms:

a) bellState.mat – Preparation of Bell state (|00> + |11>)/sqrt(2). After loading the *.mat file, type this statement: “quantumComputer(qAlgorithm)”.

b) bitSwap.mat – Swap of two q-bits content.

c) Toffoli.mat – Implementation of Toffoli gate with CNOT and single q-bit gates.

d) grover_4bit_1iter.mat – First iteration of the Grover algorithm searching for solution of logical equation abc*not(d) = 1, whete a,b,c and d are logical variables and * denotes AND operation. After loading the *.mat file, type this statement:

“quantumComputer(qAlgorithm, [1 2 4 5])”.

e) Files grover_4bit_2iter.mat and grover_4bit_3iter.mat contain two and three (i.e. optimal number) iterations of the Grover algorithm, respectively to demonstrate how increasing number of iteration increase probability of solution of abc*not(d) = 1. After loading the *.mat file, type this statement: “quantumComputer(qAlgorithm, [1 2 4 5])”.

f) statePrep.mat – Preparation of 3-qbit register with below shown distribution of states. The algorithm is based on article “Transformation of quantum states using uniformly controlled rotations” by Mottonen, Vartiainen, Bergholm and Salomaa. After loading the *.mat file, type this statement: “quantumComputer(qAlgorithm)”.

a. p(|000>) = 3 %

b. p(|001>) = 5 %

c. p(|010>) = 7 %

d. p(|011>) = 10 %

e. p(|100>) = 13 %

f. p(|101>) = 15 %

g. p(|110>) = 17 %

h. p(|111>) = 30 %

更多精彩文章请关注公众号:

【源码】量子计算机模拟器相关推荐

  1. CyanogenMod源码编译模拟器

    详细编译方法参考 CyanogenMod的wiki Configure Build Now, your environment must be configured to build specific ...

  2. android 源码编译 模拟器emulator启动,Android 模拟器运行编译后的源码

    下载Android源码以及如何编译,这里就不多介绍了,照着www.android.com给的步骤进行,主要介绍一下使用make命令编译好了源码之后,如何使用模拟器来运行生成的镜像之类的文件. 方式应该 ...

  3. android 源码编译 模拟器emulator启动,Android 源码 (AOSP) - 编译 ( 模拟器 )

    前言 走到这一步, 我们终于可以启动一下模拟器玩玩了, 经过两天编译, 感觉什么都好,就是头冷. 在这里插入图片描述 开搞,开搞. AOSP系列 开搞 自己的配置 硬件 Mac mini (Late ...

  4. fc游戏模拟器PHP源码,FC模拟器合集 - 经典怀旧 - 虎纹猫家园☆2021 - Powered by Discuz!...

    VNES各版本 http://virtuanes.s1.xrea.com:8080/vnes_dl.php 都是从官网上下的. Latest version VirtuaNES version 0.9 ...

  5. 安卓街机模拟器 MAME4droid 源码,只需要自己加入rom 可以发布到安卓市场了。

    安卓街机模拟器 MAME4droid 源码,只需要自己加入rom 可以发布到安卓市场了,可以开始自己的赚钱了.为了方便大家赚钱,apk展示的包含万普广告条,也就是只要自己去申请万普广告条,填一下app ...

  6. android 安卓GBA GBC NDS FC SFC 街机游戏模拟器源码

    提供:  GBC游戏模拟源码  GBA游戏模拟源码  MAME街机模拟器源码  nds模拟器源码  NES模拟器源码  psp模拟器源码  sfc snes9x模拟器源码  sfc Snes游戏模拟器 ...

  7. 网页小游戏源码丨FC模拟器网页版源码

    简介: 网页小游戏源码/FC模拟器网页版源码/魂斗罗/超级玛丽/双截龙等几十款怀旧游戏无需数据库,没有后台,不占用服务器空间.上传即用,直接上传到根目录即可. 网盘下载地址: http://kekew ...

  8. Ubuntu16.04编译android6.0.1源码记录

    目录 目录 一.安装环境 二.下载源码 1.下载repo 2.初始化repo 3.同步源代码 关于驱动 三.编译源码 四.导入源码到AS 五.刷入真机 六.修改源码 总结: 3.同步源代码 关于驱动 ...

  9. Android】源码编译 ---zzz

    问题解决 参考 1)/bin/bash: prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: 权限不够  解决:chmod a+ ...

  10. 动手实现Android源码(AOSP)的下载、编译、运行、导入、调试

    这几天为了搞Android源码费了不少功夫,也遇到了不少坑,在此记录作为日后参考.Android源码的编译运行只支持Linux和Mac系统,至于Windows系统只能绕道了,或是在虚拟机上安装Linu ...

最新文章

  1. RXJAVA之变换操作
  2. 基于OpenCV的实时面部识别
  3. nagios配置监控的一些思路和工作流程
  4. 注册界面翻译_B站UP主自制的开源OCR翻译器走红Github,用一次就粉了
  5. python脚本例子_python dict 字典 以及 赋值 引用的一些实例(详解)
  6. php求二维矩阵的最大子矩阵,最大子矩阵-动态规划
  7. <马哲>科学技术在社会发展中的作用2017-12-27
  8. python的代码复用技术_Python__函数和代码复用
  9. 分布式精华问答 | 分布式与集群的区别是什么?
  10. BootStrap 模态框禁用空白处点击关闭,手动显示隐藏,垂直居中
  11. win任务栏计算机变未知,深度技术Win7电脑任务栏图标显示异常的解决方法
  12. 【数据分析】销售案例——会员分析
  13. 大芒果mysql下载_大芒果魔兽世界单机版
  14. RedHat/CentOS 服务器 SSH 密钥交换实验(实现SSH密钥认证)
  15. 【外网不好用】可以尝试添加dns即可解决上不去外网的问题。
  16. 一个炒鸡简单计算拼音声母出现次数及概率程序
  17. android 一键连接wifi,还在一键连WiFi?快试试更智能的WLAN+
  18. HackingLab基础关
  19. 制作ubuntu18.04启动盘 + 安装ubuntu18.04
  20. 物体抓取位姿估計算法綜述_NO. 1 物体位姿估计 机器人抓取

热门文章

  1. ptp输出内容包含什么_PTP 无线传输
  2. 腾讯云TRTC —— 实时音视频完整案例 音视频+共享屏幕直播
  3. java 集合 并集_Java中多个集合的交集,并集和差集
  4. 如何快速调出软键盘_软键盘怎么调出来 打开软键盘的方法【图文】
  5. mysql键值相同_mysql什么是键值重复
  6. 【C#】EAN-13条形码生成与识别
  7. 小布语音下载安装_小布语音助手
  8. 浦发银行计算机抓紧用面试题目,浦发银行面试问题
  9. 注意:这些跳槽理由会被HR调查!
  10. 使用 Android Studio 内置的模拟器体验原生安卓