-
Notifications
You must be signed in to change notification settings - Fork 124
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
throw error in case of order mismatch in ProjMPO-ITensor product #390
Conversation
Hey Ori, Looks like a good check to add. We could also add a compile-time check, the advantage would be that it would make this function more type-stable (the order of the output should be inferable). I think we could just make the function signature: function product(P::ProjMPO,
v::ITensor{N})::ITensor{N} where {N}
[...]
end The runtime check you added should get called as well and is useful to have, so I think we should have both this extra type information and the check and error message you added. Having an Also it is a good idea to have guidelines for contributing to ITensors.jl. I've started an "advanced usage" section of the docs here: #387, I can start adding that there. I think with multi-line calls you are referring to here, it may be better to split it into multiple lines with temporary variables. -Matt |
We could print just I'll add the compile time check. |
I think we should remove it for now, since |
updated the PR with the type annotation and removed |
Looks great, thanks! |
This PR adds a check to
product(P::ProjMPO,wf::ITensor)
which will throw an informative error if the order ofP(wf)
doesn't matchwf
, as discussed in #389.I also implemented
NDTensors.inds(P::ProjMPO)
.The error message (for the case
nsite(P)==2
) would look like this:I should probably add some tests, but there was no
projmpo.jl
test file, should I create a new one or should the tests be indmrg.jl
test file?Also there are some multi-line function calls there and I wasn't fully sure what formatting guidelines should be followed, so let me know if formatting is off (maybe worth adding some contributors guide section somewhere).