ArcCircuit

class ArcCircuit(links, T, basis='xy', logical='0', resets=True, delay=None, barriers=True, color=None, max_dist=2, schedule=None, run_202=True, rounds_per_202=9, conditional_reset=False)[source]

Bases: CodeCircuit

Anisotropic repetition code class.

Creates circuits corresponding to an anisotropic repetition code implemented over T syndrome measurement rounds, with the syndrome measurements provided. :type links: list :param links: List of tuples (c0, a, c1), where c0 and c1 are the two code qubits in each :type links: list :param syndrome measurement: :param and a is the auxiliary qubit used.: :type T: int :param T: Number of rounds of syndrome measurement. :type T: int :type basis: str :param basis: Pair of ‘x’, ‘y’ and ‘z’, specifying the pair of local bases to be :type basis: string :param used.: :type logical: str :param logical: Logical value to store (‘0’ or ‘1’). :type logical: string :type resets: bool :param resets: Whether to include a reset gate after mid-circuit measurements. :type resets: bool :param ff: Whether to correct the effects of [[2,0,2]] sequences via feed forward. :type ff: bool :type delay: Optional[int] :param delay: Time (in dt) to delay after mid-circuit measurements (and delay). :type delay: float :type barriers: bool :param barriers: Whether to include barriers between different sections of the code. :type barriers: bool :type color: Optional[dict] :param color: Dictionary with code qubits as keys and 0 or 1 for each value, to specify :type color: dict :param a predetermined bicoloring. If not provided: :param a bicoloring is found on initialization.: :type max_dist: int :param max_dist: Maximum edge distance used when determining the bicoloring of code qubits. :type max_dist: int :type schedule: Optional[list] :param schedule: Specifies order in which entangling gates are applied in each syndrome :type schedule: list :param measurement round. Each element is a list of lists [c: :param a] for entangling gates to be: :param applied simultaneously.: :type run_202: bool :param run_202: Whether to run [[2,0,2]] sequences. This will be overwritten if T is not high :type run_202: bool :param enough: :type enough: at least rounds_per_202xlen(links) :type rounds_per_202: int :param rounds_per_202: Number of rounds that are part of the 202, including the typical link :type rounds_per_202: int :param measurements at the beginning and end. At least 9 are required to get an event dedicated to: :param conjugate errors.: :type conditional_reset: bool :param conditional_reset: Whether to apply conditional resets (an x conditioned on the result of the :param previous measurement): :param rather than a reset gate.:

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 boundary and 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)

clean_code(string)[source]

Given an output string of the code, obvious code qubit errors are identified and their effects are removed.

Parameters:

string (str) – Output string of the code.

Returns:

Modifed output string of the code.

Return type:

string (str)

static flatten_nodes(nodes)[source]

Removes time information from a set of nodes, and consolidates those on the same position at different times. Also removes nodes corresponding to the conjugate error from [[2,0,2]]s. :type nodes: List[DecodingGraphNode] :param nodes: List of nodes, of the type produced by string2nodes, to be flattened. :type nodes: list

Returns:

List of flattened nodes.

Return type:

flat_nodes (list)

get_error_coords(counts, decoding_graph, method='spitz', remove_invalid_edges=False, return_samples=False)[source]

Uses the get_error_probs method of the given decoding graph to generate probabilities of single error events from given counts. The location and time of each error is also calculated.

Parameters:
  • counts (dict) – Counts dictionary of the results to be analyzed.

  • decoding_graph (DecodingGraph) – Decoding graph object constructed

  • code. (from this)

  • method (string) – Method to used for calculation. Supported

  • 'spitz' (methods are)

  • remove_invalid_edges (string) – Whether to delete edges from the graph if

  • invalid. (they are found to be)

  • return_samples (bool) – Whether to also return the number of

  • probability. (samples used to calculated each)

Returns:

Keys are the coordinates (qubit, start_time, end_time) for specific error events. Time refers to measurement rounds. Values are a dictionary whose keys are the edges that detected the event, and whose keys are the calculated probabilities.

Return type:

dict

Additional information:

Time calculation does not take into account get lengths. It assumes that the subrounds within the schedule and the measurement all take the same time. Time is in units of rounds.

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: dict :param nodes: dictionary in the form of the return value of string2nodes

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:
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

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

transpile(backend, scheduling_method='alap')[source]
Parameters:
  • backend (qiskit.providers.ibmq.IBMQBackend) – Backend to transpile and schedule the

  • to (circuits for. The numbering of the qubits in this backend should correspond)

  • self.links. (the numbering used in)

  • scheduling_method (str) – Name of scheduling pass. Arguemnt passed to qiskit.transpile.

Returns:

As self.circuit, but with the circuits scheduled and remapped to the device connectivity.

Return type:

transpiled_circuit

Attributes

AVAILABLE_METHODS = {'naive', 'spitz'}
METHOD_NAIVE: str = 'naive'
METHOD_SPITZ: str = 'spitz'