From 135d7da829e6869bee80508ff5f3de628fc1b922 Mon Sep 17 00:00:00 2001 From: Doug Strain Date: Fri, 29 Mar 2024 19:15:26 -0700 Subject: [PATCH] Fix density matrix references in other simulators - These simulators do not use density matrices. Fixes: #6225 --- cirq-core/cirq/sim/simulation_state.py | 2 +- cirq-core/cirq/sim/state_vector_simulation_state.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cirq-core/cirq/sim/simulation_state.py b/cirq-core/cirq/sim/simulation_state.py index 09d7dc48b55..ee1f9a348f3 100644 --- a/cirq-core/cirq/sim/simulation_state.py +++ b/cirq-core/cirq/sim/simulation_state.py @@ -111,7 +111,7 @@ def get_axes(self, qubits: Sequence['cirq.Qid']) -> List[int]: return [self.qubit_map[q] for q in qubits] def _perform_measurement(self, qubits: Sequence['cirq.Qid']) -> List[int]: - """Delegates the call to measure the density matrix.""" + """Delegates the call to measure the `QuantumStateRepresentation`.""" if self._state is not None: return self._state.measure(self.get_axes(qubits), self.prng) raise NotImplementedError() diff --git a/cirq-core/cirq/sim/state_vector_simulation_state.py b/cirq-core/cirq/sim/state_vector_simulation_state.py index d96bf0dc6f7..1c8987b29ad 100644 --- a/cirq-core/cirq/sim/state_vector_simulation_state.py +++ b/cirq-core/cirq/sim/state_vector_simulation_state.py @@ -60,11 +60,11 @@ def create( This initializer creates the buffer if necessary. Args: - initial_state: The density matrix, must be correctly formatted. The data is not + initial_state: The state vector, must be correctly formatted. The data is not checked for validity here due to performance concerns. - qid_shape: The shape of the density matrix, if the initial state is provided as an int. - dtype: The dtype of the density matrix, if the initial state is provided as an int. - buffer: Optional, must be length 3 and same shape as the density matrix. If not + qid_shape: The shape of the state vector, if the initial state is provided as an int. + dtype: The dtype of the state vector, if the initial state is provided as an int. + buffer: Optional, must be length 3 and same shape as the state vector. If not provided, a buffer will be created automatically. Raises: ValueError: If initial state is provided as integer, but qid_shape is not provided.