-
Notifications
You must be signed in to change notification settings - Fork 45
More informative errors for finite mps #367
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
Codecov Report❌ Patch coverage is
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
I'm not entirely sure how I feel about the For the |
|
The error I had previously was vague enough with an unnecessarily long stack-trace that I thought it was justifiable to raise the method error from the beginning. I'm not sure what other kind of message can be raised. Transfer matrices do exist for finite MPS but their spectra are not so simply solved. This isn't really a hill to die on from my side, so I don't mind whatever. |
|
But I'm confused about where you are putting the restrictions, would that not mean you should restrict the functions that call these methods to not accept |
|
I'm confused as well now, because isn't that what the method error does? |
|
Woohoow, spreading confusion 🎉 What I mean is, you are now restricting |
|
I could do that (and I'm not against it), but I guess I don't understand how that's more informative than having the |
lkdvos
left a comment
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.
It doesn't matter too much, I'm also happy with the AbstractVector kind of approach, but in general the idea is to restrict types the least amount possible. For example, in principle we could decide at some point to diagonalize the full spectrum of the transfer matrix, which would then be a SectorDict, and perhaps the methods might still just work. I also think an explicit error that says you can't call correlation_length on a FiniteMPS is more informative than a MethodError, since that might also mean that it isn't implemented, or you accidentally have the argument order wrong, etc. None of this is super important though, so feel free to merge this if you think it isn't worth the hassle, I'm just giving my general thoughts :)
|
Thanks for sharing your thoughts! For now, I'll merge as is, and deal with potential repercussions in the future 😉 |
Small silly change, but while I was being lazy with variable names and confused my finite MPS with infinite MPS, I realised I could call certain functions and get it to error at weird places. This change fixes that. It seemed good to do since these functions are exported, so the generic method was always available.
Unrelated to this, I was also playing around with Cartesian spaces and
transfer_spectrumwould use the sectorTrivial()to make aComplexSpace, so now it checks the space type instead of sector type.Final thing to add: the eigsolve that happens in
transfer_spectrumdefaults to Arnoldi even though the state is fully real. I didn't change this, because I simply don't know how much support we want for real MPSs.