pygsti.circuits.subcircuit_selection.simple_weighted_subcirc_selection#
- simple_weighted_subcirc_selection(full_circ, width, depth, num_subcircs, coupling_map, instruction_durations, use_qiskit_for_instruction_durations=None, depth_metric='layer_count', rand_state=None, return_depth_info=False, stochastic_2q_drops=False, verbosity=1)#
Samples subcircuits from a full circuit using a simple approach. The simple approach is to identify a starting layer, along with a connected subset of active qubits, and snip out a subcircuit with the desired width and depth.
- Parameters:
full_circs (Union[pygsti.circuits.Circuit, List[pygsti.circuits.Circuit]]) – The full circuit(s) from which to sample subcircuits.
width (int) – width of subcircuit to snip out.
depth (int) – depth of subcircuit to snip out.
num_subcircs (int) – The number of subcircuits to snip out for the given width and depth.
coupling_map (Union[str, qiskit.transpiler.CouplingMap]) – The coupling map defining the connectivity of qubits. Can be ‘all-to-all’, ‘linear’, or a qiskit CouplingMap object.
instruction_durations (qiskit.transpiler.InstructionDurations) – A qiskit InstructionDurations object used to determine delay times for idle subcircuit layers.
use_qiskit_for_instruction_durations (bool, optional) – Whether to use qiskit gatenames instead of pyGSTi gatenames when looking up instruction durations in instruction_durations. If this argument is not provided, then the lookup gatename is based on the type of instruction_durations. If instruction_durations is an InstructionDurations object, the qiskit gatenames are used, else the pyGSTi gatenames are used.
rand_state (_np.random.RandomState, optional) – A random state for reproducibility. Default is None.
return_depth_info (bool, optional) – Whether to include compiled depths and the start and end layer for each subcircuit. Default is False.
stochastic_2q_drops (bool, optional) – Whether to apply stochastic dropping of 2-qubit gates. Default is False, in which case all dangling 2-qubit gates are dropped. A gate is considered dangling if it has support on at least one qubit that is not in the selected subset of qubits snipped out for the subcircuit.
verbosity (int, optional) – Level of verbosity for logging. Default is 1.
full_circ (_Circuit)
depth_metric (Literal['layer_count', 'falcon_depth'])
- Returns:
- Optional[List[int], Optional[List[Tuple[int,int]]]],
Optional[List[int]], Optional[List[int]]]
A tuple containing the selected subcircuits and the counts of dropped gates. If return_depth_info is set to True, then the returns are extended to include the compiled depth of each subcircuit and the start and end layers of each subcircuit. If stochastic_2q_drops is set to True, then the returns are extended to include the number of dangling gates in each subcircuit and the indices of added layers.
- Return type:
Tuple[List[pygsti.circuits.Circuit], List[int],