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

PALP Normal Form #13525

Closed
sagetrac-sjg10 mannequin opened this issue Sep 24, 2012 · 37 comments
Closed

PALP Normal Form #13525

sagetrac-sjg10 mannequin opened this issue Sep 24, 2012 · 37 comments

Comments

@sagetrac-sjg10
Copy link
Mannequin

sagetrac-sjg10 mannequin commented Sep 24, 2012

This patch adds the PALP normal form algorithm natively into the lattice_polytope class, as well as a modified algorithm that is more efficient for some polytopes. This is then also used directly to calculate a normal form for Laurent polynomials.

These algorithms require abilities to permute rows and columns of matrices, as well as find automorphisms of matrices under these operations, and lattice polytopes under GL(n,Z) transformations. These are also implemented here.

Apply the latest patch only.

Depends on #14319

CC: @novoselt @sagetrac-tomc @sagetrac-trehn @sagetrac-jkeitel

Component: geometry

Author: Samuel Gonshaw, Jan Keitel

Branch/Commit: 1262262

Reviewer: Volker Braun

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

@sagetrac-sjg10 sagetrac-sjg10 mannequin added this to the sage-5.11 milestone Sep 24, 2012
@vbraun
Copy link
Member

vbraun commented Sep 24, 2012

comment:2

Very nice! Thanks for tackling this, I always wanted this implemented!

Some minor nitpicks: Whenever you return a list of stuff, its better to return a tuple (which is immutable).

def matrix_transformation(self,NewPolytope): 

CamelCase should only be used for class names, not parameters. Also, space after comma. Thats just the standard Python code style.

def lexicographical_order(self,certify=False): 

The name is a bit confusing, how about permutation_normal_form() or something like that?

def is_isomorphic(self,N,certify=False): 

The linear algebra people will probably object to that kind of isomorphism check of matrices. How about is_permutation_of()?

By default, in general one can't mix matrices and permutations

Should be just "in general, ...".

@dimpase
Copy link
Member

dimpase commented Sep 24, 2012

comment:3

The reference you give in the code does not define the normal form you are computing. Is this published anywhere? If yes, please give a proper reference. If not, it would be great if you give a definition in the docstrings.

PS. Well, I am very curious to find out what it is. That's one of the reasons I ask :–)

@dimpase
Copy link
Member

dimpase commented Sep 24, 2012

comment:5

Replying to @dimpase:

The reference you give in the code does not define the normal form you are computing. Is this published anywhere? If yes, please give a proper reference. If not, it would be great if you give a definition in the docstrings.

PS. Well, I am very curious to find out what it is. That's one of the reasons I ask :–)

Volker kindly wrote:
See Section 3.4 of http://arxiv.org/pdf/hep-th/9805190.pdf for the definition of the PALP normal form.
So this would be a reference to add.

@sagetrac-trehn
Copy link
Mannequin

sagetrac-trehn mannequin commented Sep 26, 2012

comment:6

I have one brief remark about the method automorphisms(). If I see this correctly, you build the complete face lattice, compute its automorphism group (i.e. the combinatorial automorphism group of the polytope) and filter those permutations that correspond to GL(n,ZZ)-transformations.

There seems to be already a method of Polyhedron that computes the combinatorial automorphism group, so you could use this method. For the combinatorial automorphisms of the polytope you don't need the whole face lattice, but the bipartite vertex-facet-incidence graph is enough.

@sagetrac-sjg10
Copy link
Mannequin Author

sagetrac-sjg10 mannequin commented Sep 27, 2012

comment:7

Thanks all, fixing up the small issues now. Regarding what trehn said, firstly, LatticePolytope does not inherit at all from Polyhedron and there does not seem to be an easy way to cast between the two, though as an aside, maybe this should be rectified?

