ProgramSetQuantumTaskResult
- class braket.tasks.program_set_quantum_task_result.MeasuredEntry(measurements, counts, probabilities, measured_qubits, measurements_from_device, probabilities_from_device, program, inputs, observable)[source]
Bases:
objectResult of a single executable in a program.
- Parameters:
measurements (
ndarray) – 2d array - row is shot and column is qubit. The columns are in the order ofmeasured_qubits.counts (
Counter) – ACounterof measurements. Key is the measurements in a big endian binary string. Value is the number of times that measurement occurred.probabilities (
dict[str,float]) – A dictionary of probabilistic results. Key is the measurements in a big endian binary string. Value is the probability the measurement occurred.measured_qubits (
list[int]) – The indices of the measured qubits.measurements_from_device (
bool) – flag whethermeasurementswere copied from device. If false,measurementsare calculated from device data.probabilities_from_device (
bool) – flag whethermeasurement_probabilitieswere copied from device. If false,measurement_probabilitiesare calculated from device data.program (
str) – The program this executable ran.inputs (
dict[str,float] |None) – The input parameters to this program, if any.observable (
Observable|None) – The observable of this program, if any.
- measurements: ndarray
- counts: Counter
- probabilities: dict[str, float]
- measured_qubits: list[int]
- measurements_from_device: bool
- probabilities_from_device: bool
- program: str
- inputs: dict[str, float] | None
- observable: Observable | None
- property expectation: float | None
The expectation value of this entry’s observable if there is one.
- Type:
float | None
- class braket.tasks.program_set_quantum_task_result.CompositeEntry(entries, program, inputs, observables, shots_per_executable, additional_metadata)[source]
Bases:
objectResults of a program in a program set
- Parameters:
entries (
list[MeasuredEntry]) – The results of each executable in this programprogram (
Program) – The program that was runinputs (
ParameterSets) – The input values this program was run withobservables (
Sum|list[Observable] |None) – The Sum Hamiltonian or observables that were measured, if any.shots_per_executable (
int) – The number of shots each underlying executable was run withadditional_metadata (
AdditionalMetadata|None) – Additional metadata about this program.Nonefor entries produced byProgramSetQuantumTaskResult.merge, since per-program metadata cannot be aggregated meaningfully across underlying tasks.
- property entries: list[MeasuredEntry]
The results of each executable in this program.
- Type:
list[MeasuredEntry]
- property program: Program
The program that was run.
- Type:
Program
- property inputs: ParameterSets
The input values this program was run with.
- Type:
- property observables: Sum | list[Observable] | None
The Sum Hamiltonian or observables measured, if any.
- Type:
Sum | list[Observable] | None
- property shots_per_executable: int
The number of shots each underlying executable was run with.
- Type:
int
- property additional_metadata: AdditionalMetadata | None
Additional metadata about this program.
For entries produced by
ProgramSetQuantumTaskResult.merge, this will beNone; Use the original per-task results for true per-program metadata.- Type:
AdditionalMetadata | None
- class braket.tasks.program_set_quantum_task_result.ProgramSetQuantumTaskResult(entries, task_metadata, num_executables, program_set)[source]
Bases:
objectThe result of a program set task.
- Parameters:
entries (
list[CompositeEntry]) – The results of each program in this program settask_metadata (
ProgramSetTaskMetadata)num_executables (
int) – The total number of executables in this program set taskprogram_set (
ProgramSet|None) – The program set that was run; if specified, information from the program set such as observable expectation values can be automatically computed.
- property entries: list[CompositeEntry]
The results of each program in this program set.
- Type:
list[CompositeEntry]
- property task_metadata: ProgramSetTaskMetadata
The metadata of the task.
- Type:
ProgramSetTaskMetadata
- property num_executables: int
The total number of executables in this program set task.
- Type:
int
- property program_set: ProgramSet | None
The program set that was run, if provided to the constructor.
- Type:
ProgramSet | None
- static from_object(result_schema, program_set=None)[source]
Create ProgramSetQuantumTaskResult from ProgramSetTaskResult object.
- Parameters:
result_schema (
ProgramSetTaskResult) – The result returned by the device; programs and metadata may be specified as relative S3 paths, in which case they will be downloaded to populate the instance.program_set (
ProgramSet|None) – The program set that was run; if specified, information from the program set such as observable expectation values can be automatically computed. Default: None.
- Return type:
- Returns:
ProgramSetQuantumTaskResult – A ProgramSetQuantumTaskResult based on the given schema object; all data stored in S3 is downloaded.
- static merge(results, program_set, index_map)[source]
Reconstruct a
ProgramSetQuantumTaskResultfrom the task results produced by running each program set ofprogram_set.split(...).index_mapis the per-executable map returned alongside the program sets byProgramSet.split:index_map[k][j]gives the index, in the order ofprogram_set, of the executable that the jth executable of the kth task represents. The kth task’s executables are read in order for its program set, namely acrossresults[k].entries, and within eachCompositeEntryacross itsentries.The returned
ProgramSetQuantumTaskResulthas the same shape as ifprogram_sethad been run unsplit, namely oneCompositeEntryper entry ofprogram_set.entries, andMeasuredEntryobjects in the order of the program.Expectation values and
SumHamiltonian expectations are computed for the originalProgramSet.- Parameters:
results (
Sequence[ProgramSetQuantumTaskResult]) – The result of each task, in the same order asprogram_set.split’s return.program_set (
ProgramSet) – The original unsplit program set.index_map (
list[list[int]]) – The per-executable map fromProgramSet.split.
- Return type:
- Returns:
ProgramSetQuantumTaskResult – A result matching the shape of
program_set.- Raises:
ValueError – If
len(results) != len(index_map), if the total size ofindex_mapdoesn’t matchprogram_set.total_executables, or if any task produces a different number of executables than its map expects.
- property programs: list[Program]
The OpenQASM programs specified in the program set
- Type:
list[Program]