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

sage.geometry: Use PalpExecutable(...).absolute_filename() #33467

Closed
mkoeppe opened this issue Mar 5, 2022 · 15 comments
Closed

sage.geometry: Use PalpExecutable(...).absolute_filename() #33467

mkoeppe opened this issue Mar 5, 2022 · 15 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 5, 2022

This is so that the Sage library becomes fully functional even when not being run from within sage-env (which sets PATH).

To test:

$ venv/bin/python3 -c 'from sage.all import *; print(lattice_polytope.cross_polytope(3).polar().facets()[0].ambient_point_indices())'
$ venv/bin/python3 -c 'from sage.all import *; from sage.geometry.polyhedron.palp_database import PALPreader; print(next(iter(PALPreader(2, output="list"))))'

Depends on #32893
Depends on #31296

CC: @dimpase

Component: geometry

Author: Matthias Koeppe

Branch/Commit: 4b58ad6

Reviewer: Dima Pasechnik

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

@mkoeppe mkoeppe added this to the sage-9.6 milestone Mar 5, 2022
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

Commit: 27b5514

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

Last 10 new commits:

a93e9afsrc/sage/features/__init__.py: Simplify Executable.absolute_path
5b25c1dsage.features: Refactor StaticFile, Executable through a new base class FileFeature
6c35717sage.features.FileFeature: Replace method absolute_path by absolute_filename, with deprecation
9266709Merge #31292
a4d0ed6sage.interfaces.four_ti_2: Use Executable.absolute_filename
4252ea3sage.sandpiles.sandpile: Use Executable.absolute_filename() when interfacing 4ti2
17b9fdesage.interfaces.latte: Use Executable.absolute_filename
d15588aMerge #31296
314ac7asrc/sage/geometry/lattice_polytope.py: Use PalpExecutable(executable).absolute_filename()
27b5514src/sage/geometry/polyhedron/palp_database.py: Use PalpExecutable(executable).absolute_filename()

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

Author: Matthias Koeppe

@dimpase
Copy link
Member

dimpase commented Mar 6, 2022

comment:3

You need to adjust doctests for latte:

File "src/sage/interfaces/latte.py", line 95, in sage.interfaces.latte.count
Failed example:
    n = count(cddin, cdd=True, verbose=True, raw_output=True)  # optional - latte_int
Expected:
    This is LattE integrale ...
    ...
    Invocation: count '--redundancy-check=none' --cdd /dev/stdin
    ...
    Total Unimodular Cones: ...
    Maximum number of simplicial cones in memory at once: ...
    <BLANKLINE>
    ****  The number of lattice points is:   ****
    Total time: ... sec
Got:
    This is LattE integrale 1.7.6
    Available from http://www.math.ucdavis.edu/~latte/
    <BLANKLINE>
    Invocation: /mnt/opt/Sage/sage-dev/local/bin/count '--redundancy-check=none' --cdd /dev/stdin 
    Warning: Not performing check for empty polytope, because it is unimplemented for the CDD-style input format. 
    size = 12 x 4
...

etc., as the path is no longer relative...

@dimpase
Copy link
Member

dimpase commented Mar 6, 2022

comment:4

Fix the latter is easy:

--- a/src/sage/interfaces/latte.py
+++ b/src/sage/interfaces/latte.py
@@ -95,7 +95,7 @@ def count(arg, ehrhart_polynomial=False, multivariate_generating_function=False,
         sage: n = count(cddin, cdd=True, verbose=True, raw_output=True)  # optional - latte_int
         This is LattE integrale ...
         ...
-        Invocation: count '--redundancy-check=none' --cdd /dev/stdin
+        Invocation: ...count '--redundancy-check=none' --cdd /dev/stdin
         ...
         Total Unimodular Cones: ...
         Maximum number of simplicial cones in memory at once: ...
@@ -271,7 +271,7 @@ def integrate(arg, polynomial=None, algorithm='triangulate', raw_output=False, v
         sage: ans = integrate(cddin, f, cdd=True, verbose=True, raw_output=True)  # optional - latte_int
         This is LattE integrale ...
         ...
-        Invocation: integrate --valuation=integrate --triangulate --redundancy-check=none --cdd --monomials=... /dev/stdin
+        Invocation: ...integrate --valuation=integrate --triangulate --redundancy-check=none --cdd --monomials=... /dev/stdin
         ...
 
     Testing triangulate algorithm::
@@ -313,7 +313,7 @@ def integrate(arg, polynomial=None, algorithm='triangulate', raw_output=False, v
         sage: ans = integrate(cddin, cdd=True, raw_output=True, verbose=True)  # optional - latte_int
         This is LattE integrale ...
         ...
-        Invocation: integrate --valuation=volume --triangulate --redundancy-check=none --cdd /dev/stdin
+        Invocation: ...integrate --valuation=volume --triangulate --redundancy-check=none --cdd /dev/stdin
         ...
 
     Testing the runtime error::

does this patch belong here?

@dimpase
Copy link
Member

dimpase commented Mar 6, 2022

Changed commit from 27b5514 to 9b1b484

@dimpase
Copy link
Member

dimpase commented Mar 6, 2022

Last 10 new commits:

89b24ffsrc/sage/geometry/polyhedron/palp_database.py: Add # sage.doctest: optional - palp
68babd5src/sage/geometry/lattice_polytope.py: Mark doctests # optional - palp
a1bb676src/sage/geometry: Mark doctests # optional - palp
477b84cLatticePolytopeClass, NefPartition, PointCollection, ToricLattice_ambient: Add `_sage_input_` methods
6acf7desrc/sage/geometry/lattice_polytope.py: In NefPartition doctests, construct examples without using palp
9423f26src/sage/geometry/lattice_polytope.py, src/sage/schemes/toric/fano_variety.py: Use unicode disjoint union symbol
5a220b1src/sage/geometry/lattice_polytope.py: Fix typo
c78d80esrc/sage/features/databases.py (DatabaseReflexivePolytopes): New
d6b0021src/sage/geometry/lattice_polytope.py: Use PalpExecutable(executable).absolute_filename()
9b1b484src/sage/geometry/polyhedron/palp_database.py: Use PalpExecutable(executable).absolute_filename()

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 7, 2022

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

ccca4e7src/sage/geometry/polyhedron/palp_database.py: Add # sage.doctest: optional - palp
4eaad20src/sage/geometry/lattice_polytope.py: Mark doctests # optional - palp
c977daesrc/sage/geometry: Mark doctests # optional - palp
75dfdf0LatticePolytopeClass, NefPartition, PointCollection, ToricLattice_ambient: Add `_sage_input_` methods
4145202src/sage/geometry/lattice_polytope.py: In NefPartition doctests, construct examples without using palp
45edf72src/sage/geometry/lattice_polytope.py, src/sage/schemes/toric/fano_variety.py: Use unicode disjoint union symbol
bfabd53src/sage/geometry/lattice_polytope.py: Fix typo
0ac4959src/sage/features/databases.py (DatabaseReflexivePolytopes): New
bb24865src/sage/geometry/lattice_polytope.py: Use PalpExecutable(executable).absolute_filename()
4b58ad6src/sage/geometry/polyhedron/palp_database.py: Use PalpExecutable(executable).absolute_filename()

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 7, 2022

Changed commit from 9b1b484 to 4b58ad6

@dimpase
Copy link
Member

dimpase commented Mar 7, 2022

Reviewer: Dima Pasechnik

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 7, 2022

comment:8

Thank you!

@vbraun
Copy link
Member

vbraun commented Mar 9, 2022

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