-
Notifications
You must be signed in to change notification settings - Fork 56
Add SectorVector
#324
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 SectorVector
#324
Conversation
|
Looks good to me. I think the main questions I still have, especially since we are overloading more of the Some other idea, that I'm not sure about whether it is good or not, is to restrict the As a sidenote, I would have guessed that some of these I do think that changing the |
I am definitely in favor of the
I did this to make use of the specialized notations for |
This PR is an implementation of the data structure suggested for
svd_vals,eig_vals, ... but also thinking ofentanglement_spectrumfunctionality etc.I introduced a
SectorVectortype, which acts as a (dense) vector with the option of taking views for the different sectors.This is a better return type for
svd_valsetc, since their MatrixAlgebraKit equivalents are supposed to output "vector"-like objects instead of "matrix"-like objects.Therefore,
SectorVectorrelates toDiagonalTensorMapin the same wayVectorrelates toDiagonal.There are quite a few opinionated choice in here that we may carefully consider, so let me mention them here and motivate my initial choices:
SectorVector <: AbstractVectorin the end. The main reason is that I remembered people do actually like to inspect the singular and eigenvalues, and this is probably not an unreasonable point to actually be able to callmaximum,minimum, etc on this object.I <: Sector, even though the data structure does somewhat assume this is the case. It didn't really feel necessary, and leaves the door open for weird alternative uses, although I'm not sure if this really makes a difference.pairs,valuesorkeysif you want to deal with theAbstractDict-like interface, i.e. iteration by default iterates like a vector, you can iterate over the blocks usingpairsorblocksinstead.This last thing is definitely a breaking change with respect to the previous behavior, also for
LinearAlgebra.svdvals, but I think that the added convenience of having vector functionality work out of the box might be worth it.Additionally, we could consider using this
Vectoras the data type ofDiagonalTensorMap, further showing how they are interrelated. I didn't do this (yet), but I would be open for that change, since that would avoid us having to recompute the offsets inblocketc.@Jutho, I won't continue working on this, so feel free to make some more changes and merge/release if you like.