QuantumProgram¶
- class QuantumProgram(shots, items=None, noise_maps=None)[source]¶
Bases:
objectA quantum runtime executable.
A quantum program consists of a list of ordered elements, each of which contains a single circuit and an array of associated parameter values. Executing a quantum program will sample the outcome of each circuit for the specified number of
shotsfor each set of circuit arguments provided.- Parameters:
shots (int) – The number of shots for each circuit execution.
items (Iterable[QuantumProgramItem] | None) – Items that comprise the program.
noise_maps (dict[str, PauliLindbladMap] | None) – Noise maps to use with samplex items.
Methods
- append(circuit, *, samplex=None, circuit_arguments=None, samplex_arguments=None, shape=None, chunk_size=None)[source]¶
Append a new
QuantumProgramItemto this program.- Parameters:
circuit (QuantumCircuit) – The circuit of this item.
samplex (Samplex | None) – An (optional) samplex to draw random parameters for the circuit.
circuit_arguments (np.ndarray | None) – Arguments for the parameters of the circuit. A real array where the last dimension matches the number of parameters in the circuit. Circuit execution will be broadcasted over the leading axes.
samplex_arguments (dict[str, np.ndarray] | None) – A map from argument names to argument values for the samplex. If this value is provided, a samplex must be present, and
circuit_argumentsmust not be supplied.shape (tuple[int, ...] | None) – A shape tuple to extend the implicit shape defined by
samplex_arguments. Non-trivial axes introduced by this extension enumerate randomizations. If this value is provided, a samplex must be present, andcircuit_argumentsmust not be supplied.chunk_size (int | None) – The maximum number of bound circuits in each shot loop execution, or
Noneto use a server-side heuristic to optimize speed. When not executing in a session, the server-side heuristic is always used and this value is ignored.
- Return type:
None
- validate(backend)[source]¶
Validate this quantum program against the given backend.
- Parameters:
backend (IBMBackend)
- Return type:
None