Git Product home page Git Product logo

polymake.jl's Introduction

Polymake.jl

Stable version Documentation Build Status
version Build Status PkgEval

Polymake.jl is a Julia package for using polymake, a software for research in polyhedral geometry from Julia. This package is developed as part of the OSCAR project.

The current version of Polymake.jl relies on polymake version 4.0 or later.

Supported Platforms

While this package does support most julia platforms apart from Windows, everything except x86_64-linux-gnu and x86_64-apple-darwin is considered experimental.

Documentation

The documentation can be found at juliahub.

How to cite

If you use Polymake.jl in your research, please cite our ICMS article and the original polymake article.

polymake.jl's People

Contributors

alexej-jordan avatar bdapro avatar benlorenz avatar fieker avatar fingolfin avatar ivanspirandelli avatar joschmitt avatar juliatagbot avatar kalmarek avatar lgoettgens avatar lkastner avatar micjoswig avatar saschatimme avatar sebasguts avatar thofma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

polymake.jl's Issues

shell execute errors upon showing the result

due to JuliaInterop/CxxWrap.jl#196

julia> Polymake.shell_execute("prefer \"polytope::cdd.simplex\";")
(Error showing value of type Tuple{CxxWrap.CxxWrapCore.CxxBool,CxxWrap.StdLib.StdStringAllocated,CxxWrap.StdLib.StdStringAllocated,CxxWrap.StdLib.StdStringAllocated}:
ERROR: MethodError: no method matching leading_zeros(::CxxWrap.CxxWrapCore.CxxBool)
Closest candidates are:
  leading_zeros(::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) at int.jl:367
Stacktrace:
 [1] hex(::CxxWrap.CxxWrapCore.CxxBool, ::Int64, ::Bool) at ./intfuncs.jl:589
 [2] #string#320 at ./intfuncs.jl:653 [inlined]
 [3] #string at ./none:0 [inlined]
 [4] show at ./show.jl:575 [inlined]
 [5] show_delim_array(::IOContext{REPL.Terminals.TTYTerminal}, ::Tuple{CxxWrap.CxxWrapCore.CxxBool,CxxWrap.StdLib.StdStringAllocated,CxxWrap.StdLib.StdStringAllocated,CxxWrap.StdLib.StdStringAllocated}, ::Char, ::Char, ::Char, ::Bool, ::Int64, ::Int64) at ./show.jl:697

Error in printing of cones

I construct a cone via rays given by a JULIA array, but then an error is thrown after construction, although the object itself is constructed and I can work with it.

I use JULIA 1.2 on Ubuntu 18.04

Here is the minimal example that produces an error:
julia> A = [1 2 3; 1 -1 0]

julia> c1 = @pm polytope.Cone(RAYS = A)
type: Cone
Error showing value of type Polymake.BigObjectAllocated:
ERROR: MethodError: objects of type Regex are not callable
Stacktrace:
[1] count(::Regex, ::SubString{String}) at ./reduce.jl:772
[2] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::Polymake.BigObjectAllocated) at /home/epure/.julia/packages/Polymake/kIMyn/src/visual.jl:26
[3] display(::REPL.REPLDisplay, ::MIME{Symbol("text/plain")}, ::Any) at /home/epure/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:132
[4] display(::REPL.REPLDisplay, ::Any) at /home/epure/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:136
[5] display(::Any) at ./multimedia.jl:323
[6] #invokelatest#1 at ./essentials.jl:790 [inlined]
[7] invokelatest at ./essentials.jl:789 [inlined]
[8] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /home/epure/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:156
[9] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /home/epure/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:141
[10] (::getfield(REPL, Symbol("#do_respond#38")){Bool,getfield(REPL, Symbol("##48#57")){REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /home/epure/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:718
[11] #invokelatest#1 at ./essentials.jl:790 [inlined]
[12] invokelatest at ./essentials.jl:789 [inlined]
[13] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /home/epure/julia/usr/share/julia/stdlib/v1.2/REPL/src/LineEdit.jl:2306
[14] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /home/epure/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:1038
[15] run_repl(::REPL.AbstractREPL, ::Any) at /home/epure/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:201
[16] (::getfield(Base, Symbol("##737#739")){Bool,Bool,Bool,Bool})(::Module) at ./client.jl:390
[17] #invokelatest#1 at ./essentials.jl:790 [inlined]
[18] invokelatest at ./essentials.jl:789 [inlined]
[19] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:374
[20] exec_options(::Base.JLOptions) at ./client.jl:312
[21] _start() at ./client.jl:464

julia> c1.RAYS
pm::Matrixpm::Rational
1 2 3
1 -1 0

Add a "Rosetta Stone" to the README

It would be nice to have a small list of comparisons between polymake and Polymake.jl code in the README, i.e., lines like

$x->VERTICES => x.VERTICES

BigObject from another BigObject

I tried to mimic this

polymake > $c = polytope::cube(3);

polymake > $d = new polytope::Cone($c);
BigObject("polytope::Cone", polytope.cube(3))
ERROR: unknown perl subroutine Polymake::Core::BigObject::construct
Stacktrace:
 [1] BigObject(::String, ::Polymake.BigObjectAllocated) at /home/kalmar/.julia/packages/CxxWrap/lDNAy/src/CxxWrap.jl:552
 [2] top-level scope at REPL[15]:1

this constructor is called:

.constructor<const std::string&, const pm::perl::BigObject&>()

Two more questions:

  • shouldn't we be using BigObjectType for BigObject construction? what purpose BigObjectType serves for now? @benlorenz
  • in jupyter the first line gets stangely truncated if we return something templated, e.g. @pm polytope.Polytope{QuadraticExtension}(...) @saschatimme could you have a look?

rand_sphere is gone

Dear Sebastian,

I do appreciate your current effort, and I am all in favor of the idea to move the functions from application polytope to its own module.

Yet I am currently working on stuff, preparing for the upcoming OSCAR meeting. For this I need a tiny bit more stability. It's fine to move stuff around, but currently, e.g., rand_sphere does not exist any more in spite of being listed in the temporary json.

I am not sure how this test logic is supposed to work. Should I create a test from the script that I am working on? How so? Or should I create a new directory such that people could check by hand?

-- Michael

Names for polymake apps

I have just encountered a problem with the polymake application names:

Polymake.jl currently exports application names, so we can access functions, e.g., polytope.cube. Unfortunately, Polymake.jl exports those without importing those names beforehand, because they are modules, so importing those names does not make sense. This leads to a confusion if you use Hecke and Polymake, because both currently export ideal, with a complete different meaning. And I assume that this might cause problems with other OSCAR components soonish. So what should we do?

  • Not export them?
  • Rename them into something like app_ideal
  • . . .

Ideas highly appreaciated!

`nvars` for polynomials is a CxxWrap type

julia> p = Polymake.Polynomial([1,2],[3 4 5; 6 7 0])
pm::Polynomial<long, long>
2*x_0^6*x_1^7 + x_0^3*x_1^4*x_2^5

julia> Polymake.nvars(p)
CxxWrap.CxxWrapCore.ConstCxxRef{CxxWrap.CxxWrapCore.CxxLong}(Ptr{CxxWrap.CxxWrapCore.CxxLong} @0x00007fefb9f3bac0)

Sparse system tests flaky

This test

@testset "findnz" begin
jsm = sprand(1015,1841,.14)
psm = Polymake.SparseMatrix(jsm)
jr, jc, jv = findnz(jsm)
pr, pc, pv = findnz(psm)
p = sortperm(pc)
@test jr == pr[p]
@test jc == pc[p]
@test jv == pv[p]

is quite flaky on CI which seems ... odd.

Wrapper Compilation Errors

Our travis test logs show this by now:

polymake:  WARNING: Compiling temporary shared module, please be patient...
{"app": "common",
 "inst": [
  {"args": ["Matrix<Rational>", "Int"], "include": ["polymake/IncidenceMatrix.h", "polymake/Matrix.h", "polymake/Rational.h"], "op": "new", "sig": "new.X"},
 null ],
"version": 3}
ninja: Entering directory `/tmp/poly6150Taaaa0005'

[0/3] GENERATE C++ modules from Matrix.cpperl�[K
[1/3] GENERATE C++ modules from Matrix.cpperl�[K
[1/3] COMPILE Matrix.o�[K
[2/3] COMPILE Matrix.o�[K
FAILED: Matrix.o 
  g++ -c -o Matrix.o -MMD -MT Matrix.o -MF Matrix.o.d -fPIC -pipe -Wno-error -std=c++14 -ftemplate-depth-200 -fno-strict-aliasing -fopenmp -Wshadow -Wlogical-op -Wconversion -Wzero-as-null-pointer-constant -Wno-parentheses -Wno-error=unused-function -I/home/travis/build/oscar-system/Polymake.jl/deps/usr/include -I/home/travis/build/oscar-system/Polymake.jl/deps/usr/include -DPOLYMAKE_WITH_FLINT  -DPOLYMAKE_DEBUG=0 -DNDEBUG -O3 -DPOLYMAKE_APPNAME=common -I/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/external -I/home/travis/build/oscar-system/Polymake.jl/deps/usr/include Matrix.cc && : 'COMPILER_USED=7.1.0'
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/client.h:25:0,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Set.h:22,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/IncidenceMatrix.h:27,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/IncidenceMatrix.h:21,
                 from Matrix.cc:6:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h: In instantiation of ‘sv* pm::perl::Operator_new__caller_4perl::operator()(const pm::perl::ArgValues<(sizeof... (T_) + 1)>&, polymake::mlist<>, polymake::mlist<T2, Tail ...>, std::index_sequence<0, I_ ...>) const [with long unsigned int ...I_ = {1}; T0_ = pm::Matrix<pm::Rational>; T_ = {long int}; std::index_sequence<0, I_ ...> = std::integer_sequence<long unsigned int, 0, 1>]’:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1438:22:   required from ‘static sv* pm::perl::FunctionWrapper<Caller, returns, n_explicit, polymake::mlist<T ...>, std::integer_sequence<long unsigned int, anchors ...> >::consume_result(const arg_values&, polymake::mlist<sv*>) [with Caller = pm::perl::Operator_new__caller_4perl; pm::perl::Returns returns = (pm::perl::Returns)0; int n_explicit = 0; T = {pm::Matrix<pm::Rational>, long int}; long unsigned int ...anchors = {}; pm::perl::FunctionWrapper<Caller, returns, n_explicit, polymake::mlist<T ...>, std::integer_sequence<long unsigned int, anchors ...> >::arg_values = pm::perl::ArgValues<2>]’
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1404:28:   required from ‘static sv* pm::perl::FunctionWrapper<Caller, returns, n_explicit, polymake::mlist<T ...>, std::integer_sequence<long unsigned int, anchors ...> >::call(sv**) [with Caller = pm::perl::Operator_new__caller_4perl; pm::perl::Returns returns = (pm::perl::Returns)0; int n_explicit = 0; T = {pm::Matrix<pm::Rational>, long int}; long unsigned int ...anchors = {}]’
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1443:14:   required from ‘static sv* (* pm::perl::FunctionWrapper<Caller, returns, n_explicit, polymake::mlist<T ...>, std::integer_sequence<long unsigned int, anchors ...> >::get_wrapper_ptr())(sv**) [with Caller = pm::perl::Operator_new__caller_4perl; pm::perl::Returns returns = (pm::perl::Returns)0; int n_explicit = 0; T = {pm::Matrix<pm::Rational>, long int}; long unsigned int ...anchors = {}; pm::perl::wrapper_type = sv* (*)(sv**)]’
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1462:126:   required from ‘void pm::perl::FunctionWrapper<Caller, returns, n_explicit, polymake::mlist<T ...>, std::integer_sequence<long unsigned int, anchors ...> >::add__me(const polymake::AnyString&, const polymake::AnyString&, int, Attrs&& ...) const [with Attrs = {}; Caller = pm::perl::Operator_new__caller_4perl; pm::perl::Returns returns = (pm::perl::Returns)0; int n_explicit = 0; T = {pm::Matrix<pm::Rational>, long int}; long unsigned int ...anchors = {}]’
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/client.h:97:7:   required from ‘polymake::common::{anonymous}::QueueingRegistrator4perl<What, id>::QueueingRegistrator4perl(Args&& ...) [with Args = {const char (&)[6], const char (&)[7], int}; What = pm::perl::FunctionWrapper<pm::perl::Operator_new__caller_4perl, (pm::perl::Returns)0, 0, polymake::mlist<pm::Matrix<pm::Rational>, long int> >; int id = 0]’
Matrix.cc:12:1:   required from here
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1527:7: error: no matching function for call to ‘pm::Matrix<pm::Rational>::Matrix(pm::perl::access<long int>::return_type)’
       new(result.allocate<T0_>(args_.template get<0, SV*>())) T0_(args_.template get<I_, T_>()...);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Matrix.h:21:0,
                 from Matrix.cc:7:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:169:4: note: candidate: template<class Iterator> pm::Matrix<E>::Matrix(const pm::shared_array_placement&, polymake::Int, polymake::Int, Iterator&&)
    Matrix(const shared_array_placement& place, Int r, Int c, Iterator&& src)
    ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:169:4: note:   template argument deduction/substitution failed:
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/client.h:25:0,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Set.h:22,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/IncidenceMatrix.h:27,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/IncidenceMatrix.h:21,
                 from Matrix.cc:6:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1527:7: note:   candidate expects 4 arguments, 1 provided
       new(result.allocate<T0_>(args_.template get<0, SV*>())) T0_(args_.template get<I_, T_>()...);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Matrix.h:21:0,
                 from Matrix.cc:7:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:165:4: note: candidate: pm::Matrix<E>::Matrix(const pm::shared_array_placement&, polymake::Int, polymake::Int) [with E = pm::Rational; polymake::Int = long int]
    Matrix(const shared_array_placement& place, Int r, Int c)
    ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:165:4: note:   candidate expects 3 arguments, 1 provided
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:160:13: note: candidate: template<class Container> pm::Matrix<E>::Matrix(const Container&, std::enable_if_t<pm::isomorphic_to_container_of<Container, pm::Vector<E> >::value, void**>)
    explicit Matrix(const Container& src,
             ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:160:13: note:   template argument deduction/substitution failed:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:155:13: note: candidate: template<class Matrix2, class E2> pm::Matrix<E>::Matrix(const pm::GenericMatrix<Right, E2>&, std::enable_if_t<pm::can_initialize<E2, E>::value, void**>)
    explicit Matrix(const GenericMatrix<Matrix2, E2>& m,
             ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:155:13: note:   template argument deduction/substitution failed:
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/client.h:25:0,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Set.h:22,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/IncidenceMatrix.h:27,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/IncidenceMatrix.h:21,
                 from Matrix.cc:6:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1527:7: note:   mismatched types ‘const pm::GenericMatrix<TMatrix, E>’ and ‘pm::perl::access<long int>::return_type {aka long int}’
       new(result.allocate<T0_>(args_.template get<0, SV*>())) T0_(args_.template get<I_, T_>()...);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Matrix.h:21:0,
                 from Matrix.cc:7:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:150:4: note: candidate: template<class Matrix2> pm::Matrix<E>::Matrix(const pm::GenericMatrix<Matrix2, E>&)
    Matrix(const GenericMatrix<Matrix2, E>& m)
    ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:150:4: note:   template argument deduction/substitution failed:
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/client.h:25:0,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Set.h:22,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/IncidenceMatrix.h:27,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/IncidenceMatrix.h:21,
                 from Matrix.cc:6:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1527:7: note:   mismatched types ‘const pm::GenericMatrix<TMatrix2, pm::Rational>’ and ‘pm::perl::access<long int>::return_type {aka long int}’
       new(result.allocate<T0_>(args_.template get<0, SV*>())) T0_(args_.template get<I_, T_>()...);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Matrix.h:21:0,
                 from Matrix.cc:7:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:145:4: note: candidate: pm::Matrix<E>::Matrix(const pm::GenericMatrix<pm::Matrix<E> >&) [with E = pm::Rational; typename pm::Matrix<E>::element_type = pm::Rational]
    Matrix(const GenericMatrix<Matrix>& m)
    ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:145:4: note:   no known conversion for argument 1 from ‘pm::perl::access<long int>::return_type {aka long int}’ to ‘const pm::GenericMatrix<pm::Matrix<pm::Rational>, pm::Rational>&’
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:141:4: note: candidate: template<class ... Iterator, class> pm::Matrix<E>::Matrix(polymake::Int, polymake::Int, polymake::operations::move, Iterator&& ...)
    Matrix(Int r, Int c, polymake::operations::move, Iterator&&... src)
    ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:141:4: note:   template argument deduction/substitution failed:
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/client.h:25:0,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Set.h:22,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/IncidenceMatrix.h:27,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/IncidenceMatrix.h:21,
                 from Matrix.cc:6:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1527:7: note:   candidate expects at least 3 arguments, 1 provided
       new(result.allocate<T0_>(args_.template get<0, SV*>())) T0_(args_.template get<I_, T_>()...);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Matrix.h:21:0,
                 from Matrix.cc:7:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:136:4: note: candidate: template<class ... Iterator, class> pm::Matrix<E>::Matrix(polymake::Int, polymake::Int, Iterator&& ...)
    Matrix(Int r, Int c, Iterator&&... src)
    ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:136:4: note:   template argument deduction/substitution failed:
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/client.h:25:0,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Set.h:22,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/IncidenceMatrix.h:27,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/IncidenceMatrix.h:21,
                 from Matrix.cc:6:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1527:7: note:   candidate expects at least 2 arguments, 1 provided
       new(result.allocate<T0_>(args_.template get<0, SV*>())) T0_(args_.template get<I_, T_>()...);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Matrix.h:21:0,
                 from Matrix.cc:7:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:130:4: note: candidate: template<class E2, class> pm::Matrix<E>::Matrix(std::initializer_list<std::initializer_list<E2> >)
    Matrix(std::initializer_list<std::initializer_list<E2>> l)
    ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:130:4: note:   template argument deduction/substitution failed:
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/client.h:25:0,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Set.h:22,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/IncidenceMatrix.h:27,
                 from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/IncidenceMatrix.h:21,
                 from Matrix.cc:6:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/perl/wrappers.h:1527:7: note:   mismatched types ‘std::initializer_list<std::initializer_list<_Tp> >��� and ‘long int’
       new(result.allocate<T0_>(args_.template get<0, SV*>())) T0_(args_.template get<I_, T_>()...);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/Matrix.h:21:0,
                 from Matrix.cc:7:
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:125:4: note: candidate: pm::Matrix<E>::Matrix(polymake::Int, polymake::Int) [with E = pm::Rational; polymake::Int = long int]
    Matrix(Int r, Int c)
    ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:125:4: note:   candidate expects 2 arguments, 1 provided
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:122:4: note: candidate: pm::Matrix<E>::Matrix() [with E = pm::Rational]
    Matrix() {}
    ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:122:4: note:   candidate expects 0 arguments, 1 provided
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:85:7: note: candidate: pm::Matrix<pm::Rational>::Matrix(const pm::Matrix<pm::Rational>&)
 class Matrix
       ^~~~~~
/home/travis/build/oscar-system/Polymake.jl/deps/usr/include/polymake/next/Matrix.h:85:7: note:   no known conversion for argument 1 from ‘pm::perl::access<long int>::return_type {aka long int}’ to ‘const pm::Matrix<pm::Rational>&’
ninja: build stopped: subcommand failed.
polymake:  WARNING: Compiling temporary shared module, please be patient...
{"app": "common",
 "inst": [
  {"args": ["Matrix<QuadraticExtension<Rational>>", "perl::Canned<const Matrix<Integer>&>"], "include": ["polymake/IncidenceMatrix.h", "polymake/Integer.h", "polymake/Matrix.h", "polymake/QuadraticExtension.h", "polymake/Rational.h"], "op": "new", "sig": "new.X"},
 null ],
"version": 3}

Register package?

I think we should officially register the package such that it can be installed via

pkg> add Polymake

Also to introduce some versioning would make it easier to coordinate breaking changes.

cube(dim, up, low)

doesn't seem to work:

p = Polytope.cube(3, 1//4, -1//4)
p.VERTICES
pm::Matrix<pm::Rational>
1 -1 -1 -1
1 1 -1 -1
1 -1 1 -1
1 1 1 -1
1 -1 -1 1
1 1 -1 1
1 -1 1 1
1 1 1 1

Segmentation fault in MILP computation

The following Polymake input follows some examples in polymake docs

$p = new Polytope( INEQUALITIES => [ [1,1,-1],[-1,0,1],[7,-1,-1] ] );
$obj = new Vector( [0,-1,-1] );
$intvar = new Set<Int>( [0,1,2] );
$milp = $p -> MILP( LINEAR_OBJECTIVE => $obj,
                    INTEGER_VARIABLES => $intvar );
$result = $milp -> MINIMAL_VALUE;
print $result;

and yields -7.
Using the syntax translation rules from the README of Polymake.jl,
I tried to do the same with Polymake.jl, as follows.

using Polymake
p = @pm Polytope.Polytope( :INEQUALITIES => [1 1 -1; -1 0 1; 7 -1 -1] )
obj = [0,-1,-1]
intvar = Set{Int}( [0,1,2] )
milp = p.MILP( :LINEAR_OBJECTIVE => obj,
               :INTEGER_VARIABLES => intvar )

Here I get the following error message.

polymake:  WARNING: available properties insufficient to compute 'MILP'
ERROR: Exception occured at Polymake side:
property MILP not created as expected at ...

With help from Sebastian Gutsche, I tried the following variant.

p = @pm Polytope.Polytope( :INEQUALITIES => [1 1 -1; -1 0 1; 7 -1 -1] )
lp = @pm Polytope.MixedIntegerLinearProgram(
    :LINEAR_OBJECTIVE => [0,-1,-1],
    :INTEGER_VARIABLES => [0,1,2] )
p.MILP = lp
p.MILP.MINIMAL_VALUE

Here I get a segmentation fault.

cleaning polymake_caller.cpp

I came up with something like this:

// Visualization in polymake only works if the function is called and
// then immediately released,i.e. not converted to a property value
template<bool VoidContext = false>
auto polymake_call_function(
    std::string                     function_name,
    jlcxx::ArrayRef<std::string, 1> template_parameters,
    jlcxx::ArrayRef<jl_value_t*, 1> arguments) -> typename std::conditional<VoidContext, void, pm::perl::PropertyValue>::type
{
    std::vector<std::string> template_vector(template_parameters.begin(), template_parameters.end());
    auto   function = polymake::prepare_call_function(function_name, template_vector);
    for (auto arg : arguments)
        polymake_call_function_feed_argument(function, arg);
    if(!VoidContext)
        return function();
}

// Visualization in polymake only works if the method is called and
// then immediately released,i.e. not converted to a property value
template<bool VoidContext = false>
auto polymake_call_method(
    std::string                     function_name,
    pm::perl::Object*               object,
    jlcxx::ArrayRef<jl_value_t*, 1> arguments) -> typename std::conditional<VoidContext, void, pm::perl::PropertyValue>::type
{
    auto   function = object->prepare_call_method(function_name);
    for (auto arg : arguments)
        polymake_call_function_feed_argument(function, arg);
    if(!VoidContext)
        return function();
}

void polymake_module_add_caller(jlcxx::Module& polymake)
{
    polymake.method("internal_call_function", &polymake_call_function<false>);
    polymake.method("internal_call_function_void",
                    &polymake_call_function<true>);
    polymake.method("internal_call_method", &polymake_call_method<false>);
    polymake.method("internal_call_method_void", &polymake_call_method<true>);
    polymake.method("set_julia_type", &set_julia_type);
}

(note that this is dependent on JuliaInterop/libcxxwrap-julia#26), but the compiler rightfully complains that we have return statements in void functions:

/home/kalmar/.julia/dev/Polymake/deps/src/polymake_caller.cpp: In instantiation of ‘typename std::conditional<VoidContext, void, pm::perl::PropertyValue>::type polymake_call_function(std::string, jlcxx::ArrayRef<std::__cxx11::basic_string<char>, 1>, jlcxx::ArrayRef<_jl_value_t*, 1>) [with bool VoidContext = true; typename std::conditional<VoidContext, void, pm::perl::PropertyValue>::type = void; std::string = std::__cxx11::basic_string<char>]’:
/home/kalmar/.julia/dev/Polymake/deps/src/polymake_caller.cpp:93:50:   required from here
/home/kalmar/.julia/dev/Polymake/deps/src/polymake_caller.cpp:71:25: error: return-statement with a value, in function returning ‘std::conditional<true, void, pm::perl::PropertyValue>::type’ {aka ‘void’} [-fpermissive]
   71 |         return function();
      |                         ^
/home/kalmar/.julia/dev/Polymake/deps/src/polymake_caller.cpp: In instantiation of ‘typename std::conditional<VoidContext, void, pm::perl::PropertyValue>::type polymake_call_method(std::string, pm::perl::Object*, jlcxx::ArrayRef<_jl_value_t*, 1>) [with bool VoidContext = true; typename std::conditional<VoidContext, void, pm::perl::PropertyValue>::type = void; std::string = std::__cxx11::basic_string<char>]’:
/home/kalmar/.julia/dev/Polymake/deps/src/polymake_caller.cpp:95:77:   required from here
/home/kalmar/.julia/dev/Polymake/deps/src/polymake_caller.cpp:86:25: error: return-statement with a value, in function returning ‘std::conditional<true, void, pm::perl::PropertyValue>::type’ {aka ‘void’} [-fpermissive]
   86 |         return function();
      |                         ^
make[2]: *** [CMakeFiles/polymake.dir/build.make:89: CMakeFiles/polymake.dir/polymake_caller.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/polymake.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

@benlorenz what would be the correct method to disable the return statements at the compilation?

@convert_to macro

Polymake.@convert_to Array{Set{Int}} power_set

based on @pm common.convert_to{PerlType}(power_set)

Documentation

How will we document this package? Can we reuse the Polymake docstrings? Do we just delegate the user to the Polymake documentation? How do we then deal with API differences? Do we write everything by hand ☹️ ?

Package does not build on single core systems

Build fails with

ERROR: LoadError: failed process: Process(make -j0, ProcessExited(2))

This issue was probably introduced with e38efa9; the problem is that if Sys.CPU_THREADS is equal to 1, then the called make command is

make -j0

which make does not like.

Visualizing of subdivision

If I want to visualize a polyhedral subdivision I get a rather cryptic error.

julia> using Polymake

julia> A = [2 1 0; 0 0 2]'
3×2 LinearAlgebra.Adjoint{Int64,Array{Int64,2}}:
 2  0
 1  0
 0  2

julia> lift = Rational{Int64}[5//1, 3//1, 5//1]
3-element Array{Rational{Int64},1}:
 5//1
 3//1
 5//1

julia> subdiv = @pm Fan.SubdivisionOfPoints(POINTS=A, WEIGHTS=lift)
type: SubdivisionOfPoints<Rational>

POINTS
1 0
1 0
0 1


WEIGHTS
5 3 5


julia> Fan.visual(subdiv)
ERROR: Can't locate object method "code" via package "1" (perhaps you forgot to load "1"?) at /Users/sascha/.julia/dev/Polymake/deps/usr/share/polymake/perllib/Polymake/Core/ObjectType.pm line 1025.

Stacktrace:
 [1] internal_call_method at ./none:0 [inlined]
 [2] #`#42(::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(Polymake.Fan.visual), ::Polymake.pm_perl_ObjectAllocated) at /Users/sascha/.julia/dev/Polymake/src/meta.jl:213
 [3] visual(::Polymake.pm_perl_ObjectAllocated) at /Users/sascha/.julia/dev/Polymake/src/meta.jl:209
 [4] top-level scope at none:0

Visualizing our favourite 3-cube on the other hand works perfectly.

TODO List

  • parser (waiting for the JSON from Polymake) (#29, new one: #119 )
  • Exception on the Polymake execution (#48 )
  • Methods (#27, #34)
  • tab completion (#45 ,#46)
  • Build system (via #76)
  • polymake> REPL mode (#47)
  • c++lib independent typenames in PropertyValue (#38)
  • Wrappers for BigObjects (#178)
  • Document our wrapper
  • Documentation (in an automated way from Polymake):
    • functions (#119)
    • objects: (#178);
    • methods (is it even possible???) (#192)
  • Most commonly used SmallObjects:
    • [ ] BitSet
    • IncidenceMatrix (#184),
    • SparseVector (#208)
    • SparseMatrix (#181)
    • Polynomial-types? (#216)
    • TropicalNumber (#182)
    • QuadraticExtension (#221)
    • [ ] Graph
    • [ ] Map*-types
    • [ ] Pair
  • solve 0-1 based indexing (is this even a realistic goal? we need to know the intention how the object is going to be used later...) (we have to_(zero|one)_based_indexing functions)

weird int64 conversion error

The matrix is just jl_m = [1 2 3; 4 5 6] but somehow a very huge number appears during conversion. W is a polymake sparse-matrix created from jl_m.

something like this happened some time ago on travis, now we see this once more on github actions:

2020-02-19T14:19:10.7421790Z Constructors/Converts: Error During Test at /Users/runner/runners/2.165.2/work/Polymake.jl/Polymake.jl/test/sparsematrix.jl:60
2020-02-19T14:19:10.7422470Z   Test threw exception
2020-02-19T14:19:11.5055310Z   Expression: jl_m == convert(Base.Matrix{T}, W)
2020-02-19T14:19:11.5751490Z   InexactError: Int64(Int64, 14987988354931562665)
2020-02-19T14:19:11.5751760Z   Stacktrace:
2020-02-19T14:19:11.5753690Z    [1] Int64(::BigInt) at ./gmp.jl:346
2020-02-19T14:19:11.5753980Z    [2] Type at ./number.jl:7 [inlined]
2020-02-19T14:19:11.5755000Z    [3] convert at ./number.jl:7 [inlined]
2020-02-19T14:19:11.5755180Z    [4] convert(::Type{Rational{Int64}}, ::Polymake.RationalAllocated) at /Users/runner/runners/2.165.2/work/Polymake.jl/Polymake.jl/src/rationals.jl:45
2020-02-19T14:19:11.5755400Z    [5] setindex! at ./array.jl:769 [inlined]
2020-02-19T14:19:11.5755640Z    [6] copyto!(::IndexLinear, ::Array{Rational{Int64},2}, ::IndexCartesian, ::Polymake.SparseMatrixAllocated{Polymake.Rational}) at ./abstractarray.jl:742
2020-02-19T14:19:11.5755800Z    [7] copyto! at ./abstractarray.jl:723 [inlined]
2020-02-19T14:19:11.5755910Z    [8] Type at ./array.jl:497 [inlined]
2020-02-19T14:19:11.5756070Z    [9] convert(::Type{Array{Rational{Int64},2}}, ::Polymake.SparseMatrixAllocated{Polymake.Rational}) at ./array.jl:489
2020-02-19T14:19:11.5756170Z    [10] macro expansion at /Users/runner/runners/2.165.2/work/Polymake.jl/Polymake.jl/test/sparsematrix.jl:60 [inlined]
2020-02-19T14:19:11.5756310Z    [11] macro expansion at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
2020-02-19T14:19:11.5756460Z    [12] macro expansion at /Users/runner/runners/2.165.2/work/Polymake.jl/Polymake.jl/test/sparsematrix.jl:20 [inlined]
2020-02-19T14:19:11.5756590Z    [13] macro expansion at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
2020-02-19T14:19:11.5775700Z    [14] top-level scope at /Users/runner/runners/2.165.2/work/Polymake.jl/Polymake.jl/test/sparsematrix.jl:3
2020-02-19T14:20:35.8008180Z Test Summary:                   | Pass  Error  Total
2020-02-19T14:20:35.8622130Z Polymake                        | 6055      1   6056
2020-02-19T14:20:35.8627570Z   Polymake.Integer              |  103           103
2020-02-19T14:20:35.8632270Z   Polymake.Rational             |  220           220
2020-02-19T14:20:35.8638140Z   Polymake.Vector               | 1107          1107
2020-02-19T14:20:35.8644940Z   Polymake.Matrix               | 1171          1171
2020-02-19T14:20:35.8650750Z   Polymake.Set                  |  126           126
2020-02-19T14:20:35.8658190Z   julia Base.Sets compatibility |  249           249
2020-02-19T14:20:35.8663190Z   Polymake.Array                |  180           180
2020-02-19T14:20:35.8671670Z   IncidenceMatrix               |  948           948
2020-02-19T14:20:35.8676650Z   converting                    |   32            32
2020-02-19T14:20:35.8682450Z   bigobject                     |   58            58
2020-02-19T14:20:35.8689070Z   Interface functions           |   19            19
2020-02-19T14:20:35.8693420Z   Indexing helpers              |   53            53
2020-02-19T14:20:35.8699860Z   Polymake.SparseMatrix         | 1291      1   1292
2020-02-19T14:20:35.8704830Z     Constructors/Converts       |  471      1    472
2020-02-19T14:20:35.8712040Z     Low-level operations        |  247           247
2020-02-19T14:20:35.8715980Z     Arithmetic                  |  546           546
2020-02-19T14:20:35.8721430Z     findnz                      |    3             3
2020-02-19T14:20:35.8729020Z   Polymake.TropicalNumber       |  230           230
2020-02-19T14:20:35.8737670Z   Polymake.Polynomial           |  268           268

BigObject name completion and help strings

It'd be great to have a json file generated at compile time with a (potentially incomplete) list of big objects together with their docstrings. Then we can add annotated stub structs when we generate code for applications:

struct PolymakeObject <: PolymakeCallable
    jl_function::Symbol
    pm_name::String
    app_name::String
    json::Dict{String, Any}

   PolymakeObject(pm_name::String, app_name::String) = new(Symbol(pm_name), pm_name, app_name)
   PolymakeObject(jl_name::Symbol, pm_name::String, app_name::String, json_dict) = new(jl_name, pm_name, app_name, json_dict)
end

docstring(obj::PolymakeObject) = obj.json["docs"] # or whatever

function jl_code(obj::PolymakeObject)
    return :(
        struct $(jl_symbol(obj)) end;
        Base.Docs.getdoc(::typeof($(jl_symbol(obj)))) = Markdown.parse($(docstring(obj)))
    )
end

optimum on an empty polytope?

On the empty polytope

julia> using Polymake

julia> p = @pm Polytope.Polytope( :INEQUALITIES => [ -1 1;  0 -1 ] );

julia> @pm Polytope.print_constraints( p )
Inequalities:
0: x1 >= 1
1: -x1 >= 0
2: 0 >= -1


julia> p.FEASIBLE
false

one gets a minimal solution for a MILP.

julia> p.MILP = Polymake.@pm Polytope.MixedIntegerLinearProgram(
         :LINEAR_OBJECTIVE => [ 0, 0 ], :INTEGER_VARIABLES => [ 0, 1 ] );

julia> p.MILP.MINIMAL_SOLUTION
pm::Vector<pm::Rational>
1 0

On the other hand, if one takes a nonempty polytope without lattice points,
the corresponding question yields a nothing result, which makes more sense.

julia> ENV[ "OMP_NUM_THREADS" ] = 1;

julia> using Polymake

julia> inequalities = [ 3 2 -3 ; 0 -2 3 ; 9 -2 -3 ; -6 2 3 ];

julia> p = @pm Polytope.Polytope( :INEQUALITIES => inequalities );

julia> p.MILP = @pm Polytope.MixedIntegerLinearProgram(
       :LINEAR_OBJECTIVE => [ 0, 0, 0 ], :INTEGER_VARIABLES => [ 0, 1, 2 ] );

julia> typeof( p.MILP.MINIMAL_SOLUTION )
Nothing

Is this different behavior intended?
The documentation seems not to state what shall be the result in these situations.
(As a workaround, I can check for FEASIBLE.)

getting actual value from pm::PropertyValue

we can have a discussion here about this.

Currently we have this:

const WrappedTypes = Dict(
    Symbol("int") => to_int,
    Symbol("double") => to_double, 
    Symbol("perl::Object") => to_perl_object,
    Symbol("pm::Integer") => to_pm_Integer,
    Symbol("pm::Rational") => to_pm_Rational,
    Symbol("pm::Vector<pm::Integer>") => to_vector_Integer,
    ...)

function convert_from_property_value(obj::Polymake.pm_perl_PropertyValue)
    type_name = Polymake.typeinfo_string(obj)
    f = get(WrappedTypes, Symbol(type_name), identity)
    return f(obj)
end

The other options:

  • WrappedTypes is Dict{Symbol,Type} and we obtain T which we use to `convert(T, obj)
  • some @generated function which automatically populates Dictionary{Symbol, Function} at runtime
  • any other fancy meta-stuff which I have no idea about

signal handler

We set the signal handler for polymake.jl in initialize_polymake but this breaks Ctrl+C in julia afterwards.
Either we remove this or we need to set and unset this around every computation, and make sure we reset it to he correct one.

julia> sleep(5);
^CERROR: InterruptException:
Stacktrace:
 [1] poptaskref(::Base.InvasiveLinkedListSynchronized{Task}) at ./task.jl:564
 [2] wait() at ./task.jl:591
 [3] wait(::Base.GenericCondition{Base.Threads.SpinLock}) at ./condition.jl:104
 [4] stream_wait(::Timer, ::Base.GenericCondition{Base.Threads.SpinLock}) at ./stream.jl:47
 [5] wait(::Timer) at ./asyncevent.jl:116
 [6] sleep(::Int64) at ./asyncevent.jl:188
 [7] top-level scope at REPL[1]:1

julia> using Polymake
polymake version 4.0
Copyright (c) 1997-2020
Ewgenij Gawrilow, Michael Joswig, and the polymake team
Technische Universität Berlin, Germany
https://polymake.org
...

julia> sleep(5);
^C^C^C  (nothing happens)
julia> 

After removing the set_interrupt_signal from the polymake init Ctrl+C aborts julia and returns to the shell:

julia> using Polymake
polymake version 4.0
...

julia> sleep(5)
^C
lorenz $

It seems perl is also messing with the signal handler.

faux properties in Polymake

show as capitalized functions in appropriate modules e.g. $p.DIM is translated to Polymake.polytope.DIM(p).

should we de-capitalize them??

compose(::Visual, ...)

doesn't work

but

P = rand_sphere(3,10)
Q = rand_sphere(3,10)

Common.compose(Polytope.visual(P).obj, Polytope.visual(Q).obj)

seems to work fine

Option to disable warnings

Currently we give a warning if a not-wrapped typed is returned.
But my usual workflow results in a REPL which looks like that

┌ Warning: The return value contains pm::IncidenceMatrix<pm::NonSymmetric> which has not been wrapped yet;
│ use `@pm Common.convert_to{wrapped_type}(...)` to convert to julia-understandable type.
└ @ Polymake ~/.julia/dev/Polymake/src/functions.jl:66
┌ Warning: The return value contains pm::IncidenceMatrix<pm::NonSymmetric> which has not been wrapped yet;
│ use `@pm Common.convert_to{wrapped_type}(...)` to convert to julia-understandable type.
└ @ Polymake ~/.julia/dev/Polymake/src/functions.jl:66
┌ Warning: The return value contains pm::IncidenceMatrix<pm::NonSymmetric> which has not been wrapped yet;
│ use `@pm Common.convert_to{wrapped_type}(...)` to convert to julia-understandable type.
└ @ Polymake ~/.julia/dev/Polymake/src/functions.jl:66
┌ Warning: The return value contains pm::IncidenceMatrix<pm::NonSymmetric> which has not been wrapped yet;
│ use `@pm Common.convert_to{wrapped_type}(...)` to convert to julia-understandable type.
└ @ Polymake ~/.julia/dev/Polymake/src/functions.jl:66
┌ Warning: The return value contains pm::IncidenceMatrix<pm::NonSymmetric> which has not been wrapped yet;
│ use `@pm Common.convert_to{wrapped_type}(...)` to convert to julia-understandable type.
└ @ Polymake ~/.julia/dev/Polymake/src/functions.jl:66
┌ Warning: The return value contains pm::IncidenceMatrix<pm::NonSymmetric> which has not been wrapped yet;
│ use `@pm Common.convert_to{wrapped_type}(...)` to convert to julia-understandable type.
└ @ Polymake ~/.julia/dev/Polymake/src/functions.jl:66
┌ Warning: The return value contains pm::IncidenceMatrix<pm::NonSymmetric> which has not been wrapped yet;
│ use `@pm Common.convert_to{wrapped_type}(...)` to convert to julia-understandable type.
└ @ Polymake ~/.julia/dev/Polymake/src/functions.jl:66
┌ Warning: The return value contains pm::IncidenceMatrix<pm::NonSymmetric> which has not been wrapped yet;
│ use `@pm Common.convert_to{wrapped_type}(...)` to convert to julia-understandable type.
└ @ Polymake ~/.julia/dev/Polymake/src/functions.jl:66
┌ Warning: The return value contains pm::IncidenceMatrix<pm::NonSymmetric> which has not been wrapped yet;
│ use `@pm Common.convert_to{wrapped_type}(...)` to convert to julia-understandable type.
└ @ Polymake ~/.julia/dev/Polymake/src/functions.jl:66

So this is also not super desirable

Bug: IncidenceMatrix becoming SparseMatrix

@kalmarek mentioned there was a bug with the IncidenceMatrix being converted to a SparseMatrix. I would like to have the information how/in which context this happened to reproduce and fix it.

@saschatimme

Edit: or probably i understood it wrong and the bug occured somewhere in the conversion process?

TEST_SET full and fast

If ENV[TEST_SET]==full all tests are run;

by default TEST_SET = fast and the aim is that each test file/type doesn't take more than 10s to test
(at the moment some of them take more than a minute on my laptop).

On travis we can have TEST_SET=full for a specific version (latest stable?) of julia

gcc internal compiler error: Segmentation fault

build Polymake
  Building CxxWrap ─→ `~/.julia/packages/CxxWrap/lDNAy/deps/build.log`
  Building CMake ───→ `~/.julia/packages/CMake/nSK2r/deps/build.log`
  Building Polymake → `~/Berlin-dev/updating_cxxwrap/dev/Polymake/deps/build.log`
 Resolving package versions...
┌ Error: Error building `Polymake`: 
│ -- Found Julia executable: /opt/julia-1.3.0/bin/julia
│ -- Julia_VERSION_STRING: 1.3.0
│ -- Julia_INCLUDE_DIRS:   /opt/julia-1.3.0/include/julia
│ -- Julia_LIBRARY_DIR:    /opt/julia-1.3.0/lib
│ -- Julia_LIBRARY:        /opt/julia-1.3.0/lib/libjulia.so.1
│ -- JULIA_HOME:           /opt/julia-1.3.0/bin
│ -- Julia_LLVM_VERSION:   v6.0.1
│ -- Julia_WORD_SIZE:      64
│ -- Configuring done
│ -- Generating done
│ -- Build files have been written to: /home/kalmar/Berlin-dev/updating_cxxwrap/dev/Polymake/deps/src
│ Scanning dependencies of target polymake
│ [  6%] Building CXX object CMakeFiles/polymake.dir/polymake.cpp.o
│ [ 12%] Building CXX object CMakeFiles/polymake.dir/polymake_arrays.cpp.o
│ [ 18%] Building CXX object CMakeFiles/polymake.dir/polymake_bigobjects.cpp.o
│ [ 25%] Building CXX object CMakeFiles/polymake.dir/polymake_caller.cpp.o
│ /home/kalmar/Berlin-dev/updating_cxxwrap/dev/Polymake/deps/src/polymake_caller.cpp: In instantiation of ‘funcall_type<VoidContext> polymake_call_function(const string&, const std::vector<std::__cxx11::basic_string<char> >&, jlcxx::ArrayRef<_jl_value_t*>) [with bool VoidContext = false; funcall_type<VoidContext> = pm::perl::PropertyValue; std::string = std::__cxx11::basic_string<char>]’:
│ /home/kalmar/Berlin-dev/updating_cxxwrap/dev/Polymake/deps/src/polymake_caller.cpp:67:77:   required from here
│ /home/kalmar/Berlin-dev/updating_cxxwrap/dev/Polymake/deps/src/polymake_caller.cpp:47:12: internal compiler error: Segmentation fault
│    47 |     return static_cast<funcall_type<VoidContext>>(function());
│       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ Please submit a full bug report,
│ with preprocessed source if appropriate.
│ See <https://bugs.archlinux.org/> for instructions.
│ make[2]: *** [CMakeFiles/polymake.dir/build.make:102: CMakeFiles/polymake.dir/polymake_caller.cpp.o] Error 1
│ make[2]: *** Waiting for unfinished jobs....
│ make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/polymake.dir/all] Error 2
│ make: *** [Makefile:130: all] Error 2
│ ERROR: LoadError: failed process: Process(`make -j2`, ProcessExited(2)) [2]
│ 
│ Stacktrace:
│  [1] pipeline_error at ./process.jl:525 [inlined]
│  [2] #run#565(::Bool, ::typeof(run), ::Cmd) at ./process.jl:440
│  [3] run(::Cmd) at ./process.jl:438
│  [4] top-level scope at /home/kalmar/Berlin-dev/updating_cxxwrap/dev/Polymake/deps/build.jl:151
│  [5] include at ./boot.jl:328 [inlined]
│  [6] include_relative(::Module, ::String) at ./loading.jl:1105
│  [7] include(::Module, ::String) at ./Base.jl:31
│  [8] include(::String) at ./client.jl:424
│  [9] top-level scope at none:5
│ in expression starting at /home/kalmar/Berlin-dev/updating_cxxwrap/dev/Polymake/deps/build.jl:151
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Pkg/src/backwards_compatible_isolation.jl:649

now this happens for both the BinaryProvider and locally build Polymake. @benlorenz, could you remind me what was the fix for this?

Remove polymake default application (switch to "common")

Currently the polymake interpreter is set to application polytope by default which is non-obvious for any julia user. We should change the default to application common and use only fully qualified names.

  • The automatically generated function calls need to get the corresponding app:: prefix

  • All perlobj calls also need to have the application prefix which we need to lookup in the @pm macro (discussed in #100)
    This adds some extra difficulty for the case that someone does using Polymake.Tropical, in this case @pm Polytope{...}(...) should produce the correct object from application tropical.
    Also we need to throw an error when someone does using Polymake.Tropical and using Polymake.Polytopes because of the conflicting big object types.

    For this we could introduce a bunch of names (without any functionality) for the generic object types (generated with list_big_objects) in each application which we could then use for the type lookup in the macro and to make sure an error is thrown for conflicting applications?

  • maybe more?

don't call `eval` in init

when using Polymake inside a different module it produces:

WARNING: eval from module Polymake to OscarPolytope:    
Expr(:ref, :WrappedTypes, Expr(:call, :Symbol, "pm::perl::Object")) = Expr(:., :Polymake, :(:to_perl_object))
  ** incremental compilation may be broken for this module **

or similar.

The solution might be to populate (and save) WrappedTypes at build time.

Segfault after trying to compute property with insufficient data

julia> using Polymake
polymake version 3.3
Copyright (c) 1997-2018
Ewgenij Gawrilow, Michael Joswig (TU Berlin)
http://www.polymake.org

This is free software licensed under GPL; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

julia> A = [1 1 0 0; 1 -1 1 0; 1 0 -1 1]
p 3×4 Array{Int64,2}:
 1   1   0  0
 1  -1   1  0
 1   0  -1  1

julia> p = @pm Polytopes.Polytope(POINTS=A)
type: Polytope<Rational>

POINTS
1 1 0 0
1 -1 1 0
1 0 -1 1

julia> p.EQUATIONS
polymake:  WARNING: available properties insufficient to compute 'EQUATIONS'

julia> p

signal (11): Segmentation fault: 11
in expression starting at no file:0
_ZL46XS_Polymake__Core__CPlusPlus_convert_to_stringP11interpreterP2cv at /usr/local/lib/libpolymake.3.3.dylib (unknown line)
Perl_pp_entersub at /usr/local/opt/perl/lib/perl5/5.28.1/darwin-thread-multi-2level/CORE/libperl.dylib (unknown line)
Perl_runops_standard at /usr/local/opt/perl/lib/perl5/5.28.1/darwin-thread-multi-2level/CORE/libperl.dylib (unknown line)
Perl_call_sv at /usr/local/opt/perl/lib/perl5/5.28.1/darwin-thread-multi-2level/CORE/libperl.dylib (unknown line)
_ZN2pm4perl4glue18call_method_scalarEP11interpreterPKcb at /usr/local/lib/libpolymake.3.3.dylib (unknown line)
_ZZ31polymake_module_add_perl_objectRN5jlcxx6ModuleEENK3$_7clEN2pm4perl6ObjectE at /Users/sascha/coding/Polymake/deps/src/libpolymake.dylib (unknown line)
_ZNSt3__110__function6__funcIZ31polymake_module_add_perl_objectRN5jlcxx6ModuleEE3$_7NS_9allocatorIS5_EEFNS_12basic_stringIcNS_11char_traitsIcEENS6_IcEEEEN2pm4perl6ObjectEEEclEOSF_ at /Users/sascha/coding/Polymake/deps/src/libpolymake.dylib (unknown line)
_ZN5jlcxx6detail17ReturnTypeAdapterINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJN2pm4perl6ObjectEEEclEPKvNS_13WrappedCppPtrE at /Users/sascha/coding/Polymake/deps/src/libpolymake.dylib (unknown line)
_ZN5jlcxx6detail11CallFunctorINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJN2pm4perl6ObjectEEE5applyEPKvNS_13WrappedCppPtrE at /Users/sascha/coding/Polymake/deps/src/libpolymake.dylib (unknown line)
properties at ./none:0 [inlined]
show at /Users/sascha/coding/Polymake/src/functions.jl:146
show at ./sysimg.jl:194
display at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:131
display at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:135
display at ./multimedia.jl:287
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1571 [inlined]
jl_f__apply at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:556
jl_f__apply_latest at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:594
#invokelatest#1 at ./essentials.jl:742 [inlined]
invokelatest at ./essentials.jl:741 [inlined]
print_response at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:155
print_response at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:140
jfptr_print_response_13387.clone_1 at /Applications/Julia-1.1.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
do_respond at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:714
unknown function (ip: 0x11ba70f64)
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1571 [inlined]
jl_f__apply at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:556
jl_f__apply_latest at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:594
#invokelatest#1 at ./essentials.jl:742 [inlined]
invokelatest at ./essentials.jl:741 [inlined]
run_interface at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:2273
run_frontend at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:1035
run_repl at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:192
#734 at ./client.jl:362
jfptr_#734_6056.clone_1 at /Applications/Julia-1.1.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1571 [inlined]
jl_f__apply at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:556
jl_f__apply_latest at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:594
#invokelatest#1 at ./essentials.jl:742 [inlined]
invokelatest at ./essentials.jl:741 [inlined]
run_main_repl at ./client.jl:346
exec_options at ./client.jl:284
_start at ./client.jl:436
true_main at /Applications/Julia-1.1.app/Contents/Resources/julia/bin/julia (unknown line)
main at /Applications/Julia-1.1.app/Contents/Resources/julia/bin/julia (unknown line)
Allocations: 29609676 (Pool: 29604769; Big: 4907); GC: 65
Segmentation fault: 11

type stability of pm_Integer et al

Do something about return type instability, i.e.

julia> @code_warntype pm_Integer(3)
Body::Any
 1%1 = invoke Base.getindex(Polymake.__cxxwrap_pointers::Array{Ptr{Nothing},1}, 26::Int64)::Ptr{Nothing}%2 = invoke Base.getindex(Polymake.__cxxwrap_pointers::Array{Ptr{Nothing},1}, 25::Int64)::Ptr{Nothing}%3 = $(Expr(:foreigncall, :(%2), Any, svec(Ptr{Nothing}, Int64), :(:ccall), 2, :(%1), :(arg1), :(arg1), :(%1)))::Any
 └──      return %3

(note: this doesn't change if pm_Integer subtypes Base.Integer or not

tag 0.3

add https://github.com/oscar-system/Polymake.jl
with self-compiled Polymake-V3.3 fails with

[100%] Built target polymake
│ ERROR: LoadError: IOError: unlink: no such file or directory (ENOENT)
│ Stacktrace:
│  [1] uv_error at ./libuv.jl:85 [inlined]
│  [2] unlink(::String) at ./file.jl:722
│  [3] #rm#9(::Bool, ::Bool, ::Function, ::String) at ./file.jl:253
│  [4] rm(::String) at ./file.jl:245
│  [5] top-level scope at none:0
│  [6] include at ./boot.jl:317 [inlined]
│  [7] include_relative(::Module, ::String) at ./loading.jl:1044
│  [8] include(::Module, ::String) at ./sysimg.jl:29
│  [9] include(::String) at ./client.jl:392
│  [10] top-level scope at none:0
│ in expression starting at /home/kalmar/.julia/packages/Polymake/QZMKs/deps/build.jl:139
│ Parsing /home/kalmar/.julia/packages/Polymake/QZMKs/deps/parser/json/common.json
│ Parsing /home/kalmar/.julia/packages/Polymake/QZMKs/deps/parser/json/fan.json
│ Parsing /home/kalmar/.julia/packages/Polymake/QZMKs/deps/parser/json/fulton.json
│ Parsing /home/kalmar/.julia/packages/Polymake/QZMKs/deps/parser/json/graph.json
│ Parsing /home/kalmar/.julia/packages/Polymake/QZMKs/deps/parser/json/group.json
│ Parsing /home/kalmar/.julia/packages/Polymake/QZMKs/deps/parser/json/ideal.json
│ Parsing /home/kalmar/.julia/packages/Polymake/QZMKs/deps/parser/json/matroid.json
│ Parsing /home/kalmar/.julia/packages/Polymake/QZMKs/deps/parser/json/polytope.json
│ Parsing /home/kalmar/.julia/packages/Polymake/QZMKs/deps/parser/json/topaz.json
│ Parsing /home/kalmar/.julia/packages/Polymake/QZMKs/deps/parser/json/tropical.json
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1097

master works ok

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.