Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
madcpf committed Jul 30, 2024
1 parent 7c0cea9 commit 5afde99
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions unitary/alpha/quantum_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5afde99

Please sign in to comment.