1.8K Star 3K Fork 4.3K

GVPMindSpore/mindquantum

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
.github
.gitlab
.jenkins
_build
ccsrc
cmake
docs
api_python
algorithm
compiler
mindquantum.algorithm.compiler.BasicCompilerRule.rst
mindquantum.algorithm.compiler.BasicDecompose.rst
mindquantum.algorithm.compiler.CXToCZ.rst
mindquantum.algorithm.compiler.CZBasedChipCompiler.rst
mindquantum.algorithm.compiler.CZToCX.rst
mindquantum.algorithm.compiler.DAGCircuit.rst
mindquantum.algorithm.compiler.DAGNode.rst
mindquantum.algorithm.compiler.DAGQubitNode.rst
mindquantum.algorithm.compiler.FullyNeighborCanceler.rst
mindquantum.algorithm.compiler.GateNode.rst
mindquantum.algorithm.compiler.GateReplacer.rst
mindquantum.algorithm.compiler.KroneckerSeqCompiler.rst
mindquantum.algorithm.compiler.SequentialCompiler.rst
mindquantum.algorithm.compiler.SimpleNeighborCanceler.rst
mindquantum.algorithm.compiler.abc_decompose.rst
mindquantum.algorithm.compiler.ccx_decompose.rst
mindquantum.algorithm.compiler.ch_decompose.rst
mindquantum.algorithm.compiler.compile_circuit.rst
mindquantum.algorithm.compiler.connect_two_node.rst
mindquantum.algorithm.compiler.crx_decompose.rst
mindquantum.algorithm.compiler.crxx_decompose.rst
mindquantum.algorithm.compiler.cry_decompose.rst
mindquantum.algorithm.compiler.cryy_decompose.rst
mindquantum.algorithm.compiler.cs_decompose.rst
mindquantum.algorithm.compiler.cswap_decompose.rst
mindquantum.algorithm.compiler.ct_decompose.rst
mindquantum.algorithm.compiler.cu_decompose.rst
mindquantum.algorithm.compiler.cy_decompose.rst
mindquantum.algorithm.compiler.cz_decompose.rst
mindquantum.algorithm.compiler.euler_decompose.rst
mindquantum.algorithm.compiler.kak_decompose.rst
mindquantum.algorithm.compiler.qs_decompose.rst
mindquantum.algorithm.compiler.rxx_decompose.rst
mindquantum.algorithm.compiler.ryy_decompose.rst
mindquantum.algorithm.compiler.rzz_decompose.rst
mindquantum.algorithm.compiler.swap_decompose.rst
mindquantum.algorithm.compiler.tensor_product_decompose.rst
mindquantum.algorithm.compiler.try_merge.rst
error_mitigation
library
mapping
nisq
qaia
mindquantum.algorithm.compiler.rst
mindquantum.algorithm.error_mitigation.rst
mindquantum.algorithm.library.rst
mindquantum.algorithm.mapping.rst
mindquantum.algorithm.nisq.rst
mindquantum.algorithm.qaia.rst
core
device
dtype
engine
framework
io
simulator
utils
mindquantum.algorithm.rst
mindquantum.core.rst
mindquantum.device.rst
mindquantum.dtype.rst
mindquantum.engine.rst
mindquantum.framework.rst
mindquantum.io.rst
mindquantum.simulator.rst
mindquantum.utils.rst
overview.rst
api_python_en
source
CMakeLists.txt
Doxyfile
Makefile
MindQuantum-architecture.png
MindQuantum-architecture_EN.png
README.md
circuit_svg.png
index.html.in
mindquantum
mindquantum_config
scripts
tests
third_party
.clang-format
.clangd
.cmake-format.yaml
.codespell.allow
.cppcheck.suppressions
.gitignore
.gitlab-ci.yml
.pre-commit-config-format-gitee.yml
.pre-commit-config-format.yml
.pre-commit-config-gitee.yaml
.pre-commit-config.yaml
.readthedocs.yaml
.whitelizard.txt
.yamllint
CMakeLists.txt
CONTRIBUTING.md
CONTRIBUTING_CN.md
CPPLINT.cfg
INSTALL.md
INSTALL_cn.md
LICENSE
MANIFEST.in
NOTICE
README.md
README_CN.md
RELEASE.md
RELEASE_CN.md
VERSION.txt
build.bat
build.ps1
build.sh
build_locally.bat
build_locally.ps1
build_locally.sh
install_with_docker.md
install_with_docker_en.md
pyproject.toml
requirements.txt
requirements_test.txt
setup.cfg
setup.py
克隆/下载
mindquantum.algorithm.compiler.BasicCompilerRule.rst 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
donghufeng 提交于 2年前 . fix docing

mindquantum.algorithm.compiler.BasicCompilerRule

.. py:class:: mindquantum.algorithm.compiler.BasicCompilerRule(rule_name="BasicCompilerRule", log_level=0)

    编译规则的基类。

    编译规则会处理量子线路的DAG图 :class:`~.algorithm.compiler.DAGCircuit` ,并且根据编译规则中的 `do` 方法来进行编译。当继承子类编译规则时,你必须实现 `do` 方法。请确保 `do` 方法会返回一个 `bool` 值,该值表示编译规则是否成功执行。

    参数:
        - **rule_name** (str) - 该编译规则的名称。
        - **log_level** (int) - 展示log信息的级别。如果为 ``0``,log信息不会被展示。如果为 ``1``,log信息展示较为简洁。如果为 ``2``,log信息展示较为丰富。默认值: ``0``。

    .. py:method:: do(dag_circuit: DAGCircuit)
        :abstractmethod:

        原位的将该编译规则运用到 :class:`~.algorithm.compiler.DAGCircuit` 上。

        参数:
            - **dag_circuit** (:class:`~.algorithm.compiler.DAGCircuit`) - 量子线路的 DAG 图。

    .. py:method:: set_log_level(log_level: int)

        设置log信息的展示级别。

        参数:
            - **log_level** (int) - log信息展示级别。可以为 ``0`` 、 ``1`` 或者 ``2`` 。关于log级别的更多信息,请参考 :class:`~.algorithm.compiler.BasicCompilerRule` 。
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mindspore/mindquantum.git
git@gitee.com:mindspore/mindquantum.git
mindspore
mindquantum
mindquantum
r0.9

搜索帮助