You must have the 4ti2 Sage package installed on your computer for this interface to work.
AUTHORS:
Bases: object
This object defines an interface to the program 4ti2. Each command 4ti2 has is exposed as one method.
Run the 4ti2 program command on the project named project in the directory directory().
INPUT:
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: four_ti_2.write_matrix([[6,10,15]], "test_file.mat")
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]
Runs the 4ti2 program circuits on the parameters. See http://www.4ti2.de/ for details.
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: four_ti_2.circuits([1,2,3]) # optional - 4ti2
[ 0 3 -2]
[ 2 -1 0]
[ 3 0 -1]
Return the directory where the input files for 4ti2 are written by Sage and where 4ti2 is run.
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import FourTi2
sage: f = FourTi2("/tmp/")
sage: f.directory()
'/tmp/'
Runs the 4ti2 program graver on the parameters. See http://www.4ti2.de/ for details.
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: four_ti_2.graver([1,2,3]) # optional - 4ti2
[ 2 -1 0]
[ 3 0 -1]
[ 1 1 -1]
[ 1 -2 1]
[ 0 3 -2]
Runs the 4ti2 program groebner on the parameters. This computes a Toric Groebner basis of a matrix. See http://www.4ti2.de/ 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
[-5 0 2]
[-5 3 0]
Runs the 4ti2 program hilbert on the parameters. See http://www.4ti2.de/ 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
[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]
Runs the 4ti2 program minimize on the parameters. See http://www.4ti2.de/ for details.
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: four_ti_2.minimize() # optional - 4ti2
Traceback (most recent call last):
...
NotImplementedError: 4ti2 command 'minimize' not implemented in Sage.
Runs the 4ti2 program ppi on the parameters. See http://www.4ti2.de/ for details.
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: four_ti_2.ppi(3) # optional - 4ti2
[-2 1 0]
[ 0 -3 2]
[-1 -1 1]
[-3 0 1]
[ 1 -2 1]
Runs the 4ti2 program qsolve on the parameters. See http://www.4ti2.de/ 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
[[], [ 1 -2 1]]
Runs the 4ti2 program rays on the parameters. See http://www.4ti2.de/ 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
[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]
[2 0 1 0 1 2 1 2 0]
Read a matrix in 4ti2 format from the file filename in directory directory().
INPUT:
OUTPUT:
The data from the file as a matrix over .
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: four_ti_2.write_matrix([[1,2,3],[3,4,6]], "test_file")
sage: four_ti_2.read_matrix("test_file")
[1 2 3]
[3 4 6]
Return an input project file name that has not been used yet.
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: four_ti_2.temp_project()
'project_...'
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.
INPUT:
of lists.
nrows - The number of rows in array.
ncols - The number of columns in array.
file - A file name not including a path.
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: four_ti_2.write_array([[1,2,3],[3,4,5]], 2, 3, "test_file")
Write the matrix mat to the file filename in 4ti2 format.
INPUT:
converted to that.
filename - A file name not including a path.
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: four_ti_2.write_matrix([[1,2],[3,4]], "test_file")
Write the list row to the file filename in 4ti2 format as a matrix with one row.
INPUT:
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: four_ti_2.write_single_row([1,2,3,4], "test_file")
Runs the 4ti2 program zsolve on the parameters. See http://www.4ti2.de/ for details.
EXAMPLES:
sage: from sage.interfaces.four_ti_2 import four_ti_2
sage: A = [[1,1,1],[1,2,3]]
sage: rel = ['<', '<']
sage: rhs = [2, 3]
sage: sign = [1,0,1]
sage: four_ti_2.zsolve(A, rel, rhs, sign) # optional - 4ti2
[
[ 1 -1 0]
[ 0 -1 0]
[0 0 1] [ 0 -3 2]
[1 1 0] [ 1 -2 1]
[0 1 0], [ 0 -2 1], []
]