-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Some optimizations for method regions of hyperplane arrangements #29661
Comments
Branch: public/29661 |
comment:1
Note that this ticket is motivated by a new implementation in polymake by Lars Kastner and Marta Panizzut, see https://arxiv.org/pdf/2003.13548.pdf. The example to benchmark is taken from their paper. New commits:
|
Commit: |
comment:2
One comment: Probably a comment like + # Determine if all vertices lie on one side of the hyperplane.
+ splits = False
+ direction = 0 Would complete the following one: + if not splits:
+ # All vertices lie in one closed halfspace of the hyperplane. I am a bit perturbed by the for loop followed by an if statement that ultimately modify the value of But now that I look at it more, probably it is the best way to do so. Hm. Another thing: if the algorithm you wrote is described in the article you mention, it should be added in the documentation of the function. |
comment:3
No, it's not their algorithm. It's exactly the algorithm that Volker Braun implemented back in 2013 (according to I came up with both ideas optimizing Sage's approach myself. I don't see anything like this mentioned in their paper, but I will ask them about that. |
comment:4
Replying to @kliem:
Ok, fine. Just making sure. |
Changed branch from public/29661 to public/29661-reb |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:7
Replying to @kliem:
You mean for example something like a library of hyperplane arrangements? There is
Do you mean whether hyperplane arrangements accept other types of input? |
comment:8
Thanks. That's not exactly what I meant. But it helped. I was looking for something like
that just figures out some meaningful generators, but I guess one extra line does the job (as is illustrated in the method
|
comment:9
Replying to @kliem:
Ahhh. Yes, I got you. Yes... I like this method too, it is better for internal usage... |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:11
Two minor comments: -Example 6 of [KP2020]::
+Example 6 of [KP2020]_:: in order to get the link. To avoid some repeated calls: + region_lines = region.lines()
if direction == 0:
# In this case all vertices lie on the hyperplane and we must
# check if rays are contained in one closed halfspace given by the hyperplane.
valuations = tuple(ieq[1:]*ray[:] for ray in region.rays())
- if region.lines():
- valuations += tuple(ieq[1:]*line[:] for line in region.lines())
- valuations += tuple(-ieq[1:]*line[:] for line in region.lines())
+ if region_lines:
+ valuations += tuple(ieq[1:]*line[:] for line in region_lines)
+ valuations += tuple(-ieq[1:]*line[:] for line in region_lines)
if any(x > 0 for x in valuations) and any(x < 0 for x in valuations):
splits = True
else:
# In this case, at least one of the vertices is not on the hyperplane.
# So we check if any ray or line pokes the hyperplane.
- if any(ieq[1:]*r[:]*direction < 0 for r in region.rays()) or \
- any(ieq[1:]*l[:] != 0 for l in region.lines()):
+ if any(ieq[1:]*r[:]*direction < 0 for r in region.rays()) or
+ any(ieq[1:]*l[:] != 0 for l in region_lines):
splits = True |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:13
Thank you. I applied that. The backslash in the if clause is needed though. Replying to @tscrim:
|
comment:14
Replying to @kliem:
Ah right. I miscounted the number of parentheses.
See the previous point. I agree with not changing the alignment. If I was coding this, I would have done it like this: if (any(ieq[1:]*r[:]*direction < 0 for r in region.rays())
or any(ieq[1:]*l[:] != 0 for l in region_lines)): However, that is my style and my general desire to avoid the |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:17
I never thought about using parenthesis to avoid backslash. I like that. The reason that I often do something like
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Changed keywords from hyerplane arrangements, regions to hyperplane arrangements, regions |
Reviewer: Jean-Philippe Labbé, Travis Scrimshaw |
comment:20
It looks good to me. If Travis agrees, I suggest to give positive review. |
comment:21
Yep, I am happy with it. Thanks. |
comment:22
Thank you. |
Changed branch from public/29661-reb to |
There are some easy optimzations that speed up the computation of regions of hyperplane arrangements:
Before this ticket:
With this ticket:
The last timing indicates that half of the time in this example is taken just to create the object and cannot be improved (in this method).
CC: @jplab @LaisRast @sophiasage
Component: geometry
Keywords: hyperplane arrangements, regions
Author: Jonathan Kliem
Branch/Commit:
930217f
Reviewer: Jean-Philippe Labbé, Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/29661
The text was updated successfully, but these errors were encountered: