pygsti.algorithms.randomcircuit.sample_circuit_layer_of_one_q_gates

pygsti.algorithms.randomcircuit.sample_circuit_layer_of_one_q_gates#

sample_circuit_layer_of_one_q_gates(pspec, qubit_labels=None, one_q_gate_names='all', pdist='uniform', modelname='clifford', rand_state=None)#

Samples a random circuit layer containing only 1-qubit gates.

The allowed 1-qubit gates are specified by one_q_gate_names, and the 1-qubit gates are sampled independently and uniformly.

Parameters:
  • pspec (QubitProcessorSpec) – The QubitProcessorSpec for the device that the circuit layer is being sampled for. Unless qubit_labels is not None, a circuit layer is sampled over all the qubits in pspec.

  • qubit_labels (list, optional) – If not None, a list of the qubits to sample the circuit layer for. This is a subset of pspec.qubit_labels. If None, the circuit layer is sampled to acton all the qubits in pspec.

  • one_q_gate_names ('all' or list of strs, optional) – If not ‘all’, a list of the names of the 1-qubit gates to be sampled from when applying a 1-qubit gate to a qubit. If this is ‘all’, the full set of 1-qubit gate names is extracted from the QubitProcessorSpec.

  • pdist ('uniform' or list of floats, optional) – If a list, they are unnormalized probabilities to sample each of the 1-qubit gates in the list one_q_gate_names. If this is not ‘uniform’, then oneQgatename` must not be ‘all’ (it must be a list so that it is unambiguous which probability corresponds to which gate). So if not ‘uniform’, pdist is a list of non-negative floats of the same length as one_q_gate_names. If ‘uniform’, then the uniform distribution over the gates is used.

  • modelname (str, optional) – Only used if one_q_gate_names is ‘all’. Specifies which of the pspec.models to use to extract the model. The clifford default is suitable for Clifford or direct RB, but will not use any non-Clifford gates in the model.

  • rand_state (RandomState, optional) – A np.random.RandomState object for seeding RNG

Returns:

A list of gate Labels that defines a “complete” circuit layer (there is one and only one gate acting on each qubit).

Return type:

list of gates