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
Code: Select all
cd /usr/local/sage-4.7.1
touch spkg/installed/atlas-3.8.3.p16
make
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
Code: Select all
cd local/lib
ln -s libmpfr.so libmpfr.so.1
cd -
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 -
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
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()
Code: Select all
p._save("p.poly")
Code: Select all
p.visual()
Code: Select all
p._get_integer_property("CUBICALITY")
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>.
Happy pypolymaking!
-- Michael