{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/32","labels_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/32/comments","events_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/32/events","html_url":"https://github.com/JuliaQuantum/QuBase.jl/pull/32","id":75153357,"number":32,"title":"WIP: Add new types QuStateVec and QuDensityMatrix.","user":{"login":"acroy","id":6170781,"avatar_url":"https://avatars.githubusercontent.com/u/6170781?v=3","gravatar_id":"","url":"https://api.github.com/users/acroy","html_url":"https://github.com/acroy","followers_url":"https://api.github.com/users/acroy/followers","following_url":"https://api.github.com/users/acroy/following{/other_user}","gists_url":"https://api.github.com/users/acroy/gists{/gist_id}","starred_url":"https://api.github.com/users/acroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acroy/subscriptions","organizations_url":"https://api.github.com/users/acroy/orgs","repos_url":"https://api.github.com/users/acroy/repos","events_url":"https://api.github.com/users/acroy/events{/privacy}","received_events_url":"https://api.github.com/users/acroy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-05-11T09:30:24Z","updated_at":"2015-05-14T20:36:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/32","html_url":"https://github.com/JuliaQuantum/QuBase.jl/pull/32","diff_url":"https://github.com/JuliaQuantum/QuBase.jl/pull/32.diff","patch_url":"https://github.com/JuliaQuantum/QuBase.jl/pull/32.patch"},"body":"This adds two new types `QuStateVec` (for state vectors/wave functions) and `QuDensityMatrix` (for density matrices). I am not sure we want/need the former, but since I had implemented it anyways I include it here.\r\n\r\nTwo new functions, `populations` and `purity`, are defined, which return the occupation probability and the purity, respectively. I also added `trace` and `sqrtm` for `AbstractQuMatrix`.\r\n\r\nTests are missing so far."},"comment":{"url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/comments/102161820","html_url":"https://github.com/JuliaQuantum/QuBase.jl/pull/32#issuecomment-102161820","issue_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/32","id":102161820,"user":{"login":"jrevels","id":3277443,"avatar_url":"https://avatars.githubusercontent.com/u/3277443?v=3","gravatar_id":"","url":"https://api.github.com/users/jrevels","html_url":"https://github.com/jrevels","followers_url":"https://api.github.com/users/jrevels/followers","following_url":"https://api.github.com/users/jrevels/following{/other_user}","gists_url":"https://api.github.com/users/jrevels/gists{/gist_id}","starred_url":"https://api.github.com/users/jrevels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrevels/subscriptions","organizations_url":"https://api.github.com/users/jrevels/orgs","repos_url":"https://api.github.com/users/jrevels/repos","events_url":"https://api.github.com/users/jrevels/events{/privacy}","received_events_url":"https://api.github.com/users/jrevels/received_events","type":"User","site_admin":false},"created_at":"2015-05-14T20:36:54Z","updated_at":"2015-05-14T20:36:54Z","body":"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 are correspond to the probability amplitudes for the basis states. \r\n\r\nThat 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?\r\n\r\nIf so, it might make more sense to distinguish the behavior on a functional level (e.g. `statenorm` vs. `norm`) rather than on the type level. Or, having types that capture each behavior (`QuDensityState`, `QuDensityOp`).\r\n\r\nAnyway, this PR makes a bit more sense to me now, thanks for your patience.\r\n\r\n@amitjamadagni So the type you listed represents the sum (mixing Julia notation and math)  `∑ prob[i] * | i >< i |`? This could only work in the case where the off-diagonal elements of the matrix are zero, i.e., there are no coherences in the mixed state."}}