Polymake.jl example

Example for Polymake.jl

Start by initializing Cxx (necessary for Docker)

In [ ]:
using Cxx

Initialize Polymake

In [ ]:
using Polymake

Data for polymake is passed as a dictionary

In [ ]:
input_data = Dict(
    "POINTS" => [ 1 -1 -1 ;
                  1  1 -1 ;
                  1 -1  1 ;
                  1  1  1 ;
                  1  0  0 ]
)

Create a new polytope

In [ ]:
polytope = Polymake.perlobj( "Polytope<Rational>", input_data )

Properties of perl objects can be accessed using the Polymake.give method

In [ ]:
vertices = Polymake.give( polytope, "VERTICES" )

Numbers, vectors, and matrices can be converted to natural julia data structures.

In [ ]:
vertices_julia = convert( Array{Rational{BigInt},2}, vertices )
In [ ]:
volume = Polymake.give( polytope, "VOLUME" )
In [ ]:
volume_julia = convert( Rational{BigInt}, volume )

Computed properties of perl objects are automatically printed

In [ ]:
polytope