-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow simulator quantum state representations to be used in qis #5265
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
Conversation
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.
What all does this actually buy us? I assume qis
makes use of QUANTUM_STATE_LIKE
in several places, and that's how this gets distributed? OTherwise it seems like only von_neumann_entropy
is benefiting from this.
return None | ||
return np.reshape(self.data, self.qid_shape) | ||
|
||
def density_matrix(self) -> np.ndarray: |
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.
Keeping this here seems wrong - density matrices should override it, and everything else can call the parent method.
|
||
class QuantumState: | ||
"""A quantum state. | ||
class HasQuantumState(abc.ABC): |
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.
Mixed feelings on this name - I'd expect "Has..." to be a method, intuitively. Is AbstractQuantumState
already taken?
@95-martin-orion Perhaps it's not useful. I'm mostly looking at #4582, which seems to be asking for some unification between various types of quantum states allowing them to be used in qis independently, and then a Admittedly when I started this I assumed I still think it's a nice unification for the sake of unification, but we should probably sync with @viathor and see if this is what he had in mind for #4582 next cynq. I'll re-mark this as draft until then. |
@95-martin-orion The other consideration is I remember a while ago there was a proposal to adopt some existing qis library. That may actually make sense here. The only real core thing in qis seems to be the |
This PR unifies the quantum state types between
sim
andqis
modules.We create a
HasQuantumState
interface, from which bothQuantumState
andProductState
(used in qis), andQuantumStateRepresentation
(the base class of quantum states used in simulators, including CliffordTableau, MPS, CHForm, SV/DM) inherit.We then update the relevant
qis
method parameters to useHasQuantumState
instead ofQuantumState
. This allows a broader range of quantum state representations to be analyzed in ourqis
utilities.xref #4582