-
Notifications
You must be signed in to change notification settings - Fork 370
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
Confusions about checks in PolynomialTensor #240
Comments
|
|
Three. Okay, I agree that we should raise ValueError in some of these cases then. |
I've been looking over
PolynomialTensor
after seeing some PRs touch it, and had a few questions. I'm not very familiar with the class, so I think one of them might be a misunderstanding, but the others appear to be problems that are a) not sufficiently tested and b) could give errors in the code.My questions have to do with several places where a
TypeError
is raised, or tensors are considered unequal, ifself.n_body_tensors.keys() != other.n_body_tensors.keys()
in https://github.com/quantumlib/OpenFermion/blob/master/src/openfermion/ops/_polynomial_tensor.py.The questions I have are
keys()
doesn't guarantees order in its output, so I don't think these checks are particularly meaningful to begin with (they should at least useset(x.keys())
for comparison - if that's what we really want),self
but not inother
with the corresponding value inself
withinEQ_TOLERANCE
of zero, the tensors should be equal, not unequal (shouldn't they?),TypeError
says that arguments are the wrong type, not that something else is wrong with them. So TypeError is not the right error to be raising here. But as in 2. I don't think this condition should lead to an error at all.Thoughts?
The text was updated successfully, but these errors were encountered: