Before I start I would like to express my sincere thanks to Burcin Erocal who took the lead to write this first interface. The code is available at https://bitbucket.org/burcin/pypolymake. The installation instructions below are also mostly due to him.

The setup is somewhat delicate but has been tried with sage 4.7.1 and polymake 2.9.10. While it does not work with our most recent release 2.10 Benjamin Lorenz was able to resolve this extremely subtle issue a few days ago, and the patch will appear in our next release (to be expected soon).

Here are my

**installation**details on Ubuntu 11.04 which includes building sage. I used an additionally installed gcc 4.4 (from the Ubuntu package), since the default compiler from the 4.5 series is bogus. The newer versions of gcc 4.6.x would be another viable option.

Code: Select all

`CC=gcc-4.4; CXX=g++-4.4`

SAGE64=yes

SAGE_FORTRAN=/usr/bin/gfortran-4.4

SAGE_FORTRAN_LIB=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.4/libgfortran.so

In the sequel I assume that the sage source code has been extracted to

*/usr/local/sage-4.7.1*. Building libatlas is very tedious and also unnecessary since it can be installed from a package.

Code: Select all

`cd /usr/local/sage-4.7.1`

touch spkg/installed/atlas-3.8.3.p16

make

The following updates some sage packages to versions compatible with polymake. This includes a version of polymake 2.9.10 as a sage package.

Code: Select all

`./sage -i http://sage.math.washington.edu/home/burcin/polymake/mpfi-1.5.spkg`

./sage -i http://sage.math.washington.edu/home/burcin/polymake/mpfr-3.0.0.spkg

./sage -f spkg/standard/mpir-1.2.2.p2.spkg

./sage -i http://sage.math.washington.edu/home/burcin/polymake/polymake-2.9.10.p0.spkg

./sage -b

For me the following trick was neceassary:

Code: Select all

`cd local/lib`

ln -s libmpfr.so libmpfr.so.1

cd -

You now should have custom made version of sage 4.7.1 up and running.

This is where the installation of pypolymake starts. The commands below require mercurial (with extension mq) to be installed. The patch itself is attached below. First we patch sage.

Code: Select all

`cd local/bin`

hg qimport sage-env.patch

hg qpush

cd -

Now comes the actual pypolymake:

Code: Select all

`hg clone https://bitbucket.org/burcin/pypolymake`

ln -s /usr/local/sage-4.7.1/devel/sage/c_lib/include /usr/local/sage-4.7.1/local/include/sage

./sage -sh

cd pypolymake

python setup.py install

That's it.

Here is a first

**demo**(in a sage notebook):

Code: Select all

`import polymake`

m = matrix(QQ,[[1, 3, 0, 0], [1, 0, 3, 0], [1, 1, 1, 1], [1, 0, 0, 3], [1, 0, 0, 0], [1, 2, 2, 2]])

p = polymake.Polytope('POINTS',m)

p.is_simple()

The above should return

*False*. You can save objects to files which can then be processed further by polymake.

Code: Select all

`p._save("p.poly")`

Visualization via jreality should work, too.

Code: Select all

`p.visual()`

More fancy polymake functions can be called via passing the corresponding property as a string:

Code: Select all

`p._get_integer_property("CUBICALITY")`

Please look into the pypolymake code for more examples.

The current pypolymake implementation has the following

**limitations**:

- The only basic polymake types supported so far are:
*Bool*,*Int*,*Matrix<Rational>*. - The only big object types supported so far is:
*Polytope<Rational>*.

**Next Steps.**Someone should take the lead to extend the pypolymake interface to add more basic types. Most importantly:

*Integer*,

*Rational*,

*Array<Int>*,

*Set<Int>*. Adding other big object types, such as

*SimplicialComplex*and

*PolyhedralFan*should be fairly easy but does not make much sense before more basic types are available. Whatever you do in this direction, please document it in this thread.

Happy pypolymaking!

-- Michael