Ensuring PALP fails consistently without returning misleading data#41414
Ensuring PALP fails consistently without returning misleading data#41414vbraun merged 6 commits intosagemath:developfrom
Conversation
|
@fchapoton so what do you think does this fix it? |
|
The design of this method is a little weird so I may be overlooking some complication, but I think it would be much simpler if we did the cache check at the beginning of the method, for example: if self._points is not None:
return self._points(*args, **kwds)
# rest of the function
M = self.lattice()
nv = self.n_vertices()
points = self._vertices
...
if len(points) > nv:
points = PointCollection(points, M)
self._points = points
return self._points(*args, **kwds)From what I understand PALP already raises an exception when it fails. So long as the premature |
|
your approach is valid but i kind went this way to only cache on success so i completely avoid any garbage value that might happen, so if everything goes smoothly then i cache otherwise it's just empty |
|
Sure, that is the goal. In my example,
When the class is initiated, Putting that aside for the moment, why catch and re-raise the exception? |
|
I simplified the code structure
|
| current.set_immutable() | ||
| points.append(current) | ||
| if self.dim() > 1: | ||
| result = self. poly_x("p", reduce_dimension=True) |
There was a problem hiding this comment.
It looks like an extra space snuck in here between self. and poly_x.
| current.set_immutable() | ||
| for j in range(nv, m.ncols()): | ||
| current = M.element_class( | ||
| M, [m[i, j] for i in range(M. rank())]) |
|
Aside from three little typos it LGTM. Can you please add a doctest for the issue in #41400? |
|
i fixed typo i just got used smashing the space button :) |
Co-authored-by: Frédéric Chapoton <chapoton@unistra.fr>
|
Documentation preview for this PR (built with commit aa049b7; changes) is ready! 🎉 |
|
any pointers on why these test failed, i didn't understand why or what happened |
|
the test failure is irrelevant here, it's in |
|
it would be good to get to the bottom of the matter, |
|
There's a git repo now at https://gitlab.com/stringstuwien/PALP The error message is
which makes sense given that Fixing the problem in general is not going to be easy. With the upper limits hard-coded, you'll always be able to find a polytope that exceeds them. I think if a clever data structure was used, all of these limits could be dynamic, but that would (a) be a lot of work and (b) invalidate the documentation, which the author of PALP does not want to do. We might be able to get the limit raised to |
c0906c3 to
565f7ec
Compare
|
i closed it by mistake @dimpase it's ok right ? |
|
Closing is no big deal. Eventually someone will mark this "positive review" and then when it's time to release the next beta, our release manager will merge it. I think your doctest misses the issue though. You have to run |
|
thanks, on my manual testing i used to running it more than once |
|
The diff is OK, github is mangling it because the entire function was de-indented by one level. One last comment (sorry). The description of the doctest does not really explain the problem. It says that the example used to fail, but then the doctest shows it failing again. If you can please make it say something like "This method should not cache an incorrect answer if an exception is raised." |
|
no problem, what do you think of this line? i think this explain it better |
|
That's better, thank you. |
Description
it addresses issue #41400
where PALP fails and in the first call for n_points it fails (good)
second time it returns the number of vertices (wrong)
Changes
tests