# cirq.DensityMatrixStepResult¶

class cirq.DensityMatrixStepResult(density_matrix: numpy.ndarray, measurements: Dict[str, numpy.ndarray], qubit_map: Dict[cirq.ops.raw_types.Qid, int], dtype: Type[numpy.number] = <class 'numpy.complex64'>)[source]

A single step in the simulation of the DensityMatrixSimulator.

qubit\_map
A map from the Qubits in the Circuit to the the index
of this qubit for a canonical ordering. This canonical ordering
is used to define the state vector (see the state_vector()
method).
measurements
A dictionary from measurement gate key to measurement
results, ordered by the qubits that the measurement operates on.
__init__(density_matrix: numpy.ndarray, measurements: Dict[str, numpy.ndarray], qubit_map: Dict[cirq.ops.raw_types.Qid, int], dtype: Type[numpy.number] = <class 'numpy.complex64'>)[source]

DensityMatrixStepResult.

Parameters
• density_matrix – The density matrix at this step. Can be mutated.

• measurements – The measurements for this step of the simulation.

• qubit_map – A map from qid to index used to define the ordering of the basis in density_matrix.

• dtype – The numpy dtype for the density matrix.

Methods

 Returns the density matrix at this step in the simulation. sample(qubits[, repetitions, seed]) Samples from the system at this point in the computation. sample_measurement_ops(measurement_ops[, …]) Samples from the system at this point in the computation. set_density_matrix(density_matrix_repr) Set the density matrix to a new density matrix.