Shortcuts

qiskit.result.Result

class Result(backend_name, backend_version, qobj_id, job_id, success, results, date=None, status=None, header=None, **kwargs)[소스]

Model for Results.

backend_name

backend name.

Type

str

backend_version

backend version, in the form X.Y.Z.

Type

str

qobj_id

user-generated Qobj id.

Type

str

job_id

unique execution id from the backend.

Type

str

success

True if complete input qobj executed correctly. (Implies each experiment success)

Type

bool

results

corresponding results for array of experiments of the input qobj

Type

list[ExperimentResult]

__init__(backend_name, backend_version, qobj_id, job_id, success, results, date=None, status=None, header=None, **kwargs)[소스]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(backend_name, backend_version, …)

Initialize self.

data([experiment])

Get the raw data for an experiment.

from_dict(data)

Create a new ExperimentResultData object from a dictionary.

get_counts([experiment])

Get the histogram data of an experiment.

get_memory([experiment])

Get the sequence of memory states (readouts) for each shot The data from the experiment is a list of format [〈00000〉, 〈01000〉, 〈10100〉, 〈10100〉, 〈11101〉, 〈11100〉, 〈00101〉, …, 〈01010〉]

get_statevector([experiment, decimals])

Get the final statevector of an experiment.

get_unitary([experiment, decimals])

Get the final unitary of an experiment.

to_dict()

Return a dictionary format representation of the Result

data(experiment=None)[소스]

Get the raw data for an experiment.

Note this data will be a single classical and quantum register and in a format required by the results schema. We recommend that most users use the get_xxx method, and the data will be post-processed for the data type.

매개변수

experiment (str or QuantumCircuit or Schedule or int or None) – the index of the experiment. Several types are accepted for convenience:: * str: the name of the experiment. * QuantumCircuit: the name of the circuit instance will be used. * Schedule: the name of the schedule instance will be used. * int: the position of the experiment. * None: if there is only one experiment, returns it.

반환값

A dictionary of results data for an experiment. The data depends on the backend it ran on and the settings of meas_level, meas_return and memory.

QASM backends return a dictionary of dictionary with the key 〈counts〉 and with the counts, with the second dictionary keys containing a string in hex format (0x123) and values equal to the number of times this outcome was measured.

Statevector backends return a dictionary with key 〈statevector〉 and values being a list[list[complex components]] list of 2^num_qubits complex amplitudes. Where each complex number is represented as a 2 entry list for each component. For example, a list of [0.5+1j, 0-1j] would be represented as [[0.5, 1], [0, -1]].

Unitary backends return a dictionary with key 〈unitary〉 and values being a list[list[list[complex components]]] list of 2^num_qubits x 2^num_qubits complex amplitudes in a two entry list for each component. For example if the amplitude is [[0.5+0j, 0-1j], …] the value returned will be [[[0.5, 0], [0, -1]], …].

The simulator backends also have an optional key 〈snapshots〉 which returns a dict of snapshots specified by the simulator backend. The value is of the form dict[slot: dict[str: array]] where the keys are the requested snapshot slots, and the values are a dictionary of the snapshots.

반환 형식

dict

예외

QiskitError – if data for the experiment could not be retrieved.

classmethod from_dict(data)[소스]

Create a new ExperimentResultData object from a dictionary.

매개변수

data (dict) – A dictionary representing the Result to create. It will be in the same format as output by to_dict().

반환값

The Result object from the input dictionary.

반환 형식

Result

get_counts(experiment=None)[소스]

Get the histogram data of an experiment.

매개변수

experiment (str or QuantumCircuit or Schedule or int or None) – the index of the experiment, as specified by get_data().

반환값

int] or list[dict[str:int]]: a dictionary or a list of

dictionaries. A dictionary has the counts for each qubit with the keys containing a string in binary format and separated according to the registers in circuit (e.g. 0100 1110). The string is little-endian (cr[0] on the right hand side).

반환 형식

dict[str

예외

QiskitError – if there are no counts for the experiment.

get_memory(experiment=None)[소스]

Get the sequence of memory states (readouts) for each shot The data from the experiment is a list of format [〈00000〉, 〈01000〉, 〈10100〉, 〈10100〉, 〈11101〉, 〈11100〉, 〈00101〉, …, 〈01010〉]

매개변수

experiment (str or QuantumCircuit or Schedule or int or None) – the index of the experiment, as specified by data().

반환값

Either the list of each outcome, formatted according to

registers in circuit or a complex numpy np.darray with shape:

meas_level

meas_return

shape

0

single

np.ndarray[shots, memory_slots, memory_slot_size]

0

avg

np.ndarray[memory_slots, memory_slot_size]

1

single

np.ndarray[shots, memory_slots]

1

avg

np.ndarray[memory_slots]

2

memory=True

list

반환 형식

List[str] or np.ndarray

예외

QiskitError – if there is no memory data for the circuit.

get_statevector(experiment=None, decimals=None)[소스]

Get the final statevector of an experiment.

매개변수
  • experiment (str or QuantumCircuit or Schedule or int or None) – the index of the experiment, as specified by data().

  • decimals (int) – the number of decimals in the statevector. If None, does not round.

반환값

list of 2^num_qubits complex amplitudes.

반환 형식

list[complex]

예외

QiskitError – if there is no statevector for the experiment.

get_unitary(experiment=None, decimals=None)[소스]

Get the final unitary of an experiment.

매개변수
  • experiment (str or QuantumCircuit or Schedule or int or None) – the index of the experiment, as specified by data().

  • decimals (int) – the number of decimals in the unitary. If None, does not round.

반환값

list of 2^num_qubits x 2^num_qubits complex

amplitudes.

반환 형식

list[list[complex]]

예외

QiskitError – if there is no unitary for the experiment.

to_dict()[소스]

Return a dictionary format representation of the Result

반환값

The dictionary form of the Result

반환 형식

dict

당신은 다음 언어로 문서를 보고 있다 lang: Korean
언어
English
Japanese
German
Korean