-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow measure_entanglement to calculate entanglement for multiple qubits #206
base: main
Are you sure you want to change the base?
Conversation
@@ -20,7 +20,8 @@ | |||
from unitary.alpha.sparse_vector_simulator import PostSelectOperation, SparseSimulator | |||
from unitary.alpha.qudit_state_transform import qudit_to_qubit_unitary, num_bits | |||
import numpy as np | |||
import itertools | |||
from itertools import combinations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer import itertools
then itertools.combinations
below
"Use import statements for packages and modules only, not for individual types, classes, or functions."
https://google.github.io/styleguide/pyguide.html#22-imports
entanglement[j][i] = entanglement[i][j] | ||
names = list(self.object_name_dict.keys()) | ||
data_frame = pd.DataFrame(entanglement, index=names, columns=names) | ||
print(data_frame.round(1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we return the data_frame (or some other result) instead of printing it?
Printing it seems generally unhelpful if we are using this within a game.
entropy = [0.0] * num_qubits | ||
entropy_pair = np.zeros((num_qubits, num_qubits)) | ||
entanglement = np.zeros((num_qubits, num_qubits)) | ||
for i in range(num_qubits - 1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this block is fairly tough to follow. I would add comments below or in the function's docstring to explain the implementation details.
Update quantum world to