Skip to content
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

Always use PPL for facet normals of lattice polytopes #22391

Closed
novoselt opened this issue Feb 18, 2017 · 20 comments
Closed

Always use PPL for facet normals of lattice polytopes #22391

novoselt opened this issue Feb 18, 2017 · 20 comments

Comments

@novoselt
Copy link
Member

A follow up to #22310. As promised there, this switch makes even full-dimensional polytopes faster, on the same example we now get

sage: timeit("LatticePolytope(lattice_polytope.cross_polytope(3).vertices()).facet_normals()")
625 loops, best of 3: 976 µs per loop

The reason is that dimension computation used to be quite complicated.

Next in the chain of lattice polytope improvements is #22524

Depends on #22310

Component: geometry

Keywords: sd91, sd90

Author: Andrey Novoseltsev

Branch/Commit: baf0a4a

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/22391

@novoselt novoselt added this to the sage-7.6 milestone Feb 18, 2017
@novoselt
Copy link
Member Author

Branch: u/novoselt/PPL_for_normals

@novoselt
Copy link
Member Author

Commit: b4410f1

@novoselt
Copy link
Member Author

Last 10 new commits:

db3b54eFix doctests - mostly due to different order of vertices
5281cf4Use PPL for facet normals of full-dimensional polytopes
d244793Update a lot of toric doctests for the new facet order
e70f34dMerge tag '7.6.beta3' into PPL_for_normals
b27e343Always use PPL for LatticePolytope.facet_normals()
8e77861Update docstrings for facet normals and constants
ba7656aUse PPL for LatticePolytope.dim()
38bbdb2Don't use embedding in LatticePolytope.distances()
f4a696bImplement point containment test for LatticePolytope
b4410f1Do not rely on distances for containment check

@novoselt

This comment has been minimized.

@sagetrac-ursula
Copy link
Mannequin

sagetrac-ursula mannequin commented Sep 28, 2017

comment:4

I successfully installed this patch and tried some variants on the example. Speed seems to work as advertised:

sage: sim = ReflexivePolytope(3,0)
sage: timeit("sim.facet_normals()")
625 loops, best of 3: 576 ns per loop

@videlec
Copy link
Contributor

videlec commented Sep 29, 2017

comment:5

Have you tried using normaliz? In dimension >= 10 it is likely to be faster. For that reason, it is good to have an optional keyword method= or algorithm= that simplifies speed comparisons.

@novoselt
Copy link
Member Author

comment:6

Replying to @videlec:

Have you tried using normaliz? In dimension >= 10 it is likely to be faster. For that reason, it is good to have an optional keyword method= or algorithm= that simplifies speed comparisons.

The interest here is mostly in polytopes of dimensions 3-4-5, when the bottleneck is often the interface between programs. Also, the old code was quite convoluted for many reasons and adding different algorithms would be tricky. One of the goals of this and related tickets was to clean up the mess to indeed allow using different backends for certain operations.

@roed314
Copy link
Contributor

roed314 commented Sep 30, 2017

Changed keywords from none to sd91

@sagetrac-ursula
Copy link
Mannequin

sagetrac-ursula mannequin commented Oct 24, 2017

Changed keywords from sd91 to sd91, sd90

@sagetrac-ursula
Copy link
Mannequin

sagetrac-ursula mannequin commented Oct 24, 2017

comment:9

I tried building again, and now this patch fails, with errors involving sage-ursula/src/build/cythonized/sage/. My guess is that the transition from Sage 7.6 to the current development branch is too great. Do you mind updating the patch?

@novoselt
Copy link
Member Author

comment:11

Can you please be more specific in how it fails? The branch merges cleanly and passes tests according to the patchbot.

@tscrim
Copy link
Collaborator

tscrim commented Oct 25, 2017

comment:12

It also works for me. I am guessing what happened is @sagetrac-ursula just used the branch, effectively downgrading her version of Sage to that of the branch, and ran sage -b, which does not rebuild the necessary parts of Sage. In general, I always make sure to merge it ontop of (my version of) develop to avoid regressing Sage (which will include long compilation time). If that is not what [@Ursula] did, then try running make build and then sage -t.

@tscrim
Copy link
Collaborator

tscrim commented Oct 25, 2017

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Oct 25, 2017

comment:13

I made some small formatting changes to more match our style guide. If my changes look good, then positive review.


New commits:

49be993Merge branch 'u/novoselt/PPL_for_normals' of git://trac.sagemath.org/sage into u/novoselt/PPL_for_normals
baf0a4aA little bit of reviewer cleanup.

@tscrim
Copy link
Collaborator

tscrim commented Oct 25, 2017

Changed commit from b4410f1 to baf0a4a

@tscrim
Copy link
Collaborator

tscrim commented Oct 25, 2017

@tscrim tscrim modified the milestones: sage-7.6, sage-8.1 Oct 25, 2017
@novoselt
Copy link
Member Author

comment:14

Thank you!!!

Of course your changes look good - anything to get it in ;-) A small question however:

         TypeError: the point M(1, 1) and
-        2-d cone in 2-d lattice N have incompatible lattices!
+         2-d cone in 2-d lattice N have incompatible lattices

Your new line apart from dropping the exclamation point due to exception formatting change also adds a space in front of the second part of the broken line. Is this also the style recommended somewhere? I can't recall ever reading it.

@tscrim
Copy link
Collaborator

tscrim commented Oct 25, 2017

comment:15

Not really, but I feel its gives better grouping that it is part of the error message and not some new line of output, similar to indenting function blocks.

@tscrim
Copy link
Collaborator

tscrim commented Oct 25, 2017

comment:16

Also, Python does not use sentence ending punctuation for any exceptions (or initial uppercase letters).

@vbraun
Copy link
Member

vbraun commented Oct 29, 2017

Changed branch from public/polytopes/PPL_for_normals-22391 to baf0a4a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants