View source on GitHub |
The results of running on an IonQ QPU.
cirq_ionq.results.QPUResult(
counts: Dict[int, int],
num_qubits: int,
measurement_dict: Dict[str, Sequence[int]]
)
Methods
counts
counts(
key: Optional[str] = None
) -> Counter[int]
Returns the processed counts of the measurement results.
If a key parameter is supplied, these are the counts for the measurement results for the qubits measured by the measurement gate with that key. If no key is given, these are the measurement results from measuring all qubits in the circuit.
The key in the returned dictionary is the computational basis state measured for the
qubits that have been measured. This is expressed in big-endian form. For example, if
no measurement key is supplied and all qubits are measured, the key in this returned dict
has a bit string where the cirq.LineQubit
s are expressed in the order:
(cirq.LineQubit(0), cirq.LineQubit(1), ..., cirq.LineQubit(n-1))
In the case where only r
qubits are measured corresponding to targets t_0, t1,...t{r-1},
the bit string corresponds to the order
(cirq.LineQubit(t_0), cirq.LineQubit(t1), ... cirq.LineQubit(t{r-1}))
The value is the number of times that corresponding bit string occurred.
See to_cirq_result
to convert to a cirq.Result
.
measurement_dict
measurement_dict() -> Dict[str, Sequence[int]]
Returns a map from measurement keys to target qubit indices for this measurement.
num_qubits
num_qubits() -> int
Returns the number of qubits the circuit was run on.
ordered_results
ordered_results(
key: Optional[str] = None
) -> List[int]
Returns a list of arbitrarily but consistently ordered results as big endian ints.
If a key parameter is supplied, these are the counts for the measurement results for the qubits measured by the measurement gate with that key. If no key is given, these are the measurement results from measuring all qubits in the circuit.
The value in the returned list is the computational basis state measured for the
qubits that have been measured. This is expressed in big-endian form. For example, if
no measurement key is supplied and all qubits are measured, each entry in this returned dict
has a bit string where the cirq.LineQubit
s are expressed in the order:
(cirq.LineQubit(0), cirq.LineQubit(1), ..., cirq.LineQubit(n-1))
In the case where only r
qubits are measured corresponding to targets t_0, t1,...t{r-1},
the bit string corresponds to the order
(cirq.LineQubit(t_0), cirq.LineQubit(t1), ... cirq.LineQubit(t{r-1}))
repetitions
repetitions() -> int
Returns the number of times the circuit was run.
to_cirq_result
to_cirq_result(
params: Optional[cirq.ParamResolver] = None
) -> cirq.Result
Returns a cirq.Result
for these results.
cirq.Result
contains a less dense representation of results than that returned by
the IonQ API. Typically these results are also ordered by when they were run, though
that contract is implicit. Because the IonQ API does not retain that ordering information,
the order of these cirq.Result
objects should not be interpetted as representing the
order in which the circuit was repeated. Correlations between measurements keys are
preserved.
Args | |
---|---|
params
|
The cirq.ParamResolver used to generate these results.
|
Returns | |
---|---|
The cirq.Result for these results.
|
Raises | |
---|---|
ValueError
|
If the circuit used to produce this result had no measurement gates (and hence no measurement keys). |
__eq__
__eq__(
other
)
Return self==value.