state#
Quantum states
Classes
|
A graph state composed by several SubGraphStates. |
|
A subgraph state of a quantum state. |
- class GraphState(nodes_state: int | list[int] | None = None, state: Any = 'plus', edges: list | None = None, nodes: int | list[int] | None = None)[source]#
Bases:
ModuleA graph state composed by several SubGraphStates.
- Parameters:
nodes_state (int | list[int] | None) – The nodes of the input state in the initial graph state. It can be an integer representing the number of nodes or a list of node indices. Default:
Nonestate (Any) – The input state of the initial graph state. The string representation of state could be
'plus','minus','zero', and'one'. Default:'plus'edges (list | None) – Additional edges connecting the nodes in the initial graph state. Default:
Nonenodes (int | list[int] | None) – Additional nodes to include in the initial graph state. Default:
None
- add_subgraph(nodes_state: int | list[int] | None = None, state: Any = 'plus', edges: list | None = None, nodes: int | list[int] | None = None, measure_dict: dict | None = None, index: int | None = None) None[source]#
Add a subgraph state to the graph state.
- Parameters:
nodes_state (int | list[int] | None) – The nodes of the input state in the subgraph state. It can be an integer representing the number of nodes or a list of node indices. Default:
Nonestate (Any) – The input state of the subgraph state. The string representation of state could be
'plus','minus','zero', and'one'. Default:'plus'edges (list | None) – Additional edges connecting the nodes in the subgraph state. Default:
Nonenodes (int | list[int] | None) – Additional nodes to include in the subgraph state. Default:
Nonemeasure_dict (dict | None) – A dictionary containing all measurement results. Default:
Noneindex (int | None) – The index where to insert the subgraph state. Default:
None
- property full_state: Tensor#
Compute and return the full quantum state of the graph state.
- property graph: SubGraphState#
The combined graph state of all subgraph states.
- property measure_dict: dict#
A dictionary containing all measurement results for the graph state.
- class SubGraphState(nodes_state: int | list[int] | None = None, state: Any = 'plus', edges: list | None = None, nodes: int | list[int] | None = None)[source]#
Bases:
ModuleA subgraph state of a quantum state.
- Parameters:
nodes_state (int | list[int] | None) – The nodes of the input state in the subgraph state. It can be an integer representing the number of nodes or a list of node indices. Default:
Nonestate (Any) – The input state of the subgraph state. The string representation of state could be
'plus','minus','zero', and'one'. Default:'plus'edges (list | None) – Additional edges connecting the nodes in the subgraph state. Default:
Nonenodes (int | list[int] | None) – Additional nodes to include in the subgraph state. Default:
None
- compose(other: SubGraphState, relabel: bool = True) SubGraphState[source]#
Compose this subgraph state with another subgraph state.
- Parameters:
other (SubGraphState) – The other subgraph state to compose with.
relabel (bool) – Whether to relabel nodes to avoid conflicts. Default:
True
- Returns:
A new subgraph state that is the composition of the two.
- Return type:
- property edges#
Edges of the graph.
- property full_state: Tensor#
Compute and return the full quantum state of the subgraph state.
- property nodes#
Nodes of the graph.
- set_graph(nodes_state: int | list[int] | None = None, edges: list | None = None, nodes: int | list[int] | None = None) None[source]#
Set the graph structure for the subgraph state.