cirq.SimulationTrialResult

class cirq.SimulationTrialResult(params: cirq.study.resolver.ParamResolver, measurements: Dict[str, numpy.ndarray], final_state: numpy.ndarray)[source]

Results of a simulation by a SimulatesFinalWaveFunction.

Unlike TrialResult these results contain the final state (wave function)
of the system.
params

A ParamResolver of settings used for this result.

measurements
A dictionary from measurement gate key to measurement
results. Measurement results are a numpy ndarray of actual boolean
measurement results (ordered by the qubits acted on by the
measurement gate.)
final_state
The final state (wave function) of the system after the
trial finishes. The state is returned in the computational basis
with these basis states defined by the qubit ordering of the
simulation. In particular the qubit ordering can be used to produce
a list of qubits, and these qubits can the be associated with their
index in the list. This mapping of qubit to index is then
translated into binary vectors where the last qubit is the
1s bit of the index, the second-to-last is the 2s bit of the index,
and so forth (i.e. big endian ordering). Example:
qubit ordering: [QubitA, QubitB, QubitC]
Then the returned vector will have indices mapped to qubit basis
states like the following table
| | QubitA | QubitB | QubitC |
+—+——–+——–+——–+
| 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 |
| 2 | 0 | 1 | 0 |
| 3 | 0 | 1 | 1 |
| 4 | 1 | 0 | 0 |
| 5 | 1 | 0 | 1 |
| 6 | 1 | 1 | 0 |
| 7 | 1 | 1 | 1 |
+—+——–+——–+——–+
__init__(params: cirq.study.resolver.ParamResolver, measurements: Dict[str, numpy.ndarray], final_state: numpy.ndarray) → None[source]

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

Methods

bloch_vector(index) Returns the bloch vector of a qubit.
density_matrix(indices) Returns the density matrix of the wavefunction.
dirac_notation(decimals) Returns the wavefunction as a string in Dirac notation.