command#
MBQC commands
Classes
|
Correction command. |
|
Entanglement command. |
|
Measurement command. |
|
Node (qubit) preparation command. |
- class Correction(nodes: int | list[int], basis: str = 'x', domain: int | Iterable[int] | None = None)[source]#
Bases:
CommandCorrection command.
- Parameters:
nodes (int | list[int]) – The indices of the nodes to correct.
basis (str) – The type of correction (
'x'or'z'). Default:'x'domain (int | Iterable[int] | None) – The indices of the nodes that contribute to signal domain s. Default:
None
- forward(x: GraphState) GraphState[source]#
Perform a forward pass by correcting the GraphState.
- class Entanglement(node1: int, node2: int)[source]#
Bases:
CommandEntanglement command.
- Parameters:
node1 (int) – The first node index.
node2 (int) – The second node index.
- forward(x: GraphState) GraphState[source]#
Perform a forward pass by adding an edge in the GraphState.
- class Measurement(nodes: int | list[int], angle: Any = 0.0, plane: str = 'xy', s_domain: int | Iterable[int] | None = None, t_domain: int | Iterable[int] | None = None, requires_grad: bool = False)[source]#
Bases:
CommandMeasurement command.
- Parameters:
nodes (int | list[int]) – The indices of the nodes to measure.
angle (Any) – The measurement angle in radians. Default: 0.
plane (str) – The measurement plane (
'xy','yz'or'zx'). Default:'xy's_domain (int | Iterable[int] | None) – The indices of the nodes that contribute to signal domain s. Default:
Nonet_domain (int | Iterable[int] | None) – The indices of the nodes that contribute to signal domain t. Default:
Nonerequires_grad (bool) – Whether the parameter is
nn.Parameterorbuffer. Default:False(which meansbuffer)
- forward(x: GraphState) GraphState[source]#
Perform a forward pass by measuring the GraphState.
- class Node(nodes: int | list[int])[source]#
Bases:
CommandNode (qubit) preparation command.
- Parameters:
nodes (int | list[int]) – The indices of the nodes to prepare.
- forward(x: GraphState) GraphState[source]#
Perform a forward pass by adding SubGraphState in the GraphState.