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

Lattice Polytopes: compute_facets does not check dimension when setting is_reflexive #28741

Closed
kliem opened this issue Nov 15, 2019 · 16 comments
Closed

Comments

@kliem
Copy link
Contributor

kliem commented Nov 15, 2019

Currently, computing facets of a lattice polytope, changes whether it is reflexive or not.

sage: p = LatticePolytope([], lattice=ToricLattice(3).dual()); p
-1-d lattice polytope in 3-d lattice M
sage: a = p.faces()[0][0]
sage: p = LatticePolytope([], lattice=ToricLattice(3).dual()); p
-1-d lattice polytope in 3-d lattice M
sage: a = p.faces()[0][0]; a
-1-d lattice polytope in 3-d lattice M
sage: a.facet_normals()
Empty collection
in 3-d lattice N
sage: a
-1-d reflexive polytope in 3-d lattice M

CC: @jplab @LaisRast @novoselt

Component: geometry

Keywords: lattice polytopes, reflexive

Author: Jonathan Kliem

Branch/Commit: 769d877

Reviewer: Andrey Novoseltsev

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

@kliem kliem added this to the sage-9.0 milestone Nov 15, 2019
@kliem
Copy link
Contributor Author

kliem commented Nov 15, 2019

New commits:

fbe2013do not overwrite `is_reflexive` in `compute_facets`

@kliem
Copy link
Contributor Author

kliem commented Nov 15, 2019

Branch: public/28741

@kliem
Copy link
Contributor Author

kliem commented Nov 15, 2019

Commit: fbe2013

@novoselt
Copy link
Member

comment:2

What do you mean its own definition??? It is the same definition as in other places and it does not overwrite is_reflexive but rather sets a cached value. However the code failed to check that the polytope is full-dimensional, so I'd much rather keep the old code and add the missing check rather than getting rid of an easy computation and triggering another one right away with is_reflexive() call.

@kliem
Copy link
Contributor Author

kliem commented Nov 15, 2019

comment:4

Sorry. I was completely puzzled about this and exaggerated.

As you can probably tell, I stumbled open this trying to implement incidence matrix.

I still don't get the advantage of the current setup. Is it because we avoid making a copy of the constants?

What currently happens with is_reflexive is that it implicitly calls compute_facets, which computes the value for is_reflexive. However, is_reflexive now recomputes the value and returns it. I don't think this is ideal.

@kliem
Copy link
Contributor Author

kliem commented Nov 15, 2019

comment:5

But my idea isn't perfect either.

It is still double calculation. Just executing the same code now.

@kliem
Copy link
Contributor Author

kliem commented Nov 15, 2019

comment:6

Anyway. I don't have hard feelings about this. I think we can just fix it in place.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 15, 2019

Changed commit from fbe2013 to 9ff978f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 15, 2019

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

9ff978ffix setting cache of `is_reflexive`

@novoselt
Copy link
Member

Reviewer: Andrey Novoseltsev

@novoselt
Copy link
Member

comment:8

Sorry for confusing code, believe me it used to be even more convoluted, especially with regard to determining and using reflexivity ;-) It still feels to me that this is a better fix.

@novoselt

This comment has been minimized.

@novoselt novoselt changed the title Lattice Polytopes: compute_facets has its own definition of reflexive and applies it Lattice Polytopes: compute_facets does not check dimension when setting is_reflexive Nov 15, 2019
@kliem
Copy link
Contributor Author

kliem commented Nov 19, 2019

Changed commit from 9ff978f to 769d877

@kliem
Copy link
Contributor Author

kliem commented Nov 19, 2019

comment:10

Had to rebase.

This time I did not delete any trailing spaces etc. Implementing the incidence matrix in #28743 will take care of that.


New commits:

769d877fix setting cache of `is_reflexive`

@kliem
Copy link
Contributor Author

kliem commented Nov 19, 2019

Changed branch from public/28741 to public/28741-reb

@vbraun
Copy link
Member

vbraun commented Nov 30, 2019

Changed branch from public/28741-reb to 769d877

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

3 participants