From 5afde999aa0290dd6f3406691e91317d94b6c239 Mon Sep 17 00:00:00 2001 From: madcpf Date: Tue, 30 Jul 2024 15:16:05 -0700 Subject: [PATCH] update comment --- unitary/alpha/quantum_world.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/unitary/alpha/quantum_world.py b/unitary/alpha/quantum_world.py index 7d8d5ad0..6235b908 100644 --- a/unitary/alpha/quantum_world.py +++ b/unitary/alpha/quantum_world.py @@ -639,11 +639,17 @@ def get_binary_probabilities( def density_matrix( self, objects: Optional[Sequence[QuantumObject]] = None, count: int = 1000 ) -> np.ndarray: - """Simulates the density matrix of the given objects. + """Simulates the density matrix of the given objects. We assume that the overall state of + the quantum world (including all quantum objects in it) could be described by one pure + state. To calculate the density matrix of the given quantum objects, we would always measure/ + peek the quantum world for `count` times, deduce the (pure) state vector based on the results, + then the density matrix is its outer product. We will then trace out the un-needed quantum + objects before returning the density matrix. Parameters: - objects: List of QuantumObjects (currently only qubits are supported) - count: Number of measurements + objects: List of QuantumObjects (currently only qubits are supported). If not specified, + all quantum objects' density matrix will be returned. + count: Number of measurements. Returns: The density matrix of the specified objects.