pygsti.protocols.mirror_edesign.qiskit_circuits_to_subcircuit_mirror_edesign

pygsti.protocols.mirror_edesign.qiskit_circuits_to_subcircuit_mirror_edesign#

qiskit_circuits_to_subcircuit_mirror_edesign(qk_circs, aggregate_subcircs, width_depth_dict, coupling_map, instruction_durations, subcirc_kwargs_dict={}, mirroring_kwargs_dict={})#

Create a subcircuit benchmark from transpiled Qiskit circuits.

Parameters:
  • qk_circs (List[qiskit.QuantumCircuit] | Dict[qiskit.QuantumCircuit]) – Qiskit QuantumCircuits from which a subcircuit benchmark is to be created. If a dictionary is provided, those keys are used. If a list is provided, default integer keys are used.

  • aggregate_subcircs (bool) – Whether or not the provided Qiskit circuits should be used to create one combined subcircuit experiment design or kept separate. Circuit aggregation can be useful if the provided circuits are all instances of the same ‘family’ of the circuit, e.g., all Bernstein-Vazirani circuits with different secret keys.

  • width_depth_dict (dict[int, list[int]]) – dictionary whose keys are subcircuit widths and whose values are lists of depths to snip out for that width.

  • coupling_map (str or qiskit.transpiler.CouplingMap) – coupling map for the device the Qiskit circuits were transpiled to. If ‘all-to-all’, an all-to-all coupling map is used. If ‘linear’, a linear topology is used.

  • instruction_durations (qiskit.transpiler.InstructionDurations) – instruction durations for each gate in the target device. These durations are needed to calculate the appropriate delay time when only idling qubits are sampled out from a full circuit layer.

  • subcirc_kwargs_dict (dict, optional) –

    dictionary of keyword arguments to be used in subcircuit selection. If an arg is not provided, a default value is used. The args are:

    ’num_samples_per_width_depth’: default 10. number of subcircuits to sample from each full circuit. if aggregate_subcircuits is set to True, num_samplse_per_width_depth subcircuits are drawn from each full circuit and combined into one experiment design.

    ’rand_state’: default None. np.random.RandomState to be used for subcircuit selection.

  • mirroring_kwargs_dict (dict, optional) –

    dictionary of keyword arguments to be used in circuit mirroring If an arg is not provided, a default value is used. The args are:

    ’mirror_circuits_per_circ’: default 10. The number of mirror circuits of the test-exact and exact-exact varieties to be used for the process fidelity estimation of each provided Qiskit circuit.

    ’num_ref_per_qubit_subset’: default 10. The number of SPAM reference circuits to use for each qubit subset that is represented among the provided Qiskit circuits.

    ’rand_state’: default None. np.random.RandomState to be used for circuit mirroring.

Returns:

dict[hashable, pygsti.protocols.FreeformDesign] or pygsti.protocols.FreeformDesign

Experiment design(s) containing the pyGSTi conversion of all Qiskit circuits that were passed in. Does not need executed, but is needed for fidelity calculations. A dictionary is returned if aggregate_subcircs is False, otherwise a FreeformDesign is returned.

dict[hashable, pygsti.protocols.CombinedExperimentDesign] or pygsti.protocols.CombinedExperimentDesign

Experiment design(s) containing all mirror circuits that must be executed in order to perform mirror circuit fidelity estimation. A dictionary is returned if aggregate_subcircs is False, otherwise a FreeformDesign is returned.

Return type:

Tuple