initializing incidence matrices through perl::Object

Questions and problems about using polymake go here.
ren
Posts: 38
Joined: 03 May 2011, 15:21

initializing incidence matrices through perl::Object

Postby ren » 04 May 2011, 17:14

Hello, I have a problem with initializing incidence matrices through perl::Object.
The following line of code:

Code: Select all

perl::Object q("IncidenceMatrix");
sometimes causes following Error Message during execution:
ERROR: Can't use string ("") as a subroutine ref while "strict refs" in use at /usr/local/share/polymake/perllib/Polymake/Struct.pm line 487, <GEN3> line 81.
Sometimes, because "smalltest" as it is in the attachment with the line of code above causes the error,
while the program executes without problem, if you move the line to the end of the code where the blank line is.

Can anybody please help me with figuring out what is causing that error and how to get around it?

best regards and thanks in advance, Yue.
Attachments
callable.tar.gz
small modification of benjamin's original "smalltest" to demonstrate the error, added a single line "perl::Object q("IncidenceMatrix");"
(850 Bytes) Downloaded 447 times

User avatar
joswig
Main Author
Posts: 280
Joined: 24 Dec 2010, 11:10

Re: initializing incidence matrices through perl::Object

Postby joswig » 04 May 2011, 18:22

The confusion comes from mixing two (very different) kinds of objects.

Things like Polytope<Rational>, SimplicialComplex, Graph, ... are big objects which live on the Perl side with properties and rules and such. But there are also small objects which live on the C++ side, e.g., Matrix<Rational>, Vector<Rational>, and also your IncidenceMatrix.

Add

Code: Select all

#include "polymake/IncidenceMatrix.h"
to your list of included headers and use, e.g., something like

Code: Select all

const IncidenceMatrix<> I=p.give("VERTICES_IN_FACETS");
if you want to have the vertex facet incidences from the polytope p.

The small objects reside in the PTL and are (partially) documented at:
http://polymake.mathematik.tu-darmstadt ... rrent/PTL/

ren
Posts: 38
Joined: 03 May 2011, 15:21

Re: initializing incidence matrices through perl::Object

Postby ren » 11 May 2011, 12:31

Ah, sorry. I total forgot that I haven't replied yet.

Thank you for the answer, that solves my problem. :-)


Return to “Helpdesk”