- class mentpy.MBQCircuit
The MBQCircuit class that deals with operations and manipulations of graph states
- Parameters:¶
- graph : mp.GraphState
The graph state of the MBQC circuit.
- input_nodes : list
The input nodes of the MBQC circuit.
- output_nodes : list
The output nodes of the MBQC circuit.
- measurements : dict
The measurements of the MBQC circuit. The keys are the nodes and the values are the measurements.
- default_measurement : mp.Ment
The default measurement of the MBQC circuit if no measurements are given.
Examples¶
Create a 1D cluster state \(|G>\) of five qubits
In [1]: g = mp.GraphState() In [2]: g.add_edges_from([(0,1), (1,2), (2,3), (3, 4)]) In [3]: state = mp.MBQCircuit(g, input_nodes=[0], output_nodes=[4])
See also
mp.GraphState
Constructors¶
-
MBQCircuit(graph: GraphState, input_nodes: List[int] =
[]
, ...) Initializes a graph state
String representation¶
Special methods¶
- __delitem__(key)
Delete the measurement of the node with index key.
- __getitem__(key)
Return the value of the measurement of the node with index key.
- __setitem__(key, value)
Set the value of the measurement of the node with index key.
Methods¶
- add_edges_from(edges, **kwargs)
Adds edges from a list of tuples
- calculate_order()
Returns the order of the measurements
-
ordered_layers(train_indices=
False
) List[List[int]] Returns the layers of the MBQC circuit.
Properties¶
- property classical_output_nodes : List[int]
Return the output nodes of the MBQC circuit.
- property controlled_nodes : List[int]
Return the controlled nodes of the MBQC circuit.
- property graph : GraphState
Return the graph of the resource state.
- property input_nodes : List[int]
Return the input nodes of the MBQC circuit.
- property measurement_order : List[int]
Return the measurement order of the MBQC circuit.
- property measurements : Dict[int, Ment]
Return the measurements of the MBQC circuit.
- property output_nodes : List[int]
Return the output nodes of the MBQC circuit.
- property partial_order : Callable
Return the partial order function of the MBQC circuit.
- property quantum_output_nodes : List[int]
Return the output nodes of the MBQC circuit.
- property trainable_nodes : List[int]
Return the trainable nodes of the MBQC circuit.