-
Notifications
You must be signed in to change notification settings - Fork 6
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
WIP: Add new types QuStateVec and QuDensityMatrix. #32
base: master
Are you sure you want to change the base?
Conversation
I'm not sure what My assumption was that we were going to have a
And then define
And then we define things like
e.g., a calculation that only takes the outer product once and does not require repeated access to the resulting elements. We can overload
Anyway, I was gonna tackle #31 today, then move on to making a PR that defines the above stuff, but it seems like that PR would be competing with this one. Thoughts on the above? |
Yeah, I am not sure about Independent of that, I think your suggestions regarding a lazy outer product sound like a great idea and there is probably no conflict with this PR. |
I was thinking whether we could have something like this type QuDensityMatrix
prob::Array{Float64,1}
state::QuStateVec
QuDensityMatrix(prob::Array{Float64,1}, state::QuStateVec) = new(prob, state)
end
QuDensityMatrix(qa::QuDensityMatrix) = QuMatrix(#summation_of_states_outerproduct given by coeffs(qa.prob * (qa.state*(qa.StateVec)')) I guess using this we could even fix conversion of state to density matrix using this. Please do let me know if I am missing something on this. |
What I'm saying is that we already have a type which explicitly covers this behavior:
...and the trace over a
The point, I think, is that any |
@amitjamadagni If I understand the type you gave (which I might not, correct me if I'm wrong), it is equivalent to an outer product of pure states - states that can be straightforwardly represented as a superposition of other states (e.g., a |
@acroy I may have misinterpreted the intent of your statement about the norm being defined by the trace - so you're saying we'd have conflicting definitions for |
@acroy Also, an addendum to this statement:
The way I've been thinking of it is that a density operator does represent a state, but what it is is an operator. So, re-reading your comment, your claim is that there will be functions for which we want a different definition for |
@jrevels : I basically agree with what you say and, in particular, I would also like to avoid redundant types. Unfortunately, states (= density matrices) and operators do not always behave in the same way. The first example is But we could also just use the trace norm for operators as well and accept the inconsistency with the inner product. However, I am still wondering if it would be convenient in some cases to say that an argument has to be a density matrix/state (like for propagation)? |
Hmm. I've normally thought of the density matrix as a representation of an operator describing an ensemble of states, rather than a representation of a state in and of itself, but I guess that both concepts are equally valid when referring to mixed states. The separate time evolution behavior makes sense to me after looking at a derivation from the Von Neumann equation. I couldn't find anything on defining the norm to be the square root of the trace, but it makes sense to me if the diagonal elements of the matrix correspond to the probability amplitudes for the basis states. That brings up the point: Is it feasible that one would actually want to treat a density matrix as an operator or a state, given the context of different calculations? For example, would a user ever want to take the traditional Frobenius norm for the density operator, rather than the norm of the state that operator describes? If so, it might make more sense to distinguish the behavior on a functional level (e.g. Anyway, this PR makes a bit more sense to me now, thanks for your patience. @amitjamadagni So the type you listed represents the sum (mixing Julia notation and math) |
I think this is actually a pretty subtle point, which touches the ontology of density matrices and state vectors. Some consider the latter as fundamental, while others argue for the opposite. Fortunately we don't have to decide this here :-)
Good question. One certainly wants the DM to be an operator in most situations, just for some (interpretation related) questions one needs special behavior. The issue with Regarding Amit's suggestion: the sum is like you say, but |
After being absent from QuBase.jl for a while, I'm fairly convinced that traits are the correct way to do this. As we've already discussed, density matrices can be treated like states or operators depending on context. Thus, a density matrix could be defined as a subtype of an |
This adds two new types
QuStateVec
(for state vectors/wave functions) andQuDensityMatrix
(for density matrices). I am not sure we want/need the former, but since I had implemented it anyways I include it here.Two new functions,
populations
andpurity
, are defined, which return the occupation probability and the purity, respectively. I also addedtrace
andsqrtm
forAbstractQuMatrix
.Tests are missing so far.