{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 噪声模拟器\n", "\n", "[![下载Notebook](https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/master/resource/_static/logo_notebook.svg)](https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/notebook/master/mindquantum/zh_cn/middle_level/mindspore_noise_simulator.ipynb) \n", "[![下载样例代码](https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/master/resource/_static/logo_download_code.svg)](https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/notebook/master/mindquantum/zh_cn/middle_level/mindspore_noise_simulator.py) \n", "[![查看源文件](https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/master/resource/_static/logo_source.svg)](https://gitee.com/mindspore/docs/blob/master/docs/mindquantum/docs/source_zh_cn/middle_level/noise_simulator.ipynb)\n", "\n", "MindQuantum 中包含各种噪声信道,利用噪声信道我们可以对真实的量子芯片进行模拟。在 MindQuantum 中,我们定义了各种 [ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html),可以有选择性的在量子线路的不同位置添加噪声信道,依次完成含噪声的量子模拟。下面介绍如何利用 MindQuantum 完成此任务。\n", "\n", "## [ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html)\n", "\n", "[ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html) 是一个能够在量子线路特定位置添加特定信道的处理器,例如在测量门后添加比特翻转信道。`ChannelAdder` 类主要由三个函数构成,`_accepter()`、`_excluder()` 和 `_handler(BasicGate)`,其功能对应如下:\n", "\n", "- `_accepter()`:返回一个由函数构成的列表,称为接受规则集,其中每个接受规则函数的输入都是一个量子门,当函数返回值为 `True` 时表示我们可以在该量子门后添加信道。\n", "\n", "- `_excluder()`:返回一个由函数构成的列表,称为拒绝规则集,其中每个拒绝规则函数的输入都是一个量子门,当函数返回值为 `True` 时表示我们拒绝在该量子门后添加信道。\n", "\n", "- `_handler(BasicGate)`:输入一个量子门,返回一段量子线路,表示在输入量子门后添加一段自定义的信道。\n", "\n", "我们重定义类 [ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html) 的 `__call__` 函数,直接调用 `ChannelAdder` 即可生成处理后的量子线路。\n", "下面介绍几种 [ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html)。\n", "\n", "### [BitFlipAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.BitFlipAdder.html)\n", "\n", "[BitFlipAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.BitFlipAdder.html) 的接口定义为:\n", "\n", "```python\n", "BitFlipAdder(flip_rate: float, with_ctrl=True, focus_on: int = None, add_after: bool = True)\n", "```\n", "\n", "该 `Adder` 会在量子门后添加一个比特翻转信道,接口的参数含义为:\n", "\n", "- **flip_rate** (float):比特翻转信道的翻转概率。\n", "- **with_ctrl** (bool):是否在控制位上添加比特。默认值: ``True``。\n", "- **focus_on** (bool):只将该噪声信道作用在 ``focus_on`` 比特上。如果为 ``None``,则作用在量子门的所有比特上。默认值: ``None``。\n", "- **add_after** (bool):是否在量子门后面添加信道。如果为 ``False``,信道将会加在量子门前面。默认值: ``True``。\n", "\n", "例如,我们可以通过如下接口,在给定量子线路的每个量子门后都添加一个翻转概率为 ``0.3`` 的比特翻转信道:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "q0: q1: H RX a Z " ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from mindquantum.core.circuit.channel_adder import BitFlipAdder\n", "from mindquantum.core import gates as G\n", "from mindquantum.core.circuit import Circuit\n", "\n", "circ = Circuit()+G.H(0)+G.RX('a').on(1)+G.Z(1, 0)\n", "circ.svg()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "q0: q1: H BFC p=3/10 RX a BFC p=3/10 Z BFC p=3/10 " ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bit_flip_adder = BitFlipAdder(0.3, with_ctrl=False)\n", "new_circ = bit_flip_adder(circ)\n", "new_circ.svg()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### [MeasureAccepter](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.MeasureAccepter.html)\n", "\n", "```python\n", "MeasureAccepter()\n", "```\n", "\n", "该 `Adder` 会选择对应的测量门,它目前只是一个 `Accepter`,不会改变量子线路中的任何门,需要利用 [MixerAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.MixerAdder.html),跟其他的 `Adder` 搭配使用。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### [MixerAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.MixerAdder.html)\n", "\n", "```python\n", "MixerAdder(adders: typing.List[ChannelAdderBase])\n", "```\n", "\n", "[MixerAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.MixerAdder.html) 可以将多个 `Adder` 混合起来,保证量子门在每一个 `Adder` 中的接受函数集和拒绝函数集同时满足时,顺序添加 `_handler` 产生的量子线路。\n", "\n", "举例来说,我们可以将上文提到的 [BitFlipAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.BitFlipAdder.html) 和 [MeasureAccepter](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.MeasureAccepter.html) 混合起来,达到只在测量门前添加比特翻转信道的功能:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "MixerAdder<\n", " BitFlipAdder\n", " MeasureAccepter<>\n", ">\n" ] }, { "data": { "image/svg+xml": [ "q0: q1: H RX a Z " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "q0: q1: H RX a Z BFC p=1/100 " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from IPython.display import display_svg\n", "from mindquantum.core.circuit.channel_adder import MixerAdder, MeasureAccepter\n", "\n", "mixer = MixerAdder([\n", " BitFlipAdder(flip_rate=0.01),\n", " MeasureAccepter(),\n", "], add_after=False)\n", "print(mixer)\n", "\n", "circ = Circuit() + G.H(0) + G.RX('a').on(1) + G.Z(1, 0) + G.Measure().on(0)\n", "display_svg(circ.svg())\n", "new_circ = mixer(circ)\n", "new_circ.svg()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### [SequentialAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.SequentialAdder.html)\n", "\n", "```python\n", "SequentialAdder(adders: typing.List[ChannelAdderBase])\n", "```\n", "\n", "[SequentialAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.SequentialAdder.html) 是由多个 `Adder` 顺序构成类,量子线路会经过 [SequentialAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.SequentialAdder.html) 中的 `Adder` 依次处理,生成最终的量子线路。例如,我们想构建一个先在测量门前添加一个 $p=0.01$ 的比特翻转信道,然后在 `q1` 比特上的非测量门和非噪声信道后添加 $p=0.05$ 的去极化信道。\n", "\n", "### 自定义 `Adder`\n", "\n", "我们首先自定义在某个比特添加比特翻转信道的 `Adder`。" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SequentialAdder<\n", " MixerAdder<\n", " MeasureAccepter<>\n", " BitFlipAdder\n", " >\n", " CustomDepolarizingAdder\n", ">\n" ] } ], "source": [ "from mindquantum.core.circuit.channel_adder import ChannelAdderBase, SequentialAdder\n", "\n", "class CustomDepolarizingAdder(ChannelAdderBase):\n", " def __init__(self, q, p):\n", " self.q = q\n", " self.p = p\n", " super().__init__()\n", "\n", " def _accepter(self):\n", " return [lambda x: self.q in x.obj_qubits or self.q in x.ctrl_qubits]\n", "\n", " def _excluder(self):\n", " return [lambda x: isinstance(x, (G.Measure, G.NoiseGate))]\n", "\n", " def _handler(self, g):\n", " return Circuit([G.DepolarizingChannel(self.p).on(self.q)])\n", "\n", " def __repr__(self):\n", " return f\"CustomDepolarizingAdder\"\n", "\n", "seq_adder = SequentialAdder([\n", " MixerAdder([\n", " MeasureAccepter(),\n", " BitFlipAdder(flip_rate=0.01),\n", " ], add_after=False),\n", " CustomDepolarizingAdder(q=1, p=0.05),\n", "])\n", "print(seq_adder)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "q0: q1: H RX a Z " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "q0: q1: H RX a DC p=1/20 Z DC p=1/20 BFC p=1/100 " ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "circ = Circuit() + G.H(0) + G.RX('a').on(1) + G.Z(1, 0) + G.Measure().on(0)\n", "display_svg(circ.svg())\n", "new_circ = seq_adder(circ)\n", "new_circ.svg()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "上述自定义量子信道也可以通过 MindQuantum 中的预定义信道搭建而成。" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SequentialAdder<\n", " MixerAdder<\n", " MeasureAccepter<>\n", " BitFlipAdder\n", " >\n", " MixerAdder<\n", " ReverseAdder<\n", " MeasureAccepter<>\n", " >\n", " NoiseExcluder<>\n", " NoiseChannelAdder\n", " >\n", ">\n" ] } ], "source": [ "from mindquantum.core.circuit import ReverseAdder, NoiseExcluder, NoiseChannelAdder\n", "seq_adder = SequentialAdder([\n", " MixerAdder([\n", " MeasureAccepter(),\n", " BitFlipAdder(flip_rate=0.01),\n", " ], add_after=False),\n", " MixerAdder([\n", " ReverseAdder(MeasureAccepter()),\n", " NoiseExcluder(),\n", " NoiseChannelAdder(G.DepolarizingChannel(0.05), focus_on=1),\n", " ])\n", "])\n", "print(seq_adder)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "q0: q1: H RX a DC p=1/20 Z DC p=1/20 BFC p=1/100 " ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "seq_adder(circ).svg()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 更复杂的例子\n", "\n", "下面我们来搭建一个更复杂的 [ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html) 例子,在该例子中,芯片的不同比特上的单比特门操作的噪声可以忽略不记,而双比特门在不同比特上具有不同的去极化信道,且线路的测量具有一个翻转概率为0.01的比特翻转错误。\n", "\n", "我们假设不同比特上的去极化信道为:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "dc0 = G.DepolarizingChannel(0.01)\n", "dc1 = G.DepolarizingChannel(0.02)\n", "dc2 = G.DepolarizingChannel(0.03)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "然后,我们定义出满足要求的 `Adder`:" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "SequentialAdder<\n", " MixerAdder<\n", " NoiseExcluder<>\n", " ReverseAdder<\n", " MeasureAccepter<>\n", " >\n", " QubitNumberConstrain\n", " NoiseChannelAdder\n", " >\n", " MixerAdder<\n", " NoiseExcluder<>\n", " ReverseAdder<\n", " MeasureAccepter<>\n", " >\n", " QubitNumberConstrain\n", " NoiseChannelAdder\n", " >\n", " MixerAdder<\n", " NoiseExcluder<>\n", " ReverseAdder<\n", " MeasureAccepter<>\n", " >\n", " QubitNumberConstrain\n", " NoiseChannelAdder\n", " >\n", " MixerAdder<\n", " NoiseExcluder<>\n", " MeasureAccepter<>\n", " BitFlipAdder\n", " >\n", ">" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from mindquantum.core.circuit import QubitNumberConstrain\n", "noise_adder = SequentialAdder([\n", " MixerAdder([\n", " NoiseExcluder(),\n", " ReverseAdder(MeasureAccepter()),\n", " QubitNumberConstrain(2),\n", " NoiseChannelAdder(dc0, focus_on=0),\n", " ]),\n", " MixerAdder([\n", " NoiseExcluder(),\n", " ReverseAdder(MeasureAccepter()),\n", " QubitNumberConstrain(2),\n", " NoiseChannelAdder(dc1, focus_on=1),\n", " ]),\n", " MixerAdder([\n", " NoiseExcluder(),\n", " ReverseAdder(MeasureAccepter()),\n", " QubitNumberConstrain(2),\n", " NoiseChannelAdder(dc2, focus_on=2),\n", " ]),\n", " MixerAdder([\n", " NoiseExcluder(),\n", " MeasureAccepter(),\n", " BitFlipAdder(0.01)\n", " ], add_after=False),\n", "])\n", "noise_adder" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "假设我们想要处理的量子线路是哈密顿量 $H=a_{01} Z_0Z_1 + a_{12} Z_1Z_2 + b_0 X_0 + b_1 X_1 + b_2 X_2$ 含时演化的一阶Trotter近似线路:" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " b_0 [X0] +\n", " b_1 [X1] +\n", " b_2 [X2] +\n", "a_01 [Z0 Z1] +\n", "a_12 [Z1 Z2]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from mindquantum.core.operators import TimeEvolution, QubitOperator\n", "\n", "ham = sum([\n", " QubitOperator('X0', 'b_0'),\n", " QubitOperator('X1', 'b_1'),\n", " QubitOperator('X2', 'b_2'),\n", " QubitOperator('Z0 Z1', 'a_01'),\n", " QubitOperator('Z1 Z2', 'a_12')\n", "])\n", "ham" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "q0: q1: q2: RX 2*b_0 RX 2*b_1 RX 2*b_2 RZ 2*a_01 RZ 2*a_12 " ], "text/plain": [ "" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "circ = TimeEvolution(ham).circuit\n", "circ.barrier()\n", "circ.measure_all()\n", "circ.svg()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "此线路经过上述定义的 `noise_adder` 处理后的量子线路为:" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "q0: q1: q2: RX 2*b_0 RX 2*b_1 RX 2*b_2 DC p=1/50 DC p=1/100 RZ 2*a_01 DC p=1/50 DC p=1/100 DC p=0.03 DC p=1/50 RZ 2*a_12 DC p=0.03 DC p=1/50 BFC p=1/100 BFC p=1/100 BFC p=1/100 " ], "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "noise_adder(circ).svg()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### [ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html) 列表\n", "\n", "下面列举出 MindQuantum 中现有的一些 [ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html),并给出具体含义:\n", "\n", "|[ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html)| 功能|\n", "|--|--|\n", "|[ChannelAdderBase](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html)|在量子门前面或者后面添加信道|\n", "|[NoiseChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.NoiseChannelAdder.html)|添加一个单比特量子信道|\n", "|[MeasureAccepter](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.MeasureAccepter.html)|选取测量门|\n", "|[ReverseAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ReverseAdder.html)|翻转给定信道添加器的接受和拒绝规则|\n", "|[NoiseExcluder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.NoiseExcluder.html)|排除噪声门|\n", "|[BitFlipAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.BitFlipAdder.html)|在量子门前面或者后面添加一个比特翻转信道|\n", "|[MixerAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.MixerAdder.html)|在子添加器的接受集被满足、拒绝集被拒绝时依次执行所有的添加器|\n", "|[SequentialAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.SequentialAdder.html)|依次执行每一个添加器|\n", "|[QubitNumberConstrain](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.QubitNumberConstrain.html)|只将噪声信道作用在比特数为 ``n_qubits`` 的量子门上|\n", "|[QubitIDConstrain](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.QubitIDConstrain.html)|只将噪声信道作用在给定比特序号的量子门上|\n", "|[GateSelector](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.GateSelector.html)|选择想要的量子门添加信道|\n", "|[DepolarizingChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.DepolarizingChannelAdder.html)|添加去极化信道|\n", "\n", "MindQuantum 中 [ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html) 的API接口文档请参考:[channel_adder](https://mindspore.cn/mindquantum/docs/zh-CN/master/core/mindquantum.core.circuit.html#channel-adder)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 基于 [ChannelAdder](https://www.mindspore.cn/mindquantum/docs/zh-CN/master/core/circuit/mindquantum.core.circuit.ChannelAdderBase.html) 的噪声模拟器\n", "\n", "我们可以将如上定义的各种 `Adder` 与现有的模拟器组合,构成一个含噪声模拟器。" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "q0: q1: H RX 1 Z " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "Shots:\n", " 10000 Keys: q1 0.0 0.154 0.307 0.461 0.614 0.768 0 7677 1 2323 probability " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from mindquantum.simulator import Simulator\n", "from mindquantum.simulator.noise import NoiseBackend\n", "\n", "noiseless_sim = Simulator('mqvector', 2)\n", "noiseless_circ = Circuit().h(0).rx(1.0, 1).z(1, 0).measure(1)\n", "display_svg(noiseless_circ.svg())\n", "res1 = noiseless_sim.sampling(noiseless_circ, shots=10000)\n", "display(res1.svg())" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "Shots:\n", " 10000 Keys: q1 0.0 0.149 0.297 0.446 0.594 0.743 0 7426 1 2574 probability " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "q0: q1: H RX 1 DC p=1/20 Z DC p=1/20 BFC p=1/100 " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "noise_sim = Simulator(NoiseBackend('mqvector', 2, seq_adder))\n", "res2 = noise_sim.sampling(noiseless_circ, shots=10000)\n", "display(res2.svg())\n", "display(noise_sim.backend.transform_circ(noiseless_circ).svg())" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", " \n", " \n", "\n", "\n", "
SoftwareVersion
mindquantum0.9.11
scipy1.10.1
numpy1.24.4
SystemInfo
Python3.8.17
OSLinux x86_64
Memory16.62 GB
CPU Max Thread16
DateTue Jan 2 15:11:15 2024
\n" ], "text/plain": [ "" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from mindquantum.utils.show_info import InfoTable\n", "\n", "InfoTable('mindquantum', 'scipy', 'numpy')" ] } ], "metadata": { "kernelspec": { "display_name": "MindSpore", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.17" } }, "nbformat": 4, "nbformat_minor": 2 }