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

fix constructor of ConvexRationalPolyhedralCone #27423

Closed
videlec opened this issue Mar 4, 2019 · 16 comments
Closed

fix constructor of ConvexRationalPolyhedralCone #27423

videlec opened this issue Mar 4, 2019 · 16 comments

Comments

@videlec
Copy link
Contributor

videlec commented Mar 4, 2019

The class ConvexRationalPolyhedralCone (sage/geometry/cone.py) has an "advanced" constructor parameter PPL that can be set to a ppl.polyhedron.C_Polyhedron. However, before #23024, this attribute used to be set immutable in the constructor and this is not the case anymore (since pplpy does not support the mutability/immutability flag).

This ticket stands to fix this possibly problematic behavior. Some options:

  1. reintroduce mutability/immutability in pplpy
  2. make a copy of the polyhedron (this definitely should not be done - the reason for this parameter is to avoid any work when PPL representation is already constructed)
  3. keep it the way it is but fix the documentation

CC: @novoselt

Component: geometry

Author: Vincent Delecroix

Branch/Commit: d04b627

Reviewer: Andrey Novoseltsev

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

@videlec videlec added this to the sage-8.7 milestone Mar 4, 2019
@videlec

This comment has been minimized.

@novoselt

This comment has been minimized.

@novoselt
Copy link
Member

novoselt commented Mar 5, 2019

comment:2

How feasible is the first option? I imagine what has to be done is adding a flag and then making sure that it is checked in all functions (current and future) that may change the polyhedron.

@videlec
Copy link
Contributor Author

videlec commented Mar 5, 2019

comment:3

Replying to @novoselt:

How feasible is the first option? I imagine what has to be done is adding a flag and then making sure that it is checked in all functions (current and future) that may change the polyhedron.

PPL (the C++ library) does not implement any mutability flag. This is why it has disappeared in the Python interface pplpy. A mutability flag is definitely error prone since you can still modify the polyhedron via C++ access to thisptr. Unless you have a serious use case for this immutability flag I am not inclined to reintroduce it.

@videlec
Copy link
Contributor Author

videlec commented Mar 5, 2019

comment:4

What is the problem with option 2? Copying the whole PPL object (together with all its data) is doable and certainly not expensive unless it is gigantic.

@videlec
Copy link
Contributor Author

videlec commented Mar 5, 2019

comment:5

Replying to @videlec:

What is the problem with option 2? Copying the whole PPL object (together with all its data) is doable and certainly not expensive unless it is gigantic.

Indeed, PPL has copy constructor which I believe does the right thing.

@novoselt
Copy link
Member

novoselt commented Mar 5, 2019

comment:6

What if it is not gigantic, but there are 400 millions of them? What's the point to copy it if you specifically produced a PPL object to feed into constructor? Given that it is unlikely to be used "by accident", I think it should be kept as is, but the documentation should clearly say that it will be stored in a private attribute and will be assumed not to change.

@videlec
Copy link
Contributor Author

videlec commented Mar 5, 2019

New commits:

5a5293cfix documentation of PPL parameter

@videlec
Copy link
Contributor Author

videlec commented Mar 5, 2019

Commit: 5a5293c

@videlec
Copy link
Contributor Author

videlec commented Mar 5, 2019

Author: Vincent Delecroix

@videlec
Copy link
Contributor Author

videlec commented Mar 5, 2019

Branch: u/vdelecroix/27423

@novoselt
Copy link
Member

novoselt commented Mar 6, 2019

Reviewer: Andrey Novoseltsev

@novoselt
Copy link
Member

novoselt commented Mar 6, 2019

comment:8

Should it be "make a copy" rather than "take a copy"?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2019

Changed commit from 5a5293c to d04b627

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2019

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

d04b627take -> make

@vbraun
Copy link
Member

vbraun commented Mar 7, 2019

Changed branch from u/vdelecroix/27423 to d04b627

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