1.3K Star 2K Fork 3.5K

GVPMindSpore / mindquantum

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mindquantum.algorithm.nisq.ansatz_variance.rst 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
donghufeng 提交于 2023-11-01 01:16 . re-organize docs

mindquantum.algorithm.nisq.ansatz_variance

.. py:function:: mindquantum.algorithm.nisq.ansatz_variance(ansatz: Circuit, ham: Hamiltonian, focus: str, var_range: typing.Tuple[float, float] = (0, np.pi * 2), other_var: np.array = None, atol: float = 0.1, init_batch: int = 20, sim: typing.Union[Simulator, str] = 'mqvector')

    计算变分量子线路中的某个参数的梯度的方差。

    参数:
        - **ansatz** (:class:`~.core.circuit.Circuit`) - 输入的变分量子线路。
        - **ham** (:class:`~.core.operators.Hamiltonian`) - 输入的可观察量哈密顿量。
        - **focus** (str) - 需要检查哪个参数。
        - **var_range** (Tuple[float, float]) - 参数的随机变化范围。默认值: ``(0, 2*np.pi)``。
        - **other_var** (numpy.array) - 其他变量的数值。如果为 ``None``,则每次采样是都是随机数。默认值: ``None``。
        - **atol** (float) - 方差浮动的容忍度。默认值 ``0.1``。
        - **init_batch** (int) - 初始采样时样本点的个数。默认值: ``20``。
        - **sim** (Union[:class:`~.simulator.Simulator`, str]) - 用哪种模拟器来完成任务。默认值: ``mqvector``。
Python
1
https://gitee.com/mindspore/mindquantum.git
git@gitee.com:mindspore/mindquantum.git
mindspore
mindquantum
mindquantum
master

搜索帮助