Result module
- class Result
Implements the Result class. The user is not required to create an instance of this class on their own. The backend creates an instance of this class, once the job is executed and the results of the experiment are available.
See also: JobV1.result()
- Result()
The constructor of the Result class.
- Args:
None
- Returns:
Result
- Raises:
None
- Result.backend_name: str
Name of the backend that proceesed the job.
- Result.backend_version: str
Version of the backend.
- Result.qobj_id: str
Used generated object ID of the result object. Currently not used.
- Result.job_id: str
The Job ID corresponding to the results.
- Result.success: bool
True: If the job was successful. False: If the job execution failed. The result data may not be accurate.
- Result.results: list[str]
A list of the measurement data obtained from each shot of execution.
- Result.date: str
The date on which the job was executed.
- Result.status: str
A textual description of the status.
- Result.header: str
Results header. Currently not used.
- to_dict(self)
Provides a dictionary of the default result data.
- Args:
None
- Returns:
dict
- Raises:
None
- data(self)
Returns a dictionary of the result data. returns “counts”, “statevector”, “probabilities”, “amplitudes”, and “densitymatrix”. Note that some of these calculations require a lot of memory. For example to obtain statevector, the user is adviced to fetch it for a number of qubits of 12 at a time using the corresponding get methods.
- Args:
None
- Returns:
dict
- Raises:
- MemoryAllocError:
In case there is not enough memory to process the data.
- get_memory(self)
Fetches the execution summary. The measurement data of all shots is returned as a list.
- Args:
None
- Returns:
list[str]
- Raises:
None
- get_counts(self)
Returns the counts dictionary. For each measurement result, the percentage of occurance is returned as a dictionary.
- Args:
None
- Returns:
dict
- Raises:
None
- get_statevector(self, experiment=0, decimals=0, qubit_list=None)
Returns the statevector of the specified qubits
- Args:
- experiment (int):
The experiment for which the statevector is to be returned. This field is unused and only the statevector of the last executed shot is stored by the system.
- decimals (int):
Sets a limit on the number of decimal places to be returned. Currently, this field is not used.
- qubit_list (Optional[list[int]]):
An integer array listing the qubits for which the statevector is to be calculated. If not provided, the entire list of qubits is assumed.
- Returns:
[complex,complex]
- Raises:
- MemoryAllocError:
If there is insufficient memory to calculate the statevector.
- OutOfRangeError:
If the qubit list had invalid qubits.
- get_unitary(self, experiment=0, decimals=0, qubit_list=None)
Returns the amplitude vector of the specified qubits
- Args:
- experiment (int):
The experiment for which the amplitude vector is to be returned. This field is unused and only the amplitude vector of the last executed shot is stored by the system.
- decimals (int):
Sets a limit on the number of decimal places to be returned. Currently, this field is not used.
- qubit_list (Optional[list[int]]):
An integer array listing the qubits for which the amplitude vector is to be calculated. If not provided, the entire list of qubits is assumed.
- Returns:
[complex]
- Raises:
- MemoryAllocError:
If there is insufficient memory to calculate the amplitude vector.
- OutOfRangeError:
If the qubit list had invalid qubits.
- from_dict(self, data)
This function is not supported.
- Args:
None
- Returns:
None
- Raises:
- NotImplemented:
This function is not supported.
- get_probabilities(self, experiment=0, decimals=0, qubit_list=None)
Returns the probability vector of the specified qubits
- Args:
- experiment (int):
The experiment for which the probability vector is to be returned. This field is unused and only the probability vector of the last executed shot is stored by the system.
- decimals (int):
Sets a limit on the number of decimal places to be returned. Currently, this field is not used.
- qubit_list (Optional[list[int]]):
An integer array listing the qubits for which the probability vector is to be calculated. If not provided, the entire list of qubits is assumed.
- Returns:
[float]
- Raises:
- MemoryAllocError:
If there is insufficient memory to calculate the probability vector.
- OutOfRangeError:
If the qubit list had invalid qubits.
- get_densitymatrix(self, experiment=0, decimals=0, qubit_list=None)
Returns the density matrix of the specified qubits
- Args:
- experiment (int):
The experiment for which the density matrix is to be returned. This field is unused and only the density matrix of the last executed shot is stored by the system.
- decimals (int):
Sets a limit on the number of decimal places to be returned. Currently, this field is not used.
- qubit_list (Optional[list[int]]):
An integer array listing the qubits for which the density matrix is to be calculated. If not provided, the entire list of qubits is assumed.
- Returns:
[complex, complex]
- Raises:
- MemoryAllocError:
If there is insufficient memory to calculate the density matrix.
- OutOfRangeError:
If the qubit list had invalid qubits.
- get_classicalregister(self)
Returns the current state of the classical registers
- Args:
None
- Returns:
str
- Raises:
- MemoryAllocError:
If there is insufficient memory.