Secondly it is possible, and such was the intent (though I haven't personally checked this out, but have been told) that checking if a permutation corresponds to a GL(n,ZZ) transformation is a more hefty computation than constructing the face lattice. Doing so (especially as it is decorated with some lattice polytope invariants) and reducing the number of permutations to check, over just finding the combinatorial automorphisms and checking all of these may be quicker.

@sagetrac-trehn
Copy link
Mannequin

sagetrac-trehn mannequin commented Sep 27, 2012

comment:8

Replying to @sagetrac-sjg10:

Secondly it is possible, and such was the intent (though I haven't personally checked this out, but have been told) that checking if a permutation corresponds to a GL(n,ZZ) transformation is a more hefty computation than constructing the face lattice. Doing so (especially as it is decorated with some lattice polytope invariants) and reducing the number of permutations to check, over just finding the combinatorial automorphisms and checking all of these may be quicker.

Sorry, I didn't see the lattice index invariants at first. Of course, my comment is not relevant if your input is "easy". Because you check all permutations whether they correspond to GL(n,ZZ)-transformations, trying to keep this number small seems reasonable.

I think that, depending on the polytope, either the size of the face lattice or the number of group elements will cause problems if you go to dimensions beyond the PALP limit.

@sagetrac-sjg10
Copy link
Mannequin Author

sagetrac-sjg10 mannequin commented Oct 2, 2012

comment:9

Replying to @sagetrac-trehn:

I think that, depending on the polytope, either the size of the face lattice or the number of group elements will cause problems if you go to dimensions beyond the PALP limit.

This is one of the main reasons of having implemented the PALP algorithm natively, the overflow errors that PALP is susceptible to in higher dimensions is removed when running the algorithm through python.

@sagetrac-sjg10
Copy link
Mannequin Author

sagetrac-sjg10 mannequin commented Oct 3, 2012

Attachment: trac13525_palplaurentnormalform2.patch.gz

Issues in comments addressed

@sagetrac-sjg10

This comment has been minimized.

@jdemeyer
Copy link

jdemeyer commented Oct 5, 2012

Changed author from sjg10 to Samuel Gonshaw

@vbraun
Copy link
Member

vbraun commented May 1, 2013

Dependencies: #14319

@vbraun
Copy link
Member

vbraun commented May 1, 2013

comment:12

#14319 improves the graph automorphisms so you don't have to track the relabeling any more. This would simplify the code here, too.

As a minor nitpick, pep8 would be nice:

def palp_modified_normal_form(L,affine_transform=False,certify=False):    # no
def palp_modified_normal_form(L, affine_transform=False, certify=False):  # yes

Also, docstring should be imperative: "Return foobar". Not: "Returns foobar" or "We return foobar".

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-jkeitel
Copy link
Mannequin

sagetrac-jkeitel mannequin commented Sep 28, 2013

Branch: u/jkeitel/PALP_normal_form

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 28, 2013

Commit: e4db787

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 28, 2013

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

[changeset:e4db787]First pass over lattice_polytope, still errors.
[changeset:a497d27]First sweep of matrix0.pyx
[changeset:3dbd2dc]First sweep of matrix2.pyx and permgroup_element.pyx
[changeset:efd80b4]Working on matrix permutations.
[changeset:4aa0318]Natively implement PALP Normal Form
[changeset:3b15578]Merging Sage-5.12.beta5, newest dev scripts, and the doctest fixes.
[changeset:1456c52]Merge branch 'ticket/14482' into public/sage-git/master
[changeset:b890215]Merge branch 'ticket/14482' into public/sage-git/master
[changeset:d8713eb]Merge remote-tracking branch 'origin/build_system' into public/sage-git/master
[changeset:970090d]Merge branch 'u/ohanar/build_system'

@sagetrac-jkeitel
Copy link
Mannequin

sagetrac-jkeitel mannequin commented Sep 28, 2013

comment:17

I have tried to rebase the patch and, in particular, tried to adapt to the changes from #14319. However, automorphisms of LatticePolytopes do not work yet and there is probably much code that could be rewritten.

As far as the code in lattice_polytope.py is concerned, I've only reformated and not checked what the code actually does.
The same is true for all other normal_form methods.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 23, 2013

Branch pushed to git repo; I updated commit sha1. New commits:

[changeset:1051207]Removed auto- and isomorphism code for the time being.
[changeset:a11b390]Fixing doctests.
[changeset:1b1f739]Rearranging and regrouping palp_* methods.
[changeset:e31daec]Fixed errors in palp_*-methods.
[changeset:37ea582]Working on permutation normal form.
[changeset:e4cdd6d]Cosmetic changes.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 23, 2013

Changed commit from e4db787 to 1051207

@sagetrac-jkeitel
Copy link
Mannequin

sagetrac-jkeitel mannequin commented Oct 23, 2013

comment:20

This is now almost at a point where things are working. For now I have removed the attempts at a method finding isomorphisms between two given polytopes.
The plan is to write a proper method for general affine transformations in #15280.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 28, 2013

Branch pushed to git repo; I updated commit sha1. New commits:

[changeset:6938bac]Added normal form permutation read out from PALP.
[changeset:0f328ca]Removed normal form for Laurent polynomials.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@rwst
Copy link

rwst commented May 9, 2014

Work Issues: rebase

@vbraun
Copy link
Member

vbraun commented May 12, 2014

Changed branch from u/jkeitel/PALP_normal_form to u/vbraun/PALP_normal_form

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 12, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

6b7b32cminor fixes

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 12, 2014

Changed commit from 7b85f7e to 6b7b32c

@vbraun
Copy link
Member

vbraun commented May 12, 2014

Reviewer: Volker Braun

@vbraun
Copy link
Member

vbraun commented May 12, 2014

comment:30

I've fixed the merge conflict and some minor nitpicks (unnused _normal_form, doc build). Functionality looks good to me.

@vbraun
Copy link
Member

vbraun commented May 12, 2014

Changed work issues from rebase to none

@novoselt
Copy link
Member

comment:31

This branch "undoes" some of the deprecation-related changes from #15240, let me try to go over it too, will have a version in a few hours.

@novoselt
Copy link
Member

Changed branch from u/vbraun/PALP_normal_form to u/novoselt/PALP_normal_form

@novoselt
Copy link
Member

Changed commit from 6b7b32c to 1262262

@novoselt
Copy link
Member

comment:33

Done!


New commits:

a5428afFixes to normal_form_pc to work with point collections properly.
1262262Use point collections more directly.

@vbraun
Copy link
Member

vbraun commented May 13, 2014

Changed branch from u/novoselt/PALP_normal_form to 1262262

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