-
Notifications
You must be signed in to change notification settings - Fork 624
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
add output type to qobj.eigenstate #2351
base: master
Are you sure you want to change the base?
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.
@rochisha0
Please tell us when this is ready to review.
It will need tests with the new option and a towncrier entry.
@Ericgig I have made the changes upto best of my knowledge, I am not able to figure out how to apply phase fixing to the new operator type. Also after a few iterations my local build seems to give cython errors, is there a wiki on how to sort that out? |
Cython error are quite vague, but there should not be any cython error here. |
qutip/core/qobj.py
Outdated
ekets = Qobj(evecs) | ||
norm = ekets.norm() |
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.
Closer but still not there.
Dimensions are not set.
The output should be the same as the kets concatenated in a single matrices:
op = qutip.rand_herm(N)
_, kets = op.eigenstates(output_type='kets', phase_fix=M)
_, oper = op.eigenstates(output_type='operator', phase_fix=M)
qutip.Qobj(np.hstack([vec.full() for vec in kets]), dims) == oper
The norm of a matrix, per default it the trace norm: tr(sqrt(A @ A.adjoint()))
, while for the ket it's l2 norm: sqrt(sum(|a_i|**2))
.
For normalization and phase_fix, you may want to take a look into Qobj.inv
, qutip.qdiags
.
@rochisha0 are you still working on this? |
@Ericgig Yes, I'm working on this. Caught up in some tasks, will try to complete over weekend. |
Could you fix the conflict. |
Description
Add output_type to qobj.eigenstate() to add return type as both operator as well as kets
Related issues or PRs
fix #2338