forked from mindspore-ai/mindquantum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yuhan
committed
Feb 21, 2024
1 parent
076481a
commit cce7478
Showing
5 changed files
with
26 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 9 additions & 6 deletions
15
docs/api_python/utils/mindquantum.utils.random_insert_gates.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
mindquantum.utils.random_insert_gates | ||
====================================== | ||
|
||
.. py:function:: mindquantum.utils.random_insert_gates(circuit, gates, nums, focus_on=None, with_ctrl=True, after_measure=False, shots=1, seed=None) | ||
.. py:function:: mindquantum.utils.random_insert_gates(circuit: Circuit, gates: BasicGate | list[BasicGate], nums: int | list[int], focus_on: int | list[int] | None = None, with_ctrl: bool = True, after_measure: bool = False, shots: int = 1, seed: int | None = None) | ||
将指定数量的单量子比特门插入到量子线路中的随机位置。 | ||
|
||
参数: | ||
- **circuit** (Circuit) - 待随机插入量子门的量子线路。 | ||
- **gates** (Union[BasicGate, List[BasicGate]]) - 所有待插入的量子门。 | ||
- **nums** (Union[int, List[int]]) - 每种量子门插入的数量。 | ||
- **focus_on** (Optional[Union[int, List[int]]]) - 只将量子门作用在 focus_on 比特上。如果为 None,则作用在量子线路的所有比特上。默认值: None。 | ||
- **with_ctrl** (bool) - 是否在控制位上插入量子门。默认值: True。 | ||
- **after_measure** (bool) - 是否在测量门后插入量子门。默认值: False。 | ||
- **shots** (int) - 随机采样量子线路的数量。默认值: 1。 | ||
- **seed** (Optional[int]) - 生成插入位置的随机数种子。默认值: None。 | ||
- **focus_on** (Union[int, List[int]], 可选) - 只将量子门作用在 focus_on 比特上。如果为 None,则作用在量子线路的所有比特上。默认值: None。 | ||
- **with_ctrl** (bool, 可选) - 是否在控制位上插入量子门。默认值: True。 | ||
- **after_measure** (bool, 可选) - 是否在测量门后插入量子门。默认值: False。 | ||
- **shots** (int, 可选) - 随机采样量子线路的数量。默认值: 1。 | ||
- **seed** (int, 可选) - 生成插入位置的随机数种子。默认值: None。 | ||
|
||
返回: | ||
一个可以产生量子线路的生成器。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters