Page 1 of 1

initializing incidence matrices through perl::Object

Posted: 04 May 2011, 17:14
by ren
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.

Re: initializing incidence matrices through perl::Object

Posted: 04 May 2011, 18:22
by joswig
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/

Re: initializing incidence matrices through perl::Object

Posted: 11 May 2011, 12:31
by ren
Ah, sorry. I total forgot that I haven't replied yet.

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