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

Add neighborly methods for polyhedra #22417

Closed
mo271 opened this issue Feb 22, 2017 · 34 comments
Closed

Add neighborly methods for polyhedra #22417

mo271 opened this issue Feb 22, 2017 · 34 comments

Comments

@mo271
Copy link
Contributor

mo271 commented Feb 22, 2017

I propose to add two functions to the polyhedron class; namely neighborliness and is_neighborly.

While neighborliness could be used to calculate the is_neighborly, it might be faster not to compute the neighborliness if one only wants to know is_neighborly(k) for some small k. (More specifically, the output of P.is_neighborly() shoud be the same as P.neighborliness()>=floor(P.dim()/2))).

CC: @jplab @fchapoton @videlec

Component: geometry

Keywords: polyhedron, days84

Author: Moritz Firsching

Branch/Commit: eea1215

Reviewer: Jean-Philippe Labbé

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

@mo271 mo271 added this to the sage-7.6 milestone Feb 22, 2017
@mo271
Copy link
Contributor Author

mo271 commented Feb 22, 2017

Branch: u/moritz/neighborly

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 22, 2017

Commit: 941c9bd

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 22, 2017

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

941c9bdundo accidental unwanted modification of truncation method

@jplab
Copy link
Contributor

jplab commented Feb 23, 2017

comment:3

Hi Moritz,

You could truncate the two long lines before the "for" (see https://www.python.org/dev/peps/pep-0008/#maximum-line-length )

@jplab
Copy link
Contributor

jplab commented Feb 23, 2017

comment:4

and you can put your name as the author.

@mo271
Copy link
Contributor Author

mo271 commented Mar 3, 2017

Author: Moritz Firsching

@mo271
Copy link
Contributor Author

mo271 commented Mar 3, 2017

Changed keywords from polyhedron to polyhedron days84

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 3, 2017

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

e147192improved docstring

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 3, 2017

Changed commit from 941c9bd to e147192

@videlec
Copy link
Contributor

videlec commented Mar 5, 2017

comment:8
k = 1
while(True):
    if len(self.faces(k))==binomial(self.n_vertices(),k+1):
        k += 1
    else:
        return k

can be simplified to

k = 1
while len(self.faces(k)) == binomial(self.n_vertices(), k + 1):
    k += 1
return k

(please be careful with spaces in the code)

@videlec
Copy link
Contributor

videlec commented Mar 5, 2017

comment:9

About spacing, change (in the code and in the examples)

  • a=b to a = b, a>b to a > b, etc
  • f(x,y) to f(x, y)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2017

Changed commit from e147192 to 8552363

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2017

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

17e931eadded 'neighborliness' and 'is_neighborly' methods
a05912eundo accidental unwanted modification of truncation method
07e8c58improved docstring
8552363spaces and more doctests

@mo271
Copy link
Contributor Author

mo271 commented Mar 5, 2017

comment:11

Thanks Vincent!
I modified the spaces and added more doctests.


New commits:

17e931eadded 'neighborliness' and 'is_neighborly' methods
a05912eundo accidental unwanted modification of truncation method
07e8c58improved docstring
8552363spaces and more doctests

@jplab
Copy link
Contributor

jplab commented Mar 5, 2017

comment:12

Hi Moritz,

  • perhaps in the "neighborliness" add a SEEALSO pointing to "is_neighborly".
  • In the examples of neighborliness there are spaces missing in P=Polyhedron in several instances.
  • In the INPUT and OUTPUT of is_neighborly there are backticks missing around one k.

More comments to come...

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2017

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

be71a2eadded SEEALSO, links to wikipedia and improved docstrings

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2017

Changed commit from 8552363 to be71a2e

@jplab
Copy link
Contributor

jplab commented Mar 5, 2017

Changed keywords from polyhedron days84 to polyhedron, days84

@jplab
Copy link
Contributor

jplab commented Mar 5, 2017

Reviewer: Jean-Philippe Labbé

@jplab

This comment has been minimized.

@jplab
Copy link
Contributor

jplab commented Mar 5, 2017

comment:15

This ticket looks ready to go to me.

I'd like to have a second opinion though to make sure!

@jplab
Copy link
Contributor

jplab commented Mar 6, 2017

comment:16

Hi Moritz,

Here are a couple of things to correct:

  • the syntax for the seealso block (in both functions) should be corrected (see here)
  • The seealso block should be before the examples
  • The first example in is_neighborly should be easy. Put the first example at the end.
  • perhaps change the indexl so that it is not confused with the number 1.

The doc compiles on 7.6.beta6

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2017

Changed commit from be71a2e to c994323

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2017

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

c994323improved docstring

@mo271
Copy link
Contributor Author

mo271 commented Mar 6, 2017

comment:18

Thanks JP! I improved the docstring.

@jplab
Copy link
Contributor

jplab commented Mar 6, 2017

comment:20

Looks good! Up to the bot, I'll give it a positive review.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2017

Changed commit from c994323 to 604b46b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2017

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

604b46bfixed two pep8 errors

@jplab
Copy link
Contributor

jplab commented Mar 6, 2017

comment:22

I would adapt the text before the neighborliness examples (specifying the cubes).

All test pass on 7.6.beta6 and the documentation looks good.

Once the bot gives the green light and you corrected the above, I'd give it a positive review.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2017

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

eea1215moved comment about cyclic polytopes

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2017

Changed commit from 604b46b to eea1215

@mo271
Copy link
Contributor Author

mo271 commented Mar 6, 2017

comment:24

thanks, JP!

I moved the text before the cubes to the cyclic example.

@jplab
Copy link
Contributor

jplab commented Mar 7, 2017

comment:25

It now looks good to me. Positive review.

@vbraun
Copy link
Member

vbraun commented Mar 10, 2017

Changed branch from u/moritz/neighborly to eea1215

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

4 participants