diff --git a/build/pkgs/4ti2/SPKG.rst b/build/pkgs/4ti2/SPKG.rst index 1a3a5e5c9c4..f3bd67741e9 100644 --- a/build/pkgs/4ti2/SPKG.rst +++ b/build/pkgs/4ti2/SPKG.rst @@ -5,7 +5,7 @@ Description ----------- A software package for algebraic, geometric and combinatorial problems -on linear spaces. Available at www.4ti2.de. +on linear spaces. Available at https://4ti2.github.io/. License ------- diff --git a/src/sage/interfaces/four_ti_2.py b/src/sage/interfaces/four_ti_2.py index 92de8d2d478..79a07dcdad4 100644 --- a/src/sage/interfaces/four_ti_2.py +++ b/src/sage/interfaces/four_ti_2.py @@ -1,7 +1,7 @@ r""" Interface to 4ti2 -http://www.4ti2.de +https://4ti2.github.io/ You must have the 4ti2 Sage package installed on your computer for this interface to work. @@ -43,8 +43,9 @@ class FourTi2(): r""" - This object defines an interface to the program 4ti2. Each command - 4ti2 has is exposed as one method. + An interface to the program 4ti2. + + Each 4ti2 command is exposed as a method of this class. """ def __init__(self, directory=None): r""" @@ -155,10 +156,11 @@ def write_single_row(self, row, filename): def write_array(self, array, nrows, ncols, filename): r""" - Write the matrix ``array`` of integers (can be represented as - a list of lists) to the file ``filename`` in directory - ``directory()`` in 4ti2 format. The matrix must have ``nrows`` - rows and ``ncols`` columns. + Write the integer matrix ``array`` to the file ``filename`` + in directory ``directory()`` in 4ti2 format. + + The matrix must have ``nrows`` rows and ``ncols`` columns. + It can be provided as a list of lists. INPUT: @@ -216,9 +218,10 @@ def read_matrix(self, filename): def _process_input(self, kwds): r""" - kwds is a dict, and the values are written to files with - extension given by the keys, except for the keys ``self`` - and ``project``. + Process the input in the dictionary ``kwds``. + + The values are written to files with extensions given + by the keys, except for the keys ``self`` and ``project``. This interesting method is intended to be called as the first thing going on in a method implementing some action of 4ti2, @@ -227,13 +230,13 @@ def _process_input(self, kwds): just by giving the parameters of the method names that are the extension of the corresponding files. - Nothing is written if the value is None. Otherwise the value + Nothing is written if the value is ``None``. Otherwise the value is written as a matrix to the file given by the value of the key ``'project'`` with extension given by the key. INPUT: - - kwds -- A dict controlling what data is written to what files. + - ``kwds`` -- A dict controlling what data is written to what files. OUTPUT: @@ -280,17 +283,17 @@ def call(self, command, project, verbose=True, *, options=()): INPUT: - - command -- The 4ti2 program to run. - - project -- The file name of the project to run on. - - verbose -- Display the output of 4ti2 if ``True``. - - options -- A list of strings to pass to the program. + - ``command`` -- The 4ti2 program to run. + - ``project`` -- The file name of the project to run on. + - ``verbose`` -- Display the output of 4ti2 if ``True``. + - ``options`` -- A list of strings to pass to the program. EXAMPLES:: sage: from sage.interfaces.four_ti_2 import four_ti_2 sage: four_ti_2.write_matrix([[6,10,15]], "test_file") - sage: four_ti_2.call("groebner", "test_file", False) # optional - 4ti2 - sage: four_ti_2.read_matrix("test_file.gro") # optional - 4ti2 + sage: four_ti_2.call("groebner", "test_file", False) # optional - 4ti2 + sage: four_ti_2.read_matrix("test_file.gro") # optional - 4ti2 [-5 0 2] [-5 3 0] """ @@ -306,8 +309,9 @@ def call(self, command, project, verbose=True, *, options=()): def zsolve(self, mat=None, rel=None, rhs=None, sign=None, lat=None, project=None): r""" - Run the 4ti2 program ``zsolve`` on the parameters. See - ``http://www.4ti2.de/`` for details. + Run the 4ti2 program ``zsolve`` on the parameters. + + See `4ti2 website `_ for details. EXAMPLES:: @@ -316,7 +320,7 @@ def zsolve(self, mat=None, rel=None, rhs=None, sign=None, lat=None, project=None sage: rel = ['<', '<'] sage: rhs = [2, 3] sage: sign = [1,0,1] - sage: four_ti_2.zsolve(A, rel, rhs, sign) # optional - 4ti2 + sage: four_ti_2.zsolve(A, rel, rhs, sign) # optional - 4ti2 [ [ 1 -1 0] [ 0 -1 0] @@ -324,7 +328,7 @@ def zsolve(self, mat=None, rel=None, rhs=None, sign=None, lat=None, project=None [1 1 0] [ 1 -2 1] [0 1 0], [ 0 -2 1], [] ] - sage: four_ti_2.zsolve(lat=[[1,2,3],[1,1,1]]) # optional - 4ti2 + sage: four_ti_2.zsolve(lat=[[1,2,3],[1,1,1]]) # optional - 4ti2 [ [1 2 3] [0 0 0], [], [1 1 1] @@ -338,14 +342,15 @@ def zsolve(self, mat=None, rel=None, rhs=None, sign=None, lat=None, project=None def qsolve(self, mat=None, rel=None, sign=None, project=None): r""" - Run the 4ti2 program ``qsolve`` on the parameters. See - ``http://www.4ti2.de/`` for details. + Run the 4ti2 program ``qsolve`` on the parameters. + + See `4ti2 website `_ for details. EXAMPLES:: sage: from sage.interfaces.four_ti_2 import four_ti_2 sage: A = [[1,1,1],[1,2,3]] - sage: four_ti_2.qsolve(A) # optional - 4ti2 + sage: four_ti_2.qsolve(A) # optional - 4ti2 [[], [ 1 -2 1]] """ project = self._process_input(locals()) @@ -355,13 +360,14 @@ def qsolve(self, mat=None, rel=None, sign=None, project=None): def rays(self, mat=None, project=None): r""" - Run the 4ti2 program ``rays`` on the parameters. See - ``http://www.4ti2.de/`` for details. + Run the 4ti2 program ``rays`` on the parameters. + + See `4ti2 website `_ for details. EXAMPLES:: sage: from sage.interfaces.four_ti_2 import four_ti_2 - sage: four_ti_2.rays(four_ti_2._magic3x3()) # optional - 4ti2 + sage: four_ti_2.rays(four_ti_2._magic3x3()) # optional - 4ti2 [0 2 1 2 1 0 1 0 2] [1 0 2 2 1 0 0 2 1] [1 2 0 0 1 2 2 0 1] @@ -373,19 +379,20 @@ def rays(self, mat=None, project=None): def hilbert(self, mat=None, lat=None, project=None): r""" - Run the 4ti2 program ``hilbert`` on the parameters. See - ``http://www.4ti2.de/`` for details. + Run the 4ti2 program ``hilbert`` on the parameters. + + See `4ti2 website `_ for details. EXAMPLES:: sage: from sage.interfaces.four_ti_2 import four_ti_2 - sage: four_ti_2.hilbert(four_ti_2._magic3x3()) # optional - 4ti2 + sage: four_ti_2.hilbert(four_ti_2._magic3x3()) # optional - 4ti2 [2 0 1 0 1 2 1 2 0] [1 0 2 2 1 0 0 2 1] [0 2 1 2 1 0 1 0 2] [1 2 0 0 1 2 2 0 1] [1 1 1 1 1 1 1 1 1] - sage: four_ti_2.hilbert(lat=[[1,2,3],[1,1,1]]) # optional - 4ti2 + sage: four_ti_2.hilbert(lat=[[1,2,3],[1,1,1]]) # optional - 4ti2 [2 1 0] [0 1 2] [1 1 1] @@ -396,13 +403,14 @@ def hilbert(self, mat=None, lat=None, project=None): def graver(self, mat=None, lat=None, project=None): r""" - Run the 4ti2 program ``graver`` on the parameters. See - ``http://www.4ti2.de/`` for details. + Run the 4ti2 program ``graver`` on the parameters. + + See `4ti2 website `_ for details. EXAMPLES:: sage: from sage.interfaces.four_ti_2 import four_ti_2 - sage: four_ti_2.graver([1,2,3]) # optional - 4ti2 + sage: four_ti_2.graver([1,2,3]) # optional - 4ti2 [ 2 -1 0] [ 3 0 -1] [ 1 1 -1] @@ -420,13 +428,14 @@ def graver(self, mat=None, lat=None, project=None): def ppi(self, n): r""" - Run the 4ti2 program ``ppi`` on the parameters. See - ``http://www.4ti2.de/`` for details. + Run the 4ti2 program ``ppi`` on the parameters. + + See `4ti2 website `_ for details. EXAMPLES:: sage: from sage.interfaces.four_ti_2 import four_ti_2 - sage: four_ti_2.ppi(3) # optional - 4ti2 + sage: four_ti_2.ppi(3) # optional - 4ti2 [-2 1 0] [ 0 -3 2] [-1 -1 1] @@ -439,13 +448,14 @@ def ppi(self, n): def circuits(self, mat=None, project=None): r""" - Run the 4ti2 program ``circuits`` on the parameters. See - ``http://www.4ti2.de/`` for details. + Run the 4ti2 program ``circuits`` on the parameters. + + See `4ti2 website `_ for details. EXAMPLES:: sage: from sage.interfaces.four_ti_2 import four_ti_2 - sage: four_ti_2.circuits([1,2,3]) # optional - 4ti2 + sage: four_ti_2.circuits([1,2,3]) # optional - 4ti2 [ 0 3 -2] [ 2 -1 0] [ 3 0 -1] @@ -456,13 +466,14 @@ def circuits(self, mat=None, project=None): def minimize(self, mat=None, lat=None): r""" - Run the 4ti2 program ``minimize`` on the parameters. See - ``http://www.4ti2.de/`` for details. + Run the 4ti2 program ``minimize`` on the parameters. + + See `4ti2 website `_ for details. EXAMPLES:: sage: from sage.interfaces.four_ti_2 import four_ti_2 - sage: four_ti_2.minimize() # optional - 4ti2 + sage: four_ti_2.minimize() # optional - 4ti2 Traceback (most recent call last): ... NotImplementedError: 4ti2 command 'minimize' not implemented in Sage. @@ -472,18 +483,20 @@ def minimize(self, mat=None, lat=None): def groebner(self, mat=None, lat=None, project=None): r""" - Run the 4ti2 program ``groebner`` on the parameters. This - computes a Toric Groebner basis of a matrix. See - ``http://www.4ti2.de/`` for details. + Run the 4ti2 program ``groebner`` on the parameters. + + This computes a toric Groebner basis of a matrix. + + See `4ti2 website `_ for details. EXAMPLES:: sage: from sage.interfaces.four_ti_2 import four_ti_2 sage: A = [6,10,15] - sage: four_ti_2.groebner(A) # optional - 4ti2 + sage: four_ti_2.groebner(A) # optional - 4ti2 [-5 0 2] [-5 3 0] - sage: four_ti_2.groebner(lat=[[1,2,3],[1,1,1]]) # optional - 4ti2 + sage: four_ti_2.groebner(lat=[[1,2,3],[1,1,1]]) # optional - 4ti2 [-1 0 1] [ 2 1 0] """ @@ -498,7 +511,7 @@ def _magic3x3(self): EXAMPLES:: sage: from sage.interfaces.four_ti_2 import four_ti_2 - sage: four_ti_2._magic3x3() # optional - 4ti2 + sage: four_ti_2._magic3x3() # optional - 4ti2 [ 1 1 1 -1 -1 -1 0 0 0] [ 1 1 1 0 0 0 -1 -1 -1] [ 0 1 1 -1 0 0 -1 0 0]