SurfaceCodeCircuit¶
- class SurfaceCodeCircuit(d, T, basis='z', resets=True)[source]¶
Bases:
CodeCircuit
Distance d rotated surface code with T syndrome measurement rounds.
Creates the circuits corresponding to logical basis states.
Creates the circuits corresponding to logical basis states encoded using a rotated surface code.
- Parameters:
d (int) – Number of code qubits (and hence repetitions) used.
T (int) – Number of rounds of ancilla-assisted syndrome measurement.
basis (str) – Basis used to initialize qubit.
resets (bool) – Whether to include a reset gate after mid-circuit measurements.
- Additional information:
No measurements are added to the circuit if T=0. Otherwise T rounds are added, followed by measurement of the code qubits (corresponding to a logical measurement and final syndrome measurement round).
Methods
- check_nodes(nodes, ignore_extras=False, minimal=False)[source]¶
Determines whether a given set of nodes are neutral. If so, also determines any additional logical readout qubits that would be flipped by the errors creating such a cluster and how many errors would be required to make the cluster. :type nodes: :param nodes: List of nodes, of the type produced by string2nodes. :type nodes: list :type ignore_extras: :param ignore_extras: If True, undeeded logical nodes are :type ignore_extras: bool :param ignored.: :type minimal: :param minimal: Whether output should only reflect the minimal error :type minimal: bool :param case.:
- Returns:
Whether the nodes independently correspond to a valid set of errors. flipped_logical_nodes (list): List of qubits nodes for logical operators that are flipped by the errors, that were not included in the original nodes. num_errors (int): Minimum number of errors required to create nodes.
- Return type:
neutral (bool)
- get_circuit_list()[source]¶
- Returns:
self.circuit as a list, with circuit_list[0] = circuit[‘0’] circuit_list[1] = circuit[‘1’]
- Return type:
circuit_list
- is_cluster_neutral(nodes)[source]¶
Determines whether or not the cluster is neutral, meaning that one or more errors could have caused the set of nodes (syndrome changes) passed to the method. :type nodes: :param nodes: :type nodes: dictionary in the form of the return value of string2nodes
- readout()[source]¶
Readout of all code qubits, which corresponds to a logical measurement as well as allowing for a measurement of the syndrome to be inferred.
- string2nodes(string, **kwargs)[source]¶
Convert output string from circuits into a set of nodes.
- Parameters:
string (string) – Results string to convert.
kwargs (dict) – Additional keyword arguments. See below:
- kwargs:
logical (str): Logical value whose results are used (‘0’ as default). all_logicals (bool): Whether to include logical nodes irrespective of value. (False as default).
- Returns:
- List of nodes corresponding to to the non-trivial
elements in the string.
- Return type:
dict
- Additional information:
Strings are read right to left, but lists* are read left to right. So, we have some ugly indexing code whenever we’re dealing with both strings and lists.
- string2raw_logicals(string)[source]¶
Extracts raw logicals from output string. :type string: :param string: Results string from which to extract logicals :type string: string
- Returns:
Raw values for logical operators that correspond to nodes.
- Return type:
list
- syndrome_measurement(final=False, barrier=False)[source]¶
Application of a syndrome measurement round.
- Parameters:
final (bool) – Whether to disregard the reset (if applicable) due to this being the final syndrome measurement round.
barrier (bool) – Boolean denoting whether to include a barrier at the end.